mirror of
https://github.com/dbt-labs/dbt-project-evaluator.git
synced 2025-12-18 02:11:27 +00:00
fix time spine exclusion
This commit is contained in:
@@ -5,4 +5,7 @@ models:
|
||||
standard_granularity_column: date_day # Column for the standard grain of your table
|
||||
columns:
|
||||
- name: date_day
|
||||
granularity: day
|
||||
granularity: day
|
||||
data_tests:
|
||||
- unique
|
||||
- not_null
|
||||
@@ -24,8 +24,14 @@
|
||||
"cast(" ~ dbt_project_evaluator.is_not_empty_string(node.description) | trim ~ " as " ~ dbt.type_boolean() ~ ")",
|
||||
"cast(" ~ node.config.enabled ~ " as " ~ dbt.type_boolean() ~ ")",
|
||||
wrap_string_with_quotes(node.loaded_at_field | replace("'", "_")),
|
||||
"cast(" ~ (((node.config.freshness or node.freshness) != None) and (dbt_project_evaluator.is_not_empty_string((node.config.freshness.warn_after.count or node.freshness.warn_after.count))
|
||||
or dbt_project_evaluator.is_not_empty_string((node.config.freshness.error_after.count or node.freshness.error_after.count)))) | trim ~ " as boolean)",
|
||||
|
||||
"cast(" ~ (
|
||||
((node.config.freshness != None) and (dbt_project_evaluator.is_not_empty_string(node.config.freshness.warn_after.count)
|
||||
or dbt_project_evaluator.is_not_empty_string(node.config.freshness.error_after.count)))
|
||||
or ((node.freshness != None) and (dbt_project_evaluator.is_not_empty_string(node.freshness.warn_after.count)
|
||||
or dbt_project_evaluator.is_not_empty_string(node.freshness.error_after.count)))
|
||||
) | trim ~ " as boolean)",
|
||||
|
||||
wrap_string_with_quotes(node.database),
|
||||
wrap_string_with_quotes(node.schema),
|
||||
wrap_string_with_quotes(node.package_name),
|
||||
|
||||
@@ -1,5 +1,14 @@
|
||||
-- this model finds cases where a model has 0 direct parents, likely due to a lack of source or ref function
|
||||
|
||||
{% if execute %}
|
||||
{% set metric_flow_time_spine_names = graph.nodes.values()
|
||||
| selectattr("resource_type", "equalto", "model")
|
||||
| rejectattr("time_spine", "none")
|
||||
| map(attribute = "name")
|
||||
| join("', '")
|
||||
%}
|
||||
{% endif %}
|
||||
|
||||
with model_relationships as (
|
||||
select
|
||||
*
|
||||
@@ -9,7 +18,9 @@ with model_relationships as (
|
||||
-- filtering parents could result in incorrectly flagging nodes that depend on excluded nodes
|
||||
and not child_is_excluded
|
||||
-- exclude required time spine
|
||||
and child != 'metricflow_time_spine'
|
||||
{% if metric_flow_time_spine_names %}
|
||||
and child not in ('{{ metric_flow_time_spine_names }}')
|
||||
{% endif %}
|
||||
),
|
||||
|
||||
final as (
|
||||
|
||||
@@ -1,11 +1,22 @@
|
||||
-- all models with inappropriate (or lack of) pre-fix
|
||||
-- ensure dbt project has consistent naming conventions
|
||||
|
||||
{% if execute %}
|
||||
{% set metric_flow_time_spine_names = graph.nodes.values()
|
||||
| selectattr("resource_type", "equalto", "model")
|
||||
| rejectattr("time_spine", "none")
|
||||
| map(attribute = "name")
|
||||
| join("', '")
|
||||
%}
|
||||
{% endif %}
|
||||
|
||||
with all_graph_resources as (
|
||||
select * from {{ ref('int_all_graph_resources') }}
|
||||
where not is_excluded
|
||||
-- exclude required metricflow time spine
|
||||
and resource_name != 'metricflow_time_spine'
|
||||
-- exclude required time spine
|
||||
{% if metric_flow_time_spine_names %}
|
||||
and resource_name not in ('{{ metric_flow_time_spine_names }}')
|
||||
{% endif %}
|
||||
),
|
||||
|
||||
naming_convention_prefixes as (
|
||||
|
||||
Reference in New Issue
Block a user