我在 delta 表上的 readStream 中遇到问题。
什么是预期的,参考以下链接 https://docs.databricks.com/delta/delta-streaming.html#delta-table-as-a-stream-source Ex:
spark.readStream.format("delta").table("events") -- As expected, should work fine
Run Code Online (Sandbox Code Playgroud)
问题,我已经通过以下方式尝试了相同的方法:
df.write.format("delta").saveAsTable("deltatable") -- Saved the Dataframe as a delta table
spark.readStream.format("delta").table("deltatable") -- Called readStream
Run Code Online (Sandbox Code Playgroud)
错误:
Traceback (most recent call last):
File "<input>", line 1, in <module>
AttributeError: 'DataStreamReader' object has no attribute 'table'
Run Code Online (Sandbox Code Playgroud)
注意:我在 localhost 中运行它,使用 pycharm IDE,安装了最新版本的 pyspark,spark 版本 = 2.4.5,Scala 版本 2.11.12