【问题标题】:WriteStream with format('console') in Azure Synapse Notebook在 Azure Synapse Notebook 中使用 format(\'console\') 的 WriteStream
【发布时间】:2022-10-21 05:00:16
【问题描述】:

我有一个数据流,我可以使用 pyspark 将其写入内存表并从那里使用 sql 查询:

transformeddata.writeStream\
   .format("memory")\
   .queryName("transformeddatatable")\
   .trigger(processingTime='5 seconds')\
   .start()\
   .awaitTermination(20)  # write the data for 20 seconds into the memory table from the stream

在下一个单元格中,我可以查询数据:

%%sql
SELECT * FROM transformeddatatable

这很好用,数据出现在内存表transformeddatatable 中。

但是,我无法直接在控制台中显示数据:

transformeddata.writeStream\
   .format("console")\
   .outputMode("append")\
   .trigger(processingTime='5 seconds') \
   .option("checkpointLocation", "tmp/checkpoint/streamtoconsole/")\
   .start()\
   .awaitTermination(20)

唯一返回到控制台的是布尔值False,一旦它在 20 秒后终止。

在许多在线示例中,上面的代码有效。我傻眼了,我做错了什么——是 Azure 的 Synapse Notebook 的问题吗?它仅适用于 Databricks 吗?

【问题讨论】:

  • 我也有同样的问题,请问你解决了吗?
  • 可悲的是没有。如果您发现了什么,请确保将其添加为答案。

标签: azure pyspark spark-streaming


【解决方案1】:

我在 Synapse 中管理运行此操作,使用从 Synapse Analytics 到 Synapse storageaccount datalake 的专用端点建立连接。您的存储帐户是否使用“选定的网络”?

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-09-15
    • 2022-08-02
    • 2021-06-09
    • 2021-10-19
    • 2021-11-21
    • 2023-01-22
    • 2021-10-16
    • 2022-07-11
    相关资源
    最近更新 更多