当使用storefailures标志时,为什么DBT teste在后缀中创建具有唯一标识符的审计表?

2024-04-19 04:45:04 发布

您现在位置:Python中文网/ 问答频道 /正文

我使用--store-failure标志运行dbt测试,但它创建的审计表使用唯一标识符作为表名,而不是表名本身

例如:

dbt_test__audit.source_not_null_my_schema_d29191aff8f71d8f3b84416a167e7f7a

我正在使用dbt和spark


Tags: storetestsourcefailureschemamy标志not
1条回答
网友
1楼 · 发布于 2024-04-19 04:45:04

我想你可能误解了 store-failures的作用。 假设有一个idmytbl,我想测试它以确保它是唯一的。如果我调用dbt test -m mytbl store-failures,我要求dbt创建一个表,其中包含mytbl的行,其中id不是唯一的,而不仅仅是将该信息打印到控制台

因此,它创建了一个表,其中包括:

  • 定义测试的。yml文件的名称
  • 表名和列名,以及
  • 与您刚才调用的特定dbt test关联的guid

这样,我就可以在事后查询我的失败,而不必在控制台中滚动查找错误,一次只处理一个问题

The docs关于这方面有很多信息:

Normally, a test query will calculate failures as part of its execution. If you set the optional store-failures flag or store_failures config, dbt will first save the results of a test query to a table in the database, and then query that table to calculate the number of failures.

This workflow allows you to query and examine failing records much more quickly in development

这有意义吗

相关问题 更多 >