You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Azure Databricks Autoloader从队列存储加载失败:eventType键不存在

问题原因

cloudfiles的useNotifications模式是为了处理Azure Blob Storage的Event Grid事件通知(这类通知会包含eventType字段),但你当前尝试读取的是Azure Queue Storage中的自定义消息,并非标准的Event Grid事件结构,因此抛出找不到eventType的错误。

解决方案

如果需要直接读取Azure Queue Storage中的自定义消息,请改用azure-queue数据源格式,代码调整如下:

  1. 确保集群安装依赖(若未预装):
%pip install azure-storage-queue
  1. 重构读取流逻辑:
from pyspark.sql.types import StructType, StringType

# 自定义消息结构schema,按需调整
schema = StructType().add("message", StringType(), nullable=True)

df = (spark.readStream
      .format("azure-queue")
      .option("queueName", "queue-dev")
      .option("connectionString", "替换为你的Azure Queue存储连接字符串")
      .schema(schema)
      .load()
)

streamQuery = (df.writeStream
               .format("delta")
               .outputMode("append")
               .option("ignoreDeletes", "true")
               .option("checkpointLocation", "/mnt/datalake/Streaming-test/checkpoint/")
               .start("/mnt/datalake/Streaming-test/data/")
              )
额外说明
  • cloudfiles + useNotifications的正确场景是:Blob存储有新文件上传时,Event Grid将事件推送到Queue,cloudfiles读取Queue中的事件通知后,自动去Blob存储拉取对应文件内容,并非直接读取Queue内的自定义消息。
  • 若你原本的需求是监听Blob存储的文件变化,请确保Queue中的消息是Event Grid推送的标准事件格式,而非自定义消息。

内容的提问来源于stack exchange,提问作者John K

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.24 23:11:06