diff --git a/models/incremental/fct_dbt__run_results.sql b/models/incremental/fct_dbt__run_results.sql index 9286a348..b0a91e40 100644 --- a/models/incremental/fct_dbt__run_results.sql +++ b/models/incremental/fct_dbt__run_results.sql @@ -34,7 +34,8 @@ fields as ( was_full_refresh {% if env_keys %} - {% for key in env_keys %} + -- Environment keys are sorted for determinism. + {% for key in env_keys|sort %} ,env:{{ key }} as env_{{ key }} {% endfor %} {% endif %} diff --git a/models/schemas.yml b/models/schemas.yml index 7ed4f01d..b5a809ca 100644 --- a/models/schemas.yml +++ b/models/schemas.yml @@ -15,6 +15,28 @@ models: description: The duration of time in minutes for the model to run. - name: model_materialization + - name: fct_dbt__exposures_updates + description: A table of exposures and models feeding them. Latest update time for each models is provided. + columns: + - name: latest_generation + description: Timestamp of when the source artifact was generated. + - name: node_id + description: Unique id for the node, in the form of exposure.[package_name].[exposure_name] + - name: name + description: User-defined name of the exposure. + - name: type + description: User-defined type of the exposure. + - name: owner + description: User-defined owner of the exposure. + - name: maturity + description: User-defined name of the exposure. + - name: package_name + description: Source package in which each feed of an exposure was defined. + - name: output_feeds + description: Unique id for each feed of an exposure, in the form of model.[package_name].[model_name] + - name: feed_latest_update + description: Timestamp of the latest update of each feed of an exposure. + - name: fct_dbt__latest_full_model_executions description: A list of all models and executions times from the most recent, incremental run. columns: @@ -104,6 +126,33 @@ models: - name: env_* description: Columns for the environment variables set when the command was executed. + - name: dim_dbt__exposures + description: All dbt exposures metadata from every manifest.json. + columns: + - name: manifest_model_id + description: Primary key generated from the command_invocation_id and checksum. + tests: + - unique + - not_null + - name: command_invocation_id + description: The id of the command which resulted in the source artifact's generation. + - name: artifact_generated_at + description: Timestamp of when the source artifact was generated. + - name: node_id + description: Unique id for the node, in the form of exposure.[package_name].[exposure_name] + - name: name + description: User-defined name of the exposure. + - name: type + description: User-defined type of the exposure. + - name: owner + description: User-defined owner of the exposure. + - name: maturity + description: User-defined name of the exposure. + - name: output_feeds + description: Unique id for each feed of an exposure, in the form of model.[package_name].[model_name] + - name: package_name + description: Source package in which each feed of an exposure was defined. + - name: dim_dbt__models description: All dbt model metadata from every manifest.json. columns: diff --git a/models/staging/stg_dbt__run_results_env_keys.sql b/models/staging/stg_dbt__run_results_env_keys.sql index aca679b6..cd19502e 100644 --- a/models/staging/stg_dbt__run_results_env_keys.sql +++ b/models/staging/stg_dbt__run_results_env_keys.sql @@ -27,6 +27,8 @@ env_keys as ( distinct(env.key) from dbt_run, lateral flatten(input => data:metadata:env) as env + -- Sort results to ensure things are deterministic + order by 1 )