使用DLT Direct Publish功能时查询event_log报错及DPM无法禁用求助
DLT Direct Publish(私有预览版)事件日志查询及模式切换问题
问题描述
使用处于私有预览阶段的DLT Direct Publish功能构建DLT表时,执行查询语句 SELECT * FROM event_log("${pipeline_id}") 触发内部错误:
[INTERNAL_ERROR] The Spark SQL phase analysis failed with an internal error. You hit a bug in Spark or the Spark plugins you use. Please, report this bug to the corresponding communities or vendors, and provide the full stack trace. SQLSTATE: XX000
在SQL Warehouse中收到更明确的错误提示:
[FEATURE_UNAVAILABLE] The EVENT_LOG TVF for Arclight and direct publishing mode pipelines is not supported in your environment. To use this feature, please contact Databricks Support. SQLSTATE: 56038
尝试禁用Direct Publishing Mode (DPM) 但无法操作,也找不到事件日志表,需解决该问题。
相关代码
import dlt from pyspark.sql.functions import col @dlt.table( comment="test" ) def raw_customers(): return spark.read.table("external_customers") @dlt.table( comment="test" ) @dlt.expect_or_drop("non_null_id", "id IS NOT NULL") @dlt.expect_or_drop("valid_age", "age > 0") def clean_customers(): df = dlt.read("raw_customers") return df.select("id", "name", "age")
解决方案
1. 事件日志替代方案
由于Direct Publish模式暂不支持event_log() TVF,可通过以下方式获取监控信息:
- 查看DLT流水线UI监控页面:直接在Databricks流水线控制台查看运行状态、数据质量指标、任务执行日志,这是当前最直接的替代方式。
- 访问流水线元数据存储:Direct Publish模式的元数据默认存储在流水线指定的存储位置(如DBFS或外部云存储),可查看存储路径下的
_delta_log目录获取底层日志,需手动解析格式。
2. 禁用Direct Publishing Mode的方法
若UI中无法切换模式,可尝试:
- 通过Databricks REST API修改流水线配置:调用
PUT /api/2.0/pipelines/{pipeline_id}接口,将配置中的direct_publish字段设为false。示例请求体:{ "configuration": { "direct_publish": "false" } } - 联系Databricks支持团队:该功能处于私有预览阶段,部分配置开关未开放给普通用户,直接提交工单请求协助禁用DPM或开通事件日志访问权限。
3. 临时规避方案
若需继续使用DPM同时获取数据质量信息,可在代码中手动记录校验结果:
- 在
@dlt.expect_or_drop注解后,添加自定义逻辑将校验统计写入单独监控表:@dlt.table(comment="数据质量监控表") def quality_metrics(): return dlt.read("clean_customers").agg( dlt.current_timestamp().alias("record_time"), col("non_null_id").count().alias("valid_ids"), col("valid_age").count().alias("valid_ages") )
内容的提问来源于stack exchange,提问作者user3645672
相关产品推荐
相关产品推荐

