lokin
08/28/2025, 3:49 AMkapa.ai
08/28/2025, 3:49 AMkapa.ai
08/28/2025, 3:50 AMyaml models: - name: <model name> tests: - elementary.freshness_anomalies: timestamp_column: <timestamp column> # 必填 其他参数如 `where_expression`、`time_bucket`、`anomaly_sensitivity` 等都是可选项,可以根据实际需求进行配置,但不是必填项。默认情况下,时间分桶(time_bucket)为每日(daily),也可以自定义。 详细说明可参考官方文档:[freshness_anomalies](https://docs.elementary-data.com/data-tests/anomaly-detection-tests/freshness-anomalies)https://docs.elementary-data.com/data-tests/anomaly-detection-tests/freshness-anomalieslokin
08/28/2025, 3:52 AMkapa.ai
08/28/2025, 3:52 AMkapa.ai
08/28/2025, 3:52 AMfreshness 字段。具体来说,`freshness` 下需要指定 warn_after 或 `error_after`,用于定义新鲜度的阈值。例如: yaml sources: - name: my_source tables: - name: my_table freshness: warn_after: {count: 12, period: hour} error_after: {count: 24, period: hour} 其中,`warn_after` 和 error_after 至少需要配置一个,否则 dbt 不会对该表进行新鲜度检测。 总结: - 必填项:`freshness` 字段下的 warn_after 或 `error_after`(至少一个)。 - 这些参数需配置在 source 的 yml 文件中。 此结论来自于对相关 Elementary 社区问答的梳理,明确指出 source freshness 应该定义在 source 的 schema.yml 文件中,并参考了 dbt 官方文档说明参数配置方式[见此处](https://docs.getdbt.com/reference/resource-properties/freshness)https://slack.com/archives/C02CTC89LAX/p1669297028707749。