Lưu ý
Cần có ủy quyền mới truy nhập được vào trang này. Bạn có thể thử đăng nhập hoặc thay đổi thư mục.
Cần có ủy quyền mới truy nhập được vào trang này. Bạn có thể thử thay đổi thư mục.
Defines a streaming DataFrame on a table. The data source corresponding to the table must support streaming mode.
Syntax
table(tableName)
Parameters
| Parameter | Type | Description |
|---|---|---|
tableName |
str | Name of the table. |
Returns
DataFrame
Examples
Load a data stream from a table:
import tempfile
import time
_ = spark.sql("DROP TABLE IF EXISTS my_table")
with tempfile.TemporaryDirectory(prefix="table") as d:
q1 = spark.readStream.format("rate").load().writeStream.toTable(
"my_table", checkpointLocation=d)
q2 = spark.readStream.table("my_table").writeStream.format("console").start()
time.sleep(3)
q1.stop()
q2.stop()
_ = spark.sql("DROP TABLE my_table")