diff --git a/.circleci/config.yml b/.circleci/config.yml index 259c59bb..755bc86d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -31,6 +31,7 @@ jobs: dbt run-operation create_artifact_resources dbt seed --full-refresh dbt run-operation upload_dbt_artifacts --args '{filenames: [manifest, run_results]}' + dbt run --full-refresh dbt run dbt run-operation upload_dbt_artifacts --args '{filenames: [manifest, run_results]}' dbt test diff --git a/docs/catalog.json b/docs/catalog.json index 8e55f141..d1488cd5 100644 --- a/docs/catalog.json +++ b/docs/catalog.json @@ -1 +1 @@ -{"metadata": {"dbt_schema_version": "https://schemas.getdbt.com/dbt/catalog/v1.json", "dbt_version": "0.19.0", "generated_at": "2021-03-12T10:59:09.652601Z", "invocation_id": "2607e74e-72d8-4769-80b5-b6c0da4137a1", "env": {}}, "nodes": {"model.dbt_artifacts.dim_dbt__sources": {"metadata": {"type": "BASE TABLE", "database": "TEST_DB", "schema": "ANALYTICS_DEFAULT_DBT_ARTIFACTS_SCHEMA", "name": "DIM_DBT__SOURCES", "comment": null, "owner": "ROLE"}, "columns": {"MANIFEST_SOURCE_ID": {"type": "TEXT", "comment": null, "index": 1, "name": "MANIFEST_SOURCE_ID"}, "COMMAND_INVOCATION_ID": {"type": "TEXT", "comment": null, "index": 2, "name": "COMMAND_INVOCATION_ID"}, "ARTIFACT_GENERATED_AT": {"type": "TIMESTAMP_TZ", "comment": null, "index": 3, "name": "ARTIFACT_GENERATED_AT"}, "NODE_ID": {"type": "TEXT", "comment": null, "index": 4, "name": "NODE_ID"}, "NAME": {"type": "TEXT", "comment": null, "index": 5, "name": "NAME"}, "SOURCE_NAME": {"type": "TEXT", "comment": null, "index": 6, "name": "SOURCE_NAME"}, "SOURCE_SCHEMA": {"type": "TEXT", "comment": null, "index": 7, "name": "SOURCE_SCHEMA"}, "PACKAGE_NAME": {"type": "TEXT", "comment": null, "index": 8, "name": "PACKAGE_NAME"}, "RELATION_NAME": {"type": "TEXT", "comment": null, "index": 9, "name": "RELATION_NAME"}, "SOURCE_PATH": {"type": "TEXT", "comment": null, "index": 10, "name": "SOURCE_PATH"}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2021-03-12 10:53UTC", "description": "The timestamp for last update/change", "include": true}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 125771264.0, "description": "Approximate size of the table as reported by Snowflake", "include": true}, "row_count": {"id": "row_count", "label": "Row Count", "value": 5459364.0, "description": "An approximate count of rows in this table", "include": true}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "description": "Indicates whether there are statistics for this table", "include": false}}, "unique_id": "model.dbt_artifacts.dim_dbt__sources"}, "model.dbt_artifacts.stg_dbt__sources": {"metadata": {"type": "VIEW", "database": "TEST_DB", "schema": "ANALYTICS_DEFAULT_DBT_ARTIFACTS_SCHEMA", "name": "STG_DBT__SOURCES", "comment": null, "owner": "ROLE"}, "columns": {"MANIFEST_SOURCE_ID": {"type": "TEXT", "comment": null, "index": 1, "name": "MANIFEST_SOURCE_ID"}, "COMMAND_INVOCATION_ID": {"type": "TEXT", "comment": null, "index": 2, "name": "COMMAND_INVOCATION_ID"}, "ARTIFACT_GENERATED_AT": {"type": "TIMESTAMP_TZ", "comment": null, "index": 3, "name": "ARTIFACT_GENERATED_AT"}, "NODE_ID": {"type": "TEXT", "comment": null, "index": 4, "name": "NODE_ID"}, "NAME": {"type": "TEXT", "comment": null, "index": 5, "name": "NAME"}, "SOURCE_NAME": {"type": "TEXT", "comment": null, "index": 6, "name": "SOURCE_NAME"}, "SOURCE_SCHEMA": {"type": "TEXT", "comment": null, "index": 7, "name": "SOURCE_SCHEMA"}, "PACKAGE_NAME": {"type": "TEXT", "comment": null, "index": 8, "name": "PACKAGE_NAME"}, "RELATION_NAME": {"type": "TEXT", "comment": null, "index": 9, "name": "RELATION_NAME"}, "SOURCE_PATH": {"type": "TEXT", "comment": null, "index": 10, "name": "SOURCE_PATH"}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "description": "Indicates whether there are statistics for this table", "include": false}}, "unique_id": "model.dbt_artifacts.stg_dbt__sources"}, "model.dbt_artifacts.stg_dbt__run_results_env_keys": {"metadata": {"type": "VIEW", "database": "TEST_DB", "schema": "ANALYTICS_DEFAULT_DBT_ARTIFACTS_SCHEMA", "name": "STG_DBT__RUN_RESULTS_ENV_KEYS", "comment": null, "owner": "ROLE"}, "columns": {"KEY": {"type": "TEXT", "comment": null, "index": 1, "name": "KEY"}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "description": "Indicates whether there are statistics for this table", "include": false}}, "unique_id": "model.dbt_artifacts.stg_dbt__run_results_env_keys"}, "model.dbt_artifacts.stg_dbt__run_results": {"metadata": {"type": "VIEW", "database": "TEST_DB", "schema": "ANALYTICS_DEFAULT_DBT_ARTIFACTS_SCHEMA", "name": "STG_DBT__RUN_RESULTS", "comment": null, "owner": "ROLE"}, "columns": {"ARTIFACT_GENERATED_AT": {"type": "TIMESTAMP_TZ", "comment": null, "index": 1, "name": "ARTIFACT_GENERATED_AT"}, "COMMAND_INVOCATION_ID": {"type": "TEXT", "comment": null, "index": 2, "name": "COMMAND_INVOCATION_ID"}, "DBT_VERSION": {"type": "TEXT", "comment": null, "index": 3, "name": "DBT_VERSION"}, "ENV": {"type": "VARIANT", "comment": null, "index": 4, "name": "ENV"}, "ELAPSED_TIME": {"type": "FLOAT", "comment": null, "index": 5, "name": "ELAPSED_TIME"}, "EXECUTION_COMMAND": {"type": "TEXT", "comment": null, "index": 6, "name": "EXECUTION_COMMAND"}, "WAS_FULL_REFRESH": {"type": "BOOLEAN", "comment": null, "index": 7, "name": "WAS_FULL_REFRESH"}, "SELECTED_MODELS": {"type": "VARIANT", "comment": null, "index": 8, "name": "SELECTED_MODELS"}, "TARGET": {"type": "TEXT", "comment": null, "index": 9, "name": "TARGET"}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "description": "Indicates whether there are statistics for this table", "include": false}}, "unique_id": "model.dbt_artifacts.stg_dbt__run_results"}, "model.dbt_artifacts.stg_dbt__model_executions": {"metadata": {"type": "VIEW", "database": "TEST_DB", "schema": "ANALYTICS_DEFAULT_DBT_ARTIFACTS_SCHEMA", "name": "STG_DBT__MODEL_EXECUTIONS", "comment": null, "owner": "ROLE"}, "columns": {"MODEL_EXECUTION_ID": {"type": "TEXT", "comment": null, "index": 1, "name": "MODEL_EXECUTION_ID"}, "COMMAND_INVOCATION_ID": {"type": "TEXT", "comment": null, "index": 2, "name": "COMMAND_INVOCATION_ID"}, "ARTIFACT_GENERATED_AT": {"type": "TIMESTAMP_TZ", "comment": null, "index": 3, "name": "ARTIFACT_GENERATED_AT"}, "WAS_FULL_REFRESH": {"type": "BOOLEAN", "comment": null, "index": 4, "name": "WAS_FULL_REFRESH"}, "NODE_ID": {"type": "TEXT", "comment": null, "index": 5, "name": "NODE_ID"}, "THREAD_ID": {"type": "NUMBER", "comment": null, "index": 6, "name": "THREAD_ID"}, "STATUS": {"type": "TEXT", "comment": null, "index": 7, "name": "STATUS"}, "COMPILE_STARTED_AT": {"type": "TIMESTAMP_NTZ", "comment": null, "index": 8, "name": "COMPILE_STARTED_AT"}, "QUERY_COMPLETED_AT": {"type": "TIMESTAMP_NTZ", "comment": null, "index": 9, "name": "QUERY_COMPLETED_AT"}, "TOTAL_NODE_RUNTIME": {"type": "FLOAT", "comment": null, "index": 10, "name": "TOTAL_NODE_RUNTIME"}, "ROWS_AFFECTED": {"type": "NUMBER", "comment": null, "index": 11, "name": "ROWS_AFFECTED"}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "description": "Indicates whether there are statistics for this table", "include": false}}, "unique_id": "model.dbt_artifacts.stg_dbt__model_executions"}, "model.dbt_artifacts.stg_dbt__models": {"metadata": {"type": "VIEW", "database": "TEST_DB", "schema": "ANALYTICS_DEFAULT_DBT_ARTIFACTS_SCHEMA", "name": "STG_DBT__MODELS", "comment": null, "owner": "ROLE"}, "columns": {"MANIFEST_MODEL_ID": {"type": "TEXT", "comment": null, "index": 1, "name": "MANIFEST_MODEL_ID"}, "COMMAND_INVOCATION_ID": {"type": "TEXT", "comment": null, "index": 2, "name": "COMMAND_INVOCATION_ID"}, "ARTIFACT_GENERATED_AT": {"type": "TIMESTAMP_TZ", "comment": null, "index": 3, "name": "ARTIFACT_GENERATED_AT"}, "NODE_ID": {"type": "TEXT", "comment": null, "index": 4, "name": "NODE_ID"}, "MODEL_DATABASE": {"type": "TEXT", "comment": null, "index": 5, "name": "MODEL_DATABASE"}, "MODEL_SCHEMA": {"type": "TEXT", "comment": null, "index": 6, "name": "MODEL_SCHEMA"}, "NAME": {"type": "TEXT", "comment": null, "index": 7, "name": "NAME"}, "DEPENDS_ON_NODES": {"type": "ARRAY", "comment": null, "index": 8, "name": "DEPENDS_ON_NODES"}, "PACKAGE_NAME": {"type": "TEXT", "comment": null, "index": 9, "name": "PACKAGE_NAME"}, "MODEL_PATH": {"type": "TEXT", "comment": null, "index": 10, "name": "MODEL_PATH"}, "CHECKSUM": {"type": "TEXT", "comment": null, "index": 11, "name": "CHECKSUM"}, "MODEL_MATERIALIZATION": {"type": "TEXT", "comment": null, "index": 12, "name": "MODEL_MATERIALIZATION"}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "description": "Indicates whether there are statistics for this table", "include": false}}, "unique_id": "model.dbt_artifacts.stg_dbt__models"}, "model.dbt_artifacts.stg_dbt__artifacts": {"metadata": {"type": "VIEW", "database": "TEST_DB", "schema": "ANALYTICS_DEFAULT_DBT_ARTIFACTS_SCHEMA", "name": "STG_DBT__ARTIFACTS", "comment": null, "owner": "ROLE"}, "columns": {"COMMAND_INVOCATION_ID": {"type": "TEXT", "comment": null, "index": 1, "name": "COMMAND_INVOCATION_ID"}, "GENERATED_AT": {"type": "TIMESTAMP_TZ", "comment": null, "index": 2, "name": "GENERATED_AT"}, "PATH": {"type": "TEXT", "comment": null, "index": 3, "name": "PATH"}, "ARTIFACT_TYPE": {"type": "TEXT", "comment": null, "index": 4, "name": "ARTIFACT_TYPE"}, "DATA": {"type": "VARIANT", "comment": null, "index": 5, "name": "DATA"}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "description": "Indicates whether there are statistics for this table", "include": false}}, "unique_id": "model.dbt_artifacts.stg_dbt__artifacts"}, "model.dbt_artifacts.int_dbt__model_executions": {"metadata": {"type": "BASE TABLE", "database": "TEST_DB", "schema": "ANALYTICS_DEFAULT_DBT_ARTIFACTS_SCHEMA", "name": "INT_DBT__MODEL_EXECUTIONS", "comment": null, "owner": "ROLE"}, "columns": {"MODEL_EXECUTION_ID": {"type": "TEXT", "comment": null, "index": 1, "name": "MODEL_EXECUTION_ID"}, "COMMAND_INVOCATION_ID": {"type": "TEXT", "comment": null, "index": 2, "name": "COMMAND_INVOCATION_ID"}, "ARTIFACT_GENERATED_AT": {"type": "TIMESTAMP_TZ", "comment": null, "index": 3, "name": "ARTIFACT_GENERATED_AT"}, "WAS_FULL_REFRESH": {"type": "BOOLEAN", "comment": null, "index": 4, "name": "WAS_FULL_REFRESH"}, "NODE_ID": {"type": "TEXT", "comment": null, "index": 5, "name": "NODE_ID"}, "THREAD_ID": {"type": "NUMBER", "comment": null, "index": 6, "name": "THREAD_ID"}, "STATUS": {"type": "TEXT", "comment": null, "index": 7, "name": "STATUS"}, "COMPILE_STARTED_AT": {"type": "TIMESTAMP_NTZ", "comment": null, "index": 8, "name": "COMPILE_STARTED_AT"}, "QUERY_COMPLETED_AT": {"type": "TIMESTAMP_NTZ", "comment": null, "index": 9, "name": "QUERY_COMPLETED_AT"}, "TOTAL_NODE_RUNTIME": {"type": "FLOAT", "comment": null, "index": 10, "name": "TOTAL_NODE_RUNTIME"}, "ROWS_AFFECTED": {"type": "NUMBER", "comment": null, "index": 11, "name": "ROWS_AFFECTED"}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2021-03-12 10:52UTC", "description": "The timestamp for last update/change", "include": true}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 27531264.0, "description": "Approximate size of the table as reported by Snowflake", "include": true}, "row_count": {"id": "row_count", "label": "Row Count", "value": 632721.0, "description": "An approximate count of rows in this table", "include": true}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "description": "Indicates whether there are statistics for this table", "include": false}}, "unique_id": "model.dbt_artifacts.int_dbt__model_executions"}, "model.dbt_artifacts.fct_dbt__run_results": {"metadata": {"type": "BASE TABLE", "database": "TEST_DB", "schema": "ANALYTICS_DEFAULT_DBT_ARTIFACTS_SCHEMA", "name": "FCT_DBT__RUN_RESULTS", "comment": null, "owner": "ROLE"}, "columns": {"ARTIFACT_GENERATED_AT": {"type": "TIMESTAMP_TZ", "comment": null, "index": 1, "name": "ARTIFACT_GENERATED_AT"}, "COMMAND_INVOCATION_ID": {"type": "TEXT", "comment": null, "index": 2, "name": "COMMAND_INVOCATION_ID"}, "DBT_VERSION": {"type": "TEXT", "comment": null, "index": 3, "name": "DBT_VERSION"}, "ELAPSED_TIME": {"type": "FLOAT", "comment": null, "index": 4, "name": "ELAPSED_TIME"}, "EXECUTION_COMMAND": {"type": "TEXT", "comment": null, "index": 5, "name": "EXECUTION_COMMAND"}, "SELECTED_MODELS": {"type": "VARIANT", "comment": null, "index": 6, "name": "SELECTED_MODELS"}, "TARGET": {"type": "TEXT", "comment": null, "index": 7, "name": "TARGET"}, "WAS_FULL_REFRESH": {"type": "BOOLEAN", "comment": null, "index": 8, "name": "WAS_FULL_REFRESH"}, "ENV_EXAMPLE_ENV_1": {"type": "VARIANT", "comment": null, "index": 9, "name": "ENV_EXAMPLE_ENV_1"}, "ENV_EXAMPLE_ENV_2": {"type": "VARIANT", "comment": null, "index": 9, "name": "ENV_EXAMPLE_ENV_2"}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2021-03-12 10:52UTC", "description": "The timestamp for last update/change", "include": true}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 279040.0, "description": "Approximate size of the table as reported by Snowflake", "include": true}, "row_count": {"id": "row_count", "label": "Row Count", "value": 2625.0, "description": "An approximate count of rows in this table", "include": true}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "description": "Indicates whether there are statistics for this table", "include": false}}, "unique_id": "model.dbt_artifacts.fct_dbt__run_results"}, "model.dbt_artifacts.fct_dbt__model_executions": {"metadata": {"type": "BASE TABLE", "database": "TEST_DB", "schema": "ANALYTICS_DEFAULT_DBT_ARTIFACTS_SCHEMA", "name": "FCT_DBT__MODEL_EXECUTIONS", "comment": null, "owner": "ROLE"}, "columns": {"MODEL_EXECUTION_ID": {"type": "TEXT", "comment": null, "index": 1, "name": "MODEL_EXECUTION_ID"}, "COMMAND_INVOCATION_ID": {"type": "TEXT", "comment": null, "index": 2, "name": "COMMAND_INVOCATION_ID"}, "ARTIFACT_GENERATED_AT": {"type": "TIMESTAMP_TZ", "comment": null, "index": 3, "name": "ARTIFACT_GENERATED_AT"}, "WAS_FULL_REFRESH": {"type": "BOOLEAN", "comment": null, "index": 4, "name": "WAS_FULL_REFRESH"}, "NODE_ID": {"type": "TEXT", "comment": null, "index": 5, "name": "NODE_ID"}, "THREAD_ID": {"type": "NUMBER", "comment": null, "index": 6, "name": "THREAD_ID"}, "STATUS": {"type": "TEXT", "comment": null, "index": 7, "name": "STATUS"}, "COMPILE_STARTED_AT": {"type": "TIMESTAMP_NTZ", "comment": null, "index": 8, "name": "COMPILE_STARTED_AT"}, "QUERY_COMPLETED_AT": {"type": "TIMESTAMP_NTZ", "comment": null, "index": 9, "name": "QUERY_COMPLETED_AT"}, "TOTAL_NODE_RUNTIME": {"type": "FLOAT", "comment": null, "index": 10, "name": "TOTAL_NODE_RUNTIME"}, "ROWS_AFFECTED": {"type": "NUMBER", "comment": null, "index": 11, "name": "ROWS_AFFECTED"}, "MODEL_MATERIALIZATION": {"type": "TEXT", "comment": null, "index": 12, "name": "MODEL_MATERIALIZATION"}, "MODEL_SCHEMA": {"type": "TEXT", "comment": null, "index": 13, "name": "MODEL_SCHEMA"}, "NAME": {"type": "TEXT", "comment": null, "index": 14, "name": "NAME"}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2021-03-12 10:55UTC", "description": "The timestamp for last update/change", "include": true}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 31973888.0, "description": "Approximate size of the table as reported by Snowflake", "include": true}, "row_count": {"id": "row_count", "label": "Row Count", "value": 632721.0, "description": "An approximate count of rows in this table", "include": true}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "description": "Indicates whether there are statistics for this table", "include": false}}, "unique_id": "model.dbt_artifacts.fct_dbt__model_executions"}, "model.dbt_artifacts.fct_dbt__latest_full_model_executions": {"metadata": {"type": "BASE TABLE", "database": "TEST_DB", "schema": "ANALYTICS_DEFAULT_DBT_ARTIFACTS_SCHEMA", "name": "FCT_DBT__LATEST_FULL_MODEL_EXECUTIONS", "comment": null, "owner": "ROLE"}, "columns": {"ARTIFACT_GENERATED_AT": {"type": "TIMESTAMP_TZ", "comment": null, "index": 1, "name": "ARTIFACT_GENERATED_AT"}, "COMMAND_INVOCATION_ID": {"type": "TEXT", "comment": null, "index": 2, "name": "COMMAND_INVOCATION_ID"}, "COMPILE_STARTED_AT": {"type": "TIMESTAMP_NTZ", "comment": null, "index": 3, "name": "COMPILE_STARTED_AT"}, "QUERY_COMPLETED_AT": {"type": "TIMESTAMP_NTZ", "comment": null, "index": 4, "name": "QUERY_COMPLETED_AT"}, "TOTAL_NODE_RUNTIME": {"type": "FLOAT", "comment": null, "index": 5, "name": "TOTAL_NODE_RUNTIME"}, "MODEL_EXECUTION_ID": {"type": "TEXT", "comment": null, "index": 6, "name": "MODEL_EXECUTION_ID"}, "MODEL_MATERIALIZATION": {"type": "TEXT", "comment": null, "index": 7, "name": "MODEL_MATERIALIZATION"}, "MODEL_SCHEMA": {"type": "TEXT", "comment": null, "index": 8, "name": "MODEL_SCHEMA"}, "NAME": {"type": "TEXT", "comment": null, "index": 9, "name": "NAME"}, "NODE_ID": {"type": "TEXT", "comment": null, "index": 10, "name": "NODE_ID"}, "THREAD_ID": {"type": "NUMBER", "comment": null, "index": 11, "name": "THREAD_ID"}, "ROWS_AFFECTED": {"type": "NUMBER", "comment": null, "index": 12, "name": "ROWS_AFFECTED"}, "STATUS": {"type": "TEXT", "comment": null, "index": 13, "name": "STATUS"}, "WAS_FULL_REFRESH": {"type": "BOOLEAN", "comment": null, "index": 14, "name": "WAS_FULL_REFRESH"}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2021-03-12 10:55UTC", "description": "The timestamp for last update/change", "include": true}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 79360.0, "description": "Approximate size of the table as reported by Snowflake", "include": true}, "row_count": {"id": "row_count", "label": "Row Count", "value": 933.0, "description": "An approximate count of rows in this table", "include": true}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "description": "Indicates whether there are statistics for this table", "include": false}}, "unique_id": "model.dbt_artifacts.fct_dbt__latest_full_model_executions"}, "model.dbt_artifacts.fct_dbt__critical_path": {"metadata": {"type": "BASE TABLE", "database": "TEST_DB", "schema": "ANALYTICS_DEFAULT_DBT_ARTIFACTS_SCHEMA", "name": "FCT_DBT__CRITICAL_PATH", "comment": null, "owner": "ROLE"}, "columns": {"NODE_ID": {"type": "TEXT", "comment": null, "index": 1, "name": "NODE_ID"}, "INDEX": {"type": "NUMBER", "comment": null, "index": 2, "name": "INDEX"}, "EXECUTION_MINUTES": {"type": "FLOAT", "comment": null, "index": 3, "name": "EXECUTION_MINUTES"}, "MODEL_MATERIALIZATION": {"type": "TEXT", "comment": null, "index": 4, "name": "MODEL_MATERIALIZATION"}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2021-03-12 10:57UTC", "description": "The timestamp for last update/change", "include": true}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 2560.0, "description": "Approximate size of the table as reported by Snowflake", "include": true}, "row_count": {"id": "row_count", "label": "Row Count", "value": 21.0, "description": "An approximate count of rows in this table", "include": true}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "description": "Indicates whether there are statistics for this table", "include": false}}, "unique_id": "model.dbt_artifacts.fct_dbt__critical_path"}, "model.dbt_artifacts.dim_dbt__models": {"metadata": {"type": "BASE TABLE", "database": "TEST_DB", "schema": "ANALYTICS_DEFAULT_DBT_ARTIFACTS_SCHEMA", "name": "DIM_DBT__MODELS", "comment": null, "owner": "ROLE"}, "columns": {"MANIFEST_MODEL_ID": {"type": "TEXT", "comment": null, "index": 1, "name": "MANIFEST_MODEL_ID"}, "COMMAND_INVOCATION_ID": {"type": "TEXT", "comment": null, "index": 2, "name": "COMMAND_INVOCATION_ID"}, "ARTIFACT_GENERATED_AT": {"type": "TIMESTAMP_TZ", "comment": null, "index": 3, "name": "ARTIFACT_GENERATED_AT"}, "NODE_ID": {"type": "TEXT", "comment": null, "index": 4, "name": "NODE_ID"}, "MODEL_DATABASE": {"type": "TEXT", "comment": null, "index": 5, "name": "MODEL_DATABASE"}, "MODEL_SCHEMA": {"type": "TEXT", "comment": null, "index": 6, "name": "MODEL_SCHEMA"}, "NAME": {"type": "TEXT", "comment": null, "index": 7, "name": "NAME"}, "DEPENDS_ON_NODES": {"type": "ARRAY", "comment": null, "index": 8, "name": "DEPENDS_ON_NODES"}, "PACKAGE_NAME": {"type": "TEXT", "comment": null, "index": 9, "name": "PACKAGE_NAME"}, "MODEL_PATH": {"type": "TEXT", "comment": null, "index": 10, "name": "MODEL_PATH"}, "CHECKSUM": {"type": "TEXT", "comment": null, "index": 11, "name": "CHECKSUM"}, "MODEL_MATERIALIZATION": {"type": "TEXT", "comment": null, "index": 12, "name": "MODEL_MATERIALIZATION"}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2021-03-12 10:55UTC", "description": "The timestamp for last update/change", "include": true}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 204217856.0, "description": "Approximate size of the table as reported by Snowflake", "include": true}, "row_count": {"id": "row_count", "label": "Row Count", "value": 7170516.0, "description": "An approximate count of rows in this table", "include": true}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "description": "Indicates whether there are statistics for this table", "include": false}}, "unique_id": "model.dbt_artifacts.dim_dbt__models"}}, "sources": {"source.dbt_artifacts.dbt_artifacts.artifacts": {"metadata": {"type": "BASE TABLE", "database": "DBT_AUDIT_DB", "schema": "PUBLIC", "name": "DBT_RUN_RESULTS_V4", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATA": {"type": "VARIANT", "comment": null, "index": 1, "name": "DATA"}, "GENERATED_AT": {"type": "TIMESTAMP_TZ", "comment": null, "index": 2, "name": "GENERATED_AT"}, "PATH": {"type": "TEXT", "comment": null, "index": 3, "name": "PATH"}, "ARTIFACT_TYPE": {"type": "TEXT", "comment": null, "index": 4, "name": "ARTIFACT_TYPE"}}, "stats": {"last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2021-03-12 10:55UTC", "description": "The timestamp for last update/change", "include": true}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 5546819584.0, "description": "Approximate size of the table as reported by Snowflake", "include": true}, "row_count": {"id": "row_count", "label": "Row Count", "value": 15961.0, "description": "An approximate count of rows in this table", "include": true}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "description": "Indicates whether there are statistics for this table", "include": false}}, "unique_id": "source.dbt_artifacts.dbt_artifacts.artifacts"}}, "errors": null} \ No newline at end of file +{"metadata": {"dbt_schema_version": "https://schemas.getdbt.com/dbt/catalog/v1.json", "dbt_version": "0.19.1", "generated_at": "2021-07-07T10:07:38.011213Z", "invocation_id": "21776fd0-5851-493f-ae7d-c0beb4e6da36", "env": {}}, "nodes": {"model.dbt_artifacts.fct_dbt__test_executions": {"metadata": {"type": "BASE TABLE", "schema": "SCHEMA", "name": "FCT_DBT__TEST_EXECUTIONS", "database": "DATABASE", "comment": null, "owner": "OWNER"}, "columns": {"MODEL_EXECUTION_ID": {"type": "TEXT", "index": 1, "name": "MODEL_EXECUTION_ID", "comment": null}, "COMMAND_INVOCATION_ID": {"type": "TEXT", "index": 2, "name": "COMMAND_INVOCATION_ID", "comment": null}, "DBT_CLOUD_RUN_ID": {"type": "NUMBER", "index": 3, "name": "DBT_CLOUD_RUN_ID", "comment": null}, "ARTIFACT_GENERATED_AT": {"type": "TIMESTAMP_NTZ", "index": 4, "name": "ARTIFACT_GENERATED_AT", "comment": null}, "WAS_FULL_REFRESH": {"type": "BOOLEAN", "index": 5, "name": "WAS_FULL_REFRESH", "comment": null}, "NODE_ID": {"type": "TEXT", "index": 6, "name": "NODE_ID", "comment": null}, "THREAD_ID": {"type": "NUMBER", "index": 7, "name": "THREAD_ID", "comment": null}, "STATUS": {"type": "TEXT", "index": 8, "name": "STATUS", "comment": null}, "COMPILE_STARTED_AT": {"type": "TIMESTAMP_NTZ", "index": 9, "name": "COMPILE_STARTED_AT", "comment": null}, "QUERY_COMPLETED_AT": {"type": "TIMESTAMP_NTZ", "index": 10, "name": "QUERY_COMPLETED_AT", "comment": null}, "TOTAL_NODE_RUNTIME": {"type": "FLOAT", "index": 11, "name": "TOTAL_NODE_RUNTIME", "comment": null}, "ROWS_AFFECTED": {"type": "NUMBER", "index": 12, "name": "ROWS_AFFECTED", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0.0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2021-07-07 10:05UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.dbt_artifacts.fct_dbt__test_executions"}, "model.dbt_artifacts.stg_dbt__test_executions": {"metadata": {"type": "VIEW", "schema": "SCHEMA", "name": "STG_DBT__TEST_EXECUTIONS", "database": "DATABASE", "comment": null, "owner": "OWNER"}, "columns": {"MODEL_EXECUTION_ID": {"type": "TEXT", "index": 1, "name": "MODEL_EXECUTION_ID", "comment": null}, "COMMAND_INVOCATION_ID": {"type": "TEXT", "index": 2, "name": "COMMAND_INVOCATION_ID", "comment": null}, "DBT_CLOUD_RUN_ID": {"type": "NUMBER", "index": 3, "name": "DBT_CLOUD_RUN_ID", "comment": null}, "ARTIFACT_GENERATED_AT": {"type": "TIMESTAMP_NTZ", "index": 4, "name": "ARTIFACT_GENERATED_AT", "comment": null}, "WAS_FULL_REFRESH": {"type": "BOOLEAN", "index": 5, "name": "WAS_FULL_REFRESH", "comment": null}, "NODE_ID": {"type": "TEXT", "index": 6, "name": "NODE_ID", "comment": null}, "THREAD_ID": {"type": "NUMBER", "index": 7, "name": "THREAD_ID", "comment": null}, "STATUS": {"type": "TEXT", "index": 8, "name": "STATUS", "comment": null}, "MESSAGE": {"type": "TEXT", "index": 9, "name": "MESSAGE", "comment": null}, "COMPILE_STARTED_AT": {"type": "TIMESTAMP_NTZ", "index": 10, "name": "COMPILE_STARTED_AT", "comment": null}, "QUERY_COMPLETED_AT": {"type": "TIMESTAMP_NTZ", "index": 11, "name": "QUERY_COMPLETED_AT", "comment": null}, "TOTAL_NODE_RUNTIME": {"type": "FLOAT", "index": 12, "name": "TOTAL_NODE_RUNTIME", "comment": null}, "ROWS_AFFECTED": {"type": "NUMBER", "index": 13, "name": "ROWS_AFFECTED", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.dbt_artifacts.stg_dbt__test_executions"}, "model.dbt_artifacts.stg_dbt__sources": {"metadata": {"type": "VIEW", "schema": "SCHEMA", "name": "STG_DBT__SOURCES", "database": "DATABASE", "comment": null, "owner": "OWNER"}, "columns": {"MANIFEST_SOURCE_ID": {"type": "TEXT", "index": 1, "name": "MANIFEST_SOURCE_ID", "comment": null}, "COMMAND_INVOCATION_ID": {"type": "TEXT", "index": 2, "name": "COMMAND_INVOCATION_ID", "comment": null}, "DBT_CLOUD_RUN_ID": {"type": "NUMBER", "index": 3, "name": "DBT_CLOUD_RUN_ID", "comment": null}, "ARTIFACT_GENERATED_AT": {"type": "TIMESTAMP_NTZ", "index": 4, "name": "ARTIFACT_GENERATED_AT", "comment": null}, "NODE_ID": {"type": "TEXT", "index": 5, "name": "NODE_ID", "comment": null}, "NAME": {"type": "TEXT", "index": 6, "name": "NAME", "comment": null}, "SOURCE_NAME": {"type": "TEXT", "index": 7, "name": "SOURCE_NAME", "comment": null}, "SOURCE_SCHEMA": {"type": "TEXT", "index": 8, "name": "SOURCE_SCHEMA", "comment": null}, "PACKAGE_NAME": {"type": "TEXT", "index": 9, "name": "PACKAGE_NAME", "comment": null}, "RELATION_NAME": {"type": "TEXT", "index": 10, "name": "RELATION_NAME", "comment": null}, "SOURCE_PATH": {"type": "TEXT", "index": 11, "name": "SOURCE_PATH", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.dbt_artifacts.stg_dbt__sources"}, "model.dbt_artifacts.stg_dbt__run_results_env_keys": {"metadata": {"type": "VIEW", "schema": "SCHEMA", "name": "STG_DBT__RUN_RESULTS_ENV_KEYS", "database": "DATABASE", "comment": null, "owner": "OWNER"}, "columns": {"KEY": {"type": "TEXT", "index": 1, "name": "KEY", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.dbt_artifacts.stg_dbt__run_results_env_keys"}, "model.dbt_artifacts.stg_dbt__run_results": {"metadata": {"type": "VIEW", "schema": "SCHEMA", "name": "STG_DBT__RUN_RESULTS", "database": "DATABASE", "comment": null, "owner": "OWNER"}, "columns": {"ARTIFACT_GENERATED_AT": {"type": "TIMESTAMP_NTZ", "index": 1, "name": "ARTIFACT_GENERATED_AT", "comment": null}, "COMMAND_INVOCATION_ID": {"type": "TEXT", "index": 2, "name": "COMMAND_INVOCATION_ID", "comment": null}, "DBT_CLOUD_RUN_ID": {"type": "NUMBER", "index": 3, "name": "DBT_CLOUD_RUN_ID", "comment": null}, "DBT_VERSION": {"type": "TEXT", "index": 4, "name": "DBT_VERSION", "comment": null}, "ENV": {"type": "VARIANT", "index": 5, "name": "ENV", "comment": null}, "ELAPSED_TIME": {"type": "FLOAT", "index": 6, "name": "ELAPSED_TIME", "comment": null}, "EXECUTION_COMMAND": {"type": "TEXT", "index": 7, "name": "EXECUTION_COMMAND", "comment": null}, "WAS_FULL_REFRESH": {"type": "BOOLEAN", "index": 8, "name": "WAS_FULL_REFRESH", "comment": null}, "SELECTED_MODELS": {"type": "VARIANT", "index": 9, "name": "SELECTED_MODELS", "comment": null}, "TARGET": {"type": "TEXT", "index": 10, "name": "TARGET", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.dbt_artifacts.stg_dbt__run_results"}, "model.dbt_artifacts.stg_dbt__model_executions": {"metadata": {"type": "VIEW", "schema": "SCHEMA", "name": "STG_DBT__MODEL_EXECUTIONS", "database": "DATABASE", "comment": null, "owner": "OWNER"}, "columns": {"MODEL_EXECUTION_ID": {"type": "TEXT", "index": 1, "name": "MODEL_EXECUTION_ID", "comment": null}, "COMMAND_INVOCATION_ID": {"type": "TEXT", "index": 2, "name": "COMMAND_INVOCATION_ID", "comment": null}, "DBT_CLOUD_RUN_ID": {"type": "NUMBER", "index": 3, "name": "DBT_CLOUD_RUN_ID", "comment": null}, "ARTIFACT_GENERATED_AT": {"type": "TIMESTAMP_NTZ", "index": 4, "name": "ARTIFACT_GENERATED_AT", "comment": null}, "WAS_FULL_REFRESH": {"type": "BOOLEAN", "index": 5, "name": "WAS_FULL_REFRESH", "comment": null}, "NODE_ID": {"type": "TEXT", "index": 6, "name": "NODE_ID", "comment": null}, "THREAD_ID": {"type": "NUMBER", "index": 7, "name": "THREAD_ID", "comment": null}, "STATUS": {"type": "TEXT", "index": 8, "name": "STATUS", "comment": null}, "COMPILE_STARTED_AT": {"type": "TIMESTAMP_NTZ", "index": 9, "name": "COMPILE_STARTED_AT", "comment": null}, "QUERY_COMPLETED_AT": {"type": "TIMESTAMP_NTZ", "index": 10, "name": "QUERY_COMPLETED_AT", "comment": null}, "TOTAL_NODE_RUNTIME": {"type": "FLOAT", "index": 11, "name": "TOTAL_NODE_RUNTIME", "comment": null}, "ROWS_AFFECTED": {"type": "NUMBER", "index": 12, "name": "ROWS_AFFECTED", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.dbt_artifacts.stg_dbt__model_executions"}, "model.dbt_artifacts.stg_dbt__models": {"metadata": {"type": "VIEW", "schema": "SCHEMA", "name": "STG_DBT__MODELS", "database": "DATABASE", "comment": null, "owner": "OWNER"}, "columns": {"MANIFEST_MODEL_ID": {"type": "TEXT", "index": 1, "name": "MANIFEST_MODEL_ID", "comment": null}, "COMMAND_INVOCATION_ID": {"type": "TEXT", "index": 2, "name": "COMMAND_INVOCATION_ID", "comment": null}, "DBT_CLOUD_RUN_ID": {"type": "NUMBER", "index": 3, "name": "DBT_CLOUD_RUN_ID", "comment": null}, "ARTIFACT_GENERATED_AT": {"type": "TIMESTAMP_NTZ", "index": 4, "name": "ARTIFACT_GENERATED_AT", "comment": null}, "NODE_ID": {"type": "TEXT", "index": 5, "name": "NODE_ID", "comment": null}, "MODEL_DATABASE": {"type": "TEXT", "index": 6, "name": "MODEL_DATABASE", "comment": null}, "MODEL_SCHEMA": {"type": "TEXT", "index": 7, "name": "MODEL_SCHEMA", "comment": null}, "NAME": {"type": "TEXT", "index": 8, "name": "NAME", "comment": null}, "DEPENDS_ON_NODES": {"type": "ARRAY", "index": 9, "name": "DEPENDS_ON_NODES", "comment": null}, "PACKAGE_NAME": {"type": "TEXT", "index": 10, "name": "PACKAGE_NAME", "comment": null}, "MODEL_PATH": {"type": "TEXT", "index": 11, "name": "MODEL_PATH", "comment": null}, "CHECKSUM": {"type": "TEXT", "index": 12, "name": "CHECKSUM", "comment": null}, "MODEL_MATERIALIZATION": {"type": "TEXT", "index": 13, "name": "MODEL_MATERIALIZATION", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.dbt_artifacts.stg_dbt__models"}, "model.dbt_artifacts.stg_dbt__exposures": {"metadata": {"type": "VIEW", "schema": "SCHEMA", "name": "STG_DBT__EXPOSURES", "database": "DATABASE", "comment": null, "owner": "OWNER"}, "columns": {"MANIFEST_MODEL_ID": {"type": "TEXT", "index": 1, "name": "MANIFEST_MODEL_ID", "comment": null}, "COMMAND_INVOCATION_ID": {"type": "TEXT", "index": 2, "name": "COMMAND_INVOCATION_ID", "comment": null}, "DBT_CLOUD_RUN_ID": {"type": "NUMBER", "index": 3, "name": "DBT_CLOUD_RUN_ID", "comment": null}, "ARTIFACT_GENERATED_AT": {"type": "TIMESTAMP_NTZ", "index": 4, "name": "ARTIFACT_GENERATED_AT", "comment": null}, "NODE_ID": {"type": "TEXT", "index": 5, "name": "NODE_ID", "comment": null}, "NAME": {"type": "TEXT", "index": 6, "name": "NAME", "comment": null}, "DEPENDS_ON_NODES": {"type": "ARRAY", "index": 7, "name": "DEPENDS_ON_NODES", "comment": null}, "DEPENDS_ON_SOURCES": {"type": "ARRAY", "index": 8, "name": "DEPENDS_ON_SOURCES", "comment": null}, "TYPE": {"type": "TEXT", "index": 9, "name": "TYPE", "comment": null}, "OWNER": {"type": "TEXT", "index": 10, "name": "OWNER", "comment": null}, "MATURITY": {"type": "TEXT", "index": 11, "name": "MATURITY", "comment": null}, "PACKAGE_NAME": {"type": "TEXT", "index": 12, "name": "PACKAGE_NAME", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.dbt_artifacts.stg_dbt__exposures"}, "model.dbt_artifacts.stg_dbt__artifacts": {"metadata": {"type": "VIEW", "schema": "SCHEMA", "name": "STG_DBT__ARTIFACTS", "database": "DATABASE", "comment": null, "owner": "OWNER"}, "columns": {"COMMAND_INVOCATION_ID": {"type": "TEXT", "index": 1, "name": "COMMAND_INVOCATION_ID", "comment": null}, "DBT_CLOUD_RUN_ID": {"type": "NUMBER", "index": 2, "name": "DBT_CLOUD_RUN_ID", "comment": null}, "GENERATED_AT": {"type": "TIMESTAMP_NTZ", "index": 3, "name": "GENERATED_AT", "comment": null}, "PATH": {"type": "TEXT", "index": 4, "name": "PATH", "comment": null}, "ARTIFACT_TYPE": {"type": "TEXT", "index": 5, "name": "ARTIFACT_TYPE", "comment": null}, "DATA": {"type": "VARIANT", "index": 6, "name": "DATA", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.dbt_artifacts.stg_dbt__artifacts"}, "model.dbt_artifacts.int_dbt__model_executions": {"metadata": {"type": "BASE TABLE", "schema": "SCHEMA", "name": "INT_DBT__MODEL_EXECUTIONS", "database": "DATABASE", "comment": null, "owner": "OWNER"}, "columns": {"MODEL_EXECUTION_ID": {"type": "TEXT", "index": 1, "name": "MODEL_EXECUTION_ID", "comment": null}, "COMMAND_INVOCATION_ID": {"type": "TEXT", "index": 2, "name": "COMMAND_INVOCATION_ID", "comment": null}, "DBT_CLOUD_RUN_ID": {"type": "NUMBER", "index": 3, "name": "DBT_CLOUD_RUN_ID", "comment": null}, "ARTIFACT_GENERATED_AT": {"type": "TIMESTAMP_NTZ", "index": 4, "name": "ARTIFACT_GENERATED_AT", "comment": null}, "WAS_FULL_REFRESH": {"type": "BOOLEAN", "index": 5, "name": "WAS_FULL_REFRESH", "comment": null}, "NODE_ID": {"type": "TEXT", "index": 6, "name": "NODE_ID", "comment": null}, "THREAD_ID": {"type": "NUMBER", "index": 7, "name": "THREAD_ID", "comment": null}, "STATUS": {"type": "TEXT", "index": 8, "name": "STATUS", "comment": null}, "COMPILE_STARTED_AT": {"type": "TIMESTAMP_NTZ", "index": 9, "name": "COMPILE_STARTED_AT", "comment": null}, "QUERY_COMPLETED_AT": {"type": "TIMESTAMP_NTZ", "index": 10, "name": "QUERY_COMPLETED_AT", "comment": null}, "TOTAL_NODE_RUNTIME": {"type": "FLOAT", "index": 11, "name": "TOTAL_NODE_RUNTIME", "comment": null}, "ROWS_AFFECTED": {"type": "NUMBER", "index": 12, "name": "ROWS_AFFECTED", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 85504.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 1226.0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2021-07-07 10:05UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.dbt_artifacts.int_dbt__model_executions"}, "model.dbt_artifacts.dim_dbt__exposures": {"metadata": {"type": "BASE TABLE", "schema": "SCHEMA", "name": "DIM_DBT__EXPOSURES", "database": "DATABASE", "comment": null, "owner": "OWNER"}, "columns": {"MANIFEST_MODEL_ID": {"type": "TEXT", "index": 1, "name": "MANIFEST_MODEL_ID", "comment": null}, "COMMAND_INVOCATION_ID": {"type": "TEXT", "index": 2, "name": "COMMAND_INVOCATION_ID", "comment": null}, "DBT_CLOUD_RUN_ID": {"type": "NUMBER", "index": 3, "name": "DBT_CLOUD_RUN_ID", "comment": null}, "ARTIFACT_GENERATED_AT": {"type": "TIMESTAMP_NTZ", "index": 4, "name": "ARTIFACT_GENERATED_AT", "comment": null}, "NODE_ID": {"type": "TEXT", "index": 5, "name": "NODE_ID", "comment": null}, "NAME": {"type": "TEXT", "index": 6, "name": "NAME", "comment": null}, "TYPE": {"type": "TEXT", "index": 7, "name": "TYPE", "comment": null}, "OWNER": {"type": "TEXT", "index": 8, "name": "OWNER", "comment": null}, "MATURITY": {"type": "TEXT", "index": 9, "name": "MATURITY", "comment": null}, "OUTPUT_FEEDS": {"type": "TEXT", "index": 10, "name": "OUTPUT_FEEDS", "comment": null}, "PACKAGE_NAME": {"type": "TEXT", "index": 11, "name": "PACKAGE_NAME", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0.0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2021-07-07 10:05UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.dbt_artifacts.dim_dbt__exposures"}, "model.dbt_artifacts.fct_dbt__run_results": {"metadata": {"type": "BASE TABLE", "schema": "SCHEMA", "name": "FCT_DBT__RUN_RESULTS", "database": "DATABASE", "comment": null, "owner": "OWNER"}, "columns": {"ARTIFACT_GENERATED_AT": {"type": "TIMESTAMP_NTZ", "index": 1, "name": "ARTIFACT_GENERATED_AT", "comment": null}, "COMMAND_INVOCATION_ID": {"type": "TEXT", "index": 2, "name": "COMMAND_INVOCATION_ID", "comment": null}, "DBT_CLOUD_RUN_ID": {"type": "NUMBER", "index": 3, "name": "DBT_CLOUD_RUN_ID", "comment": null}, "DBT_VERSION": {"type": "TEXT", "index": 4, "name": "DBT_VERSION", "comment": null}, "ELAPSED_TIME": {"type": "FLOAT", "index": 5, "name": "ELAPSED_TIME", "comment": null}, "EXECUTION_COMMAND": {"type": "TEXT", "index": 6, "name": "EXECUTION_COMMAND", "comment": null}, "SELECTED_MODELS": {"type": "VARIANT", "index": 7, "name": "SELECTED_MODELS", "comment": null}, "TARGET": {"type": "TEXT", "index": 8, "name": "TARGET", "comment": null}, "WAS_FULL_REFRESH": {"type": "BOOLEAN", "index": 9, "name": "WAS_FULL_REFRESH", "comment": null}, "ENV_DBT_CLOUD_JOB_ID": {"type": "VARIANT", "index": 10, "name": "ENV_DBT_CLOUD_JOB_ID", "comment": null}, "ENV_DBT_CLOUD_PROJECT_ID": {"type": "VARIANT", "index": 11, "name": "ENV_DBT_CLOUD_PROJECT_ID", "comment": null}, "ENV_DBT_CLOUD_RUN_ID": {"type": "VARIANT", "index": 12, "name": "ENV_DBT_CLOUD_RUN_ID", "comment": null}, "ENV_DBT_CLOUD_RUN_REASON": {"type": "VARIANT", "index": 13, "name": "ENV_DBT_CLOUD_RUN_REASON", "comment": null}, "ENV_DBT_CLOUD_RUN_REASON_CATEGORY": {"type": "VARIANT", "index": 14, "name": "ENV_DBT_CLOUD_RUN_REASON_CATEGORY", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 10240.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 10.0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2021-07-07 10:05UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.dbt_artifacts.fct_dbt__run_results"}, "model.dbt_artifacts.fct_dbt__model_executions": {"metadata": {"type": "BASE TABLE", "schema": "SCHEMA", "name": "FCT_DBT__MODEL_EXECUTIONS", "database": "DATABASE", "comment": null, "owner": "OWNER"}, "columns": {"MODEL_EXECUTION_ID": {"type": "TEXT", "index": 1, "name": "MODEL_EXECUTION_ID", "comment": null}, "COMMAND_INVOCATION_ID": {"type": "TEXT", "index": 2, "name": "COMMAND_INVOCATION_ID", "comment": null}, "DBT_CLOUD_RUN_ID": {"type": "NUMBER", "index": 3, "name": "DBT_CLOUD_RUN_ID", "comment": null}, "ARTIFACT_GENERATED_AT": {"type": "TIMESTAMP_NTZ", "index": 4, "name": "ARTIFACT_GENERATED_AT", "comment": null}, "WAS_FULL_REFRESH": {"type": "BOOLEAN", "index": 5, "name": "WAS_FULL_REFRESH", "comment": null}, "NODE_ID": {"type": "TEXT", "index": 6, "name": "NODE_ID", "comment": null}, "THREAD_ID": {"type": "NUMBER", "index": 7, "name": "THREAD_ID", "comment": null}, "STATUS": {"type": "TEXT", "index": 8, "name": "STATUS", "comment": null}, "COMPILE_STARTED_AT": {"type": "TIMESTAMP_NTZ", "index": 9, "name": "COMPILE_STARTED_AT", "comment": null}, "QUERY_COMPLETED_AT": {"type": "TIMESTAMP_NTZ", "index": 10, "name": "QUERY_COMPLETED_AT", "comment": null}, "TOTAL_NODE_RUNTIME": {"type": "FLOAT", "index": 11, "name": "TOTAL_NODE_RUNTIME", "comment": null}, "ROWS_AFFECTED": {"type": "NUMBER", "index": 12, "name": "ROWS_AFFECTED", "comment": null}, "MODEL_MATERIALIZATION": {"type": "TEXT", "index": 13, "name": "MODEL_MATERIALIZATION", "comment": null}, "MODEL_SCHEMA": {"type": "TEXT", "index": 14, "name": "MODEL_SCHEMA", "comment": null}, "NAME": {"type": "TEXT", "index": 15, "name": "NAME", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 91648.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 1226.0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2021-07-07 10:05UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.dbt_artifacts.fct_dbt__model_executions"}, "model.dbt_artifacts.fct_dbt__latest_full_model_executions": {"metadata": {"type": "BASE TABLE", "schema": "SCHEMA", "name": "FCT_DBT__LATEST_FULL_MODEL_EXECUTIONS", "database": "DATABASE", "comment": null, "owner": "OWNER"}, "columns": {"ARTIFACT_GENERATED_AT": {"type": "TIMESTAMP_NTZ", "index": 1, "name": "ARTIFACT_GENERATED_AT", "comment": null}, "COMMAND_INVOCATION_ID": {"type": "TEXT", "index": 2, "name": "COMMAND_INVOCATION_ID", "comment": null}, "DBT_CLOUD_RUN_ID": {"type": "NUMBER", "index": 3, "name": "DBT_CLOUD_RUN_ID", "comment": null}, "COMPILE_STARTED_AT": {"type": "TIMESTAMP_NTZ", "index": 4, "name": "COMPILE_STARTED_AT", "comment": null}, "QUERY_COMPLETED_AT": {"type": "TIMESTAMP_NTZ", "index": 5, "name": "QUERY_COMPLETED_AT", "comment": null}, "TOTAL_NODE_RUNTIME": {"type": "FLOAT", "index": 6, "name": "TOTAL_NODE_RUNTIME", "comment": null}, "MODEL_EXECUTION_ID": {"type": "TEXT", "index": 7, "name": "MODEL_EXECUTION_ID", "comment": null}, "MODEL_MATERIALIZATION": {"type": "TEXT", "index": 8, "name": "MODEL_MATERIALIZATION", "comment": null}, "MODEL_SCHEMA": {"type": "TEXT", "index": 9, "name": "MODEL_SCHEMA", "comment": null}, "NAME": {"type": "TEXT", "index": 10, "name": "NAME", "comment": null}, "NODE_ID": {"type": "TEXT", "index": 11, "name": "NODE_ID", "comment": null}, "THREAD_ID": {"type": "NUMBER", "index": 12, "name": "THREAD_ID", "comment": null}, "ROWS_AFFECTED": {"type": "NUMBER", "index": 13, "name": "ROWS_AFFECTED", "comment": null}, "STATUS": {"type": "TEXT", "index": 14, "name": "STATUS", "comment": null}, "WAS_FULL_REFRESH": {"type": "BOOLEAN", "index": 15, "name": "WAS_FULL_REFRESH", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 14336.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 124.0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2021-07-07 10:05UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.dbt_artifacts.fct_dbt__latest_full_model_executions"}, "model.dbt_artifacts.fct_dbt__exposures_updates": {"metadata": {"type": "BASE TABLE", "schema": "SCHEMA", "name": "FCT_DBT__EXPOSURES_UPDATES", "database": "DATABASE", "comment": null, "owner": "OWNER"}, "columns": {"LATEST_GENERATION": {"type": "TIMESTAMP_NTZ", "index": 1, "name": "LATEST_GENERATION", "comment": null}, "NODE_ID": {"type": "TEXT", "index": 2, "name": "NODE_ID", "comment": null}, "NAME": {"type": "TEXT", "index": 3, "name": "NAME", "comment": null}, "TYPE": {"type": "TEXT", "index": 4, "name": "TYPE", "comment": null}, "OWNER": {"type": "TEXT", "index": 5, "name": "OWNER", "comment": null}, "MATURITY": {"type": "TEXT", "index": 6, "name": "MATURITY", "comment": null}, "PACKAGE_NAME": {"type": "TEXT", "index": 7, "name": "PACKAGE_NAME", "comment": null}, "OUTPUT_FEEDS": {"type": "TEXT", "index": 8, "name": "OUTPUT_FEEDS", "comment": null}, "FEED_LATEST_UPDATE": {"type": "TIMESTAMP_NTZ", "index": 9, "name": "FEED_LATEST_UPDATE", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 0.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 0.0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2021-07-07 10:05UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.dbt_artifacts.fct_dbt__exposures_updates"}, "model.dbt_artifacts.fct_dbt__critical_path": {"metadata": {"type": "BASE TABLE", "schema": "SCHEMA", "name": "FCT_DBT__CRITICAL_PATH", "database": "DATABASE", "comment": null, "owner": "OWNER"}, "columns": {"NODE_ID": {"type": "TEXT", "index": 1, "name": "NODE_ID", "comment": null}, "INDEX": {"type": "NUMBER", "index": 2, "name": "INDEX", "comment": null}, "EXECUTION_MINUTES": {"type": "FLOAT", "index": 3, "name": "EXECUTION_MINUTES", "comment": null}, "MODEL_MATERIALIZATION": {"type": "TEXT", "index": 4, "name": "MODEL_MATERIALIZATION", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 2048.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 3.0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2021-07-07 10:05UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.dbt_artifacts.fct_dbt__critical_path"}, "model.dbt_artifacts.dim_dbt__sources": {"metadata": {"type": "BASE TABLE", "schema": "SCHEMA", "name": "DIM_DBT__SOURCES", "database": "DATABASE", "comment": null, "owner": "OWNER"}, "columns": {"MANIFEST_SOURCE_ID": {"type": "TEXT", "index": 1, "name": "MANIFEST_SOURCE_ID", "comment": null}, "COMMAND_INVOCATION_ID": {"type": "TEXT", "index": 2, "name": "COMMAND_INVOCATION_ID", "comment": null}, "DBT_CLOUD_RUN_ID": {"type": "NUMBER", "index": 3, "name": "DBT_CLOUD_RUN_ID", "comment": null}, "ARTIFACT_GENERATED_AT": {"type": "TIMESTAMP_NTZ", "index": 4, "name": "ARTIFACT_GENERATED_AT", "comment": null}, "NODE_ID": {"type": "TEXT", "index": 5, "name": "NODE_ID", "comment": null}, "NAME": {"type": "TEXT", "index": 6, "name": "NAME", "comment": null}, "SOURCE_NAME": {"type": "TEXT", "index": 7, "name": "SOURCE_NAME", "comment": null}, "SOURCE_SCHEMA": {"type": "TEXT", "index": 8, "name": "SOURCE_SCHEMA", "comment": null}, "PACKAGE_NAME": {"type": "TEXT", "index": 9, "name": "PACKAGE_NAME", "comment": null}, "RELATION_NAME": {"type": "TEXT", "index": 10, "name": "RELATION_NAME", "comment": null}, "SOURCE_PATH": {"type": "TEXT", "index": 11, "name": "SOURCE_PATH", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 48128.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 729.0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2021-07-07 10:05UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.dbt_artifacts.dim_dbt__sources"}, "model.dbt_artifacts.dim_dbt__models": {"metadata": {"type": "BASE TABLE", "schema": "SCHEMA", "name": "DIM_DBT__MODELS", "database": "DATABASE", "comment": null, "owner": "OWNER"}, "columns": {"MANIFEST_MODEL_ID": {"type": "TEXT", "index": 1, "name": "MANIFEST_MODEL_ID", "comment": null}, "COMMAND_INVOCATION_ID": {"type": "TEXT", "index": 2, "name": "COMMAND_INVOCATION_ID", "comment": null}, "DBT_CLOUD_RUN_ID": {"type": "NUMBER", "index": 3, "name": "DBT_CLOUD_RUN_ID", "comment": null}, "ARTIFACT_GENERATED_AT": {"type": "TIMESTAMP_NTZ", "index": 4, "name": "ARTIFACT_GENERATED_AT", "comment": null}, "NODE_ID": {"type": "TEXT", "index": 5, "name": "NODE_ID", "comment": null}, "MODEL_DATABASE": {"type": "TEXT", "index": 6, "name": "MODEL_DATABASE", "comment": null}, "MODEL_SCHEMA": {"type": "TEXT", "index": 7, "name": "MODEL_SCHEMA", "comment": null}, "NAME": {"type": "TEXT", "index": 8, "name": "NAME", "comment": null}, "DEPENDS_ON_NODES": {"type": "ARRAY", "index": 9, "name": "DEPENDS_ON_NODES", "comment": null}, "PACKAGE_NAME": {"type": "TEXT", "index": 10, "name": "PACKAGE_NAME", "comment": null}, "MODEL_PATH": {"type": "TEXT", "index": 11, "name": "MODEL_PATH", "comment": null}, "CHECKSUM": {"type": "TEXT", "index": 12, "name": "CHECKSUM", "comment": null}, "MODEL_MATERIALIZATION": {"type": "TEXT", "index": 13, "name": "MODEL_MATERIALIZATION", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 116224.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 1226.0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2021-07-07 10:05UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.dbt_artifacts.dim_dbt__models"}}, "sources": {"source.dbt_artifacts.dbt_artifacts.artifacts": {"metadata": {"type": "BASE TABLE", "schema": "DBT_ARTIFACTS", "name": "ARTIFACTS", "database": "DBT_ARTIFACTS", "comment": null, "owner": "OWNER"}, "columns": {"DATA": {"type": "VARIANT", "index": 1, "name": "DATA", "comment": null}, "GENERATED_AT": {"type": "TIMESTAMP_NTZ", "index": 2, "name": "GENERATED_AT", "comment": null}, "PATH": {"type": "TEXT", "index": 3, "name": "PATH", "comment": null}, "ARTIFACT_TYPE": {"type": "TEXT", "index": 4, "name": "ARTIFACT_TYPE", "comment": null}}, "stats": {"bytes": {"id": "bytes", "label": "Approximate Size", "value": 2398720.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "row_count": {"id": "row_count", "label": "Row Count", "value": 20.0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2021-07-07 09:11UTC", "include": true, "description": "The timestamp for last update/change"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "source.dbt_artifacts.dbt_artifacts.artifacts"}}, "errors": null} \ No newline at end of file diff --git a/docs/manifest.json b/docs/manifest.json index df330852..0b47e6ef 100644 --- a/docs/manifest.json +++ b/docs/manifest.json @@ -1 +1 @@ -{"metadata": {"dbt_schema_version": "https://schemas.getdbt.com/dbt/manifest/v1.json", "dbt_version": "0.19.0", "generated_at": "2021-03-12T10:58:22.510910Z", "invocation_id": "2607e74e-72d8-4769-80b5-b6c0da4137a1", "env": {}, "project_id": "80a035c5caa7bfb9378465c4c70ed133", "user_id": "8c5cc7d3-99d1-4068-b087-c9620dd5e1aa", "send_anonymous_usage_stats": true, "adapter_type": "snowflake"}, "nodes": {"model.dbt_artifacts.fct_dbt__latest_full_model_executions": {"raw_sql": "with run_results as (\n\n select *\n from {{ ref('fct_dbt__run_results') }}\n\n),\n\nmodel_executions as (\n\n select *\n from {{ ref('fct_dbt__model_executions') }}\n\n),\n\nlatest_full as (\n\n select *\n from run_results\n where selected_models is null and was_full_refresh = false\n order by artifact_generated_at desc\n limit 1\n\n),\n\njoined as (\n\n select\n model_executions.*\n from latest_full\n left join model_executions on model_executions.command_invocation_id = latest_full.command_invocation_id\n\n),\n\nfields as (\n\n select\n artifact_generated_at,\n command_invocation_id,\n compile_started_at,\n query_completed_at,\n total_node_runtime,\n model_execution_id,\n model_materialization,\n model_schema,\n name,\n node_id,\n thread_id,\n rows_affected,\n status,\n was_full_refresh\n from joined\n\n)\n\nselect * from fields", "compiled": true, "database": "test_db", "schema": "analytics_default_dbt_artifacts_schema", "fqn": ["dbt_artifacts", "fct_dbt__latest_full_model_executions"], "unique_id": "model.dbt_artifacts.fct_dbt__latest_full_model_executions", "package_name": "dbt_artifacts", "root_path": "dbt_artifacts", "path": "fct_dbt__latest_full_model_executions.sql", "original_file_path": "models/fct_dbt__latest_full_model_executions.sql", "name": "fct_dbt__latest_full_model_executions", "resource_type": "model", "alias": "fct_dbt__latest_full_model_executions", "checksum": {"name": "sha256", "checksum": "ed3ddeaaea221f6dbe9bd7b2f0ecc96558e51c588a8533cca8db9109e59862c1"}, "config": {"enabled": true, "materialized": "table", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": "default_dbt_artifacts_schema", "database": null, "tags": [], "full_refresh": null}, "tags": [], "refs": [["fct_dbt__run_results"], ["fct_dbt__model_executions"]], "sources": [], "depends_on": {"macros": [], "nodes": ["model.dbt_artifacts.fct_dbt__run_results", "model.dbt_artifacts.fct_dbt__model_executions"]}, "description": "A list of all models and executions times from the most recent, incremental run.", "columns": {"node_id": {"name": "node_id", "description": "Primary key.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "artifact_generated_at": {"name": "artifact_generated_at", "description": "Timestamp of when the source artifact was generated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "command_invocation_id": {"name": "command_invocation_id", "description": "Foreign key to fct_dbt_run_results. The id of the command which resulted in the source artifact's generation.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "compile_started_at": {"name": "compile_started_at", "description": "Timestamp of when a model starts to be compiled.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "query_completed_ats": {"name": "query_completed_ats", "description": "Timestamp of when a model's SQL is completed", "meta": {}, "data_type": null, "quote": null, "tags": []}, "total_node_runtime": {"name": "total_node_runtime", "description": "The duration of time in seconds for the model to run. Note that this is _not_ equal to the delta between `compile_started_at` and `query_completed_at` since it includes extra tasks performed by dbt.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "model_execution_id": {"name": "model_execution_id", "description": "A surrogate key of command_invocation_id and node_id.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "model_materialization": {"name": "model_materialization", "description": "", "meta": {}, "data_type": null, "quote": null, "tags": []}, "model_schema": {"name": "model_schema", "description": "", "meta": {}, "data_type": null, "quote": null, "tags": []}, "name": {"name": "name", "description": "The model name.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "rows_affected": {"name": "rows_affected", "description": "The number of rows affected by the model's execution. Always 1 for non-incremental executions.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "status": {"name": "status", "description": "Success/fail status of the model's execution.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "was_full_refresh": {"name": "was_full_refresh", "description": "Boolean value for whether this model was executed with a --full-refresh flag.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "models/schemas.yml", "build_path": "target/compiled/dbt_artifacts/models/fct_dbt__latest_full_model_executions.sql", "deferred": false, "unrendered_config": {"schema": "default_dbt_artifacts_schema", "materialized": "table"}, "compiled_sql": "with run_results as (\n\n select *\n from test_db.analytics_default_dbt_artifacts_schema.fct_dbt__run_results\n\n),\n\nmodel_executions as (\n\n select *\n from test_db.analytics_default_dbt_artifacts_schema.fct_dbt__model_executions\n\n),\n\nlatest_full as (\n\n select *\n from run_results\n where selected_models is null and was_full_refresh = false\n order by artifact_generated_at desc\n limit 1\n\n),\n\njoined as (\n\n select\n model_executions.*\n from latest_full\n left join model_executions on model_executions.command_invocation_id = latest_full.command_invocation_id\n\n),\n\nfields as (\n\n select\n artifact_generated_at,\n command_invocation_id,\n compile_started_at,\n query_completed_at,\n total_node_runtime,\n model_execution_id,\n model_materialization,\n model_schema,\n name,\n node_id,\n thread_id,\n rows_affected,\n status,\n was_full_refresh\n from joined\n\n)\n\nselect * from fields", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "test_db.analytics_default_dbt_artifacts_schema.fct_dbt__latest_full_model_executions"}, "model.dbt_artifacts.fct_dbt__critical_path": {"raw_sql": "with models as (\n\n select *\n from {{ ref('stg_dbt__models') }}\n\n),\n\nlatest_executions as (\n\n select *\n from {{ ref('fct_dbt__latest_full_model_executions') }}\n\n),\n\nlatest_id as (\n -- Find the latest full, incremental execution\n\n select\n any_value(command_invocation_id) as command_invocation_id\n from latest_executions\n\n),\n\nlatest_models as (\n -- Get the latest set of models for the above execution\n\n select\n models.node_id,\n models.depends_on_nodes,\n models.model_materialization\n from latest_id\n left join models on latest_id.command_invocation_id = models.command_invocation_id\n\n\n),\n\nnode_dependencies as (\n -- Create a row for each model and dependency (could be another model, or source)\n\n select\n latest_models.node_id,\n node.value::string as depends_on_node_id,\n regexp_substr(node.value::string, '^([a-z]+)') as depends_on_node_type\n from latest_models,\n lateral flatten(input => latest_models.depends_on_nodes) as node\n\n),\n\nnode_dependencies_deduped as (\n -- depends_on_nodes is simply a list of all the ref() statements used in a model, so it may contain duplicates\n\n select distinct\n node_id,\n depends_on_node_type,\n depends_on_node_id\n from node_dependencies\n\n),\n\nmodel_dependencies_with_total_node_runtime as (\n -- Model dependencies enriched with execution time\n\n select distinct\n node_dependencies_deduped.node_id,\n latest_executions.total_node_runtime,\n depends_on_node_id\n from node_dependencies_deduped\n left join latest_executions on node_dependencies_deduped.node_id = latest_executions.node_id\n where depends_on_node_type = 'model'\n\n),\n\nmodels_with_at_least_one_model_dependency as (\n -- Return a list of model nodes which have at least one model dependency\n\n select distinct\n node_id\n from node_dependencies\n where depends_on_node_type = 'model'\n\n),\n\nmodels_with_no_model_dependencies_with_total_node_runtime as (\n -- Models which have no dependencies enriched with execution time\n -- These are models at the base of the tree\n\n select\n latest_models.node_id,\n latest_executions.total_node_runtime\n from latest_models\n left join models_with_at_least_one_model_dependency\n on latest_models.node_id = models_with_at_least_one_model_dependency.node_id\n left join latest_executions on latest_models.node_id = latest_executions.node_id\n where models_with_at_least_one_model_dependency.node_id is null\n\n),\n\nmodels_with_dependent_models as (\n -- Get a list of all the models which have dependent models\n\n select distinct depends_on_node_id as node_id\n from node_dependencies_deduped\n\n),\n\nmodels_with_no_dependent_models as (\n -- Models which have no dependents\n -- These are models at the tips of the tree\n\n select\n latest_models.node_id\n from latest_models\n left join models_with_dependent_models\n on latest_models.node_id = models_with_dependent_models.node_id\n where models_with_dependent_models.node_id is null\n\n),\n\nanchor as (\n -- The anchor of a recursive CTE is the initial query\n -- The anchor in this case is models which have no dependents, the tips of the tree\n -- The dependencies for these models are joined in to build out the paths during recursion\n\n select\n models_with_no_dependent_models.node_id,\n coalesce(node_dependencies_deduped.depends_on_node_id, '') as depends_on_node_id,\n coalesce(latest_executions.total_node_runtime, 0) as total_node_runtime\n from models_with_no_dependent_models\n left join node_dependencies_deduped on models_with_no_dependent_models.node_id = node_dependencies_deduped.node_id\n left join latest_executions on models_with_no_dependent_models.node_id = latest_executions.node_id\n\n),\n\nall_needed_dependencies as (\n -- Union all the base models with all other dependencies\n -- Use an empty string for depends_on_node_id to avoid NULL result in a non-nullable column error\n -- Nothing will join onto the empty string depends_on_node_id, ending the recursion at the base.\n\n select\n node_id,\n total_node_runtime,\n '' as depends_on_node_id\n from models_with_no_model_dependencies_with_total_node_runtime\n union\n select\n node_id,\n total_node_runtime,\n depends_on_node_id as depends_on_node_id\n from model_dependencies_with_total_node_runtime\n\n),\n\nsearch_path (node_ids, total_time) as (\n -- The recursive part\n -- This CTE creates an array of node_ids and total_time for every possible path through the DAG\n -- Starting with the tips of the tree, work backwards through every path until there's a '' depends_on_node_id\n\n select\n array_construct(depends_on_node_id, node_id),\n total_node_runtime\n from anchor\n union all\n select\n array_cat(to_array(all_needed_dependencies.depends_on_node_id), search_path.node_ids) as node_ids,\n all_needed_dependencies.total_node_runtime + search_path.total_time\n from search_path\n left join all_needed_dependencies\n where get(search_path.node_ids, 0) = all_needed_dependencies.node_id\n\n),\n\nlongest_path_node_ids as (\n -- Find the path with the longest total time\n\n select\n -- Remove any empty strings from the beginning of the array that were introduced in search_path to prevent infinite recursion\n case\n when get(node_ids, 0) = ''\n -- Ensure we keep the last element of the array by using array_size for the last index\n then array_slice(node_ids, 1, array_size(node_ids))\n else node_ids\n end as node_ids,\n total_time\n from search_path\n order by total_time desc\n limit 1\n\n),\n\nflattened as (\n -- Flatten the array of node_ids and keep the index\n\n select\n value as node_id,\n index\n from longest_path_node_ids,\n lateral flatten (input => node_ids)\n\n),\n\nlongest_path_with_times as (\n -- Join the indidivual model execution times back in along with the materializations\n\n select\n flattened.node_id::string as node_id,\n flattened.index,\n latest_executions.total_node_runtime/60 as execution_minutes,\n latest_models.model_materialization\n from flattened\n left join latest_executions on flattened.node_id = latest_executions.node_id\n left join latest_models on flattened.node_id = latest_models.node_id\n\n)\n\nselect * from longest_path_with_times", "compiled": true, "database": "test_db", "schema": "analytics_default_dbt_artifacts_schema", "fqn": ["dbt_artifacts", "fct_dbt__critical_path"], "unique_id": "model.dbt_artifacts.fct_dbt__critical_path", "package_name": "dbt_artifacts", "root_path": "dbt_artifacts", "path": "fct_dbt__critical_path.sql", "original_file_path": "models/fct_dbt__critical_path.sql", "name": "fct_dbt__critical_path", "resource_type": "model", "alias": "fct_dbt__critical_path", "checksum": {"name": "sha256", "checksum": "25aea617f781be3f0beb3c6b749b4630928d0df58b37075bc40220381a1f032a"}, "config": {"enabled": true, "materialized": "table", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": "default_dbt_artifacts_schema", "database": null, "tags": [], "full_refresh": null}, "tags": [], "refs": [["stg_dbt__models"], ["fct_dbt__latest_full_model_executions"]], "sources": [], "depends_on": {"macros": [], "nodes": ["model.dbt_artifacts.stg_dbt__models", "model.dbt_artifacts.fct_dbt__latest_full_model_executions"]}, "description": "A table of models and executions times that make up the critical path of a full, incremental run.", "columns": {"node_id": {"name": "node_id", "description": "Primary key.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "index": {"name": "index", "description": "The index of the model in the critical path. Starts at 0.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "execution_minutes": {"name": "execution_minutes", "description": "The duration of time in minutes for the model to run.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "model_materialization": {"name": "model_materialization", "description": "", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "models/schemas.yml", "build_path": "target/compiled/dbt_artifacts/models/fct_dbt__critical_path.sql", "deferred": false, "unrendered_config": {"schema": "default_dbt_artifacts_schema", "materialized": "table"}, "compiled_sql": "with models as (\n\n select *\n from test_db.analytics_default_dbt_artifacts_schema.stg_dbt__models\n\n),\n\nlatest_executions as (\n\n select *\n from test_db.analytics_default_dbt_artifacts_schema.fct_dbt__latest_full_model_executions\n\n),\n\nlatest_id as (\n -- Find the latest full, incremental execution\n\n select\n any_value(command_invocation_id) as command_invocation_id\n from latest_executions\n\n),\n\nlatest_models as (\n -- Get the latest set of models for the above execution\n\n select\n models.node_id,\n models.depends_on_nodes,\n models.model_materialization\n from latest_id\n left join models on latest_id.command_invocation_id = models.command_invocation_id\n\n\n),\n\nnode_dependencies as (\n -- Create a row for each model and dependency (could be another model, or source)\n\n select\n latest_models.node_id,\n node.value::string as depends_on_node_id,\n regexp_substr(node.value::string, '^([a-z]+)') as depends_on_node_type\n from latest_models,\n lateral flatten(input => latest_models.depends_on_nodes) as node\n\n),\n\nnode_dependencies_deduped as (\n -- depends_on_nodes is simply a list of all the ref() statements used in a model, so it may contain duplicates\n\n select distinct\n node_id,\n depends_on_node_type,\n depends_on_node_id\n from node_dependencies\n\n),\n\nmodel_dependencies_with_total_node_runtime as (\n -- Model dependencies enriched with execution time\n\n select distinct\n node_dependencies_deduped.node_id,\n latest_executions.total_node_runtime,\n depends_on_node_id\n from node_dependencies_deduped\n left join latest_executions on node_dependencies_deduped.node_id = latest_executions.node_id\n where depends_on_node_type = 'model'\n\n),\n\nmodels_with_at_least_one_model_dependency as (\n -- Return a list of model nodes which have at least one model dependency\n\n select distinct\n node_id\n from node_dependencies\n where depends_on_node_type = 'model'\n\n),\n\nmodels_with_no_model_dependencies_with_total_node_runtime as (\n -- Models which have no dependencies enriched with execution time\n -- These are models at the base of the tree\n\n select\n latest_models.node_id,\n latest_executions.total_node_runtime\n from latest_models\n left join models_with_at_least_one_model_dependency\n on latest_models.node_id = models_with_at_least_one_model_dependency.node_id\n left join latest_executions on latest_models.node_id = latest_executions.node_id\n where models_with_at_least_one_model_dependency.node_id is null\n\n),\n\nmodels_with_dependent_models as (\n -- Get a list of all the models which have dependent models\n\n select distinct depends_on_node_id as node_id\n from node_dependencies_deduped\n\n),\n\nmodels_with_no_dependent_models as (\n -- Models which have no dependents\n -- These are models at the tips of the tree\n\n select\n latest_models.node_id\n from latest_models\n left join models_with_dependent_models\n on latest_models.node_id = models_with_dependent_models.node_id\n where models_with_dependent_models.node_id is null\n\n),\n\nanchor as (\n -- The anchor of a recursive CTE is the initial query\n -- The anchor in this case is models which have no dependents, the tips of the tree\n -- The dependencies for these models are joined in to build out the paths during recursion\n\n select\n models_with_no_dependent_models.node_id,\n coalesce(node_dependencies_deduped.depends_on_node_id, '') as depends_on_node_id,\n coalesce(latest_executions.total_node_runtime, 0) as total_node_runtime\n from models_with_no_dependent_models\n left join node_dependencies_deduped on models_with_no_dependent_models.node_id = node_dependencies_deduped.node_id\n left join latest_executions on models_with_no_dependent_models.node_id = latest_executions.node_id\n\n),\n\nall_needed_dependencies as (\n -- Union all the base models with all other dependencies\n -- Use an empty string for depends_on_node_id to avoid NULL result in a non-nullable column error\n -- Nothing will join onto the empty string depends_on_node_id, ending the recursion at the base.\n\n select\n node_id,\n total_node_runtime,\n '' as depends_on_node_id\n from models_with_no_model_dependencies_with_total_node_runtime\n union\n select\n node_id,\n total_node_runtime,\n depends_on_node_id as depends_on_node_id\n from model_dependencies_with_total_node_runtime\n\n),\n\nsearch_path (node_ids, total_time) as (\n -- The recursive part\n -- This CTE creates an array of node_ids and total_time for every possible path through the DAG\n -- Starting with the tips of the tree, work backwards through every path until there's a '' depends_on_node_id\n\n select\n array_construct(depends_on_node_id, node_id),\n total_node_runtime\n from anchor\n union all\n select\n array_cat(to_array(all_needed_dependencies.depends_on_node_id), search_path.node_ids) as node_ids,\n all_needed_dependencies.total_node_runtime + search_path.total_time\n from search_path\n left join all_needed_dependencies\n where get(search_path.node_ids, 0) = all_needed_dependencies.node_id\n\n),\n\nlongest_path_node_ids as (\n -- Find the path with the longest total time\n\n select\n -- Remove any empty strings from the beginning of the array that were introduced in search_path to prevent infinite recursion\n case\n when get(node_ids, 0) = ''\n -- Ensure we keep the last element of the array by using array_size for the last index\n then array_slice(node_ids, 1, array_size(node_ids))\n else node_ids\n end as node_ids,\n total_time\n from search_path\n order by total_time desc\n limit 1\n\n),\n\nflattened as (\n -- Flatten the array of node_ids and keep the index\n\n select\n value as node_id,\n index\n from longest_path_node_ids,\n lateral flatten (input => node_ids)\n\n),\n\nlongest_path_with_times as (\n -- Join the indidivual model execution times back in along with the materializations\n\n select\n flattened.node_id::string as node_id,\n flattened.index,\n latest_executions.total_node_runtime/60 as execution_minutes,\n latest_models.model_materialization\n from flattened\n left join latest_executions on flattened.node_id = latest_executions.node_id\n left join latest_models on flattened.node_id = latest_models.node_id\n\n)\n\nselect * from longest_path_with_times", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "test_db.analytics_default_dbt_artifacts_schema.fct_dbt__critical_path"}, "model.dbt_artifacts.stg_dbt__models": {"raw_sql": "with base as (\n\n select *\n from {{ ref('stg_dbt__artifacts') }}\n\n),\n\nmanifests as (\n\n select *\n from base\n where artifact_type = 'manifest.json'\n\n),\n\nflatten as (\n\n select\n command_invocation_id,\n generated_at as artifact_generated_at,\n node.key as node_id,\n node.value:database::string as model_database,\n node.value:schema::string as model_schema,\n node.value:name::string as name,\n to_array(node.value:depends_on:nodes) as depends_on_nodes,\n node.value:package_name::string as package_name,\n node.value:path::string as model_path,\n node.value:checksum.checksum::string as checksum,\n node.value:config.materialized::string as model_materialization\n from manifests,\n lateral flatten(input => data:nodes) as node\n where node.value:resource_type = 'model'\n\n),\n\nsurrogate_key as (\n\n select\n {{ dbt_utils.surrogate_key(['command_invocation_id', 'node_id']) }} as manifest_model_id,\n command_invocation_id,\n artifact_generated_at,\n node_id,\n model_database,\n model_schema,\n name,\n depends_on_nodes,\n package_name,\n model_path,\n checksum,\n model_materialization\n from flatten\n\n)\n\nselect * from surrogate_key", "compiled": true, "database": "test_db", "schema": "analytics_default_dbt_artifacts_schema", "fqn": ["dbt_artifacts", "staging", "stg_dbt__models"], "unique_id": "model.dbt_artifacts.stg_dbt__models", "package_name": "dbt_artifacts", "root_path": "dbt_artifacts", "path": "staging/stg_dbt__models.sql", "original_file_path": "models/staging/stg_dbt__models.sql", "name": "stg_dbt__models", "resource_type": "model", "alias": "stg_dbt__models", "checksum": {"name": "sha256", "checksum": "898e76cc18524bdb6c65d29ee41c5d55d4540e31d0091ac33801dbf0645b7e36"}, "config": {"enabled": true, "materialized": "view", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": "default_dbt_artifacts_schema", "database": null, "tags": [], "full_refresh": null}, "tags": [], "refs": [["stg_dbt__artifacts"]], "sources": [], "depends_on": {"macros": ["macro.dbt_utils.surrogate_key"], "nodes": ["model.dbt_artifacts.stg_dbt__artifacts"]}, "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": "target/compiled/dbt_artifacts/models/staging/stg_dbt__models.sql", "deferred": false, "unrendered_config": {"schema": "default_dbt_artifacts_schema", "materialized": "view"}, "compiled_sql": "with base as (\n\n select *\n from test_db.analytics_default_dbt_artifacts_schema.stg_dbt__artifacts\n\n),\n\nmanifests as (\n\n select *\n from base\n where artifact_type = 'manifest.json'\n\n),\n\nflatten as (\n\n select\n command_invocation_id,\n generated_at as artifact_generated_at,\n node.key as node_id,\n node.value:database::string as model_database,\n node.value:schema::string as model_schema,\n node.value:name::string as name,\n to_array(node.value:depends_on:nodes) as depends_on_nodes,\n node.value:package_name::string as package_name,\n node.value:path::string as model_path,\n node.value:checksum.checksum::string as checksum,\n node.value:config.materialized::string as model_materialization\n from manifests,\n lateral flatten(input => data:nodes) as node\n where node.value:resource_type = 'model'\n\n),\n\nsurrogate_key as (\n\n select\n md5(cast(\n \n coalesce(cast(command_invocation_id as \n varchar\n), '') || '-' || coalesce(cast(node_id as \n varchar\n), '')\n\n as \n varchar\n)) as manifest_model_id,\n command_invocation_id,\n artifact_generated_at,\n node_id,\n model_database,\n model_schema,\n name,\n depends_on_nodes,\n package_name,\n model_path,\n checksum,\n model_materialization\n from flatten\n\n)\n\nselect * from surrogate_key", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "test_db.analytics_default_dbt_artifacts_schema.stg_dbt__models"}, "model.dbt_artifacts.stg_dbt__run_results_env_keys": {"raw_sql": "with base as (\n\n select *\n from {{ ref('stg_dbt__artifacts') }}\n\n),\n\nrun_results as (\n\n select *\n from base\n where artifact_type = 'run_results.json'\n\n),\n\ndbt_run as (\n\n select *\n from run_results\n where data:args:which = 'run'\n\n),\n\nenv_keys as (\n\n select\n distinct(env.key)\n from dbt_run,\n lateral flatten(input => data:metadata:env) as env\n\n)\n\nselect * from env_keys", "compiled": true, "database": "test_db", "schema": "analytics_default_dbt_artifacts_schema", "fqn": ["dbt_artifacts", "staging", "stg_dbt__run_results_env_keys"], "unique_id": "model.dbt_artifacts.stg_dbt__run_results_env_keys", "package_name": "dbt_artifacts", "root_path": "dbt_artifacts", "path": "staging/stg_dbt__run_results_env_keys.sql", "original_file_path": "models/staging/stg_dbt__run_results_env_keys.sql", "name": "stg_dbt__run_results_env_keys", "resource_type": "model", "alias": "stg_dbt__run_results_env_keys", "checksum": {"name": "sha256", "checksum": "3e41841a02876b84d657d1273e404396e9e34c0149e4db0805122e47e358a668"}, "config": {"enabled": true, "materialized": "view", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": "default_dbt_artifacts_schema", "database": null, "tags": [], "full_refresh": null}, "tags": [], "refs": [["stg_dbt__artifacts"]], "sources": [], "depends_on": {"macros": [], "nodes": ["model.dbt_artifacts.stg_dbt__artifacts"]}, "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": "target/compiled/dbt_artifacts/models/staging/stg_dbt__run_results_env_keys.sql", "deferred": false, "unrendered_config": {"schema": "default_dbt_artifacts_schema", "materialized": "view"}, "compiled_sql": "with base as (\n\n select *\n from test_db.analytics_default_dbt_artifacts_schema.stg_dbt__artifacts\n\n),\n\nrun_results as (\n\n select *\n from base\n where artifact_type = 'run_results.json'\n\n),\n\ndbt_run as (\n\n select *\n from run_results\n where data:args:which = 'run'\n\n),\n\nenv_keys as (\n\n select\n distinct(env.key)\n from dbt_run,\n lateral flatten(input => data:metadata:env) as env\n\n)\n\nselect * from env_keys", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "test_db.analytics_default_dbt_artifacts_schema.stg_dbt__run_results_env_keys"}, "model.dbt_artifacts.stg_dbt__sources": {"raw_sql": "with base as (\n\n select *\n from {{ ref('stg_dbt__artifacts') }}\n\n),\n\nmanifests as (\n\n select *\n from base\n where artifact_type = 'manifest.json'\n\n),\n\nflatten as (\n\n select\n command_invocation_id,\n generated_at as artifact_generated_at,\n node.key as node_id,\n node.value:name::string as name,\n node.value:source_name::string as source_name,\n node.value:schema::string as source_schema,\n node.value:package_name::string as package_name,\n node.value:relation_name::string as relation_name,\n node.value:path::string as source_path\n from manifests,\n lateral flatten(input => data:sources) as node\n where node.value:resource_type = 'source'\n\n),\n\nsurrogate_key as (\n\n select\n {{ dbt_utils.surrogate_key(['command_invocation_id', 'node_id']) }} as manifest_source_id,\n command_invocation_id,\n artifact_generated_at,\n node_id,\n name,\n source_name,\n source_schema,\n package_name,\n relation_name,\n source_path\n from flatten\n\n)\n\nselect * from surrogate_key", "compiled": true, "database": "test_db", "schema": "analytics_default_dbt_artifacts_schema", "fqn": ["dbt_artifacts", "staging", "stg_dbt__sources"], "unique_id": "model.dbt_artifacts.stg_dbt__sources", "package_name": "dbt_artifacts", "root_path": "dbt_artifacts", "path": "staging/stg_dbt__sources.sql", "original_file_path": "models/staging/stg_dbt__sources.sql", "name": "stg_dbt__sources", "resource_type": "model", "alias": "stg_dbt__sources", "checksum": {"name": "sha256", "checksum": "5b9b91c3db29e330b11011b2b1715fd92100fc7b6986abb5c8fab097ff9db559"}, "config": {"enabled": true, "materialized": "view", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": "default_dbt_artifacts_schema", "database": null, "tags": [], "full_refresh": null}, "tags": [], "refs": [["stg_dbt__artifacts"]], "sources": [], "depends_on": {"macros": ["macro.dbt_utils.surrogate_key"], "nodes": ["model.dbt_artifacts.stg_dbt__artifacts"]}, "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": "target/compiled/dbt_artifacts/models/staging/stg_dbt__sources.sql", "deferred": false, "unrendered_config": {"schema": "default_dbt_artifacts_schema", "materialized": "view"}, "compiled_sql": "with base as (\n\n select *\n from test_db.analytics_default_dbt_artifacts_schema.stg_dbt__artifacts\n\n),\n\nmanifests as (\n\n select *\n from base\n where artifact_type = 'manifest.json'\n\n),\n\nflatten as (\n\n select\n command_invocation_id,\n generated_at as artifact_generated_at,\n node.key as node_id,\n node.value:name::string as name,\n node.value:source_name::string as source_name,\n node.value:schema::string as source_schema,\n node.value:package_name::string as package_name,\n node.value:relation_name::string as relation_name,\n node.value:path::string as source_path\n from manifests,\n lateral flatten(input => data:sources) as node\n where node.value:resource_type = 'source'\n\n),\n\nsurrogate_key as (\n\n select\n md5(cast(\n \n coalesce(cast(command_invocation_id as \n varchar\n), '') || '-' || coalesce(cast(node_id as \n varchar\n), '')\n\n as \n varchar\n)) as manifest_source_id,\n command_invocation_id,\n artifact_generated_at,\n node_id,\n name,\n source_name,\n source_schema,\n package_name,\n relation_name,\n source_path\n from flatten\n\n)\n\nselect * from surrogate_key", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "test_db.analytics_default_dbt_artifacts_schema.stg_dbt__sources"}, "model.dbt_artifacts.stg_dbt__artifacts": {"raw_sql": "with base as (\n\n select *\n from {{ source('dbt_artifacts', 'artifacts') }}\n\n),\n\nfields as (\n\n select\n data:metadata:invocation_id::string as command_invocation_id,\n generated_at,\n path,\n artifact_type,\n data\n from base\n\n),\n\nduduped as (\n\n select\n *,\n row_number() over (\n partition by command_invocation_id, artifact_type\n order by generated_at desc\n ) as index\n from fields\n qualify index = 1\n\n),\n\nartifacts as (\n\n select\n command_invocation_id,\n generated_at,\n path,\n artifact_type,\n data\n from duduped\n\n)\n\nselect * from artifacts", "compiled": true, "database": "test_db", "schema": "analytics_default_dbt_artifacts_schema", "fqn": ["dbt_artifacts", "staging", "stg_dbt__artifacts"], "unique_id": "model.dbt_artifacts.stg_dbt__artifacts", "package_name": "dbt_artifacts", "root_path": "dbt_artifacts", "path": "staging/stg_dbt__artifacts.sql", "original_file_path": "models/staging/stg_dbt__artifacts.sql", "name": "stg_dbt__artifacts", "resource_type": "model", "alias": "stg_dbt__artifacts", "checksum": {"name": "sha256", "checksum": "9fddbcee011733d9b2bed08b90cef983199fd5b8c652a2ea9e4dc884929694ff"}, "config": {"enabled": true, "materialized": "view", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": "default_dbt_artifacts_schema", "database": null, "tags": [], "full_refresh": null}, "tags": [], "refs": [], "sources": [["dbt_artifacts", "artifacts"]], "depends_on": {"macros": [], "nodes": ["source.dbt_artifacts.dbt_artifacts.artifacts"]}, "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": "target/compiled/dbt_artifacts/models/staging/stg_dbt__artifacts.sql", "deferred": false, "unrendered_config": {"schema": "default_dbt_artifacts_schema", "materialized": "view"}, "compiled_sql": "with base as (\n\n select *\n from dbt_audit_db.public.dbt_run_results_v4\n\n),\n\nfields as (\n\n select\n data:metadata:invocation_id::string as command_invocation_id,\n generated_at,\n path,\n artifact_type,\n data\n from base\n\n),\n\nduduped as (\n\n select\n *,\n row_number() over (\n partition by command_invocation_id, artifact_type\n order by generated_at desc\n ) as index\n from fields\n qualify index = 1\n\n),\n\nartifacts as (\n\n select\n command_invocation_id,\n generated_at,\n path,\n artifact_type,\n data\n from duduped\n\n)\n\nselect * from artifacts", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "test_db.analytics_default_dbt_artifacts_schema.stg_dbt__artifacts"}, "model.dbt_artifacts.stg_dbt__model_executions": {"raw_sql": "with base as (\n\n select *\n from {{ ref('stg_dbt__artifacts') }}\n\n),\n\nrun_results as (\n\n select *\n from base\n where artifact_type = 'run_results.json'\n\n),\n\ndbt_run as (\n\n select *\n from run_results\n where data:args:which = 'run'\n\n),\n\nfields as (\n\n select\n data:metadata:invocation_id::string as command_invocation_id,\n generated_at as artifact_generated_at,\n coalesce(data:args:full_refresh, 'false')::boolean as was_full_refresh,\n result.value:unique_id::string as node_id,\n split(result.value:thread_id::string, '-')[1]::integer as thread_id,\n result.value:status::string as status,\n\n -- The first item in the timing array is the model-level `compile`\n result.value:timing[0]:started_at::timestamp_ntz as compile_started_at,\n\n -- The second item in the timing array is `execute`.\n result.value:timing[1]:completed_at::timestamp_ntz as query_completed_at,\n \n -- Confusingly, this does not match the delta of the above two timestamps.\n -- should we calculate it instead?\n coalesce(result.value:execution_time::float, 0) as total_node_runtime,\n \n result.value:adapter_response:rows_affected::int as rows_affected\n from dbt_run,\n lateral flatten(input => data:results) as result\n\n),\n\nsurrogate_key as (\n\n select\n {{ dbt_utils.surrogate_key(['command_invocation_id', 'node_id']) }} as model_execution_id,\n command_invocation_id,\n artifact_generated_at,\n was_full_refresh,\n node_id,\n thread_id,\n status,\n compile_started_at,\n query_completed_at,\n total_node_runtime,\n rows_affected\n from fields\n\n)\n\nselect * from surrogate_key", "compiled": true, "database": "test_db", "schema": "analytics_default_dbt_artifacts_schema", "fqn": ["dbt_artifacts", "staging", "stg_dbt__model_executions"], "unique_id": "model.dbt_artifacts.stg_dbt__model_executions", "package_name": "dbt_artifacts", "root_path": "dbt_artifacts", "path": "staging/stg_dbt__model_executions.sql", "original_file_path": "models/staging/stg_dbt__model_executions.sql", "name": "stg_dbt__model_executions", "resource_type": "model", "alias": "stg_dbt__model_executions", "checksum": {"name": "sha256", "checksum": "df709dcef7f6191e1a8d02937b0d55b25e82afd88d520e61c62f9c5d106df6c3"}, "config": {"enabled": true, "materialized": "view", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": "default_dbt_artifacts_schema", "database": null, "tags": [], "full_refresh": null}, "tags": [], "refs": [["stg_dbt__artifacts"]], "sources": [], "depends_on": {"macros": ["macro.dbt_utils.surrogate_key"], "nodes": ["model.dbt_artifacts.stg_dbt__artifacts"]}, "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": "target/compiled/dbt_artifacts/models/staging/stg_dbt__model_executions.sql", "deferred": false, "unrendered_config": {"schema": "default_dbt_artifacts_schema", "materialized": "view"}, "compiled_sql": "with base as (\n\n select *\n from test_db.analytics_default_dbt_artifacts_schema.stg_dbt__artifacts\n\n),\n\nrun_results as (\n\n select *\n from base\n where artifact_type = 'run_results.json'\n\n),\n\ndbt_run as (\n\n select *\n from run_results\n where data:args:which = 'run'\n\n),\n\nfields as (\n\n select\n data:metadata:invocation_id::string as command_invocation_id,\n generated_at as artifact_generated_at,\n coalesce(data:args:full_refresh, 'false')::boolean as was_full_refresh,\n result.value:unique_id::string as node_id,\n split(result.value:thread_id::string, '-')[1]::integer as thread_id,\n result.value:status::string as status,\n\n -- The first item in the timing array is the model-level `compile`\n result.value:timing[0]:started_at::timestamp_ntz as compile_started_at,\n\n -- The second item in the timing array is `execute`.\n result.value:timing[1]:completed_at::timestamp_ntz as query_completed_at,\n \n -- Confusingly, this does not match the delta of the above two timestamps.\n -- should we calculate it instead?\n coalesce(result.value:execution_time::float, 0) as total_node_runtime,\n \n result.value:adapter_response:rows_affected::int as rows_affected\n from dbt_run,\n lateral flatten(input => data:results) as result\n\n),\n\nsurrogate_key as (\n\n select\n md5(cast(\n \n coalesce(cast(command_invocation_id as \n varchar\n), '') || '-' || coalesce(cast(node_id as \n varchar\n), '')\n\n as \n varchar\n)) as model_execution_id,\n command_invocation_id,\n artifact_generated_at,\n was_full_refresh,\n node_id,\n thread_id,\n status,\n compile_started_at,\n query_completed_at,\n total_node_runtime,\n rows_affected\n from fields\n\n)\n\nselect * from surrogate_key", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "test_db.analytics_default_dbt_artifacts_schema.stg_dbt__model_executions"}, "model.dbt_artifacts.stg_dbt__run_results": {"raw_sql": "with base as (\n\n select *\n from {{ ref('stg_dbt__artifacts') }}\n\n),\n\nrun_results as (\n\n select *\n from base\n where artifact_type = 'run_results.json'\n\n),\n\ndbt_run as (\n\n select *\n from run_results\n where data:args:which = 'run'\n\n),\n\nfields as (\n\n select\n generated_at as artifact_generated_at,\n data:metadata:invocation_id::string as command_invocation_id,\n data:metadata:dbt_version::string as dbt_version,\n data:metadata:env as env,\n data:elapsed_time::float as elapsed_time,\n data:args:which::string as execution_command,\n coalesce(data:args:full_refresh, 'false')::boolean as was_full_refresh,\n data:args:models as selected_models,\n data:args:target::string as target\n from dbt_run\n\n)\n\nselect * from fields", "compiled": true, "database": "test_db", "schema": "analytics_default_dbt_artifacts_schema", "fqn": ["dbt_artifacts", "staging", "stg_dbt__run_results"], "unique_id": "model.dbt_artifacts.stg_dbt__run_results", "package_name": "dbt_artifacts", "root_path": "dbt_artifacts", "path": "staging/stg_dbt__run_results.sql", "original_file_path": "models/staging/stg_dbt__run_results.sql", "name": "stg_dbt__run_results", "resource_type": "model", "alias": "stg_dbt__run_results", "checksum": {"name": "sha256", "checksum": "b54b7afa2278aa1f815fea002eea883f6116ffc0440e8c8b5386539b3ad995cf"}, "config": {"enabled": true, "materialized": "view", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": "default_dbt_artifacts_schema", "database": null, "tags": [], "full_refresh": null}, "tags": [], "refs": [["stg_dbt__artifacts"]], "sources": [], "depends_on": {"macros": [], "nodes": ["model.dbt_artifacts.stg_dbt__artifacts"]}, "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": "target/compiled/dbt_artifacts/models/staging/stg_dbt__run_results.sql", "deferred": false, "unrendered_config": {"schema": "default_dbt_artifacts_schema", "materialized": "view"}, "compiled_sql": "with base as (\n\n select *\n from test_db.analytics_default_dbt_artifacts_schema.stg_dbt__artifacts\n\n),\n\nrun_results as (\n\n select *\n from base\n where artifact_type = 'run_results.json'\n\n),\n\ndbt_run as (\n\n select *\n from run_results\n where data:args:which = 'run'\n\n),\n\nfields as (\n\n select\n generated_at as artifact_generated_at,\n data:metadata:invocation_id::string as command_invocation_id,\n data:metadata:dbt_version::string as dbt_version,\n data:metadata:env as env,\n data:elapsed_time::float as elapsed_time,\n data:args:which::string as execution_command,\n coalesce(data:args:full_refresh, 'false')::boolean as was_full_refresh,\n data:args:models as selected_models,\n data:args:target::string as target\n from dbt_run\n\n)\n\nselect * from fields", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "test_db.analytics_default_dbt_artifacts_schema.stg_dbt__run_results"}, "model.dbt_artifacts.int_dbt__model_executions": {"raw_sql": "{{ config( materialized='incremental', unique_key='model_execution_id' ) }}\n\nwith model_executions as (\n\n select *\n from {{ ref('stg_dbt__model_executions') }}\n\n),\n\nmodel_executions_incremental as (\n\n select *\n from model_executions\n\n {% if is_incremental() %}\n -- this filter will only be applied on an incremental run\n where artifact_generated_at > (select max(artifact_generated_at) from {{ this }})\n {% endif %}\n\n),\n\nfields as (\n\n select\n model_execution_id,\n command_invocation_id,\n artifact_generated_at,\n was_full_refresh,\n node_id,\n thread_id,\n status,\n compile_started_at,\n query_completed_at,\n total_node_runtime,\n rows_affected\n from model_executions_incremental\n\n)\n\nselect * from fields", "compiled": true, "database": "test_db", "schema": "analytics_default_dbt_artifacts_schema", "fqn": ["dbt_artifacts", "incremental", "int_dbt__model_executions"], "unique_id": "model.dbt_artifacts.int_dbt__model_executions", "package_name": "dbt_artifacts", "root_path": "dbt_artifacts", "path": "incremental/int_dbt__model_executions.sql", "original_file_path": "models/incremental/int_dbt__model_executions.sql", "name": "int_dbt__model_executions", "resource_type": "model", "alias": "int_dbt__model_executions", "checksum": {"name": "sha256", "checksum": "6a4b3840501d98debc2d008b61a266c06050d8e4d86bd1a9477aca24736722c9"}, "config": {"enabled": true, "materialized": "incremental", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": "default_dbt_artifacts_schema", "database": null, "tags": [], "full_refresh": null, "unique_key": "model_execution_id"}, "tags": [], "refs": [["stg_dbt__model_executions"]], "sources": [], "depends_on": {"macros": ["macro.dbt.is_incremental"], "nodes": ["model.dbt_artifacts.stg_dbt__model_executions"]}, "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": "target/compiled/dbt_artifacts/models/incremental/int_dbt__model_executions.sql", "deferred": false, "unrendered_config": {"schema": "default_dbt_artifacts_schema", "materialized": "incremental", "unique_key": "model_execution_id"}, "compiled_sql": "\n\nwith model_executions as (\n\n select *\n from test_db.analytics_default_dbt_artifacts_schema.stg_dbt__model_executions\n\n),\n\nmodel_executions_incremental as (\n\n select *\n from model_executions\n\n \n -- this filter will only be applied on an incremental run\n where artifact_generated_at > (select max(artifact_generated_at) from test_db.analytics_default_dbt_artifacts_schema.int_dbt__model_executions)\n \n\n),\n\nfields as (\n\n select\n model_execution_id,\n command_invocation_id,\n artifact_generated_at,\n was_full_refresh,\n node_id,\n thread_id,\n status,\n compile_started_at,\n query_completed_at,\n total_node_runtime,\n rows_affected\n from model_executions_incremental\n\n)\n\nselect * from fields", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "test_db.analytics_default_dbt_artifacts_schema.int_dbt__model_executions"}, "model.dbt_artifacts.fct_dbt__model_executions": {"raw_sql": "{{ config( materialized='incremental', unique_key='model_execution_id' ) }}\n\nwith models as (\n\n select *\n from {{ ref('dim_dbt__models') }}\n\n),\n\nmodel_executions as (\n\n select *\n from {{ ref('int_dbt__model_executions') }}\n\n),\n\nmodel_executions_incremental as (\n\n select *\n from model_executions\n\n {% if is_incremental() %}\n -- this filter will only be applied on an incremental run\n where artifact_generated_at > (select max(artifact_generated_at) from {{ this }})\n {% endif %}\n\n),\n\nmodel_executions_with_materialization as (\n\n select\n model_executions_incremental.*,\n models.model_materialization,\n models.model_schema,\n models.name\n from model_executions_incremental\n left join models on (\n model_executions_incremental.command_invocation_id = models.command_invocation_id\n and model_executions_incremental.node_id = models.node_id\n )\n\n),\n\nfields as (\n\n select\n model_execution_id,\n command_invocation_id,\n artifact_generated_at,\n was_full_refresh,\n node_id,\n thread_id,\n status,\n compile_started_at,\n query_completed_at,\n total_node_runtime,\n rows_affected,\n model_materialization,\n model_schema,\n name\n from model_executions_with_materialization\n\n)\n\nselect * from fields", "compiled": true, "database": "test_db", "schema": "analytics_default_dbt_artifacts_schema", "fqn": ["dbt_artifacts", "incremental", "fct_dbt__model_executions"], "unique_id": "model.dbt_artifacts.fct_dbt__model_executions", "package_name": "dbt_artifacts", "root_path": "dbt_artifacts", "path": "incremental/fct_dbt__model_executions.sql", "original_file_path": "models/incremental/fct_dbt__model_executions.sql", "name": "fct_dbt__model_executions", "resource_type": "model", "alias": "fct_dbt__model_executions", "checksum": {"name": "sha256", "checksum": "b11463797435bef15d46c3286c09a95c6d9c0ce37b59cd14d05f44d11c2c2baf"}, "config": {"enabled": true, "materialized": "incremental", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": "default_dbt_artifacts_schema", "database": null, "tags": [], "full_refresh": null, "unique_key": "model_execution_id"}, "tags": [], "refs": [["dim_dbt__models"], ["int_dbt__model_executions"]], "sources": [], "depends_on": {"macros": ["macro.dbt.is_incremental"], "nodes": ["model.dbt_artifacts.dim_dbt__models", "model.dbt_artifacts.int_dbt__model_executions"]}, "description": "All historic dbt model executions.", "columns": {"model_execution_id": {"name": "model_execution_id", "description": "Primary key.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "name": {"name": "name", "description": "The name of the model.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "model_schema": {"name": "model_schema", "description": "The schema containing the model.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "was_full_refresh": {"name": "was_full_refresh", "description": "Boolean value for whether this model was executed with a --full-refresh flag.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "model_materialization": {"name": "model_materialization", "description": "The configured materialization of the model.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "compile_started_at": {"name": "compile_started_at", "description": "Timestamp of when a model starts to be compiled.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "query_completed_at": {"name": "query_completed_at", "description": "Timestamp of when a model's SQL is completed", "meta": {}, "data_type": null, "quote": null, "tags": []}, "total_node_runtime": {"name": "total_node_runtime", "description": "The duration of time in seconds for the model to run. Note that this is _not_ equal to the delta between `compile_started_at` and `query_completed_at` since it includes extra tasks performed by dbt.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "status": {"name": "status", "description": "Success/fail status of the model's execution.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "command_invocation_id": {"name": "command_invocation_id", "description": "Foreign key to fct_dbt_run_results. The id of the command which resulted in the source artifact's generation.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "artifact_generated_at": {"name": "artifact_generated_at", "description": "Timestamp of when the source artifact was generated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "node_id": {"name": "node_id", "description": "Unique id for the node, in the form of model.[package_name].[model_name]", "meta": {}, "data_type": null, "quote": null, "tags": []}, "rows_affected": {"name": "rows_affected", "description": "The number of rows affected by the model's execution. Always 1 for non-incremental executions.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "models/schemas.yml", "build_path": "target/compiled/dbt_artifacts/models/incremental/fct_dbt__model_executions.sql", "deferred": false, "unrendered_config": {"schema": "default_dbt_artifacts_schema", "materialized": "incremental", "unique_key": "model_execution_id"}, "compiled_sql": "\n\nwith models as (\n\n select *\n from test_db.analytics_default_dbt_artifacts_schema.dim_dbt__models\n\n),\n\nmodel_executions as (\n\n select *\n from test_db.analytics_default_dbt_artifacts_schema.int_dbt__model_executions\n\n),\n\nmodel_executions_incremental as (\n\n select *\n from model_executions\n\n \n -- this filter will only be applied on an incremental run\n where artifact_generated_at > (select max(artifact_generated_at) from test_db.analytics_default_dbt_artifacts_schema.fct_dbt__model_executions)\n \n\n),\n\nmodel_executions_with_materialization as (\n\n select\n model_executions_incremental.*,\n models.model_materialization,\n models.model_schema,\n models.name\n from model_executions_incremental\n left join models on (\n model_executions_incremental.command_invocation_id = models.command_invocation_id\n and model_executions_incremental.node_id = models.node_id\n )\n\n),\n\nfields as (\n\n select\n model_execution_id,\n command_invocation_id,\n artifact_generated_at,\n was_full_refresh,\n node_id,\n thread_id,\n status,\n compile_started_at,\n query_completed_at,\n total_node_runtime,\n rows_affected,\n model_materialization,\n model_schema,\n name\n from model_executions_with_materialization\n\n)\n\nselect * from fields", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "test_db.analytics_default_dbt_artifacts_schema.fct_dbt__model_executions"}, "model.dbt_artifacts.dim_dbt__sources": {"raw_sql": "{{ config( materialized='incremental', unique_key='manifest_source_id' ) }}\n\nwith dbt_sources as (\n\n select * from {{ ref('stg_dbt__sources') }}\n\n),\n\ndbt_sources_incremental as (\n\n select *\n from dbt_sources\n\n {% if is_incremental() %}\n -- this filter will only be applied on an incremental run\n where artifact_generated_at > (select max(artifact_generated_at) from {{ this }})\n {% endif %}\n\n),\n\nfields as (\n\n select\n manifest_source_id,\n command_invocation_id,\n artifact_generated_at,\n node_id,\n name,\n source_name,\n source_schema,\n package_name,\n relation_name,\n source_path\n from dbt_sources_incremental\n\n)\n\nselect * from fields", "compiled": true, "database": "test_db", "schema": "analytics_default_dbt_artifacts_schema", "fqn": ["dbt_artifacts", "incremental", "dim_dbt__sources"], "unique_id": "model.dbt_artifacts.dim_dbt__sources", "package_name": "dbt_artifacts", "root_path": "dbt_artifacts", "path": "incremental/dim_dbt__sources.sql", "original_file_path": "models/incremental/dim_dbt__sources.sql", "name": "dim_dbt__sources", "resource_type": "model", "alias": "dim_dbt__sources", "checksum": {"name": "sha256", "checksum": "d68df219395ec334da3327233ff0bf4f8e557c6b23186db3e182c3d2023d69b4"}, "config": {"enabled": true, "materialized": "incremental", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": "default_dbt_artifacts_schema", "database": null, "tags": [], "full_refresh": null, "unique_key": "manifest_source_id"}, "tags": [], "refs": [["stg_dbt__sources"]], "sources": [], "depends_on": {"macros": ["macro.dbt.is_incremental"], "nodes": ["model.dbt_artifacts.stg_dbt__sources"]}, "description": "All dbt source metadata from every manifest.json.", "columns": {"manifest_source_id": {"name": "manifest_source_id", "description": "Primary key generated from the command_invocation_id and checksum.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "command_invocation_id": {"name": "command_invocation_id", "description": "The id of the command which resulted in the source artifact's generation.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "artifact_generated_at": {"name": "artifact_generated_at", "description": "Timestamp of when the source artifact was generated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "node_id": {"name": "node_id", "description": "Unique id for the node, in the form of model.[package_name].[model_name]", "meta": {}, "data_type": null, "quote": null, "tags": []}, "name": {"name": "name", "description": "The source node name.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "source_name": {"name": "source_name", "description": "The name of the source.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "source_schema": {"name": "source_schema", "description": "", "meta": {}, "data_type": null, "quote": null, "tags": []}, "package_name": {"name": "package_name", "description": "Package source is defined in.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "relation_name": {"name": "relation_name", "description": "Name of the database entity this source resolved to.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "source_path": {"name": "source_path", "description": "Filepath of the source.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "models/schemas.yml", "build_path": "target/compiled/dbt_artifacts/models/incremental/dim_dbt__sources.sql", "deferred": false, "unrendered_config": {"schema": "default_dbt_artifacts_schema", "materialized": "incremental", "unique_key": "manifest_source_id"}, "compiled_sql": "\n\nwith dbt_sources as (\n\n select * from test_db.analytics_default_dbt_artifacts_schema.stg_dbt__sources\n\n),\n\ndbt_sources_incremental as (\n\n select *\n from dbt_sources\n\n \n -- this filter will only be applied on an incremental run\n where artifact_generated_at > (select max(artifact_generated_at) from test_db.analytics_default_dbt_artifacts_schema.dim_dbt__sources)\n \n\n),\n\nfields as (\n\n select\n manifest_source_id,\n command_invocation_id,\n artifact_generated_at,\n node_id,\n name,\n source_name,\n source_schema,\n package_name,\n relation_name,\n source_path\n from dbt_sources_incremental\n\n)\n\nselect * from fields", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "test_db.analytics_default_dbt_artifacts_schema.dim_dbt__sources"}, "model.dbt_artifacts.dim_dbt__models": {"raw_sql": "{{ config( materialized='incremental', unique_key='manifest_model_id' ) }}\n\nwith dbt_models as (\n\n select * from {{ ref('stg_dbt__models') }}\n\n),\n\ndbt_models_incremental as (\n\n select *\n from dbt_models\n\n {% if is_incremental() %}\n -- this filter will only be applied on an incremental run\n where artifact_generated_at > (select max(artifact_generated_at) from {{ this }})\n {% endif %}\n\n),\n\nfields as (\n\n select\n manifest_model_id,\n command_invocation_id,\n artifact_generated_at,\n node_id,\n model_database,\n model_schema,\n name,\n depends_on_nodes,\n package_name,\n model_path,\n checksum,\n model_materialization\n from dbt_models_incremental\n\n)\n\nselect * from fields", "compiled": true, "database": "test_db", "schema": "analytics_default_dbt_artifacts_schema", "fqn": ["dbt_artifacts", "incremental", "dim_dbt__models"], "unique_id": "model.dbt_artifacts.dim_dbt__models", "package_name": "dbt_artifacts", "root_path": "dbt_artifacts", "path": "incremental/dim_dbt__models.sql", "original_file_path": "models/incremental/dim_dbt__models.sql", "name": "dim_dbt__models", "resource_type": "model", "alias": "dim_dbt__models", "checksum": {"name": "sha256", "checksum": "654bce894fb716fd6f7cf399a1a66084e6a76b8144ce2df53d605894277d20f0"}, "config": {"enabled": true, "materialized": "incremental", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": "default_dbt_artifacts_schema", "database": null, "tags": [], "full_refresh": null, "unique_key": "manifest_model_id"}, "tags": [], "refs": [["stg_dbt__models"]], "sources": [], "depends_on": {"macros": ["macro.dbt.is_incremental"], "nodes": ["model.dbt_artifacts.stg_dbt__models"]}, "description": "All dbt model metadata from every manifest.json.", "columns": {"manifest_model_id": {"name": "manifest_model_id", "description": "Primary key generated from the command_invocation_id and checksum.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "command_invocation_id": {"name": "command_invocation_id", "description": "The id of the command which resulted in the source artifact's generation.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "artifact_generated_at": {"name": "artifact_generated_at", "description": "Timestamp of when the source artifact was generated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "node_id": {"name": "node_id", "description": "Unique id for the node, in the form of model.[package_name].[model_name]", "meta": {}, "data_type": null, "quote": null, "tags": []}, "name": {"name": "name", "description": "The model name.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "model_schema": {"name": "model_schema", "description": "", "meta": {}, "data_type": null, "quote": null, "tags": []}, "depends_on_nodes": {"name": "depends_on_nodes", "description": "List of node ids the model depends on.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "package_name": {"name": "package_name", "description": "", "meta": {}, "data_type": null, "quote": null, "tags": []}, "model_path": {"name": "model_path", "description": "Filepath of the model.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "checksum": {"name": "checksum", "description": "Unique identifier for the model. If a model is unchanged between separate executions this will remain the same.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "model_materialization": {"name": "model_materialization", "description": "", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "models/schemas.yml", "build_path": "target/compiled/dbt_artifacts/models/incremental/dim_dbt__models.sql", "deferred": false, "unrendered_config": {"schema": "default_dbt_artifacts_schema", "materialized": "incremental", "unique_key": "manifest_model_id"}, "compiled_sql": "\n\nwith dbt_models as (\n\n select * from test_db.analytics_default_dbt_artifacts_schema.stg_dbt__models\n\n),\n\ndbt_models_incremental as (\n\n select *\n from dbt_models\n\n \n -- this filter will only be applied on an incremental run\n where artifact_generated_at > (select max(artifact_generated_at) from test_db.analytics_default_dbt_artifacts_schema.dim_dbt__models)\n \n\n),\n\nfields as (\n\n select\n manifest_model_id,\n command_invocation_id,\n artifact_generated_at,\n node_id,\n model_database,\n model_schema,\n name,\n depends_on_nodes,\n package_name,\n model_path,\n checksum,\n model_materialization\n from dbt_models_incremental\n\n)\n\nselect * from fields", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "test_db.analytics_default_dbt_artifacts_schema.dim_dbt__models"}, "model.dbt_artifacts.fct_dbt__run_results": {"raw_sql": "{{ config( materialized='incremental', unique_key='command_invocation_id' ) }}\n\n{% set env_keys = dbt_utils.get_column_values(table=ref('stg_dbt__run_results_env_keys'), column='key') %}\n\nwith run_results as (\n\n select *\n from {{ ref('stg_dbt__run_results') }}\n\n),\n\nincremental_run_results as (\n\n select *\n from run_results\n\n {% if is_incremental() %}\n -- this filter will only be applied on an incremental run\n where artifact_generated_at > (select max(artifact_generated_at) from {{ this }})\n {% endif %}\n\n),\n\nfields as (\n\n select\n artifact_generated_at,\n command_invocation_id,\n dbt_version,\n elapsed_time,\n execution_command,\n selected_models,\n target,\n was_full_refresh\n\n {% if env_keys %}\n {% for key in env_keys %}\n ,env:{{ key }} as env_{{ key }}\n {% endfor %}\n {% endif %}\n from incremental_run_results\n\n)\n\nselect * from fields", "compiled": true, "database": "test_db", "schema": "analytics_default_dbt_artifacts_schema", "fqn": ["dbt_artifacts", "incremental", "fct_dbt__run_results"], "unique_id": "model.dbt_artifacts.fct_dbt__run_results", "package_name": "dbt_artifacts", "root_path": "dbt_artifacts", "path": "incremental/fct_dbt__run_results.sql", "original_file_path": "models/incremental/fct_dbt__run_results.sql", "name": "fct_dbt__run_results", "resource_type": "model", "alias": "fct_dbt__run_results", "checksum": {"name": "sha256", "checksum": "8f91c1f558a775aa6f5e6dca0a2675c724c9af4fb65f2ad1356fe71682f5f4e3"}, "config": {"enabled": true, "materialized": "incremental", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": "default_dbt_artifacts_schema", "database": null, "tags": [], "full_refresh": null, "unique_key": "command_invocation_id"}, "tags": [], "refs": [["stg_dbt__run_results_env_keys"], ["stg_dbt__run_results"]], "sources": [], "depends_on": {"macros": ["macro.dbt_utils.get_column_values", "macro.dbt.is_incremental"], "nodes": ["model.dbt_artifacts.stg_dbt__run_results_env_keys", "model.dbt_artifacts.stg_dbt__run_results"]}, "description": "Metadata for dbt run commands.", "columns": {"command_invocation_id": {"name": "command_invocation_id", "description": "The id of the command which resulted in the source artifact's generation.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "artifact_generated_at": {"name": "artifact_generated_at", "description": "Timestamp of when the source artifact was generated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "dbt_version": {"name": "dbt_version", "description": "The version of dbt used to generate the source artifact.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "elapsed_time": {"name": "elapsed_time", "description": "The total run time of the command.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "execution_command": {"name": "execution_command", "description": "The actual command used.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "selected_models": {"name": "selected_models", "description": "A list of model selectors used in the command.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "target": {"name": "target", "description": "The configured target for the command.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "was_full_refresh": {"name": "was_full_refresh", "description": "Was the run executed with a --full-refresh flag?", "meta": {}, "data_type": null, "quote": null, "tags": []}, "env_*": {"name": "env_*", "description": "Columns for the environment variables set when the command was executed.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "models/schemas.yml", "build_path": "target/compiled/dbt_artifacts/models/incremental/fct_dbt__run_results.sql", "deferred": false, "unrendered_config": {"schema": "default_dbt_artifacts_schema", "materialized": "incremental", "unique_key": "command_invocation_id"}, "compiled_sql": "\n\n\n\nwith run_results as (\n\n select *\n from test_db.analytics_default_dbt_artifacts_schema.stg_dbt__run_results\n\n),\n\nincremental_run_results as (\n\n select *\n from run_results\n\n \n -- this filter will only be applied on an incremental run\n where artifact_generated_at > (select max(artifact_generated_at) from test_db.analytics_default_dbt_artifacts_schema.fct_dbt__run_results)\n \n\n),\n\nfields as (\n\n select\n artifact_generated_at,\n command_invocation_id,\n dbt_version,\n elapsed_time,\n execution_command,\n selected_models,\n target,\n was_full_refresh\n\n \n \n ,env:warehouse as env_warehouse\n \n ,env:route as env_route\n \n ,env:deployschemas as env_deployschemas\n \n ,env:deployschemaprefix as env_deployschemaprefix\n \n ,env:deploydb as env_deploydb\n \n ,env:database as env_database\n \n ,env:build_hash as env_build_hash\n \n ,env:forcenonincremental as env_forcenonincremental\n \n ,env:schema as env_schema\n \n ,env:jobid as env_jobid\n \n ,env:user as env_user\n \n ,env:forceincremental as env_forceincremental\n \n \n from incremental_run_results\n\n)\n\nselect * from fields", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "test_db.analytics_default_dbt_artifacts_schema.fct_dbt__run_results"}, "test.dbt_artifacts.unique_fct_dbt__critical_path_node_id": {"raw_sql": "{{ config(severity='ERROR') }}{{ test_unique(**_dbt_schema_test_kwargs) }}", "test_metadata": {"namespace": null, "name": "unique", "kwargs": {"column_name": "node_id", "model": "{{ ref('fct_dbt__critical_path') }}"}}, "compiled": true, "database": "test_db", "schema": "analytics_default_dbt_artifacts_schema", "fqn": ["dbt_artifacts", "schema_test", "unique_fct_dbt__critical_path_node_id"], "unique_id": "test.dbt_artifacts.unique_fct_dbt__critical_path_node_id", "package_name": "dbt_artifacts", "root_path": "dbt_artifacts", "path": "schema_test/unique_fct_dbt__critical_path_node_id.sql", "original_file_path": "models/schemas.yml", "name": "unique_fct_dbt__critical_path_node_id", "resource_type": "test", "alias": "unique_fct_dbt__critical_path_node_id", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "materialized": "table", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": "default_dbt_artifacts_schema", "database": null, "tags": [], "full_refresh": null, "severity": "ERROR"}, "tags": ["schema"], "refs": [["fct_dbt__critical_path"]], "sources": [], "depends_on": {"macros": ["macro.dbt.test_unique"], "nodes": ["model.dbt_artifacts.fct_dbt__critical_path"]}, "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": "target/compiled/dbt_artifacts/models/schemas.yml/schema_test/unique_fct_dbt__critical_path_node_id.sql", "deferred": false, "unrendered_config": {"schema": "default_dbt_artifacts_schema", "materialized": "table", "severity": "ERROR"}, "compiled_sql": "\n \n \n\n\n\nselect count(*) as validation_errors\nfrom (\n\n select\n node_id\n\n from test_db.analytics_default_dbt_artifacts_schema.fct_dbt__critical_path\n where node_id is not null\n group by node_id\n having count(*) > 1\n\n) validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "node_id"}, "test.dbt_artifacts.not_null_fct_dbt__critical_path_node_id": {"raw_sql": "{{ config(severity='ERROR') }}{{ test_not_null(**_dbt_schema_test_kwargs) }}", "test_metadata": {"namespace": null, "name": "not_null", "kwargs": {"column_name": "node_id", "model": "{{ ref('fct_dbt__critical_path') }}"}}, "compiled": true, "database": "test_db", "schema": "analytics_default_dbt_artifacts_schema", "fqn": ["dbt_artifacts", "schema_test", "not_null_fct_dbt__critical_path_node_id"], "unique_id": "test.dbt_artifacts.not_null_fct_dbt__critical_path_node_id", "package_name": "dbt_artifacts", "root_path": "dbt_artifacts", "path": "schema_test/not_null_fct_dbt__critical_path_node_id.sql", "original_file_path": "models/schemas.yml", "name": "not_null_fct_dbt__critical_path_node_id", "resource_type": "test", "alias": "not_null_fct_dbt__critical_path_node_id", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "materialized": "table", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": "default_dbt_artifacts_schema", "database": null, "tags": [], "full_refresh": null, "severity": "ERROR"}, "tags": ["schema"], "refs": [["fct_dbt__critical_path"]], "sources": [], "depends_on": {"macros": ["macro.dbt.test_not_null"], "nodes": ["model.dbt_artifacts.fct_dbt__critical_path"]}, "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": "target/compiled/dbt_artifacts/models/schemas.yml/schema_test/not_null_fct_dbt__critical_path_node_id.sql", "deferred": false, "unrendered_config": {"schema": "default_dbt_artifacts_schema", "materialized": "table", "severity": "ERROR"}, "compiled_sql": "\n \n \n\n\n\nselect count(*) as validation_errors\nfrom test_db.analytics_default_dbt_artifacts_schema.fct_dbt__critical_path\nwhere node_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "node_id"}, "test.dbt_artifacts.unique_fct_dbt__latest_full_model_executions_node_id": {"raw_sql": "{{ config(severity='ERROR') }}{{ test_unique(**_dbt_schema_test_kwargs) }}", "test_metadata": {"namespace": null, "name": "unique", "kwargs": {"column_name": "node_id", "model": "{{ ref('fct_dbt__latest_full_model_executions') }}"}}, "compiled": true, "database": "test_db", "schema": "analytics_default_dbt_artifacts_schema", "fqn": ["dbt_artifacts", "schema_test", "unique_fct_dbt__latest_full_model_executions_node_id"], "unique_id": "test.dbt_artifacts.unique_fct_dbt__latest_full_model_executions_node_id", "package_name": "dbt_artifacts", "root_path": "dbt_artifacts", "path": "schema_test/unique_fct_dbt__latest_full_model_executions_node_id.sql", "original_file_path": "models/schemas.yml", "name": "unique_fct_dbt__latest_full_model_executions_node_id", "resource_type": "test", "alias": "unique_fct_dbt__latest_full_model_executions_node_id", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "materialized": "table", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": "default_dbt_artifacts_schema", "database": null, "tags": [], "full_refresh": null, "severity": "ERROR"}, "tags": ["schema"], "refs": [["fct_dbt__latest_full_model_executions"]], "sources": [], "depends_on": {"macros": ["macro.dbt.test_unique"], "nodes": ["model.dbt_artifacts.fct_dbt__latest_full_model_executions"]}, "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": "target/compiled/dbt_artifacts/models/schemas.yml/schema_test/unique_fct_dbt__latest_full_model_executions_node_id.sql", "deferred": false, "unrendered_config": {"schema": "default_dbt_artifacts_schema", "materialized": "table", "severity": "ERROR"}, "compiled_sql": "\n \n \n\n\n\nselect count(*) as validation_errors\nfrom (\n\n select\n node_id\n\n from test_db.analytics_default_dbt_artifacts_schema.fct_dbt__latest_full_model_executions\n where node_id is not null\n group by node_id\n having count(*) > 1\n\n) validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "node_id"}, "test.dbt_artifacts.not_null_fct_dbt__latest_full_model_executions_node_id": {"raw_sql": "{{ config(severity='ERROR') }}{{ test_not_null(**_dbt_schema_test_kwargs) }}", "test_metadata": {"namespace": null, "name": "not_null", "kwargs": {"column_name": "node_id", "model": "{{ ref('fct_dbt__latest_full_model_executions') }}"}}, "compiled": true, "database": "test_db", "schema": "analytics_default_dbt_artifacts_schema", "fqn": ["dbt_artifacts", "schema_test", "not_null_fct_dbt__latest_full_model_executions_node_id"], "unique_id": "test.dbt_artifacts.not_null_fct_dbt__latest_full_model_executions_node_id", "package_name": "dbt_artifacts", "root_path": "dbt_artifacts", "path": "schema_test/not_null_fct_dbt__latest_full_model_executions_node_id.sql", "original_file_path": "models/schemas.yml", "name": "not_null_fct_dbt__latest_full_model_executions_node_id", "resource_type": "test", "alias": "not_null_fct_dbt__latest_full_model_executions_node_id", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "materialized": "table", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": "default_dbt_artifacts_schema", "database": null, "tags": [], "full_refresh": null, "severity": "ERROR"}, "tags": ["schema"], "refs": [["fct_dbt__latest_full_model_executions"]], "sources": [], "depends_on": {"macros": ["macro.dbt.test_not_null"], "nodes": ["model.dbt_artifacts.fct_dbt__latest_full_model_executions"]}, "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": "target/compiled/dbt_artifacts/models/schemas.yml/schema_test/not_null_fct_dbt__latest_full_model_executions_node_id.sql", "deferred": false, "unrendered_config": {"schema": "default_dbt_artifacts_schema", "materialized": "table", "severity": "ERROR"}, "compiled_sql": "\n \n \n\n\n\nselect count(*) as validation_errors\nfrom test_db.analytics_default_dbt_artifacts_schema.fct_dbt__latest_full_model_executions\nwhere node_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "node_id"}, "test.dbt_artifacts.unique_fct_dbt__model_executions_model_execution_id": {"raw_sql": "{{ config(severity='ERROR') }}{{ test_unique(**_dbt_schema_test_kwargs) }}", "test_metadata": {"namespace": null, "name": "unique", "kwargs": {"column_name": "model_execution_id", "model": "{{ ref('fct_dbt__model_executions') }}"}}, "compiled": true, "database": "test_db", "schema": "analytics_default_dbt_artifacts_schema", "fqn": ["dbt_artifacts", "schema_test", "unique_fct_dbt__model_executions_model_execution_id"], "unique_id": "test.dbt_artifacts.unique_fct_dbt__model_executions_model_execution_id", "package_name": "dbt_artifacts", "root_path": "dbt_artifacts", "path": "schema_test/unique_fct_dbt__model_executions_model_execution_id.sql", "original_file_path": "models/schemas.yml", "name": "unique_fct_dbt__model_executions_model_execution_id", "resource_type": "test", "alias": "unique_fct_dbt__model_executions_model_execution_id", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "materialized": "table", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": "default_dbt_artifacts_schema", "database": null, "tags": [], "full_refresh": null, "severity": "ERROR"}, "tags": ["schema"], "refs": [["fct_dbt__model_executions"]], "sources": [], "depends_on": {"macros": ["macro.dbt.test_unique"], "nodes": ["model.dbt_artifacts.fct_dbt__model_executions"]}, "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": "target/compiled/dbt_artifacts/models/schemas.yml/schema_test/unique_fct_dbt__model_executions_model_execution_id.sql", "deferred": false, "unrendered_config": {"schema": "default_dbt_artifacts_schema", "materialized": "table", "severity": "ERROR"}, "compiled_sql": "\n \n \n\n\n\nselect count(*) as validation_errors\nfrom (\n\n select\n model_execution_id\n\n from test_db.analytics_default_dbt_artifacts_schema.fct_dbt__model_executions\n where model_execution_id is not null\n group by model_execution_id\n having count(*) > 1\n\n) validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "model_execution_id"}, "test.dbt_artifacts.not_null_fct_dbt__model_executions_model_execution_id": {"raw_sql": "{{ config(severity='ERROR') }}{{ test_not_null(**_dbt_schema_test_kwargs) }}", "test_metadata": {"namespace": null, "name": "not_null", "kwargs": {"column_name": "model_execution_id", "model": "{{ ref('fct_dbt__model_executions') }}"}}, "compiled": true, "database": "test_db", "schema": "analytics_default_dbt_artifacts_schema", "fqn": ["dbt_artifacts", "schema_test", "not_null_fct_dbt__model_executions_model_execution_id"], "unique_id": "test.dbt_artifacts.not_null_fct_dbt__model_executions_model_execution_id", "package_name": "dbt_artifacts", "root_path": "dbt_artifacts", "path": "schema_test/not_null_fct_dbt__model_executions_model_execution_id.sql", "original_file_path": "models/schemas.yml", "name": "not_null_fct_dbt__model_executions_model_execution_id", "resource_type": "test", "alias": "not_null_fct_dbt__model_executions_model_execution_id", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "materialized": "table", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": "default_dbt_artifacts_schema", "database": null, "tags": [], "full_refresh": null, "severity": "ERROR"}, "tags": ["schema"], "refs": [["fct_dbt__model_executions"]], "sources": [], "depends_on": {"macros": ["macro.dbt.test_not_null"], "nodes": ["model.dbt_artifacts.fct_dbt__model_executions"]}, "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": "target/compiled/dbt_artifacts/models/schemas.yml/schema_test/not_null_fct_dbt__model_executions_model_execution_id.sql", "deferred": false, "unrendered_config": {"schema": "default_dbt_artifacts_schema", "materialized": "table", "severity": "ERROR"}, "compiled_sql": "\n \n \n\n\n\nselect count(*) as validation_errors\nfrom test_db.analytics_default_dbt_artifacts_schema.fct_dbt__model_executions\nwhere model_execution_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "model_execution_id"}, "test.dbt_artifacts.unique_fct_dbt__run_results_command_invocation_id": {"raw_sql": "{{ config(severity='ERROR') }}{{ test_unique(**_dbt_schema_test_kwargs) }}", "test_metadata": {"namespace": null, "name": "unique", "kwargs": {"column_name": "command_invocation_id", "model": "{{ ref('fct_dbt__run_results') }}"}}, "compiled": true, "database": "test_db", "schema": "analytics_default_dbt_artifacts_schema", "fqn": ["dbt_artifacts", "schema_test", "unique_fct_dbt__run_results_command_invocation_id"], "unique_id": "test.dbt_artifacts.unique_fct_dbt__run_results_command_invocation_id", "package_name": "dbt_artifacts", "root_path": "dbt_artifacts", "path": "schema_test/unique_fct_dbt__run_results_command_invocation_id.sql", "original_file_path": "models/schemas.yml", "name": "unique_fct_dbt__run_results_command_invocation_id", "resource_type": "test", "alias": "unique_fct_dbt__run_results_command_invocation_id", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "materialized": "table", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": "default_dbt_artifacts_schema", "database": null, "tags": [], "full_refresh": null, "severity": "ERROR"}, "tags": ["schema"], "refs": [["fct_dbt__run_results"]], "sources": [], "depends_on": {"macros": ["macro.dbt.test_unique"], "nodes": ["model.dbt_artifacts.fct_dbt__run_results"]}, "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": "target/compiled/dbt_artifacts/models/schemas.yml/schema_test/unique_fct_dbt__run_results_command_invocation_id.sql", "deferred": false, "unrendered_config": {"schema": "default_dbt_artifacts_schema", "materialized": "table", "severity": "ERROR"}, "compiled_sql": "\n \n \n\n\n\nselect count(*) as validation_errors\nfrom (\n\n select\n command_invocation_id\n\n from test_db.analytics_default_dbt_artifacts_schema.fct_dbt__run_results\n where command_invocation_id is not null\n group by command_invocation_id\n having count(*) > 1\n\n) validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "command_invocation_id"}, "test.dbt_artifacts.not_null_fct_dbt__run_results_command_invocation_id": {"raw_sql": "{{ config(severity='ERROR') }}{{ test_not_null(**_dbt_schema_test_kwargs) }}", "test_metadata": {"namespace": null, "name": "not_null", "kwargs": {"column_name": "command_invocation_id", "model": "{{ ref('fct_dbt__run_results') }}"}}, "compiled": true, "database": "test_db", "schema": "analytics_default_dbt_artifacts_schema", "fqn": ["dbt_artifacts", "schema_test", "not_null_fct_dbt__run_results_command_invocation_id"], "unique_id": "test.dbt_artifacts.not_null_fct_dbt__run_results_command_invocation_id", "package_name": "dbt_artifacts", "root_path": "dbt_artifacts", "path": "schema_test/not_null_fct_dbt__run_results_command_invocation_id.sql", "original_file_path": "models/schemas.yml", "name": "not_null_fct_dbt__run_results_command_invocation_id", "resource_type": "test", "alias": "not_null_fct_dbt__run_results_command_invocation_id", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "materialized": "table", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": "default_dbt_artifacts_schema", "database": null, "tags": [], "full_refresh": null, "severity": "ERROR"}, "tags": ["schema"], "refs": [["fct_dbt__run_results"]], "sources": [], "depends_on": {"macros": ["macro.dbt.test_not_null"], "nodes": ["model.dbt_artifacts.fct_dbt__run_results"]}, "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": "target/compiled/dbt_artifacts/models/schemas.yml/schema_test/not_null_fct_dbt__run_results_command_invocation_id.sql", "deferred": false, "unrendered_config": {"schema": "default_dbt_artifacts_schema", "materialized": "table", "severity": "ERROR"}, "compiled_sql": "\n \n \n\n\n\nselect count(*) as validation_errors\nfrom test_db.analytics_default_dbt_artifacts_schema.fct_dbt__run_results\nwhere command_invocation_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "command_invocation_id"}, "test.dbt_artifacts.unique_dim_dbt__models_manifest_model_id": {"raw_sql": "{{ config(severity='ERROR') }}{{ test_unique(**_dbt_schema_test_kwargs) }}", "test_metadata": {"namespace": null, "name": "unique", "kwargs": {"column_name": "manifest_model_id", "model": "{{ ref('dim_dbt__models') }}"}}, "compiled": true, "database": "test_db", "schema": "analytics_default_dbt_artifacts_schema", "fqn": ["dbt_artifacts", "schema_test", "unique_dim_dbt__models_manifest_model_id"], "unique_id": "test.dbt_artifacts.unique_dim_dbt__models_manifest_model_id", "package_name": "dbt_artifacts", "root_path": "dbt_artifacts", "path": "schema_test/unique_dim_dbt__models_manifest_model_id.sql", "original_file_path": "models/schemas.yml", "name": "unique_dim_dbt__models_manifest_model_id", "resource_type": "test", "alias": "unique_dim_dbt__models_manifest_model_id", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "materialized": "table", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": "default_dbt_artifacts_schema", "database": null, "tags": [], "full_refresh": null, "severity": "ERROR"}, "tags": ["schema"], "refs": [["dim_dbt__models"]], "sources": [], "depends_on": {"macros": ["macro.dbt.test_unique"], "nodes": ["model.dbt_artifacts.dim_dbt__models"]}, "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": "target/compiled/dbt_artifacts/models/schemas.yml/schema_test/unique_dim_dbt__models_manifest_model_id.sql", "deferred": false, "unrendered_config": {"schema": "default_dbt_artifacts_schema", "materialized": "table", "severity": "ERROR"}, "compiled_sql": "\n \n \n\n\n\nselect count(*) as validation_errors\nfrom (\n\n select\n manifest_model_id\n\n from test_db.analytics_default_dbt_artifacts_schema.dim_dbt__models\n where manifest_model_id is not null\n group by manifest_model_id\n having count(*) > 1\n\n) validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "manifest_model_id"}, "test.dbt_artifacts.not_null_dim_dbt__models_manifest_model_id": {"raw_sql": "{{ config(severity='ERROR') }}{{ test_not_null(**_dbt_schema_test_kwargs) }}", "test_metadata": {"namespace": null, "name": "not_null", "kwargs": {"column_name": "manifest_model_id", "model": "{{ ref('dim_dbt__models') }}"}}, "compiled": true, "database": "test_db", "schema": "analytics_default_dbt_artifacts_schema", "fqn": ["dbt_artifacts", "schema_test", "not_null_dim_dbt__models_manifest_model_id"], "unique_id": "test.dbt_artifacts.not_null_dim_dbt__models_manifest_model_id", "package_name": "dbt_artifacts", "root_path": "dbt_artifacts", "path": "schema_test/not_null_dim_dbt__models_manifest_model_id.sql", "original_file_path": "models/schemas.yml", "name": "not_null_dim_dbt__models_manifest_model_id", "resource_type": "test", "alias": "not_null_dim_dbt__models_manifest_model_id", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "materialized": "table", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": "default_dbt_artifacts_schema", "database": null, "tags": [], "full_refresh": null, "severity": "ERROR"}, "tags": ["schema"], "refs": [["dim_dbt__models"]], "sources": [], "depends_on": {"macros": ["macro.dbt.test_not_null"], "nodes": ["model.dbt_artifacts.dim_dbt__models"]}, "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": "target/compiled/dbt_artifacts/models/schemas.yml/schema_test/not_null_dim_dbt__models_manifest_model_id.sql", "deferred": false, "unrendered_config": {"schema": "default_dbt_artifacts_schema", "materialized": "table", "severity": "ERROR"}, "compiled_sql": "\n \n \n\n\n\nselect count(*) as validation_errors\nfrom test_db.analytics_default_dbt_artifacts_schema.dim_dbt__models\nwhere manifest_model_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "manifest_model_id"}, "test.dbt_artifacts.unique_dim_dbt__sources_manifest_source_id": {"raw_sql": "{{ config(severity='ERROR') }}{{ test_unique(**_dbt_schema_test_kwargs) }}", "test_metadata": {"namespace": null, "name": "unique", "kwargs": {"column_name": "manifest_source_id", "model": "{{ ref('dim_dbt__sources') }}"}}, "compiled": true, "database": "test_db", "schema": "analytics_default_dbt_artifacts_schema", "fqn": ["dbt_artifacts", "schema_test", "unique_dim_dbt__sources_manifest_source_id"], "unique_id": "test.dbt_artifacts.unique_dim_dbt__sources_manifest_source_id", "package_name": "dbt_artifacts", "root_path": "dbt_artifacts", "path": "schema_test/unique_dim_dbt__sources_manifest_source_id.sql", "original_file_path": "models/schemas.yml", "name": "unique_dim_dbt__sources_manifest_source_id", "resource_type": "test", "alias": "unique_dim_dbt__sources_manifest_source_id", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "materialized": "table", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": "default_dbt_artifacts_schema", "database": null, "tags": [], "full_refresh": null, "severity": "ERROR"}, "tags": ["schema"], "refs": [["dim_dbt__sources"]], "sources": [], "depends_on": {"macros": ["macro.dbt.test_unique"], "nodes": ["model.dbt_artifacts.dim_dbt__sources"]}, "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": "target/compiled/dbt_artifacts/models/schemas.yml/schema_test/unique_dim_dbt__sources_manifest_source_id.sql", "deferred": false, "unrendered_config": {"schema": "default_dbt_artifacts_schema", "materialized": "table", "severity": "ERROR"}, "compiled_sql": "\n \n \n\n\n\nselect count(*) as validation_errors\nfrom (\n\n select\n manifest_source_id\n\n from test_db.analytics_default_dbt_artifacts_schema.dim_dbt__sources\n where manifest_source_id is not null\n group by manifest_source_id\n having count(*) > 1\n\n) validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "manifest_source_id"}, "test.dbt_artifacts.not_null_dim_dbt__sources_manifest_source_id": {"raw_sql": "{{ config(severity='ERROR') }}{{ test_not_null(**_dbt_schema_test_kwargs) }}", "test_metadata": {"namespace": null, "name": "not_null", "kwargs": {"column_name": "manifest_source_id", "model": "{{ ref('dim_dbt__sources') }}"}}, "compiled": true, "database": "test_db", "schema": "analytics_default_dbt_artifacts_schema", "fqn": ["dbt_artifacts", "schema_test", "not_null_dim_dbt__sources_manifest_source_id"], "unique_id": "test.dbt_artifacts.not_null_dim_dbt__sources_manifest_source_id", "package_name": "dbt_artifacts", "root_path": "dbt_artifacts", "path": "schema_test/not_null_dim_dbt__sources_manifest_source_id.sql", "original_file_path": "models/schemas.yml", "name": "not_null_dim_dbt__sources_manifest_source_id", "resource_type": "test", "alias": "not_null_dim_dbt__sources_manifest_source_id", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "materialized": "table", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": "default_dbt_artifacts_schema", "database": null, "tags": [], "full_refresh": null, "severity": "ERROR"}, "tags": ["schema"], "refs": [["dim_dbt__sources"]], "sources": [], "depends_on": {"macros": ["macro.dbt.test_not_null"], "nodes": ["model.dbt_artifacts.dim_dbt__sources"]}, "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": "target/compiled/dbt_artifacts/models/schemas.yml/schema_test/not_null_dim_dbt__sources_manifest_source_id.sql", "deferred": false, "unrendered_config": {"schema": "default_dbt_artifacts_schema", "materialized": "table", "severity": "ERROR"}, "compiled_sql": "\n \n \n\n\n\nselect count(*) as validation_errors\nfrom test_db.analytics_default_dbt_artifacts_schema.dim_dbt__sources\nwhere manifest_source_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "manifest_source_id"}}, "sources": {"source.dbt_artifacts.dbt_artifacts.artifacts": {"fqn": ["dbt_artifacts", "staging", "dbt_artifacts", "artifacts"], "database": "dbt_audit_db", "schema": "public", "unique_id": "source.dbt_artifacts.dbt_artifacts.artifacts", "package_name": "dbt_artifacts", "root_path": "dbt_artifacts", "path": "models/staging/sources.yml", "original_file_path": "models/staging/sources.yml", "name": "artifacts", "source_name": "dbt_artifacts", "source_description": "", "loader": "", "identifier": "dbt_run_results_v4", "resource_type": "source", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": null, "freshness": {"warn_after": null, "error_after": null, "filter": null}, "external": null, "description": "The source table containing loaded dbt artifacts. All of the artifacts must be loaded into this table. See the README for more info.\n", "columns": {"data": {"name": "data", "description": "A variant type object containing all the artifact's data.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "generated_at": {"name": "generated_at", "description": "Timestamp for when the artifact was generated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "path": {"name": "path", "description": "The path of the artifact in the external stage.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "artifact_type": {"name": "artifact_type", "description": "The type of the artifact, e.g. manifest.json", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "dbt_audit_db.public.dbt_run_results_v4"}}, "macros": {"macro.dbt_artifacts.upload_dbt_artifacts": {"unique_id": "macro.dbt_artifacts.upload_dbt_artifacts", "package_name": "dbt_artifacts", "root_path": "dbt_artifacts", "path": "macros/upload_artifacts.sql", "original_file_path": "macros/upload_artifacts.sql", "name": "upload_dbt_artifacts", "macro_sql": "{% macro upload_dbt_artifacts(filenames) %}\n\n{% set src_dbt_artifacts = source('dbt_artifacts', 'artifacts') %}\n\n{% set remove_query %}\n remove @{{ src_dbt_artifacts }} pattern='.*.json.gz';\n{% endset %}\n\n{% do log(\"Clearing existing files from Stage: \" ~ remove_query, info=True) %}\n{% do run_query(remove_query) %}\n\n{% for filename in filenames %}\n\n {% set file = filename ~ '.json' %}\n\n {% set put_query %}\n put file://target/{{ file }} @{{ src_dbt_artifacts }} auto_compress=true;\n {% endset %}\n\n {% do log(\"Uploading \" ~ file ~ \" to Stage: \" ~ put_query, info=True) %}\n {% do run_query(put_query) %}\n\n {% set copy_query %}\n begin;\n copy into {{ src_dbt_artifacts }} from\n (\n select\n $1 as data,\n $1:metadata:generated_at::timestamp_ntz as generated_at,\n metadata$filename as path,\n regexp_substr(metadata$filename, '([a-z_]+.json)') as artifact_type\n from @{{ src_dbt_artifacts }}\n )\n file_format=(type='JSON')\n on_error='skip_file';\n commit;\n {% endset %}\n\n {% do log(\"Copying \" ~ file ~ \" from Stage: \" ~ copy_query, info=True) %}\n {% do run_query(copy_query) %}\n\n{% endfor %}\n\n{% do log(\"Clearing new files from Stage: \" ~ remove_query, info=True) %}\n{% do run_query(remove_query) %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_artifacts.create_artifact_resources": {"unique_id": "macro.dbt_artifacts.create_artifact_resources", "package_name": "dbt_artifacts", "root_path": "dbt_artifacts", "path": "macros/create_artifact_resources.sql", "original_file_path": "macros/create_artifact_resources.sql", "name": "create_artifact_resources", "macro_sql": "{% macro create_artifact_resources() %}\n\n{% set src_dbt_artifacts = source('dbt_artifacts', 'artifacts') %}\n\n{{ create_schema( src_dbt_artifacts ) }}\n\n{% set create_stage_query %}\ncreate stage if not exists {{ src_dbt_artifacts }}\nfile_format = ( type = json );\n{% endset %}\n\n{% set create_table_query %}\ncreate table if not exists {{ src_dbt_artifacts }} (\n data variant,\n generated_at timestamp,\n path string,\n artifact_type string\n);\n\n{% endset %}\n\n\n{% do log(\"Creating Stage: \" ~ create_stage_query, info=True) %}\n{% do run_query(create_stage_query) %}\n\n{% do log(\"Creating Table: \" ~ create_table_query, info=True) %}\n{% do run_query(create_table_query) %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_snowflake.snowflake__get_catalog": {"unique_id": "macro.dbt_snowflake.snowflake__get_catalog", "package_name": "dbt_snowflake", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/snowflake", "path": "macros/catalog.sql", "original_file_path": "macros/catalog.sql", "name": "snowflake__get_catalog", "macro_sql": "{% macro snowflake__get_catalog(information_schema, schemas) -%}\n {% set query %}\n with tables as (\n\n select\n table_catalog as \"table_database\",\n table_schema as \"table_schema\",\n table_name as \"table_name\",\n table_type as \"table_type\",\n comment as \"table_comment\",\n\n -- note: this is the _role_ that owns the table\n table_owner as \"table_owner\",\n\n 'Clustering Key' as \"stats:clustering_key:label\",\n clustering_key as \"stats:clustering_key:value\",\n 'The key used to cluster this table' as \"stats:clustering_key:description\",\n (clustering_key is not null) as \"stats:clustering_key:include\",\n\n 'Row Count' as \"stats:row_count:label\",\n row_count as \"stats:row_count:value\",\n 'An approximate count of rows in this table' as \"stats:row_count:description\",\n (row_count is not null) as \"stats:row_count:include\",\n\n 'Approximate Size' as \"stats:bytes:label\",\n bytes as \"stats:bytes:value\",\n 'Approximate size of the table as reported by Snowflake' as \"stats:bytes:description\",\n (bytes is not null) as \"stats:bytes:include\",\n\n 'Last Modified' as \"stats:last_modified:label\",\n to_varchar(convert_timezone('UTC', last_altered), 'yyyy-mm-dd HH24:MI'||'UTC') as \"stats:last_modified:value\",\n 'The timestamp for last update/change' as \"stats:last_modified:description\",\n (last_altered is not null and table_type='BASE TABLE') as \"stats:last_modified:include\"\n\n from {{ information_schema }}.tables\n\n ),\n\n columns as (\n\n select\n table_catalog as \"table_database\",\n table_schema as \"table_schema\",\n table_name as \"table_name\",\n\n column_name as \"column_name\",\n ordinal_position as \"column_index\",\n data_type as \"column_type\",\n comment as \"column_comment\"\n\n from {{ information_schema }}.columns\n )\n\n select *\n from tables\n join columns using (\"table_database\", \"table_schema\", \"table_name\")\n where (\n {%- for schema in schemas -%}\n upper(\"table_schema\") = upper('{{ schema }}'){%- if not loop.last %} or {% endif -%}\n {%- endfor -%}\n )\n order by \"column_index\"\n {%- endset -%}\n\n {{ return(run_query(query)) }}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_snowflake.snowflake__create_table_as": {"unique_id": "macro.dbt_snowflake.snowflake__create_table_as", "package_name": "dbt_snowflake", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "snowflake__create_table_as", "macro_sql": "{% macro snowflake__create_table_as(temporary, relation, sql) -%}\n {%- set transient = config.get('transient', default=true) -%}\n {%- set cluster_by_keys = config.get('cluster_by', default=none) -%}\n {%- set enable_automatic_clustering = config.get('automatic_clustering', default=false) -%}\n {%- set copy_grants = config.get('copy_grants', default=false) -%}\n\n {%- if cluster_by_keys is not none and cluster_by_keys is string -%}\n {%- set cluster_by_keys = [cluster_by_keys] -%}\n {%- endif -%}\n {%- if cluster_by_keys is not none -%}\n {%- set cluster_by_string = cluster_by_keys|join(\", \")-%}\n {% else %}\n {%- set cluster_by_string = none -%}\n {%- endif -%}\n {%- set sql_header = config.get('sql_header', none) -%}\n\n {{ sql_header if sql_header is not none }}\n\n create or replace {% if temporary -%}\n temporary\n {%- elif transient -%}\n transient\n {%- endif %} table {{ relation }} {% if copy_grants and not temporary -%} copy grants {%- endif %} as\n (\n {%- if cluster_by_string is not none -%}\n select * from(\n {{ sql }}\n ) order by ({{ cluster_by_string }})\n {%- else -%}\n {{ sql }}\n {%- endif %}\n );\n {% if cluster_by_string is not none and not temporary -%}\n alter table {{relation}} cluster by ({{cluster_by_string}});\n {%- endif -%}\n {% if enable_automatic_clustering and cluster_by_string is not none and not temporary -%}\n alter table {{relation}} resume recluster;\n {%- endif -%}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_snowflake.snowflake__create_view_as": {"unique_id": "macro.dbt_snowflake.snowflake__create_view_as", "package_name": "dbt_snowflake", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "snowflake__create_view_as", "macro_sql": "{% macro snowflake__create_view_as(relation, sql) -%}\n {%- set secure = config.get('secure', default=false) -%}\n {%- set copy_grants = config.get('copy_grants', default=false) -%}\n {%- set sql_header = config.get('sql_header', none) -%}\n\n {{ sql_header if sql_header is not none }}\n create or replace {% if secure -%}\n secure\n {%- endif %} view {{ relation }} {% if copy_grants -%} copy grants {%- endif %} as (\n {{ sql }}\n );\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_snowflake.snowflake__get_columns_in_relation": {"unique_id": "macro.dbt_snowflake.snowflake__get_columns_in_relation", "package_name": "dbt_snowflake", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "snowflake__get_columns_in_relation", "macro_sql": "{% macro snowflake__get_columns_in_relation(relation) -%}\n {%- set sql -%}\n describe table {{ relation }}\n {%- endset -%}\n {%- set result = run_query(sql) -%}\n\n {% set maximum = 10000 %}\n {% if (result | length) >= maximum %}\n {% set msg %}\n Too many columns in relation {{ relation }}! dbt can only get\n information about relations with fewer than {{ maximum }} columns.\n {% endset %}\n {% do exceptions.raise_compiler_error(msg) %}\n {% endif %}\n\n {% set columns = [] %}\n {% for row in result %}\n {% do columns.append(api.Column.from_description(row['name'], row['type'])) %}\n {% endfor %}\n {% do return(columns) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_snowflake.snowflake__list_schemas": {"unique_id": "macro.dbt_snowflake.snowflake__list_schemas", "package_name": "dbt_snowflake", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "snowflake__list_schemas", "macro_sql": "{% macro snowflake__list_schemas(database) -%}\n {# 10k limit from here: https://docs.snowflake.net/manuals/sql-reference/sql/show-schemas.html#usage-notes #}\n {% set maximum = 10000 %}\n {% set sql -%}\n show terse schemas in database {{ database }}\n limit {{ maximum }}\n {%- endset %}\n {% set result = run_query(sql) %}\n {% if (result | length) >= maximum %}\n {% set msg %}\n Too many schemas in database {{ database }}! dbt can only get\n information about databases with fewer than {{ maximum }} schemas.\n {% endset %}\n {% do exceptions.raise_compiler_error(msg) %}\n {% endif %}\n {{ return(result) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_snowflake.snowflake__list_relations_without_caching": {"unique_id": "macro.dbt_snowflake.snowflake__list_relations_without_caching", "package_name": "dbt_snowflake", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "snowflake__list_relations_without_caching", "macro_sql": "{% macro snowflake__list_relations_without_caching(schema_relation) %}\n {%- set sql -%}\n show terse objects in {{ schema_relation }}\n {%- endset -%}\n\n {%- set result = run_query(sql) -%}\n {% set maximum = 10000 %}\n {% if (result | length) >= maximum %}\n {% set msg %}\n Too many schemas in schema {{ schema_relation }}! dbt can only get\n information about schemas with fewer than {{ maximum }} objects.\n {% endset %}\n {% do exceptions.raise_compiler_error(msg) %}\n {% endif %}\n {%- do return(result) -%}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_snowflake.snowflake__check_schema_exists": {"unique_id": "macro.dbt_snowflake.snowflake__check_schema_exists", "package_name": "dbt_snowflake", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "snowflake__check_schema_exists", "macro_sql": "{% macro snowflake__check_schema_exists(information_schema, schema) -%}\n {% call statement('check_schema_exists', fetch_result=True) -%}\n select count(*)\n from {{ information_schema }}.schemata\n where upper(schema_name) = upper('{{ schema }}')\n and upper(catalog_name) = upper('{{ information_schema.database }}')\n {%- endcall %}\n {{ return(load_result('check_schema_exists').table) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_snowflake.snowflake__current_timestamp": {"unique_id": "macro.dbt_snowflake.snowflake__current_timestamp", "package_name": "dbt_snowflake", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "snowflake__current_timestamp", "macro_sql": "{% macro snowflake__current_timestamp() -%}\n convert_timezone('UTC', current_timestamp())\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_snowflake.snowflake__snapshot_string_as_time": {"unique_id": "macro.dbt_snowflake.snowflake__snapshot_string_as_time", "package_name": "dbt_snowflake", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "snowflake__snapshot_string_as_time", "macro_sql": "{% macro snowflake__snapshot_string_as_time(timestamp) -%}\n {%- set result = \"to_timestamp_ntz('\" ~ timestamp ~ \"')\" -%}\n {{ return(result) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_snowflake.snowflake__snapshot_get_time": {"unique_id": "macro.dbt_snowflake.snowflake__snapshot_get_time", "package_name": "dbt_snowflake", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "snowflake__snapshot_get_time", "macro_sql": "{% macro snowflake__snapshot_get_time() -%}\n to_timestamp_ntz({{ current_timestamp() }})\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_snowflake.snowflake__rename_relation": {"unique_id": "macro.dbt_snowflake.snowflake__rename_relation", "package_name": "dbt_snowflake", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "snowflake__rename_relation", "macro_sql": "{% macro snowflake__rename_relation(from_relation, to_relation) -%}\n {% call statement('rename_relation') -%}\n alter table {{ from_relation }} rename to {{ to_relation }}\n {%- endcall %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_snowflake.snowflake__alter_column_type": {"unique_id": "macro.dbt_snowflake.snowflake__alter_column_type", "package_name": "dbt_snowflake", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "snowflake__alter_column_type", "macro_sql": "{% macro snowflake__alter_column_type(relation, column_name, new_column_type) -%}\n {% call statement('alter_column_type') %}\n alter table {{ relation }} alter {{ adapter.quote(column_name) }} set data type {{ new_column_type }};\n {% endcall %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_snowflake.snowflake__alter_relation_comment": {"unique_id": "macro.dbt_snowflake.snowflake__alter_relation_comment", "package_name": "dbt_snowflake", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "snowflake__alter_relation_comment", "macro_sql": "{% macro snowflake__alter_relation_comment(relation, relation_comment) -%}\n comment on {{ relation.type }} {{ relation }} IS $${{ relation_comment | replace('$', '[$]') }}$$;\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_snowflake.snowflake__alter_column_comment": {"unique_id": "macro.dbt_snowflake.snowflake__alter_column_comment", "package_name": "dbt_snowflake", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "snowflake__alter_column_comment", "macro_sql": "{% macro snowflake__alter_column_comment(relation, column_dict) -%}\n alter {{ relation.type }} {{ relation }} alter\n {% for column_name in column_dict %}\n {{ adapter.quote(column_name) if column_dict[column_name]['quote'] else column_name }} COMMENT $${{ column_dict[column_name]['description'] | replace('$', '[$]') }}$$ {{ ',' if not loop.last else ';' }}\n {% endfor %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_snowflake.get_current_query_tag": {"unique_id": "macro.dbt_snowflake.get_current_query_tag", "package_name": "dbt_snowflake", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "get_current_query_tag", "macro_sql": "{% macro get_current_query_tag() -%}\n {{ return(run_query(\"show parameters like 'query_tag' in session\").rows[0]['value']) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_snowflake.set_query_tag": {"unique_id": "macro.dbt_snowflake.set_query_tag", "package_name": "dbt_snowflake", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "set_query_tag", "macro_sql": "{% macro set_query_tag() -%}\n {% set new_query_tag = config.get('query_tag') %}\n {% if new_query_tag %}\n {% set original_query_tag = get_current_query_tag() %}\n {{ log(\"Setting query_tag to '\" ~ new_query_tag ~ \"'. Will reset to '\" ~ original_query_tag ~ \"' after materialization.\") }}\n {% do run_query(\"alter session set query_tag = '{}'\".format(new_query_tag)) %}\n {{ return(original_query_tag)}}\n {% endif %}\n {{ return(none)}}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_snowflake.unset_query_tag": {"unique_id": "macro.dbt_snowflake.unset_query_tag", "package_name": "dbt_snowflake", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "unset_query_tag", "macro_sql": "{% macro unset_query_tag(original_query_tag) -%}\n {% set new_query_tag = config.get('query_tag') %}\n {% if new_query_tag %}\n {% if original_query_tag %}\n {{ log(\"Resetting query_tag to '\" ~ original_query_tag ~ \"'.\") }}\n {% do run_query(\"alter session set query_tag = '{}'\".format(original_query_tag)) %}\n {% else %}\n {{ log(\"No original query_tag, unsetting parameter.\") }}\n {% do run_query(\"alter session unset query_tag\") %}\n {% endif %}\n {% endif %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_snowflake.snowflake__get_merge_sql": {"unique_id": "macro.dbt_snowflake.snowflake__get_merge_sql", "package_name": "dbt_snowflake", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/snowflake", "path": "macros/materializations/merge.sql", "original_file_path": "macros/materializations/merge.sql", "name": "snowflake__get_merge_sql", "macro_sql": "{% macro snowflake__get_merge_sql(target, source_sql, unique_key, dest_columns, predicates) -%}\n\n {#\n Workaround for Snowflake not being happy with a merge on a constant-false predicate.\n When no unique_key is provided, this macro will do a regular insert. If a unique_key\n is provided, then this macro will do a proper merge instead.\n #}\n\n {%- set dest_cols_csv = get_quoted_csv(dest_columns | map(attribute='name')) -%}\n {%- set sql_header = config.get('sql_header', none) -%}\n\n {%- if unique_key is none -%}\n\n {{ sql_header if sql_header is not none }}\n\n insert into {{ target }} ({{ dest_cols_csv }})\n (\n select {{ dest_cols_csv }}\n from {{ source_sql }}\n );\n\n {%- else -%}\n\n {{ default__get_merge_sql(target, source_sql, unique_key, dest_columns, predicates) }}\n\n {%- endif -%}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_snowflake.materialization_view_snowflake": {"unique_id": "macro.dbt_snowflake.materialization_view_snowflake", "package_name": "dbt_snowflake", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/snowflake", "path": "macros/materializations/view.sql", "original_file_path": "macros/materializations/view.sql", "name": "materialization_view_snowflake", "macro_sql": "{% materialization view, adapter='snowflake' -%}\n\n {% set original_query_tag = set_query_tag() %}\n {% set to_return = create_or_replace_view() %}\n\n {% set target_relation = this.incorporate(type='view') %}\n {% do persist_docs(target_relation, model, for_columns=false) %}\n\n {% do return(to_return) %}\n\n {% do unset_query_tag(original_query_tag) %}\n\n{%- endmaterialization %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_snowflake.materialization_table_snowflake": {"unique_id": "macro.dbt_snowflake.materialization_table_snowflake", "package_name": "dbt_snowflake", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/snowflake", "path": "macros/materializations/table.sql", "original_file_path": "macros/materializations/table.sql", "name": "materialization_table_snowflake", "macro_sql": "{% materialization table, adapter='snowflake' %}\n\n {% set original_query_tag = set_query_tag() %}\n\n {%- set identifier = model['alias'] -%}\n\n {%- set old_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) -%}\n {%- set target_relation = api.Relation.create(identifier=identifier,\n schema=schema,\n database=database, type='table') -%}\n\n {{ run_hooks(pre_hooks, inside_transaction=False) }}\n\n -- `BEGIN` happens here:\n {{ run_hooks(pre_hooks, inside_transaction=True) }}\n\n {#-- Drop the relation if it was a view to \"convert\" it in a table. This may lead to\n -- downtime, but it should be a relatively infrequent occurrence #}\n {% if old_relation is not none and not old_relation.is_table %}\n {{ log(\"Dropping relation \" ~ old_relation ~ \" because it is of type \" ~ old_relation.type) }}\n {{ drop_relation_if_exists(old_relation) }}\n {% endif %}\n\n --build model\n {% call statement('main') -%}\n {{ create_table_as(false, target_relation, sql) }}\n {%- endcall %}\n\n {{ run_hooks(post_hooks, inside_transaction=True) }}\n\n -- `COMMIT` happens here\n {{ adapter.commit() }}\n\n {{ run_hooks(post_hooks, inside_transaction=False) }}\n\n {% do persist_docs(target_relation, model) %}\n\n {% do unset_query_tag(original_query_tag) %}\n\n {{ return({'relations': [target_relation]}) }}\n\n{% endmaterialization %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_snowflake.dbt_snowflake_validate_get_incremental_strategy": {"unique_id": "macro.dbt_snowflake.dbt_snowflake_validate_get_incremental_strategy", "package_name": "dbt_snowflake", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/snowflake", "path": "macros/materializations/incremental.sql", "original_file_path": "macros/materializations/incremental.sql", "name": "dbt_snowflake_validate_get_incremental_strategy", "macro_sql": "{% macro dbt_snowflake_validate_get_incremental_strategy(config) %}\n {#-- Find and validate the incremental strategy #}\n {%- set strategy = config.get(\"incremental_strategy\", default=\"merge\") -%}\n\n {% set invalid_strategy_msg -%}\n Invalid incremental strategy provided: {{ strategy }}\n Expected one of: 'merge', 'delete+insert'\n {%- endset %}\n {% if strategy not in ['merge', 'delete+insert'] %}\n {% do exceptions.raise_compiler_error(invalid_strategy_msg) %}\n {% endif %}\n\n {% do return(strategy) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_snowflake.dbt_snowflake_get_incremental_sql": {"unique_id": "macro.dbt_snowflake.dbt_snowflake_get_incremental_sql", "package_name": "dbt_snowflake", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/snowflake", "path": "macros/materializations/incremental.sql", "original_file_path": "macros/materializations/incremental.sql", "name": "dbt_snowflake_get_incremental_sql", "macro_sql": "{% macro dbt_snowflake_get_incremental_sql(strategy, tmp_relation, target_relation, unique_key, dest_columns) %}\n {% if strategy == 'merge' %}\n {% do return(get_merge_sql(target_relation, tmp_relation, unique_key, dest_columns)) %}\n {% elif strategy == 'delete+insert' %}\n {% do return(get_delete_insert_merge_sql(target_relation, tmp_relation, unique_key, dest_columns)) %}\n {% else %}\n {% do exceptions.raise_compiler_error('invalid strategy: ' ~ strategy) %}\n {% endif %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_snowflake.materialization_incremental_snowflake": {"unique_id": "macro.dbt_snowflake.materialization_incremental_snowflake", "package_name": "dbt_snowflake", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/snowflake", "path": "macros/materializations/incremental.sql", "original_file_path": "macros/materializations/incremental.sql", "name": "materialization_incremental_snowflake", "macro_sql": "{% materialization incremental, adapter='snowflake' -%}\n\n {% set original_query_tag = set_query_tag() %}\n\n {%- set unique_key = config.get('unique_key') -%}\n {%- set full_refresh_mode = (should_full_refresh()) -%}\n\n {% set target_relation = this %}\n {% set existing_relation = load_relation(this) %}\n {% set tmp_relation = make_temp_relation(this) %}\n\n {#-- Validate early so we don't run SQL if the strategy is invalid --#}\n {% set strategy = dbt_snowflake_validate_get_incremental_strategy(config) -%}\n\n -- setup\n {{ run_hooks(pre_hooks, inside_transaction=False) }}\n\n -- `BEGIN` happens here:\n {{ run_hooks(pre_hooks, inside_transaction=True) }}\n\n {% if existing_relation is none %}\n {% set build_sql = create_table_as(False, target_relation, sql) %}\n {% elif existing_relation.is_view %}\n {#-- Can't overwrite a view with a table - we must drop --#}\n {{ log(\"Dropping relation \" ~ target_relation ~ \" because it is a view and this model is a table.\") }}\n {% do adapter.drop_relation(existing_relation) %}\n {% set build_sql = create_table_as(False, target_relation, sql) %}\n {% elif full_refresh_mode %}\n {% set build_sql = create_table_as(False, target_relation, sql) %}\n {% else %}\n {% do run_query(create_table_as(True, tmp_relation, sql)) %}\n {% do adapter.expand_target_column_types(\n from_relation=tmp_relation,\n to_relation=target_relation) %}\n {% set dest_columns = adapter.get_columns_in_relation(target_relation) %}\n {% set build_sql = dbt_snowflake_get_incremental_sql(strategy, tmp_relation, target_relation, unique_key, dest_columns) %}\n {% endif %}\n\n {%- call statement('main') -%}\n {{ build_sql }}\n {%- endcall -%}\n\n {{ run_hooks(post_hooks, inside_transaction=True) }}\n\n -- `COMMIT` happens here\n {{ adapter.commit() }}\n\n {{ run_hooks(post_hooks, inside_transaction=False) }}\n\n {% set target_relation = target_relation.incorporate(type='table') %}\n {% do persist_docs(target_relation, model) %}\n\n {% do unset_query_tag(original_query_tag) %}\n\n {{ return({'relations': [target_relation]}) }}\n\n{%- endmaterialization %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.statement": {"unique_id": "macro.dbt.statement", "package_name": "dbt", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/core.sql", "original_file_path": "macros/core.sql", "name": "statement", "macro_sql": "{% macro statement(name=None, fetch_result=False, auto_begin=True) -%}\n {%- if execute: -%}\n {%- set sql = caller() -%}\n\n {%- if name == 'main' -%}\n {{ log('Writing runtime SQL for node \"{}\"'.format(model['unique_id'])) }}\n {{ write(sql) }}\n {%- endif -%}\n\n {%- set res, table = adapter.execute(sql, auto_begin=auto_begin, fetch=fetch_result) -%}\n {%- if name is not none -%}\n {{ store_result(name, response=res, agate_table=table) }}\n {%- endif -%}\n\n {%- endif -%}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.noop_statement": {"unique_id": "macro.dbt.noop_statement", "package_name": "dbt", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/core.sql", "original_file_path": "macros/core.sql", "name": "noop_statement", "macro_sql": "{% macro noop_statement(name=None, message=None, code=None, rows_affected=None, res=None) -%}\n {%- set sql = caller() -%}\n\n {%- if name == 'main' -%}\n {{ log('Writing runtime SQL for node \"{}\"'.format(model['unique_id'])) }}\n {{ write(sql) }}\n {%- endif -%}\n\n {%- if name is not none -%}\n {{ store_raw_result(name, message=message, code=code, rows_affected=rows_affected, agate_table=res) }}\n {%- endif -%}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.run_hooks": {"unique_id": "macro.dbt.run_hooks", "package_name": "dbt", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/helpers.sql", "original_file_path": "macros/materializations/helpers.sql", "name": "run_hooks", "macro_sql": "{% macro run_hooks(hooks, inside_transaction=True) %}\n {% for hook in hooks | selectattr('transaction', 'equalto', inside_transaction) %}\n {% if not inside_transaction and loop.first %}\n {% call statement(auto_begin=inside_transaction) %}\n commit;\n {% endcall %}\n {% endif %}\n {% set rendered = render(hook.get('sql')) | trim %}\n {% if (rendered | length) > 0 %}\n {% call statement(auto_begin=inside_transaction) %}\n {{ rendered }}\n {% endcall %}\n {% endif %}\n {% endfor %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.column_list": {"unique_id": "macro.dbt.column_list", "package_name": "dbt", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/helpers.sql", "original_file_path": "macros/materializations/helpers.sql", "name": "column_list", "macro_sql": "{% macro column_list(columns) %}\n {%- for col in columns %}\n {{ col.name }} {% if not loop.last %},{% endif %}\n {% endfor -%}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.column_list_for_create_table": {"unique_id": "macro.dbt.column_list_for_create_table", "package_name": "dbt", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/helpers.sql", "original_file_path": "macros/materializations/helpers.sql", "name": "column_list_for_create_table", "macro_sql": "{% macro column_list_for_create_table(columns) %}\n {%- for col in columns %}\n {{ col.name }} {{ col.data_type }} {%- if not loop.last %},{% endif %}\n {% endfor -%}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.make_hook_config": {"unique_id": "macro.dbt.make_hook_config", "package_name": "dbt", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/helpers.sql", "original_file_path": "macros/materializations/helpers.sql", "name": "make_hook_config", "macro_sql": "{% macro make_hook_config(sql, inside_transaction) %}\n {{ tojson({\"sql\": sql, \"transaction\": inside_transaction}) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.before_begin": {"unique_id": "macro.dbt.before_begin", "package_name": "dbt", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/helpers.sql", "original_file_path": "macros/materializations/helpers.sql", "name": "before_begin", "macro_sql": "{% macro before_begin(sql) %}\n {{ make_hook_config(sql, inside_transaction=False) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.in_transaction": {"unique_id": "macro.dbt.in_transaction", "package_name": "dbt", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/helpers.sql", "original_file_path": "macros/materializations/helpers.sql", "name": "in_transaction", "macro_sql": "{% macro in_transaction(sql) %}\n {{ make_hook_config(sql, inside_transaction=True) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.after_commit": {"unique_id": "macro.dbt.after_commit", "package_name": "dbt", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/helpers.sql", "original_file_path": "macros/materializations/helpers.sql", "name": "after_commit", "macro_sql": "{% macro after_commit(sql) %}\n {{ make_hook_config(sql, inside_transaction=False) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.drop_relation_if_exists": {"unique_id": "macro.dbt.drop_relation_if_exists", "package_name": "dbt", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/helpers.sql", "original_file_path": "macros/materializations/helpers.sql", "name": "drop_relation_if_exists", "macro_sql": "{% macro drop_relation_if_exists(relation) %}\n {% if relation is not none %}\n {{ adapter.drop_relation(relation) }}\n {% endif %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.load_relation": {"unique_id": "macro.dbt.load_relation", "package_name": "dbt", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/helpers.sql", "original_file_path": "macros/materializations/helpers.sql", "name": "load_relation", "macro_sql": "{% macro load_relation(relation) %}\n {% do return(adapter.get_relation(\n database=relation.database,\n schema=relation.schema,\n identifier=relation.identifier\n )) -%}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.should_full_refresh": {"unique_id": "macro.dbt.should_full_refresh", "package_name": "dbt", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/helpers.sql", "original_file_path": "macros/materializations/helpers.sql", "name": "should_full_refresh", "macro_sql": "{% macro should_full_refresh() %}\n {% set config_full_refresh = config.get('full_refresh') %}\n {% if config_full_refresh is none %}\n {% set config_full_refresh = flags.FULL_REFRESH %}\n {% endif %}\n {% do return(config_full_refresh) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.snapshot_merge_sql": {"unique_id": "macro.dbt.snapshot_merge_sql", "package_name": "dbt", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshot/snapshot_merge.sql", "original_file_path": "macros/materializations/snapshot/snapshot_merge.sql", "name": "snapshot_merge_sql", "macro_sql": "{% macro snapshot_merge_sql(target, source, insert_cols) -%}\n {{ adapter.dispatch('snapshot_merge_sql')(target, source, insert_cols) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.default__snapshot_merge_sql": {"unique_id": "macro.dbt.default__snapshot_merge_sql", "package_name": "dbt", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshot/snapshot_merge.sql", "original_file_path": "macros/materializations/snapshot/snapshot_merge.sql", "name": "default__snapshot_merge_sql", "macro_sql": "{% macro default__snapshot_merge_sql(target, source, insert_cols) -%}\n {%- set insert_cols_csv = insert_cols | join(', ') -%}\n\n merge into {{ target }} as DBT_INTERNAL_DEST\n using {{ source }} as DBT_INTERNAL_SOURCE\n on DBT_INTERNAL_SOURCE.dbt_scd_id = DBT_INTERNAL_DEST.dbt_scd_id\n\n when matched\n and DBT_INTERNAL_DEST.dbt_valid_to is null\n and DBT_INTERNAL_SOURCE.dbt_change_type in ('update', 'delete')\n then update\n set dbt_valid_to = DBT_INTERNAL_SOURCE.dbt_valid_to\n\n when not matched\n and DBT_INTERNAL_SOURCE.dbt_change_type = 'insert'\n then insert ({{ insert_cols_csv }})\n values ({{ insert_cols_csv }})\n ;\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.strategy_dispatch": {"unique_id": "macro.dbt.strategy_dispatch", "package_name": "dbt", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshot/strategies.sql", "original_file_path": "macros/materializations/snapshot/strategies.sql", "name": "strategy_dispatch", "macro_sql": "{% macro strategy_dispatch(name) -%}\n{% set original_name = name %}\n {% if '.' in name %}\n {% set package_name, name = name.split(\".\", 1) %}\n {% else %}\n {% set package_name = none %}\n {% endif %}\n\n {% if package_name is none %}\n {% set package_context = context %}\n {% elif package_name in context %}\n {% set package_context = context[package_name] %}\n {% else %}\n {% set error_msg %}\n Could not find package '{{package_name}}', called with '{{original_name}}'\n {% endset %}\n {{ exceptions.raise_compiler_error(error_msg | trim) }}\n {% endif %}\n\n {%- set search_name = 'snapshot_' ~ name ~ '_strategy' -%}\n\n {% if search_name not in package_context %}\n {% set error_msg %}\n The specified strategy macro '{{name}}' was not found in package '{{ package_name }}'\n {% endset %}\n {{ exceptions.raise_compiler_error(error_msg | trim) }}\n {% endif %}\n {{ return(package_context[search_name]) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.snapshot_hash_arguments": {"unique_id": "macro.dbt.snapshot_hash_arguments", "package_name": "dbt", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshot/strategies.sql", "original_file_path": "macros/materializations/snapshot/strategies.sql", "name": "snapshot_hash_arguments", "macro_sql": "{% macro snapshot_hash_arguments(args) -%}\n {{ adapter.dispatch('snapshot_hash_arguments')(args) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.default__snapshot_hash_arguments": {"unique_id": "macro.dbt.default__snapshot_hash_arguments", "package_name": "dbt", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshot/strategies.sql", "original_file_path": "macros/materializations/snapshot/strategies.sql", "name": "default__snapshot_hash_arguments", "macro_sql": "{% macro default__snapshot_hash_arguments(args) -%}\n md5({%- for arg in args -%}\n coalesce(cast({{ arg }} as varchar ), '')\n {% if not loop.last %} || '|' || {% endif %}\n {%- endfor -%})\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.snapshot_get_time": {"unique_id": "macro.dbt.snapshot_get_time", "package_name": "dbt", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshot/strategies.sql", "original_file_path": "macros/materializations/snapshot/strategies.sql", "name": "snapshot_get_time", "macro_sql": "{% macro snapshot_get_time() -%}\n {{ adapter.dispatch('snapshot_get_time')() }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.default__snapshot_get_time": {"unique_id": "macro.dbt.default__snapshot_get_time", "package_name": "dbt", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshot/strategies.sql", "original_file_path": "macros/materializations/snapshot/strategies.sql", "name": "default__snapshot_get_time", "macro_sql": "{% macro default__snapshot_get_time() -%}\n {{ current_timestamp() }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.snapshot_timestamp_strategy": {"unique_id": "macro.dbt.snapshot_timestamp_strategy", "package_name": "dbt", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshot/strategies.sql", "original_file_path": "macros/materializations/snapshot/strategies.sql", "name": "snapshot_timestamp_strategy", "macro_sql": "{% macro snapshot_timestamp_strategy(node, snapshotted_rel, current_rel, config, target_exists) %}\n {% set primary_key = config['unique_key'] %}\n {% set updated_at = config['updated_at'] %}\n {% set invalidate_hard_deletes = config.get('invalidate_hard_deletes', false) %}\n\n {#/*\n The snapshot relation might not have an {{ updated_at }} value if the\n snapshot strategy is changed from `check` to `timestamp`. We\n should use a dbt-created column for the comparison in the snapshot\n table instead of assuming that the user-supplied {{ updated_at }}\n will be present in the historical data.\n\n See https://github.com/fishtown-analytics/dbt/issues/2350\n */ #}\n {% set row_changed_expr -%}\n ({{ snapshotted_rel }}.dbt_valid_from < {{ current_rel }}.{{ updated_at }})\n {%- endset %}\n\n {% set scd_id_expr = snapshot_hash_arguments([primary_key, updated_at]) %}\n\n {% do return({\n \"unique_key\": primary_key,\n \"updated_at\": updated_at,\n \"row_changed\": row_changed_expr,\n \"scd_id\": scd_id_expr,\n \"invalidate_hard_deletes\": invalidate_hard_deletes\n }) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.snapshot_string_as_time": {"unique_id": "macro.dbt.snapshot_string_as_time", "package_name": "dbt", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshot/strategies.sql", "original_file_path": "macros/materializations/snapshot/strategies.sql", "name": "snapshot_string_as_time", "macro_sql": "{% macro snapshot_string_as_time(timestamp) -%}\n {{ adapter.dispatch('snapshot_string_as_time')(timestamp) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.default__snapshot_string_as_time": {"unique_id": "macro.dbt.default__snapshot_string_as_time", "package_name": "dbt", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshot/strategies.sql", "original_file_path": "macros/materializations/snapshot/strategies.sql", "name": "default__snapshot_string_as_time", "macro_sql": "{% macro default__snapshot_string_as_time(timestamp) %}\n {% do exceptions.raise_not_implemented(\n 'snapshot_string_as_time macro not implemented for adapter '+adapter.type()\n ) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.snapshot_check_all_get_existing_columns": {"unique_id": "macro.dbt.snapshot_check_all_get_existing_columns", "package_name": "dbt", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshot/strategies.sql", "original_file_path": "macros/materializations/snapshot/strategies.sql", "name": "snapshot_check_all_get_existing_columns", "macro_sql": "{% macro snapshot_check_all_get_existing_columns(node, target_exists) -%}\n {%- set query_columns = get_columns_in_query(node['compiled_sql']) -%}\n {%- if not target_exists -%}\n {# no table yet -> return whatever the query does #}\n {{ return([false, query_columns]) }}\n {%- endif -%}\n {# handle any schema changes #}\n {%- set target_table = node.get('alias', node.get('name')) -%}\n {%- set target_relation = adapter.get_relation(database=node.database, schema=node.schema, identifier=target_table) -%}\n {%- set existing_cols = get_columns_in_query('select * from ' ~ target_relation) -%}\n {%- set ns = namespace() -%} {# handle for-loop scoping with a namespace #}\n {%- set ns.column_added = false -%}\n\n {%- set intersection = [] -%}\n {%- for col in query_columns -%}\n {%- if col in existing_cols -%}\n {%- do intersection.append(col) -%}\n {%- else -%}\n {% set ns.column_added = true %}\n {%- endif -%}\n {%- endfor -%}\n {{ return([ns.column_added, intersection]) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.snapshot_check_strategy": {"unique_id": "macro.dbt.snapshot_check_strategy", "package_name": "dbt", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshot/strategies.sql", "original_file_path": "macros/materializations/snapshot/strategies.sql", "name": "snapshot_check_strategy", "macro_sql": "{% macro snapshot_check_strategy(node, snapshotted_rel, current_rel, config, target_exists) %}\n {% set check_cols_config = config['check_cols'] %}\n {% set primary_key = config['unique_key'] %}\n {% set invalidate_hard_deletes = config.get('invalidate_hard_deletes', false) %}\n \n {% set select_current_time -%}\n select {{ snapshot_get_time() }} as snapshot_start\n {%- endset %}\n\n {#-- don't access the column by name, to avoid dealing with casing issues on snowflake #}\n {%- set now = run_query(select_current_time)[0][0] -%}\n {% if now is none or now is undefined -%}\n {%- do exceptions.raise_compiler_error('Could not get a snapshot start time from the database') -%}\n {%- endif %}\n {% set updated_at = snapshot_string_as_time(now) %}\n\n {% set column_added = false %}\n\n {% if check_cols_config == 'all' %}\n {% set column_added, check_cols = snapshot_check_all_get_existing_columns(node, target_exists) %}\n {% elif check_cols_config is iterable and (check_cols_config | length) > 0 %}\n {% set check_cols = check_cols_config %}\n {% else %}\n {% do exceptions.raise_compiler_error(\"Invalid value for 'check_cols': \" ~ check_cols_config) %}\n {% endif %}\n\n {%- set row_changed_expr -%}\n (\n {%- if column_added -%}\n TRUE\n {%- else -%}\n {%- for col in check_cols -%}\n {{ snapshotted_rel }}.{{ col }} != {{ current_rel }}.{{ col }}\n or\n (\n (({{ snapshotted_rel }}.{{ col }} is null) and not ({{ current_rel }}.{{ col }} is null))\n or\n ((not {{ snapshotted_rel }}.{{ col }} is null) and ({{ current_rel }}.{{ col }} is null))\n )\n {%- if not loop.last %} or {% endif -%}\n {%- endfor -%}\n {%- endif -%}\n )\n {%- endset %}\n\n {% set scd_id_expr = snapshot_hash_arguments([primary_key, updated_at]) %}\n\n {% do return({\n \"unique_key\": primary_key,\n \"updated_at\": updated_at,\n \"row_changed\": row_changed_expr,\n \"scd_id\": scd_id_expr,\n \"invalidate_hard_deletes\": invalidate_hard_deletes\n }) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.create_columns": {"unique_id": "macro.dbt.create_columns", "package_name": "dbt", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshot/snapshot.sql", "original_file_path": "macros/materializations/snapshot/snapshot.sql", "name": "create_columns", "macro_sql": "{% macro create_columns(relation, columns) %}\n {{ adapter.dispatch('create_columns')(relation, columns) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.default__create_columns": {"unique_id": "macro.dbt.default__create_columns", "package_name": "dbt", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshot/snapshot.sql", "original_file_path": "macros/materializations/snapshot/snapshot.sql", "name": "default__create_columns", "macro_sql": "{% macro default__create_columns(relation, columns) %}\n {% for column in columns %}\n {% call statement() %}\n alter table {{ relation }} add column \"{{ column.name }}\" {{ column.data_type }};\n {% endcall %}\n {% endfor %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.post_snapshot": {"unique_id": "macro.dbt.post_snapshot", "package_name": "dbt", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshot/snapshot.sql", "original_file_path": "macros/materializations/snapshot/snapshot.sql", "name": "post_snapshot", "macro_sql": "{% macro post_snapshot(staging_relation) %}\n {{ adapter.dispatch('post_snapshot')(staging_relation) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.default__post_snapshot": {"unique_id": "macro.dbt.default__post_snapshot", "package_name": "dbt", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshot/snapshot.sql", "original_file_path": "macros/materializations/snapshot/snapshot.sql", "name": "default__post_snapshot", "macro_sql": "{% macro default__post_snapshot(staging_relation) %}\n {# no-op #}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.snapshot_staging_table": {"unique_id": "macro.dbt.snapshot_staging_table", "package_name": "dbt", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshot/snapshot.sql", "original_file_path": "macros/materializations/snapshot/snapshot.sql", "name": "snapshot_staging_table", "macro_sql": "{% macro snapshot_staging_table(strategy, source_sql, target_relation) -%}\n\n with snapshot_query as (\n\n {{ source_sql }}\n\n ),\n\n snapshotted_data as (\n\n select *,\n {{ strategy.unique_key }} as dbt_unique_key\n\n from {{ target_relation }}\n where dbt_valid_to is null\n\n ),\n\n insertions_source_data as (\n\n select\n *,\n {{ strategy.unique_key }} as dbt_unique_key,\n {{ strategy.updated_at }} as dbt_updated_at,\n {{ strategy.updated_at }} as dbt_valid_from,\n nullif({{ strategy.updated_at }}, {{ strategy.updated_at }}) as dbt_valid_to,\n {{ strategy.scd_id }} as dbt_scd_id\n\n from snapshot_query\n ),\n\n updates_source_data as (\n\n select\n *,\n {{ strategy.unique_key }} as dbt_unique_key,\n {{ strategy.updated_at }} as dbt_updated_at,\n {{ strategy.updated_at }} as dbt_valid_from,\n {{ strategy.updated_at }} as dbt_valid_to\n\n from snapshot_query\n ),\n\n {%- if strategy.invalidate_hard_deletes %}\n\n deletes_source_data as (\n\n select \n *,\n {{ strategy.unique_key }} as dbt_unique_key\n from snapshot_query\n ),\n {% endif %}\n\n insertions as (\n\n select\n 'insert' as dbt_change_type,\n source_data.*\n\n from insertions_source_data as source_data\n left outer join snapshotted_data on snapshotted_data.dbt_unique_key = source_data.dbt_unique_key\n where snapshotted_data.dbt_unique_key is null\n or (\n snapshotted_data.dbt_unique_key is not null\n and (\n {{ strategy.row_changed }}\n )\n )\n\n ),\n\n updates as (\n\n select\n 'update' as dbt_change_type,\n source_data.*,\n snapshotted_data.dbt_scd_id\n\n from updates_source_data as source_data\n join snapshotted_data on snapshotted_data.dbt_unique_key = source_data.dbt_unique_key\n where (\n {{ strategy.row_changed }}\n )\n )\n\n {%- if strategy.invalidate_hard_deletes -%}\n ,\n\n deletes as (\n \n select\n 'delete' as dbt_change_type,\n source_data.*,\n {{ snapshot_get_time() }} as dbt_valid_from,\n {{ snapshot_get_time() }} as dbt_updated_at,\n {{ snapshot_get_time() }} as dbt_valid_to,\n snapshotted_data.dbt_scd_id\n \n from snapshotted_data\n left join deletes_source_data as source_data on snapshotted_data.dbt_unique_key = source_data.dbt_unique_key\n where source_data.dbt_unique_key is null\n )\n {%- endif %}\n\n select * from insertions\n union all\n select * from updates\n {%- if strategy.invalidate_hard_deletes %}\n union all\n select * from deletes\n {%- endif %}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.build_snapshot_table": {"unique_id": "macro.dbt.build_snapshot_table", "package_name": "dbt", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshot/snapshot.sql", "original_file_path": "macros/materializations/snapshot/snapshot.sql", "name": "build_snapshot_table", "macro_sql": "{% macro build_snapshot_table(strategy, sql) %}\n\n select *,\n {{ strategy.scd_id }} as dbt_scd_id,\n {{ strategy.updated_at }} as dbt_updated_at,\n {{ strategy.updated_at }} as dbt_valid_from,\n nullif({{ strategy.updated_at }}, {{ strategy.updated_at }}) as dbt_valid_to\n from (\n {{ sql }}\n ) sbq\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.get_or_create_relation": {"unique_id": "macro.dbt.get_or_create_relation", "package_name": "dbt", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshot/snapshot.sql", "original_file_path": "macros/materializations/snapshot/snapshot.sql", "name": "get_or_create_relation", "macro_sql": "{% macro get_or_create_relation(database, schema, identifier, type) %}\n {%- set target_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) %}\n\n {% if target_relation %}\n {% do return([true, target_relation]) %}\n {% endif %}\n\n {%- set new_relation = api.Relation.create(\n database=database,\n schema=schema,\n identifier=identifier,\n type=type\n ) -%}\n {% do return([false, new_relation]) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.build_snapshot_staging_table": {"unique_id": "macro.dbt.build_snapshot_staging_table", "package_name": "dbt", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshot/snapshot.sql", "original_file_path": "macros/materializations/snapshot/snapshot.sql", "name": "build_snapshot_staging_table", "macro_sql": "{% macro build_snapshot_staging_table(strategy, sql, target_relation) %}\n {% set tmp_relation = make_temp_relation(target_relation) %}\n\n {% set select = snapshot_staging_table(strategy, sql, target_relation) %}\n\n {% call statement('build_snapshot_staging_relation') %}\n {{ create_table_as(True, tmp_relation, select) }}\n {% endcall %}\n\n {% do return(tmp_relation) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.materialization_snapshot_default": {"unique_id": "macro.dbt.materialization_snapshot_default", "package_name": "dbt", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshot/snapshot.sql", "original_file_path": "macros/materializations/snapshot/snapshot.sql", "name": "materialization_snapshot_default", "macro_sql": "{% materialization snapshot, default %}\n {%- set config = model['config'] -%}\n\n {%- set target_table = model.get('alias', model.get('name')) -%}\n\n {%- set strategy_name = config.get('strategy') -%}\n {%- set unique_key = config.get('unique_key') %}\n\n {% if not adapter.check_schema_exists(model.database, model.schema) %}\n {% do create_schema(model.database, model.schema) %}\n {% endif %}\n\n {% set target_relation_exists, target_relation = get_or_create_relation(\n database=model.database,\n schema=model.schema,\n identifier=target_table,\n type='table') -%}\n\n {%- if not target_relation.is_table -%}\n {% do exceptions.relation_wrong_type(target_relation, 'table') %}\n {%- endif -%}\n\n\n {{ run_hooks(pre_hooks, inside_transaction=False) }}\n\n {{ run_hooks(pre_hooks, inside_transaction=True) }}\n\n {% set strategy_macro = strategy_dispatch(strategy_name) %}\n {% set strategy = strategy_macro(model, \"snapshotted_data\", \"source_data\", config, target_relation_exists) %}\n\n {% if not target_relation_exists %}\n\n {% set build_sql = build_snapshot_table(strategy, model['compiled_sql']) %}\n {% set final_sql = create_table_as(False, target_relation, build_sql) %}\n\n {% else %}\n\n {{ adapter.valid_snapshot_target(target_relation) }}\n\n {% set staging_table = build_snapshot_staging_table(strategy, sql, target_relation) %}\n\n -- this may no-op if the database does not require column expansion\n {% do adapter.expand_target_column_types(from_relation=staging_table,\n to_relation=target_relation) %}\n\n {% set missing_columns = adapter.get_missing_columns(staging_table, target_relation)\n | rejectattr('name', 'equalto', 'dbt_change_type')\n | rejectattr('name', 'equalto', 'DBT_CHANGE_TYPE')\n | rejectattr('name', 'equalto', 'dbt_unique_key')\n | rejectattr('name', 'equalto', 'DBT_UNIQUE_KEY')\n | list %}\n\n {% do create_columns(target_relation, missing_columns) %}\n\n {% set source_columns = adapter.get_columns_in_relation(staging_table)\n | rejectattr('name', 'equalto', 'dbt_change_type')\n | rejectattr('name', 'equalto', 'DBT_CHANGE_TYPE')\n | rejectattr('name', 'equalto', 'dbt_unique_key')\n | rejectattr('name', 'equalto', 'DBT_UNIQUE_KEY')\n | list %}\n\n {% set quoted_source_columns = [] %}\n {% for column in source_columns %}\n {% do quoted_source_columns.append(adapter.quote(column.name)) %}\n {% endfor %}\n\n {% set final_sql = snapshot_merge_sql(\n target = target_relation,\n source = staging_table,\n insert_cols = quoted_source_columns\n )\n %}\n\n {% endif %}\n\n {% call statement('main') %}\n {{ final_sql }}\n {% endcall %}\n\n {% do persist_docs(target_relation, model) %}\n\n {{ run_hooks(post_hooks, inside_transaction=True) }}\n\n {{ adapter.commit() }}\n\n {% if staging_table is defined %}\n {% do post_snapshot(staging_table) %}\n {% endif %}\n\n {{ run_hooks(post_hooks, inside_transaction=False) }}\n\n {{ return({'relations': [target_relation]}) }}\n\n{% endmaterialization %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.create_csv_table": {"unique_id": "macro.dbt.create_csv_table", "package_name": "dbt", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/seed/seed.sql", "original_file_path": "macros/materializations/seed/seed.sql", "name": "create_csv_table", "macro_sql": "{% macro create_csv_table(model, agate_table) -%}\n {{ adapter.dispatch('create_csv_table')(model, agate_table) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.reset_csv_table": {"unique_id": "macro.dbt.reset_csv_table", "package_name": "dbt", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/seed/seed.sql", "original_file_path": "macros/materializations/seed/seed.sql", "name": "reset_csv_table", "macro_sql": "{% macro reset_csv_table(model, full_refresh, old_relation, agate_table) -%}\n {{ adapter.dispatch('reset_csv_table')(model, full_refresh, old_relation, agate_table) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.load_csv_rows": {"unique_id": "macro.dbt.load_csv_rows", "package_name": "dbt", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/seed/seed.sql", "original_file_path": "macros/materializations/seed/seed.sql", "name": "load_csv_rows", "macro_sql": "{% macro load_csv_rows(model, agate_table) -%}\n {{ adapter.dispatch('load_csv_rows')(model, agate_table) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.default__create_csv_table": {"unique_id": "macro.dbt.default__create_csv_table", "package_name": "dbt", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/seed/seed.sql", "original_file_path": "macros/materializations/seed/seed.sql", "name": "default__create_csv_table", "macro_sql": "{% macro default__create_csv_table(model, agate_table) %}\n {%- set column_override = model['config'].get('column_types', {}) -%}\n {%- set quote_seed_column = model['config'].get('quote_columns', None) -%}\n\n {% set sql %}\n create table {{ this.render() }} (\n {%- for col_name in agate_table.column_names -%}\n {%- set inferred_type = adapter.convert_type(agate_table, loop.index0) -%}\n {%- set type = column_override.get(col_name, inferred_type) -%}\n {%- set column_name = (col_name | string) -%}\n {{ adapter.quote_seed_column(column_name, quote_seed_column) }} {{ type }} {%- if not loop.last -%}, {%- endif -%}\n {%- endfor -%}\n )\n {% endset %}\n\n {% call statement('_') -%}\n {{ sql }}\n {%- endcall %}\n\n {{ return(sql) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.default__reset_csv_table": {"unique_id": "macro.dbt.default__reset_csv_table", "package_name": "dbt", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/seed/seed.sql", "original_file_path": "macros/materializations/seed/seed.sql", "name": "default__reset_csv_table", "macro_sql": "{% macro default__reset_csv_table(model, full_refresh, old_relation, agate_table) %}\n {% set sql = \"\" %}\n {% if full_refresh %}\n {{ adapter.drop_relation(old_relation) }}\n {% set sql = create_csv_table(model, agate_table) %}\n {% else %}\n {{ adapter.truncate_relation(old_relation) }}\n {% set sql = \"truncate table \" ~ old_relation %}\n {% endif %}\n\n {{ return(sql) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.get_seed_column_quoted_csv": {"unique_id": "macro.dbt.get_seed_column_quoted_csv", "package_name": "dbt", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/seed/seed.sql", "original_file_path": "macros/materializations/seed/seed.sql", "name": "get_seed_column_quoted_csv", "macro_sql": "{% macro get_seed_column_quoted_csv(model, column_names) %}\n {%- set quote_seed_column = model['config'].get('quote_columns', None) -%}\n {% set quoted = [] %}\n {% for col in column_names -%}\n {%- do quoted.append(adapter.quote_seed_column(col, quote_seed_column)) -%}\n {%- endfor %}\n\n {%- set dest_cols_csv = quoted | join(', ') -%}\n {{ return(dest_cols_csv) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.basic_load_csv_rows": {"unique_id": "macro.dbt.basic_load_csv_rows", "package_name": "dbt", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/seed/seed.sql", "original_file_path": "macros/materializations/seed/seed.sql", "name": "basic_load_csv_rows", "macro_sql": "{% macro basic_load_csv_rows(model, batch_size, agate_table) %}\n {% set cols_sql = get_seed_column_quoted_csv(model, agate_table.column_names) %}\n {% set bindings = [] %}\n\n {% set statements = [] %}\n\n {% for chunk in agate_table.rows | batch(batch_size) %}\n {% set bindings = [] %}\n\n {% for row in chunk %}\n {% do bindings.extend(row) %}\n {% endfor %}\n\n {% set sql %}\n insert into {{ this.render() }} ({{ cols_sql }}) values\n {% for row in chunk -%}\n ({%- for column in agate_table.column_names -%}\n %s\n {%- if not loop.last%},{%- endif %}\n {%- endfor -%})\n {%- if not loop.last%},{%- endif %}\n {%- endfor %}\n {% endset %}\n\n {% do adapter.add_query(sql, bindings=bindings, abridge_sql_log=True) %}\n\n {% if loop.index0 == 0 %}\n {% do statements.append(sql) %}\n {% endif %}\n {% endfor %}\n\n {# Return SQL so we can render it out into the compiled files #}\n {{ return(statements[0]) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.default__load_csv_rows": {"unique_id": "macro.dbt.default__load_csv_rows", "package_name": "dbt", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/seed/seed.sql", "original_file_path": "macros/materializations/seed/seed.sql", "name": "default__load_csv_rows", "macro_sql": "{% macro default__load_csv_rows(model, agate_table) %}\n {{ return(basic_load_csv_rows(model, 10000, agate_table) )}}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.materialization_seed_default": {"unique_id": "macro.dbt.materialization_seed_default", "package_name": "dbt", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/seed/seed.sql", "original_file_path": "macros/materializations/seed/seed.sql", "name": "materialization_seed_default", "macro_sql": "{% materialization seed, default %}\n\n {%- set identifier = model['alias'] -%}\n {%- set full_refresh_mode = (should_full_refresh()) -%}\n\n {%- set old_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) -%}\n\n {%- set exists_as_table = (old_relation is not none and old_relation.is_table) -%}\n {%- set exists_as_view = (old_relation is not none and old_relation.is_view) -%}\n\n {%- set agate_table = load_agate_table() -%}\n {%- do store_result('agate_table', response='OK', agate_table=agate_table) -%}\n\n {{ run_hooks(pre_hooks, inside_transaction=False) }}\n\n -- `BEGIN` happens here:\n {{ run_hooks(pre_hooks, inside_transaction=True) }}\n\n -- build model\n {% set create_table_sql = \"\" %}\n {% if exists_as_view %}\n {{ exceptions.raise_compiler_error(\"Cannot seed to '{}', it is a view\".format(old_relation)) }}\n {% elif exists_as_table %}\n {% set create_table_sql = reset_csv_table(model, full_refresh_mode, old_relation, agate_table) %}\n {% else %}\n {% set create_table_sql = create_csv_table(model, agate_table) %}\n {% endif %}\n\n {% set code = 'CREATE' if full_refresh_mode else 'INSERT' %}\n {% set rows_affected = (agate_table.rows | length) %}\n {% set sql = load_csv_rows(model, agate_table) %}\n\n {% call noop_statement('main', code ~ ' ' ~ rows_affected, code, rows_affected) %}\n {{ create_table_sql }};\n -- dbt seed --\n {{ sql }}\n {% endcall %}\n\n {% set target_relation = this.incorporate(type='table') %}\n {% do persist_docs(target_relation, model) %}\n\n {{ run_hooks(post_hooks, inside_transaction=True) }}\n\n -- `COMMIT` happens here\n {{ adapter.commit() }}\n\n {{ run_hooks(post_hooks, inside_transaction=False) }}\n\n {{ return({'relations': [target_relation]}) }}\n\n{% endmaterialization %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.incremental_upsert": {"unique_id": "macro.dbt.incremental_upsert", "package_name": "dbt", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/incremental/helpers.sql", "original_file_path": "macros/materializations/incremental/helpers.sql", "name": "incremental_upsert", "macro_sql": "{% macro incremental_upsert(tmp_relation, target_relation, unique_key=none, statement_name=\"main\") %}\n {%- set dest_columns = adapter.get_columns_in_relation(target_relation) -%}\n {%- set dest_cols_csv = dest_columns | map(attribute='quoted') | join(', ') -%}\n\n {%- if unique_key is not none -%}\n delete\n from {{ target_relation }}\n where ({{ unique_key }}) in (\n select ({{ unique_key }})\n from {{ tmp_relation }}\n );\n {%- endif %}\n\n insert into {{ target_relation }} ({{ dest_cols_csv }})\n (\n select {{ dest_cols_csv }}\n from {{ tmp_relation }}\n );\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.materialization_incremental_default": {"unique_id": "macro.dbt.materialization_incremental_default", "package_name": "dbt", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/incremental/incremental.sql", "original_file_path": "macros/materializations/incremental/incremental.sql", "name": "materialization_incremental_default", "macro_sql": "{% materialization incremental, default -%}\n\n {% set unique_key = config.get('unique_key') %}\n\n {% set target_relation = this.incorporate(type='table') %}\n {% set existing_relation = load_relation(this) %}\n {% set tmp_relation = make_temp_relation(this) %}\n\n {{ run_hooks(pre_hooks, inside_transaction=False) }}\n\n -- `BEGIN` happens here:\n {{ run_hooks(pre_hooks, inside_transaction=True) }}\n\n {% set to_drop = [] %}\n {% if existing_relation is none %}\n {% set build_sql = create_table_as(False, target_relation, sql) %}\n {% elif existing_relation.is_view or should_full_refresh() %}\n {#-- Make sure the backup doesn't exist so we don't encounter issues with the rename below #}\n {% set backup_identifier = existing_relation.identifier ~ \"__dbt_backup\" %}\n {% set backup_relation = existing_relation.incorporate(path={\"identifier\": backup_identifier}) %}\n {% do adapter.drop_relation(backup_relation) %}\n\n {% do adapter.rename_relation(target_relation, backup_relation) %}\n {% set build_sql = create_table_as(False, target_relation, sql) %}\n {% do to_drop.append(backup_relation) %}\n {% else %}\n {% set tmp_relation = make_temp_relation(target_relation) %}\n {% do run_query(create_table_as(True, tmp_relation, sql)) %}\n {% do adapter.expand_target_column_types(\n from_relation=tmp_relation,\n to_relation=target_relation) %}\n {% set build_sql = incremental_upsert(tmp_relation, target_relation, unique_key=unique_key) %}\n {% endif %}\n\n {% call statement(\"main\") %}\n {{ build_sql }}\n {% endcall %}\n\n {% do persist_docs(target_relation, model) %}\n\n {{ run_hooks(post_hooks, inside_transaction=True) }}\n\n -- `COMMIT` happens here\n {% do adapter.commit() %}\n\n {% for rel in to_drop %}\n {% do adapter.drop_relation(rel) %}\n {% endfor %}\n\n {{ run_hooks(post_hooks, inside_transaction=False) }}\n\n {{ return({'relations': [target_relation]}) }}\n\n{%- endmaterialization %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.get_merge_sql": {"unique_id": "macro.dbt.get_merge_sql", "package_name": "dbt", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/common/merge.sql", "original_file_path": "macros/materializations/common/merge.sql", "name": "get_merge_sql", "macro_sql": "{% macro get_merge_sql(target, source, unique_key, dest_columns, predicates=none) -%}\n {{ adapter.dispatch('get_merge_sql')(target, source, unique_key, dest_columns, predicates) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.get_delete_insert_merge_sql": {"unique_id": "macro.dbt.get_delete_insert_merge_sql", "package_name": "dbt", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/common/merge.sql", "original_file_path": "macros/materializations/common/merge.sql", "name": "get_delete_insert_merge_sql", "macro_sql": "{% macro get_delete_insert_merge_sql(target, source, unique_key, dest_columns) -%}\n {{ adapter.dispatch('get_delete_insert_merge_sql')(target, source, unique_key, dest_columns) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.get_insert_overwrite_merge_sql": {"unique_id": "macro.dbt.get_insert_overwrite_merge_sql", "package_name": "dbt", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/common/merge.sql", "original_file_path": "macros/materializations/common/merge.sql", "name": "get_insert_overwrite_merge_sql", "macro_sql": "{% macro get_insert_overwrite_merge_sql(target, source, dest_columns, predicates, include_sql_header=false) -%}\n {{ adapter.dispatch('get_insert_overwrite_merge_sql')(target, source, dest_columns, predicates, include_sql_header) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.default__get_merge_sql": {"unique_id": "macro.dbt.default__get_merge_sql", "package_name": "dbt", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/common/merge.sql", "original_file_path": "macros/materializations/common/merge.sql", "name": "default__get_merge_sql", "macro_sql": "{% macro default__get_merge_sql(target, source, unique_key, dest_columns, predicates) -%}\n {%- set predicates = [] if predicates is none else [] + predicates -%}\n {%- set dest_cols_csv = get_quoted_csv(dest_columns | map(attribute=\"name\")) -%}\n {%- set sql_header = config.get('sql_header', none) -%}\n\n {% if unique_key %}\n {% set unique_key_match %}\n DBT_INTERNAL_SOURCE.{{ unique_key }} = DBT_INTERNAL_DEST.{{ unique_key }}\n {% endset %}\n {% do predicates.append(unique_key_match) %}\n {% else %}\n {% do predicates.append('FALSE') %}\n {% endif %}\n\n {{ sql_header if sql_header is not none }}\n\n merge into {{ target }} as DBT_INTERNAL_DEST\n using {{ source }} as DBT_INTERNAL_SOURCE\n on {{ predicates | join(' and ') }}\n\n {% if unique_key %}\n when matched then update set\n {% for column in dest_columns -%}\n {{ adapter.quote(column.name) }} = DBT_INTERNAL_SOURCE.{{ adapter.quote(column.name) }}\n {%- if not loop.last %}, {%- endif %}\n {%- endfor %}\n {% endif %}\n\n when not matched then insert\n ({{ dest_cols_csv }})\n values\n ({{ dest_cols_csv }})\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.get_quoted_csv": {"unique_id": "macro.dbt.get_quoted_csv", "package_name": "dbt", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/common/merge.sql", "original_file_path": "macros/materializations/common/merge.sql", "name": "get_quoted_csv", "macro_sql": "{% macro get_quoted_csv(column_names) %}\n {% set quoted = [] %}\n {% for col in column_names -%}\n {%- do quoted.append(adapter.quote(col)) -%}\n {%- endfor %}\n\n {%- set dest_cols_csv = quoted | join(', ') -%}\n {{ return(dest_cols_csv) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.common_get_delete_insert_merge_sql": {"unique_id": "macro.dbt.common_get_delete_insert_merge_sql", "package_name": "dbt", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/common/merge.sql", "original_file_path": "macros/materializations/common/merge.sql", "name": "common_get_delete_insert_merge_sql", "macro_sql": "{% macro common_get_delete_insert_merge_sql(target, source, unique_key, dest_columns) -%}\n\n {%- set dest_cols_csv = get_quoted_csv(dest_columns | map(attribute=\"name\")) -%}\n\n {% if unique_key is not none %}\n delete from {{ target }}\n where ({{ unique_key }}) in (\n select ({{ unique_key }})\n from {{ source }}\n );\n {% endif %}\n\n insert into {{ target }} ({{ dest_cols_csv }})\n (\n select {{ dest_cols_csv }}\n from {{ source }}\n );\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.default__get_delete_insert_merge_sql": {"unique_id": "macro.dbt.default__get_delete_insert_merge_sql", "package_name": "dbt", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/common/merge.sql", "original_file_path": "macros/materializations/common/merge.sql", "name": "default__get_delete_insert_merge_sql", "macro_sql": "{% macro default__get_delete_insert_merge_sql(target, source, unique_key, dest_columns) -%}\n {{ common_get_delete_insert_merge_sql(target, source, unique_key, dest_columns) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.default__get_insert_overwrite_merge_sql": {"unique_id": "macro.dbt.default__get_insert_overwrite_merge_sql", "package_name": "dbt", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/common/merge.sql", "original_file_path": "macros/materializations/common/merge.sql", "name": "default__get_insert_overwrite_merge_sql", "macro_sql": "{% macro default__get_insert_overwrite_merge_sql(target, source, dest_columns, predicates, include_sql_header) -%}\n {%- set predicates = [] if predicates is none else [] + predicates -%}\n {%- set dest_cols_csv = get_quoted_csv(dest_columns | map(attribute=\"name\")) -%}\n {%- set sql_header = config.get('sql_header', none) -%}\n\n {{ sql_header if sql_header is not none and include_sql_header }}\n\n merge into {{ target }} as DBT_INTERNAL_DEST\n using {{ source }} as DBT_INTERNAL_SOURCE\n on FALSE\n\n when not matched by source\n {% if predicates %} and {{ predicates | join(' and ') }} {% endif %}\n then delete\n\n when not matched then insert\n ({{ dest_cols_csv }})\n values\n ({{ dest_cols_csv }})\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.materialization_table_default": {"unique_id": "macro.dbt.materialization_table_default", "package_name": "dbt", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/table/table.sql", "original_file_path": "macros/materializations/table/table.sql", "name": "materialization_table_default", "macro_sql": "{% materialization table, default %}\n {%- set identifier = model['alias'] -%}\n {%- set tmp_identifier = model['name'] + '__dbt_tmp' -%}\n {%- set backup_identifier = model['name'] + '__dbt_backup' -%}\n\n {%- set old_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) -%}\n {%- set target_relation = api.Relation.create(identifier=identifier,\n schema=schema,\n database=database,\n type='table') -%}\n {%- set intermediate_relation = api.Relation.create(identifier=tmp_identifier,\n schema=schema,\n database=database,\n type='table') -%}\n\n /*\n See ../view/view.sql for more information about this relation.\n */\n {%- set backup_relation_type = 'table' if old_relation is none else old_relation.type -%}\n {%- set backup_relation = api.Relation.create(identifier=backup_identifier,\n schema=schema,\n database=database,\n type=backup_relation_type) -%}\n\n {%- set exists_as_table = (old_relation is not none and old_relation.is_table) -%}\n {%- set exists_as_view = (old_relation is not none and old_relation.is_view) -%}\n\n\n -- drop the temp relations if they exists for some reason\n {{ adapter.drop_relation(intermediate_relation) }}\n {{ adapter.drop_relation(backup_relation) }}\n\n {{ run_hooks(pre_hooks, inside_transaction=False) }}\n\n -- `BEGIN` happens here:\n {{ run_hooks(pre_hooks, inside_transaction=True) }}\n\n -- build model\n {% call statement('main') -%}\n {{ create_table_as(False, intermediate_relation, sql) }}\n {%- endcall %}\n\n -- cleanup\n {% if old_relation is not none %}\n {{ adapter.rename_relation(target_relation, backup_relation) }}\n {% endif %}\n\n {{ adapter.rename_relation(intermediate_relation, target_relation) }}\n\n {{ run_hooks(post_hooks, inside_transaction=True) }}\n\n {% do persist_docs(target_relation, model) %}\n\n -- `COMMIT` happens here\n {{ adapter.commit() }}\n\n -- finally, drop the existing/backup relation after the commit\n {{ drop_relation_if_exists(backup_relation) }}\n\n {{ run_hooks(post_hooks, inside_transaction=False) }}\n\n {{ return({'relations': [target_relation]}) }}\n{% endmaterialization %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.materialization_view_default": {"unique_id": "macro.dbt.materialization_view_default", "package_name": "dbt", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/view/view.sql", "original_file_path": "macros/materializations/view/view.sql", "name": "materialization_view_default", "macro_sql": "{%- materialization view, default -%}\n\n {%- set identifier = model['alias'] -%}\n {%- set tmp_identifier = model['name'] + '__dbt_tmp' -%}\n {%- set backup_identifier = model['name'] + '__dbt_backup' -%}\n\n {%- set old_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) -%}\n {%- set target_relation = api.Relation.create(identifier=identifier, schema=schema, database=database,\n type='view') -%}\n {%- set intermediate_relation = api.Relation.create(identifier=tmp_identifier,\n schema=schema, database=database, type='view') -%}\n\n /*\n This relation (probably) doesn't exist yet. If it does exist, it's a leftover from\n a previous run, and we're going to try to drop it immediately. At the end of this\n materialization, we're going to rename the \"old_relation\" to this identifier,\n and then we're going to drop it. In order to make sure we run the correct one of:\n - drop view ...\n - drop table ...\n\n We need to set the type of this relation to be the type of the old_relation, if it exists,\n or else \"view\" as a sane default if it does not. Note that if the old_relation does not\n exist, then there is nothing to move out of the way and subsequentally drop. In that case,\n this relation will be effectively unused.\n */\n {%- set backup_relation_type = 'view' if old_relation is none else old_relation.type -%}\n {%- set backup_relation = api.Relation.create(identifier=backup_identifier,\n schema=schema, database=database,\n type=backup_relation_type) -%}\n\n {%- set exists_as_view = (old_relation is not none and old_relation.is_view) -%}\n\n {{ run_hooks(pre_hooks, inside_transaction=False) }}\n\n -- drop the temp relations if they exists for some reason\n {{ adapter.drop_relation(intermediate_relation) }}\n {{ adapter.drop_relation(backup_relation) }}\n\n -- `BEGIN` happens here:\n {{ run_hooks(pre_hooks, inside_transaction=True) }}\n\n -- build model\n {% call statement('main') -%}\n {{ create_view_as(intermediate_relation, sql) }}\n {%- endcall %}\n\n -- cleanup\n -- move the existing view out of the way\n {% if old_relation is not none %}\n {{ adapter.rename_relation(target_relation, backup_relation) }}\n {% endif %}\n {{ adapter.rename_relation(intermediate_relation, target_relation) }}\n\n {% do persist_docs(target_relation, model) %}\n\n {{ run_hooks(post_hooks, inside_transaction=True) }}\n\n {{ adapter.commit() }}\n\n {{ drop_relation_if_exists(backup_relation) }}\n\n {{ run_hooks(post_hooks, inside_transaction=False) }}\n\n {{ return({'relations': [target_relation]}) }}\n\n{%- endmaterialization -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.handle_existing_table": {"unique_id": "macro.dbt.handle_existing_table", "package_name": "dbt", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/view/create_or_replace_view.sql", "original_file_path": "macros/materializations/view/create_or_replace_view.sql", "name": "handle_existing_table", "macro_sql": "{% macro handle_existing_table(full_refresh, old_relation) %}\n {{ adapter.dispatch(\"handle_existing_table\", packages=['dbt'])(full_refresh, old_relation) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.default__handle_existing_table": {"unique_id": "macro.dbt.default__handle_existing_table", "package_name": "dbt", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/view/create_or_replace_view.sql", "original_file_path": "macros/materializations/view/create_or_replace_view.sql", "name": "default__handle_existing_table", "macro_sql": "{% macro default__handle_existing_table(full_refresh, old_relation) %}\n {{ adapter.drop_relation(old_relation) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.create_or_replace_view": {"unique_id": "macro.dbt.create_or_replace_view", "package_name": "dbt", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/view/create_or_replace_view.sql", "original_file_path": "macros/materializations/view/create_or_replace_view.sql", "name": "create_or_replace_view", "macro_sql": "{% macro create_or_replace_view(run_outside_transaction_hooks=True) %}\n {%- set identifier = model['alias'] -%}\n\n {%- set old_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) -%}\n\n {%- set exists_as_view = (old_relation is not none and old_relation.is_view) -%}\n\n {%- set target_relation = api.Relation.create(\n identifier=identifier, schema=schema, database=database,\n type='view') -%}\n\n {% if run_outside_transaction_hooks %}\n -- no transactions on BigQuery\n {{ run_hooks(pre_hooks, inside_transaction=False) }}\n {% endif %}\n\n -- `BEGIN` happens here on Snowflake\n {{ run_hooks(pre_hooks, inside_transaction=True) }}\n\n -- If there's a table with the same name and we weren't told to full refresh,\n -- that's an error. If we were told to full refresh, drop it. This behavior differs\n -- for Snowflake and BigQuery, so multiple dispatch is used.\n {%- if old_relation is not none and old_relation.is_table -%}\n {{ handle_existing_table(should_full_refresh(), old_relation) }}\n {%- endif -%}\n\n -- build model\n {% call statement('main') -%}\n {{ create_view_as(target_relation, sql) }}\n {%- endcall %}\n\n {{ run_hooks(post_hooks, inside_transaction=True) }}\n\n {{ adapter.commit() }}\n\n {% if run_outside_transaction_hooks %}\n -- No transactions on BigQuery\n {{ run_hooks(post_hooks, inside_transaction=False) }}\n {% endif %}\n\n {{ return({'relations': [target_relation]}) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.generate_alias_name": {"unique_id": "macro.dbt.generate_alias_name", "package_name": "dbt", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/etc/get_custom_alias.sql", "original_file_path": "macros/etc/get_custom_alias.sql", "name": "generate_alias_name", "macro_sql": "{% macro generate_alias_name(custom_alias_name=none, node=none) -%}\n\n {%- if custom_alias_name is none -%}\n\n {{ node.name }}\n\n {%- else -%}\n\n {{ custom_alias_name | trim }}\n\n {%- endif -%}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.run_query": {"unique_id": "macro.dbt.run_query", "package_name": "dbt", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/etc/query.sql", "original_file_path": "macros/etc/query.sql", "name": "run_query", "macro_sql": "{% macro run_query(sql) %}\n {% call statement(\"run_query_statement\", fetch_result=true, auto_begin=false) %}\n {{ sql }}\n {% endcall %}\n\n {% do return(load_result(\"run_query_statement\").table) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.is_incremental": {"unique_id": "macro.dbt.is_incremental", "package_name": "dbt", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/etc/is_incremental.sql", "original_file_path": "macros/etc/is_incremental.sql", "name": "is_incremental", "macro_sql": "{% macro is_incremental() %}\n {#-- do not run introspective queries in parsing #}\n {% if not execute %}\n {{ return(False) }}\n {% else %}\n {% set relation = adapter.get_relation(this.database, this.schema, this.table) %}\n {{ return(relation is not none\n and relation.type == 'table'\n and model.config.materialized == 'incremental'\n and not should_full_refresh()) }}\n {% endif %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.convert_datetime": {"unique_id": "macro.dbt.convert_datetime", "package_name": "dbt", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/etc/datetime.sql", "original_file_path": "macros/etc/datetime.sql", "name": "convert_datetime", "macro_sql": "{% macro convert_datetime(date_str, date_fmt) %}\n\n {% set error_msg -%}\n The provided partition date '{{ date_str }}' does not match the expected format '{{ date_fmt }}'\n {%- endset %}\n\n {% set res = try_or_compiler_error(error_msg, modules.datetime.datetime.strptime, date_str.strip(), date_fmt) %}\n {{ return(res) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.dates_in_range": {"unique_id": "macro.dbt.dates_in_range", "package_name": "dbt", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/etc/datetime.sql", "original_file_path": "macros/etc/datetime.sql", "name": "dates_in_range", "macro_sql": "{% macro dates_in_range(start_date_str, end_date_str=none, in_fmt=\"%Y%m%d\", out_fmt=\"%Y%m%d\") %}\n {% set end_date_str = start_date_str if end_date_str is none else end_date_str %}\n\n {% set start_date = convert_datetime(start_date_str, in_fmt) %}\n {% set end_date = convert_datetime(end_date_str, in_fmt) %}\n\n {% set day_count = (end_date - start_date).days %}\n {% if day_count < 0 %}\n {% set msg -%}\n Partiton start date is after the end date ({{ start_date }}, {{ end_date }})\n {%- endset %}\n\n {{ exceptions.raise_compiler_error(msg, model) }}\n {% endif %}\n\n {% set date_list = [] %}\n {% for i in range(0, day_count + 1) %}\n {% set the_date = (modules.datetime.timedelta(days=i) + start_date) %}\n {% if not out_fmt %}\n {% set _ = date_list.append(the_date) %}\n {% else %}\n {% set _ = date_list.append(the_date.strftime(out_fmt)) %}\n {% endif %}\n {% endfor %}\n\n {{ return(date_list) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.partition_range": {"unique_id": "macro.dbt.partition_range", "package_name": "dbt", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/etc/datetime.sql", "original_file_path": "macros/etc/datetime.sql", "name": "partition_range", "macro_sql": "{% macro partition_range(raw_partition_date, date_fmt='%Y%m%d') %}\n {% set partition_range = (raw_partition_date | string).split(\",\") %}\n\n {% if (partition_range | length) == 1 %}\n {% set start_date = partition_range[0] %}\n {% set end_date = none %}\n {% elif (partition_range | length) == 2 %}\n {% set start_date = partition_range[0] %}\n {% set end_date = partition_range[1] %}\n {% else %}\n {{ exceptions.raise_compiler_error(\"Invalid partition time. Expected format: {Start Date}[,{End Date}]. Got: \" ~ raw_partition_date) }}\n {% endif %}\n\n {{ return(dates_in_range(start_date, end_date, in_fmt=date_fmt)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.py_current_timestring": {"unique_id": "macro.dbt.py_current_timestring", "package_name": "dbt", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/etc/datetime.sql", "original_file_path": "macros/etc/datetime.sql", "name": "py_current_timestring", "macro_sql": "{% macro py_current_timestring() %}\n {% set dt = modules.datetime.datetime.now() %}\n {% do return(dt.strftime(\"%Y%m%d%H%M%S%f\")) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.generate_schema_name": {"unique_id": "macro.dbt.generate_schema_name", "package_name": "dbt", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/etc/get_custom_schema.sql", "original_file_path": "macros/etc/get_custom_schema.sql", "name": "generate_schema_name", "macro_sql": "{% macro generate_schema_name(custom_schema_name, node) -%}\n\n {%- set default_schema = target.schema -%}\n {%- if custom_schema_name is none -%}\n\n {{ default_schema }}\n\n {%- else -%}\n\n {{ default_schema }}_{{ custom_schema_name | trim }}\n\n {%- endif -%}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.generate_schema_name_for_env": {"unique_id": "macro.dbt.generate_schema_name_for_env", "package_name": "dbt", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/etc/get_custom_schema.sql", "original_file_path": "macros/etc/get_custom_schema.sql", "name": "generate_schema_name_for_env", "macro_sql": "{% macro generate_schema_name_for_env(custom_schema_name, node) -%}\n\n {%- set default_schema = target.schema -%}\n {%- if target.name == 'prod' and custom_schema_name is not none -%}\n\n {{ custom_schema_name | trim }}\n\n {%- else -%}\n\n {{ default_schema }}\n\n {%- endif -%}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.generate_database_name": {"unique_id": "macro.dbt.generate_database_name", "package_name": "dbt", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/etc/get_custom_database.sql", "original_file_path": "macros/etc/get_custom_database.sql", "name": "generate_database_name", "macro_sql": "{% macro generate_database_name(custom_database_name=none, node=none) -%}\n {% do return(adapter.dispatch('generate_database_name')(custom_database_name, node)) %}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__generate_database_name"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.default__generate_database_name": {"unique_id": "macro.dbt.default__generate_database_name", "package_name": "dbt", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/etc/get_custom_database.sql", "original_file_path": "macros/etc/get_custom_database.sql", "name": "default__generate_database_name", "macro_sql": "{% macro default__generate_database_name(custom_database_name=none, node=none) -%}\n {%- set default_database = target.database -%}\n {%- if custom_database_name is none -%}\n\n {{ default_database }}\n\n {%- else -%}\n\n {{ custom_database_name }}\n\n {%- endif -%}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.get_columns_in_query": {"unique_id": "macro.dbt.get_columns_in_query", "package_name": "dbt", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "get_columns_in_query", "macro_sql": "{% macro get_columns_in_query(select_sql) -%}\n {{ return(adapter.dispatch('get_columns_in_query')(select_sql)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.default__get_columns_in_query": {"unique_id": "macro.dbt.default__get_columns_in_query", "package_name": "dbt", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "default__get_columns_in_query", "macro_sql": "{% macro default__get_columns_in_query(select_sql) %}\n {% call statement('get_columns_in_query', fetch_result=True, auto_begin=False) -%}\n select * from (\n {{ select_sql }}\n ) as __dbt_sbq\n where false\n limit 0\n {% endcall %}\n\n {{ return(load_result('get_columns_in_query').table.columns | map(attribute='name') | list) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.create_schema": {"unique_id": "macro.dbt.create_schema", "package_name": "dbt", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "create_schema", "macro_sql": "{% macro create_schema(relation) -%}\n {{ adapter.dispatch('create_schema')(relation) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.default__create_schema": {"unique_id": "macro.dbt.default__create_schema", "package_name": "dbt", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "default__create_schema", "macro_sql": "{% macro default__create_schema(relation) -%}\n {%- call statement('create_schema') -%}\n create schema if not exists {{ relation.without_identifier() }}\n {% endcall %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.drop_schema": {"unique_id": "macro.dbt.drop_schema", "package_name": "dbt", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "drop_schema", "macro_sql": "{% macro drop_schema(relation) -%}\n {{ adapter.dispatch('drop_schema')(relation) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.default__drop_schema": {"unique_id": "macro.dbt.default__drop_schema", "package_name": "dbt", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "default__drop_schema", "macro_sql": "{% macro default__drop_schema(relation) -%}\n {%- call statement('drop_schema') -%}\n drop schema if exists {{ relation.without_identifier() }} cascade\n {% endcall %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.create_table_as": {"unique_id": "macro.dbt.create_table_as", "package_name": "dbt", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "create_table_as", "macro_sql": "{% macro create_table_as(temporary, relation, sql) -%}\n {{ adapter.dispatch('create_table_as')(temporary, relation, sql) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.default__create_table_as": {"unique_id": "macro.dbt.default__create_table_as", "package_name": "dbt", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "default__create_table_as", "macro_sql": "{% macro default__create_table_as(temporary, relation, sql) -%}\n {%- set sql_header = config.get('sql_header', none) -%}\n\n {{ sql_header if sql_header is not none }}\n\n create {% if temporary: -%}temporary{%- endif %} table\n {{ relation.include(database=(not temporary), schema=(not temporary)) }}\n as (\n {{ sql }}\n );\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.create_view_as": {"unique_id": "macro.dbt.create_view_as", "package_name": "dbt", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "create_view_as", "macro_sql": "{% macro create_view_as(relation, sql) -%}\n {{ adapter.dispatch('create_view_as')(relation, sql) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.default__create_view_as": {"unique_id": "macro.dbt.default__create_view_as", "package_name": "dbt", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "default__create_view_as", "macro_sql": "{% macro default__create_view_as(relation, sql) -%}\n {%- set sql_header = config.get('sql_header', none) -%}\n\n {{ sql_header if sql_header is not none }}\n create view {{ relation }} as (\n {{ sql }}\n );\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.get_catalog": {"unique_id": "macro.dbt.get_catalog", "package_name": "dbt", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "get_catalog", "macro_sql": "{% macro get_catalog(information_schema, schemas) -%}\n {{ return(adapter.dispatch('get_catalog')(information_schema, schemas)) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__get_catalog"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.default__get_catalog": {"unique_id": "macro.dbt.default__get_catalog", "package_name": "dbt", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "default__get_catalog", "macro_sql": "{% macro default__get_catalog(information_schema, schemas) -%}\n\n {% set typename = adapter.type() %}\n {% set msg -%}\n get_catalog not implemented for {{ typename }}\n {%- endset %}\n\n {{ exceptions.raise_compiler_error(msg) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.get_columns_in_relation": {"unique_id": "macro.dbt.get_columns_in_relation", "package_name": "dbt", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "get_columns_in_relation", "macro_sql": "{% macro get_columns_in_relation(relation) -%}\n {{ return(adapter.dispatch('get_columns_in_relation')(relation)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.sql_convert_columns_in_relation": {"unique_id": "macro.dbt.sql_convert_columns_in_relation", "package_name": "dbt", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "sql_convert_columns_in_relation", "macro_sql": "{% macro sql_convert_columns_in_relation(table) -%}\n {% set columns = [] %}\n {% for row in table %}\n {% do columns.append(api.Column(*row)) %}\n {% endfor %}\n {{ return(columns) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.default__get_columns_in_relation": {"unique_id": "macro.dbt.default__get_columns_in_relation", "package_name": "dbt", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "default__get_columns_in_relation", "macro_sql": "{% macro default__get_columns_in_relation(relation) -%}\n {{ exceptions.raise_not_implemented(\n 'get_columns_in_relation macro not implemented for adapter '+adapter.type()) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.alter_column_type": {"unique_id": "macro.dbt.alter_column_type", "package_name": "dbt", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "alter_column_type", "macro_sql": "{% macro alter_column_type(relation, column_name, new_column_type) -%}\n {{ return(adapter.dispatch('alter_column_type')(relation, column_name, new_column_type)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.alter_column_comment": {"unique_id": "macro.dbt.alter_column_comment", "package_name": "dbt", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "alter_column_comment", "macro_sql": "{% macro alter_column_comment(relation, column_dict) -%}\n {{ return(adapter.dispatch('alter_column_comment')(relation, column_dict)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.default__alter_column_comment": {"unique_id": "macro.dbt.default__alter_column_comment", "package_name": "dbt", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "default__alter_column_comment", "macro_sql": "{% macro default__alter_column_comment(relation, column_dict) -%}\n {{ exceptions.raise_not_implemented(\n 'alter_column_comment macro not implemented for adapter '+adapter.type()) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.alter_relation_comment": {"unique_id": "macro.dbt.alter_relation_comment", "package_name": "dbt", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "alter_relation_comment", "macro_sql": "{% macro alter_relation_comment(relation, relation_comment) -%}\n {{ return(adapter.dispatch('alter_relation_comment')(relation, relation_comment)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.default__alter_relation_comment": {"unique_id": "macro.dbt.default__alter_relation_comment", "package_name": "dbt", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "default__alter_relation_comment", "macro_sql": "{% macro default__alter_relation_comment(relation, relation_comment) -%}\n {{ exceptions.raise_not_implemented(\n 'alter_relation_comment macro not implemented for adapter '+adapter.type()) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.persist_docs": {"unique_id": "macro.dbt.persist_docs", "package_name": "dbt", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "persist_docs", "macro_sql": "{% macro persist_docs(relation, model, for_relation=true, for_columns=true) -%}\n {{ return(adapter.dispatch('persist_docs')(relation, model, for_relation, for_columns)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.default__persist_docs": {"unique_id": "macro.dbt.default__persist_docs", "package_name": "dbt", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "default__persist_docs", "macro_sql": "{% macro default__persist_docs(relation, model, for_relation, for_columns) -%}\n {% if for_relation and config.persist_relation_docs() and model.description %}\n {% do run_query(alter_relation_comment(relation, model.description)) %}\n {% endif %}\n\n {% if for_columns and config.persist_column_docs() and model.columns %}\n {% do run_query(alter_column_comment(relation, model.columns)) %}\n {% endif %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.default__alter_column_type": {"unique_id": "macro.dbt.default__alter_column_type", "package_name": "dbt", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "default__alter_column_type", "macro_sql": "{% macro default__alter_column_type(relation, column_name, new_column_type) -%}\n {#\n 1. Create a new column (w/ temp name and correct type)\n 2. Copy data over to it\n 3. Drop the existing column (cascade!)\n 4. Rename the new column to existing column\n #}\n {%- set tmp_column = column_name + \"__dbt_alter\" -%}\n\n {% call statement('alter_column_type') %}\n alter table {{ relation }} add column {{ adapter.quote(tmp_column) }} {{ new_column_type }};\n update {{ relation }} set {{ adapter.quote(tmp_column) }} = {{ adapter.quote(column_name) }};\n alter table {{ relation }} drop column {{ adapter.quote(column_name) }} cascade;\n alter table {{ relation }} rename column {{ adapter.quote(tmp_column) }} to {{ adapter.quote(column_name) }}\n {% endcall %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.drop_relation": {"unique_id": "macro.dbt.drop_relation", "package_name": "dbt", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "drop_relation", "macro_sql": "{% macro drop_relation(relation) -%}\n {{ return(adapter.dispatch('drop_relation')(relation)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.default__drop_relation": {"unique_id": "macro.dbt.default__drop_relation", "package_name": "dbt", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "default__drop_relation", "macro_sql": "{% macro default__drop_relation(relation) -%}\n {% call statement('drop_relation', auto_begin=False) -%}\n drop {{ relation.type }} if exists {{ relation }} cascade\n {%- endcall %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.truncate_relation": {"unique_id": "macro.dbt.truncate_relation", "package_name": "dbt", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "truncate_relation", "macro_sql": "{% macro truncate_relation(relation) -%}\n {{ return(adapter.dispatch('truncate_relation')(relation)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.default__truncate_relation": {"unique_id": "macro.dbt.default__truncate_relation", "package_name": "dbt", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "default__truncate_relation", "macro_sql": "{% macro default__truncate_relation(relation) -%}\n {% call statement('truncate_relation') -%}\n truncate table {{ relation }}\n {%- endcall %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.rename_relation": {"unique_id": "macro.dbt.rename_relation", "package_name": "dbt", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "rename_relation", "macro_sql": "{% macro rename_relation(from_relation, to_relation) -%}\n {{ return(adapter.dispatch('rename_relation')(from_relation, to_relation)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.default__rename_relation": {"unique_id": "macro.dbt.default__rename_relation", "package_name": "dbt", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "default__rename_relation", "macro_sql": "{% macro default__rename_relation(from_relation, to_relation) -%}\n {% set target_name = adapter.quote_as_configured(to_relation.identifier, 'identifier') %}\n {% call statement('rename_relation') -%}\n alter table {{ from_relation }} rename to {{ target_name }}\n {%- endcall %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.information_schema_name": {"unique_id": "macro.dbt.information_schema_name", "package_name": "dbt", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "information_schema_name", "macro_sql": "{% macro information_schema_name(database) %}\n {{ return(adapter.dispatch('information_schema_name')(database)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.default__information_schema_name": {"unique_id": "macro.dbt.default__information_schema_name", "package_name": "dbt", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "default__information_schema_name", "macro_sql": "{% macro default__information_schema_name(database) -%}\n {%- if database -%}\n {{ database }}.INFORMATION_SCHEMA\n {%- else -%}\n INFORMATION_SCHEMA\n {%- endif -%}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.list_schemas": {"unique_id": "macro.dbt.list_schemas", "package_name": "dbt", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "list_schemas", "macro_sql": "{% macro list_schemas(database) -%}\n {{ return(adapter.dispatch('list_schemas')(database)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.default__list_schemas": {"unique_id": "macro.dbt.default__list_schemas", "package_name": "dbt", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "default__list_schemas", "macro_sql": "{% macro default__list_schemas(database) -%}\n {% set sql %}\n select distinct schema_name\n from {{ information_schema_name(database) }}.SCHEMATA\n where catalog_name ilike '{{ database }}'\n {% endset %}\n {{ return(run_query(sql)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.check_schema_exists": {"unique_id": "macro.dbt.check_schema_exists", "package_name": "dbt", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "check_schema_exists", "macro_sql": "{% macro check_schema_exists(information_schema, schema) -%}\n {{ return(adapter.dispatch('check_schema_exists')(information_schema, schema)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.default__check_schema_exists": {"unique_id": "macro.dbt.default__check_schema_exists", "package_name": "dbt", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "default__check_schema_exists", "macro_sql": "{% macro default__check_schema_exists(information_schema, schema) -%}\n {% set sql -%}\n select count(*)\n from {{ information_schema.replace(information_schema_view='SCHEMATA') }}\n where catalog_name='{{ information_schema.database }}'\n and schema_name='{{ schema }}'\n {%- endset %}\n {{ return(run_query(sql)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.list_relations_without_caching": {"unique_id": "macro.dbt.list_relations_without_caching", "package_name": "dbt", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "list_relations_without_caching", "macro_sql": "{% macro list_relations_without_caching(schema_relation) %}\n {{ return(adapter.dispatch('list_relations_without_caching')(schema_relation)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__list_relations_without_caching"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.default__list_relations_without_caching": {"unique_id": "macro.dbt.default__list_relations_without_caching", "package_name": "dbt", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "default__list_relations_without_caching", "macro_sql": "{% macro default__list_relations_without_caching(schema_relation) %}\n {{ exceptions.raise_not_implemented(\n 'list_relations_without_caching macro not implemented for adapter '+adapter.type()) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.current_timestamp": {"unique_id": "macro.dbt.current_timestamp", "package_name": "dbt", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "current_timestamp", "macro_sql": "{% macro current_timestamp() -%}\n {{ adapter.dispatch('current_timestamp')() }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.default__current_timestamp": {"unique_id": "macro.dbt.default__current_timestamp", "package_name": "dbt", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "default__current_timestamp", "macro_sql": "{% macro default__current_timestamp() -%}\n {{ exceptions.raise_not_implemented(\n 'current_timestamp macro not implemented for adapter '+adapter.type()) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.collect_freshness": {"unique_id": "macro.dbt.collect_freshness", "package_name": "dbt", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "collect_freshness", "macro_sql": "{% macro collect_freshness(source, loaded_at_field, filter) %}\n {{ return(adapter.dispatch('collect_freshness')(source, loaded_at_field, filter))}}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.default__collect_freshness": {"unique_id": "macro.dbt.default__collect_freshness", "package_name": "dbt", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "default__collect_freshness", "macro_sql": "{% macro default__collect_freshness(source, loaded_at_field, filter) %}\n {% call statement('collect_freshness', fetch_result=True, auto_begin=False) -%}\n select\n max({{ loaded_at_field }}) as max_loaded_at,\n {{ current_timestamp() }} as snapshotted_at\n from {{ source }}\n {% if filter %}\n where {{ filter }}\n {% endif %}\n {% endcall %}\n {{ return(load_result('collect_freshness').table) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.make_temp_relation": {"unique_id": "macro.dbt.make_temp_relation", "package_name": "dbt", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "make_temp_relation", "macro_sql": "{% macro make_temp_relation(base_relation, suffix='__dbt_tmp') %}\n {{ return(adapter.dispatch('make_temp_relation')(base_relation, suffix))}}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.default__make_temp_relation": {"unique_id": "macro.dbt.default__make_temp_relation", "package_name": "dbt", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "default__make_temp_relation", "macro_sql": "{% macro default__make_temp_relation(base_relation, suffix) %}\n {% set tmp_identifier = base_relation.identifier ~ suffix %}\n {% set tmp_relation = base_relation.incorporate(\n path={\"identifier\": tmp_identifier}) -%}\n\n {% do return(tmp_relation) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.set_sql_header": {"unique_id": "macro.dbt.set_sql_header", "package_name": "dbt", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "set_sql_header", "macro_sql": "{% macro set_sql_header(config) -%}\n {{ config.set('sql_header', caller()) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.default__test_relationships": {"unique_id": "macro.dbt.default__test_relationships", "package_name": "dbt", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/schema_tests/relationships.sql", "original_file_path": "macros/schema_tests/relationships.sql", "name": "default__test_relationships", "macro_sql": "{% macro default__test_relationships(model, to, field) %}\n\n{% set column_name = kwargs.get('column_name', kwargs.get('from')) %}\n\n\nselect count(*) as validation_errors\nfrom (\n select {{ column_name }} as id from {{ model }}\n) as child\nleft join (\n select {{ field }} as id from {{ to }}\n) as parent on parent.id = child.id\nwhere child.id is not null\n and parent.id is null\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.test_relationships": {"unique_id": "macro.dbt.test_relationships", "package_name": "dbt", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/schema_tests/relationships.sql", "original_file_path": "macros/schema_tests/relationships.sql", "name": "test_relationships", "macro_sql": "{% macro test_relationships(model, to, field) %}\n {% set macro = adapter.dispatch('test_relationships') %}\n {{ macro(model, to, field, **kwargs) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.default__test_not_null": {"unique_id": "macro.dbt.default__test_not_null", "package_name": "dbt", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/schema_tests/not_null.sql", "original_file_path": "macros/schema_tests/not_null.sql", "name": "default__test_not_null", "macro_sql": "{% macro default__test_not_null(model) %}\n\n{% set column_name = kwargs.get('column_name', kwargs.get('arg')) %}\n\nselect count(*) as validation_errors\nfrom {{ model }}\nwhere {{ column_name }} is null\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.test_not_null": {"unique_id": "macro.dbt.test_not_null", "package_name": "dbt", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/schema_tests/not_null.sql", "original_file_path": "macros/schema_tests/not_null.sql", "name": "test_not_null", "macro_sql": "{% macro test_not_null(model) %}\n {% set macro = adapter.dispatch('test_not_null') %}\n {{ macro(model, **kwargs) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.default__test_unique": {"unique_id": "macro.dbt.default__test_unique", "package_name": "dbt", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/schema_tests/unique.sql", "original_file_path": "macros/schema_tests/unique.sql", "name": "default__test_unique", "macro_sql": "{% macro default__test_unique(model) %}\n\n{% set column_name = kwargs.get('column_name', kwargs.get('arg')) %}\n\nselect count(*) as validation_errors\nfrom (\n\n select\n {{ column_name }}\n\n from {{ model }}\n where {{ column_name }} is not null\n group by {{ column_name }}\n having count(*) > 1\n\n) validation_errors\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.test_unique": {"unique_id": "macro.dbt.test_unique", "package_name": "dbt", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/schema_tests/unique.sql", "original_file_path": "macros/schema_tests/unique.sql", "name": "test_unique", "macro_sql": "{% macro test_unique(model) %}\n {% set macro = adapter.dispatch('test_unique') %}\n {{ macro(model, **kwargs) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.default__test_accepted_values": {"unique_id": "macro.dbt.default__test_accepted_values", "package_name": "dbt", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/schema_tests/accepted_values.sql", "original_file_path": "macros/schema_tests/accepted_values.sql", "name": "default__test_accepted_values", "macro_sql": "{% macro default__test_accepted_values(model, values) %}\n\n{% set column_name = kwargs.get('column_name', kwargs.get('field')) %}\n{% set quote_values = kwargs.get('quote', True) %}\n\nwith all_values as (\n\n select distinct\n {{ column_name }} as value_field\n\n from {{ model }}\n\n),\n\nvalidation_errors as (\n\n select\n value_field\n\n from all_values\n where value_field not in (\n {% for value in values -%}\n {% if quote_values -%}\n '{{ value }}'\n {%- else -%}\n {{ value }}\n {%- endif -%}\n {%- if not loop.last -%},{%- endif %}\n {%- endfor %}\n )\n)\n\nselect count(*) as validation_errors\nfrom validation_errors\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.test_accepted_values": {"unique_id": "macro.dbt.test_accepted_values", "package_name": "dbt", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/schema_tests/accepted_values.sql", "original_file_path": "macros/schema_tests/accepted_values.sql", "name": "test_accepted_values", "macro_sql": "{% macro test_accepted_values(model, values) %}\n {% set macro = adapter.dispatch('test_accepted_values') %}\n {{ macro(model, values, **kwargs) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.except": {"unique_id": "macro.dbt_utils.except", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/except.sql", "original_file_path": "macros/cross_db_utils/except.sql", "name": "except", "macro_sql": "{% macro except() %}\n {{ return(adapter.dispatch('except', packages = dbt_utils._get_utils_namespaces())()) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__except": {"unique_id": "macro.dbt_utils.default__except", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/except.sql", "original_file_path": "macros/cross_db_utils/except.sql", "name": "default__except", "macro_sql": "{% macro default__except() %}\n\n except\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.bigquery__except": {"unique_id": "macro.dbt_utils.bigquery__except", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/except.sql", "original_file_path": "macros/cross_db_utils/except.sql", "name": "bigquery__except", "macro_sql": "{% macro bigquery__except() %}\n\n except distinct\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.replace": {"unique_id": "macro.dbt_utils.replace", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/replace.sql", "original_file_path": "macros/cross_db_utils/replace.sql", "name": "replace", "macro_sql": "{% macro replace(field, old_chars, new_chars) -%}\n {{ return(adapter.dispatch('replace', packages = dbt_utils._get_utils_namespaces()) (field, old_chars, new_chars)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__replace": {"unique_id": "macro.dbt_utils.default__replace", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/replace.sql", "original_file_path": "macros/cross_db_utils/replace.sql", "name": "default__replace", "macro_sql": "{% macro default__replace(field, old_chars, new_chars) %}\n\n replace(\n {{ field }},\n {{ old_chars }},\n {{ new_chars }}\n )\n \n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.concat": {"unique_id": "macro.dbt_utils.concat", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/concat.sql", "original_file_path": "macros/cross_db_utils/concat.sql", "name": "concat", "macro_sql": "{% macro concat(fields) -%}\n {{ return(adapter.dispatch('concat', packages = dbt_utils._get_utils_namespaces())(fields)) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__concat": {"unique_id": "macro.dbt_utils.default__concat", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/concat.sql", "original_file_path": "macros/cross_db_utils/concat.sql", "name": "default__concat", "macro_sql": "{% macro default__concat(fields) -%}\n concat({{ fields|join(', ') }})\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.alternative_concat": {"unique_id": "macro.dbt_utils.alternative_concat", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/concat.sql", "original_file_path": "macros/cross_db_utils/concat.sql", "name": "alternative_concat", "macro_sql": "{% macro alternative_concat(fields) %}\n {{ fields|join(' || ') }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.redshift__concat": {"unique_id": "macro.dbt_utils.redshift__concat", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/concat.sql", "original_file_path": "macros/cross_db_utils/concat.sql", "name": "redshift__concat", "macro_sql": "{% macro redshift__concat(fields) %}\n {{ dbt_utils.alternative_concat(fields) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.snowflake__concat": {"unique_id": "macro.dbt_utils.snowflake__concat", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/concat.sql", "original_file_path": "macros/cross_db_utils/concat.sql", "name": "snowflake__concat", "macro_sql": "{% macro snowflake__concat(fields) %}\n {{ dbt_utils.alternative_concat(fields) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.type_string": {"unique_id": "macro.dbt_utils.type_string", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "type_string", "macro_sql": "\n\n{%- macro type_string() -%}\n {{ return(adapter.dispatch('type_string', packages = dbt_utils._get_utils_namespaces())()) }}\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__type_string": {"unique_id": "macro.dbt_utils.default__type_string", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "default__type_string", "macro_sql": "{% macro default__type_string() %}\n string\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.redshift__type_string": {"unique_id": "macro.dbt_utils.redshift__type_string", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "redshift__type_string", "macro_sql": "\n\n{%- macro redshift__type_string() -%}\n varchar\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.postgres__type_string": {"unique_id": "macro.dbt_utils.postgres__type_string", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "postgres__type_string", "macro_sql": "{% macro postgres__type_string() %}\n varchar\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.snowflake__type_string": {"unique_id": "macro.dbt_utils.snowflake__type_string", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "snowflake__type_string", "macro_sql": "{% macro snowflake__type_string() %}\n varchar\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.type_timestamp": {"unique_id": "macro.dbt_utils.type_timestamp", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "type_timestamp", "macro_sql": "\n\n{%- macro type_timestamp() -%}\n {{ return(adapter.dispatch('type_timestamp', packages = dbt_utils._get_utils_namespaces())()) }}\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__type_timestamp": {"unique_id": "macro.dbt_utils.default__type_timestamp", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "default__type_timestamp", "macro_sql": "{% macro default__type_timestamp() %}\n timestamp\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.snowflake__type_timestamp": {"unique_id": "macro.dbt_utils.snowflake__type_timestamp", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "snowflake__type_timestamp", "macro_sql": "{% macro snowflake__type_timestamp() %}\n timestamp_ntz\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.type_float": {"unique_id": "macro.dbt_utils.type_float", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "type_float", "macro_sql": "\n\n{%- macro type_float() -%}\n {{ return(adapter.dispatch('type_float', packages = dbt_utils._get_utils_namespaces())()) }}\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__type_float": {"unique_id": "macro.dbt_utils.default__type_float", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "default__type_float", "macro_sql": "{% macro default__type_float() %}\n float\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.bigquery__type_float": {"unique_id": "macro.dbt_utils.bigquery__type_float", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "bigquery__type_float", "macro_sql": "{% macro bigquery__type_float() %}\n float64\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.type_numeric": {"unique_id": "macro.dbt_utils.type_numeric", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "type_numeric", "macro_sql": "\n\n{%- macro type_numeric() -%}\n {{ return(adapter.dispatch('type_numeric', packages = dbt_utils._get_utils_namespaces())()) }}\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__type_numeric": {"unique_id": "macro.dbt_utils.default__type_numeric", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "default__type_numeric", "macro_sql": "{% macro default__type_numeric() %}\n numeric(28, 6)\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.bigquery__type_numeric": {"unique_id": "macro.dbt_utils.bigquery__type_numeric", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "bigquery__type_numeric", "macro_sql": "{% macro bigquery__type_numeric() %}\n numeric\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.type_bigint": {"unique_id": "macro.dbt_utils.type_bigint", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "type_bigint", "macro_sql": "\n\n{%- macro type_bigint() -%}\n {{ return(adapter.dispatch('type_bigint', packages = dbt_utils._get_utils_namespaces())()) }}\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__type_bigint": {"unique_id": "macro.dbt_utils.default__type_bigint", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "default__type_bigint", "macro_sql": "{% macro default__type_bigint() %}\n bigint\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.bigquery__type_bigint": {"unique_id": "macro.dbt_utils.bigquery__type_bigint", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "bigquery__type_bigint", "macro_sql": "{% macro bigquery__type_bigint() %}\n int64\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.type_int": {"unique_id": "macro.dbt_utils.type_int", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "type_int", "macro_sql": "\n\n{%- macro type_int() -%}\n {{ return(adapter.dispatch('type_int', packages = dbt_utils._get_utils_namespaces())()) }}\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__type_int": {"unique_id": "macro.dbt_utils.default__type_int", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "default__type_int", "macro_sql": "{% macro default__type_int() %}\n int\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.bigquery__type_int": {"unique_id": "macro.dbt_utils.bigquery__type_int", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "bigquery__type_int", "macro_sql": "{% macro bigquery__type_int() %}\n int64\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils._is_relation": {"unique_id": "macro.dbt_utils._is_relation", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/_is_relation.sql", "original_file_path": "macros/cross_db_utils/_is_relation.sql", "name": "_is_relation", "macro_sql": "{% macro _is_relation(obj, macro) %}\n {%- if not (obj is mapping and obj.get('metadata', {}).get('type', '').endswith('Relation')) -%}\n {%- do exceptions.raise_compiler_error(\"Macro \" ~ macro ~ \" expected a Relation but received the value: \" ~ obj) -%}\n {%- endif -%}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.length": {"unique_id": "macro.dbt_utils.length", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/length.sql", "original_file_path": "macros/cross_db_utils/length.sql", "name": "length", "macro_sql": "{% macro length(expression) -%}\n {{ return(adapter.dispatch('length', packages = dbt_utils._get_utils_namespaces()) (expression)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__length": {"unique_id": "macro.dbt_utils.default__length", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/length.sql", "original_file_path": "macros/cross_db_utils/length.sql", "name": "default__length", "macro_sql": "{% macro default__length(expression) %}\n \n length(\n {{ expression }}\n )\n \n{%- endmacro -%}\n\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.redshift__length": {"unique_id": "macro.dbt_utils.redshift__length", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/length.sql", "original_file_path": "macros/cross_db_utils/length.sql", "name": "redshift__length", "macro_sql": "{% macro redshift__length(expression) %}\n\n len(\n {{ expression }}\n )\n \n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.dateadd": {"unique_id": "macro.dbt_utils.dateadd", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/dateadd.sql", "original_file_path": "macros/cross_db_utils/dateadd.sql", "name": "dateadd", "macro_sql": "{% macro dateadd(datepart, interval, from_date_or_timestamp) %}\n {{ return(adapter.dispatch('dateadd', packages = dbt_utils._get_utils_namespaces())(datepart, interval, from_date_or_timestamp)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__dateadd": {"unique_id": "macro.dbt_utils.default__dateadd", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/dateadd.sql", "original_file_path": "macros/cross_db_utils/dateadd.sql", "name": "default__dateadd", "macro_sql": "{% macro default__dateadd(datepart, interval, from_date_or_timestamp) %}\n\n dateadd(\n {{ datepart }},\n {{ interval }},\n {{ from_date_or_timestamp }}\n )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.bigquery__dateadd": {"unique_id": "macro.dbt_utils.bigquery__dateadd", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/dateadd.sql", "original_file_path": "macros/cross_db_utils/dateadd.sql", "name": "bigquery__dateadd", "macro_sql": "{% macro bigquery__dateadd(datepart, interval, from_date_or_timestamp) %}\n\n datetime_add(\n cast( {{ from_date_or_timestamp }} as datetime),\n interval {{ interval }} {{ datepart }}\n )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.postgres__dateadd": {"unique_id": "macro.dbt_utils.postgres__dateadd", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/dateadd.sql", "original_file_path": "macros/cross_db_utils/dateadd.sql", "name": "postgres__dateadd", "macro_sql": "{% macro postgres__dateadd(datepart, interval, from_date_or_timestamp) %}\n\n {{ from_date_or_timestamp }} + ((interval '1 {{ datepart }}') * ({{ interval }}))\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.intersect": {"unique_id": "macro.dbt_utils.intersect", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/intersect.sql", "original_file_path": "macros/cross_db_utils/intersect.sql", "name": "intersect", "macro_sql": "{% macro intersect() %}\n {{ return(adapter.dispatch('intersect', packages = dbt_utils._get_utils_namespaces())()) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__intersect": {"unique_id": "macro.dbt_utils.default__intersect", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/intersect.sql", "original_file_path": "macros/cross_db_utils/intersect.sql", "name": "default__intersect", "macro_sql": "{% macro default__intersect() %}\n\n intersect\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.bigquery__intersect": {"unique_id": "macro.dbt_utils.bigquery__intersect", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/intersect.sql", "original_file_path": "macros/cross_db_utils/intersect.sql", "name": "bigquery__intersect", "macro_sql": "{% macro bigquery__intersect() %}\n\n intersect distinct\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.right": {"unique_id": "macro.dbt_utils.right", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/right.sql", "original_file_path": "macros/cross_db_utils/right.sql", "name": "right", "macro_sql": "{% macro right(string_text, length_expression) -%}\n {{ return(adapter.dispatch('right', packages = dbt_utils._get_utils_namespaces()) (string_text, length_expression)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__right": {"unique_id": "macro.dbt_utils.default__right", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/right.sql", "original_file_path": "macros/cross_db_utils/right.sql", "name": "default__right", "macro_sql": "{% macro default__right(string_text, length_expression) %}\n\n right(\n {{ string_text }},\n {{ length_expression }}\n )\n \n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.bigquery__right": {"unique_id": "macro.dbt_utils.bigquery__right", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/right.sql", "original_file_path": "macros/cross_db_utils/right.sql", "name": "bigquery__right", "macro_sql": "{% macro bigquery__right(string_text, length_expression) %}\n\n case when {{ length_expression }} = 0 \n then ''\n else \n substr(\n {{ string_text }},\n -1 * ({{ length_expression }})\n )\n end\n\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.snowflake__right": {"unique_id": "macro.dbt_utils.snowflake__right", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/right.sql", "original_file_path": "macros/cross_db_utils/right.sql", "name": "snowflake__right", "macro_sql": "{% macro snowflake__right(string_text, length_expression) %}\n\n case when {{ length_expression }} = 0 \n then ''\n else \n right(\n {{ string_text }},\n {{ length_expression }}\n )\n end\n\n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.datediff": {"unique_id": "macro.dbt_utils.datediff", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/datediff.sql", "original_file_path": "macros/cross_db_utils/datediff.sql", "name": "datediff", "macro_sql": "{% macro datediff(first_date, second_date, datepart) %}\n {{ return(adapter.dispatch('datediff', packages = dbt_utils._get_utils_namespaces())(first_date, second_date, datepart)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__datediff": {"unique_id": "macro.dbt_utils.default__datediff", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/datediff.sql", "original_file_path": "macros/cross_db_utils/datediff.sql", "name": "default__datediff", "macro_sql": "{% macro default__datediff(first_date, second_date, datepart) %}\n\n datediff(\n {{ datepart }},\n {{ first_date }},\n {{ second_date }}\n )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.bigquery__datediff": {"unique_id": "macro.dbt_utils.bigquery__datediff", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/datediff.sql", "original_file_path": "macros/cross_db_utils/datediff.sql", "name": "bigquery__datediff", "macro_sql": "{% macro bigquery__datediff(first_date, second_date, datepart) %}\n\n datetime_diff(\n cast({{second_date}} as datetime),\n cast({{first_date}} as datetime),\n {{datepart}}\n )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.postgres__datediff": {"unique_id": "macro.dbt_utils.postgres__datediff", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/datediff.sql", "original_file_path": "macros/cross_db_utils/datediff.sql", "name": "postgres__datediff", "macro_sql": "{% macro postgres__datediff(first_date, second_date, datepart) %}\n\n {% if datepart == 'year' %}\n (date_part('year', ({{second_date}})::date) - date_part('year', ({{first_date}})::date))\n {% elif datepart == 'quarter' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'year') }} * 4 + date_part('quarter', ({{second_date}})::date) - date_part('quarter', ({{first_date}})::date))\n {% elif datepart == 'month' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'year') }} * 12 + date_part('month', ({{second_date}})::date) - date_part('month', ({{first_date}})::date))\n {% elif datepart == 'day' %}\n (({{second_date}})::date - ({{first_date}})::date)\n {% elif datepart == 'week' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'day') }} / 7 + case\n when date_part('dow', ({{first_date}})::timestamp) <= date_part('dow', ({{second_date}})::timestamp) then\n case when {{first_date}} <= {{second_date}} then 0 else -1 end\n else\n case when {{first_date}} <= {{second_date}} then 1 else 0 end\n end)\n {% elif datepart == 'hour' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'day') }} * 24 + date_part('hour', ({{second_date}})::timestamp) - date_part('hour', ({{first_date}})::timestamp))\n {% elif datepart == 'minute' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'hour') }} * 60 + date_part('minute', ({{second_date}})::timestamp) - date_part('minute', ({{first_date}})::timestamp))\n {% elif datepart == 'second' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'minute') }} * 60 + floor(date_part('second', ({{second_date}})::timestamp)) - floor(date_part('second', ({{first_date}})::timestamp)))\n {% elif datepart == 'millisecond' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'minute') }} * 60000 + floor(date_part('millisecond', ({{second_date}})::timestamp)) - floor(date_part('millisecond', ({{first_date}})::timestamp)))\n {% elif datepart == 'microsecond' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'minute') }} * 60000000 + floor(date_part('microsecond', ({{second_date}})::timestamp)) - floor(date_part('microsecond', ({{first_date}})::timestamp)))\n {% else %}\n {{ exceptions.raise_compiler_error(\"Unsupported datepart for macro datediff in postgres: {!r}\".format(datepart)) }}\n {% endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.safe_cast": {"unique_id": "macro.dbt_utils.safe_cast", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/safe_cast.sql", "original_file_path": "macros/cross_db_utils/safe_cast.sql", "name": "safe_cast", "macro_sql": "{% macro safe_cast(field, type) %}\n {{ return(adapter.dispatch('safe_cast', packages = dbt_utils._get_utils_namespaces()) (field, type)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__safe_cast": {"unique_id": "macro.dbt_utils.default__safe_cast", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/safe_cast.sql", "original_file_path": "macros/cross_db_utils/safe_cast.sql", "name": "default__safe_cast", "macro_sql": "{% macro default__safe_cast(field, type) %}\n {# most databases don't support this function yet\n so we just need to use cast #}\n cast({{field}} as {{type}})\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.snowflake__safe_cast": {"unique_id": "macro.dbt_utils.snowflake__safe_cast", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/safe_cast.sql", "original_file_path": "macros/cross_db_utils/safe_cast.sql", "name": "snowflake__safe_cast", "macro_sql": "{% macro snowflake__safe_cast(field, type) %}\n try_cast({{field}} as {{type}})\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.bigquery__safe_cast": {"unique_id": "macro.dbt_utils.bigquery__safe_cast", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/safe_cast.sql", "original_file_path": "macros/cross_db_utils/safe_cast.sql", "name": "bigquery__safe_cast", "macro_sql": "{% macro bigquery__safe_cast(field, type) %}\n safe_cast({{field}} as {{type}})\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.hash": {"unique_id": "macro.dbt_utils.hash", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/hash.sql", "original_file_path": "macros/cross_db_utils/hash.sql", "name": "hash", "macro_sql": "{% macro hash(field) -%}\n {{ return(adapter.dispatch('hash', packages = dbt_utils._get_utils_namespaces()) (field)) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__hash": {"unique_id": "macro.dbt_utils.default__hash", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/hash.sql", "original_file_path": "macros/cross_db_utils/hash.sql", "name": "default__hash", "macro_sql": "{% macro default__hash(field) -%}\n md5(cast({{field}} as {{dbt_utils.type_string()}}))\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.bigquery__hash": {"unique_id": "macro.dbt_utils.bigquery__hash", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/hash.sql", "original_file_path": "macros/cross_db_utils/hash.sql", "name": "bigquery__hash", "macro_sql": "{% macro bigquery__hash(field) -%}\n to_hex({{dbt_utils.default__hash(field)}})\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.identifier": {"unique_id": "macro.dbt_utils.identifier", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/identifier.sql", "original_file_path": "macros/cross_db_utils/identifier.sql", "name": "identifier", "macro_sql": "{% macro identifier(value) %}\t\n {%- set error_message = '\n Warning: the `identifier` macro is no longer supported and will be deprecated in a future release of dbt-utils. \\\n Use `adapter.quote` instead. The {}.{} model triggered this warning. \\\n '.format(model.package_name, model.name) -%}\n {%- do exceptions.warn(error_message) -%}\n {{ return(adapter.dispatch('identifier', packages = dbt_utils._get_utils_namespaces()) (value)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__identifier": {"unique_id": "macro.dbt_utils.default__identifier", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/identifier.sql", "original_file_path": "macros/cross_db_utils/identifier.sql", "name": "default__identifier", "macro_sql": "{% macro default__identifier(value) -%}\t\n \"{{ value }}\"\t\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.bigquery__identifier": {"unique_id": "macro.dbt_utils.bigquery__identifier", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/identifier.sql", "original_file_path": "macros/cross_db_utils/identifier.sql", "name": "bigquery__identifier", "macro_sql": "{% macro bigquery__identifier(value) -%}\t\n `{{ value }}`\t\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.position": {"unique_id": "macro.dbt_utils.position", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/position.sql", "original_file_path": "macros/cross_db_utils/position.sql", "name": "position", "macro_sql": "{% macro position(substring_text, string_text) -%}\n {{ return(adapter.dispatch('position', packages = dbt_utils._get_utils_namespaces()) (substring_text, string_text)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__position": {"unique_id": "macro.dbt_utils.default__position", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/position.sql", "original_file_path": "macros/cross_db_utils/position.sql", "name": "default__position", "macro_sql": "{% macro default__position(substring_text, string_text) %}\n\n position(\n {{ substring_text }} in {{ string_text }}\n )\n \n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.bigquery__position": {"unique_id": "macro.dbt_utils.bigquery__position", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/position.sql", "original_file_path": "macros/cross_db_utils/position.sql", "name": "bigquery__position", "macro_sql": "{% macro bigquery__position(substring_text, string_text) %}\n\n strpos(\n {{ string_text }},\n {{ substring_text }}\n \n )\n \n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.string_literal": {"unique_id": "macro.dbt_utils.string_literal", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/literal.sql", "original_file_path": "macros/cross_db_utils/literal.sql", "name": "string_literal", "macro_sql": "{%- macro string_literal(value) -%}\n {{ return(adapter.dispatch('string_literal', packages = dbt_utils._get_utils_namespaces()) (value)) }}\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__string_literal": {"unique_id": "macro.dbt_utils.default__string_literal", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/literal.sql", "original_file_path": "macros/cross_db_utils/literal.sql", "name": "default__string_literal", "macro_sql": "{% macro default__string_literal(value) -%}\n '{{ value }}'\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.current_timestamp": {"unique_id": "macro.dbt_utils.current_timestamp", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/current_timestamp.sql", "original_file_path": "macros/cross_db_utils/current_timestamp.sql", "name": "current_timestamp", "macro_sql": "{% macro current_timestamp() -%}\n {{ return(adapter.dispatch('current_timestamp', packages = dbt_utils._get_utils_namespaces())()) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__current_timestamp": {"unique_id": "macro.dbt_utils.default__current_timestamp", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/current_timestamp.sql", "original_file_path": "macros/cross_db_utils/current_timestamp.sql", "name": "default__current_timestamp", "macro_sql": "{% macro default__current_timestamp() %}\n current_timestamp::{{dbt_utils.type_timestamp()}}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.redshift__current_timestamp": {"unique_id": "macro.dbt_utils.redshift__current_timestamp", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/current_timestamp.sql", "original_file_path": "macros/cross_db_utils/current_timestamp.sql", "name": "redshift__current_timestamp", "macro_sql": "{% macro redshift__current_timestamp() %}\n getdate()\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.bigquery__current_timestamp": {"unique_id": "macro.dbt_utils.bigquery__current_timestamp", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/current_timestamp.sql", "original_file_path": "macros/cross_db_utils/current_timestamp.sql", "name": "bigquery__current_timestamp", "macro_sql": "{% macro bigquery__current_timestamp() %}\n current_timestamp\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.current_timestamp_in_utc": {"unique_id": "macro.dbt_utils.current_timestamp_in_utc", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/current_timestamp.sql", "original_file_path": "macros/cross_db_utils/current_timestamp.sql", "name": "current_timestamp_in_utc", "macro_sql": "{% macro current_timestamp_in_utc() -%}\n {{ return(adapter.dispatch('current_timestamp_in_utc', packages = dbt_utils._get_utils_namespaces())()) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__current_timestamp_in_utc": {"unique_id": "macro.dbt_utils.default__current_timestamp_in_utc", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/current_timestamp.sql", "original_file_path": "macros/cross_db_utils/current_timestamp.sql", "name": "default__current_timestamp_in_utc", "macro_sql": "{% macro default__current_timestamp_in_utc() %}\n {{dbt_utils.current_timestamp()}}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.snowflake__current_timestamp_in_utc": {"unique_id": "macro.dbt_utils.snowflake__current_timestamp_in_utc", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/current_timestamp.sql", "original_file_path": "macros/cross_db_utils/current_timestamp.sql", "name": "snowflake__current_timestamp_in_utc", "macro_sql": "{% macro snowflake__current_timestamp_in_utc() %}\n convert_timezone('UTC', {{dbt_utils.current_timestamp()}})::{{dbt_utils.type_timestamp()}}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.postgres__current_timestamp_in_utc": {"unique_id": "macro.dbt_utils.postgres__current_timestamp_in_utc", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/current_timestamp.sql", "original_file_path": "macros/cross_db_utils/current_timestamp.sql", "name": "postgres__current_timestamp_in_utc", "macro_sql": "{% macro postgres__current_timestamp_in_utc() %}\n (current_timestamp at time zone 'utc')::{{dbt_utils.type_timestamp()}}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.width_bucket": {"unique_id": "macro.dbt_utils.width_bucket", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/width_bucket.sql", "original_file_path": "macros/cross_db_utils/width_bucket.sql", "name": "width_bucket", "macro_sql": "{% macro width_bucket(expr, min_value, max_value, num_buckets) %}\n {{ return(adapter.dispatch('width_bucket', packages = dbt_utils._get_utils_namespaces()) (expr, min_value, max_value, num_buckets)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__width_bucket": {"unique_id": "macro.dbt_utils.default__width_bucket", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/width_bucket.sql", "original_file_path": "macros/cross_db_utils/width_bucket.sql", "name": "default__width_bucket", "macro_sql": "{% macro default__width_bucket(expr, min_value, max_value, num_buckets) -%}\n\n {% set bin_size -%}\n (( {{ max_value }} - {{ min_value }} ) / {{ num_buckets }} )\n {%- endset %}\n (\n -- to break ties when the amount is eaxtly at the bucket egde\n case\n when\n mod(\n {{ dbt_utils.safe_cast(expr, dbt_utils.type_numeric() ) }},\n {{ dbt_utils.safe_cast(bin_size, dbt_utils.type_numeric() ) }}\n ) = 0\n then 1\n else 0\n end\n ) +\n -- Anything over max_value goes the N+1 bucket\n least(\n ceil(\n ({{ expr }} - {{ min_value }})/{{ bin_size }}\n ),\n {{ num_buckets }} + 1\n )\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.redshift__width_bucket": {"unique_id": "macro.dbt_utils.redshift__width_bucket", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/width_bucket.sql", "original_file_path": "macros/cross_db_utils/width_bucket.sql", "name": "redshift__width_bucket", "macro_sql": "{% macro redshift__width_bucket(expr, min_value, max_value, num_buckets) -%}\n\n {% set bin_size -%}\n (( {{ max_value }} - {{ min_value }} ) / {{ num_buckets }} )\n {%- endset %}\n (\n -- to break ties when the amount is exactly at the bucket edge\n case\n when\n {{ dbt_utils.safe_cast(expr, dbt_utils.type_numeric() ) }} %\n {{ dbt_utils.safe_cast(bin_size, dbt_utils.type_numeric() ) }}\n = 0\n then 1\n else 0\n end\n ) +\n -- Anything over max_value goes the N+1 bucket\n least(\n ceil(\n ({{ expr }} - {{ min_value }})/{{ bin_size }}\n ),\n {{ num_buckets }} + 1\n )\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.snowflake__width_bucket": {"unique_id": "macro.dbt_utils.snowflake__width_bucket", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/width_bucket.sql", "original_file_path": "macros/cross_db_utils/width_bucket.sql", "name": "snowflake__width_bucket", "macro_sql": "{% macro snowflake__width_bucket(expr, min_value, max_value, num_buckets) %}\n width_bucket({{ expr }}, {{ min_value }}, {{ max_value }}, {{ num_buckets }} )\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils._get_utils_namespaces": {"unique_id": "macro.dbt_utils._get_utils_namespaces", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/_get_utils_namespaces.sql", "original_file_path": "macros/cross_db_utils/_get_utils_namespaces.sql", "name": "_get_utils_namespaces", "macro_sql": "{% macro _get_utils_namespaces() %}\n {% set override_namespaces = var('dbt_utils_dispatch_list', []) %}\n {% do return(override_namespaces + ['dbt_utils']) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.last_day": {"unique_id": "macro.dbt_utils.last_day", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/last_day.sql", "original_file_path": "macros/cross_db_utils/last_day.sql", "name": "last_day", "macro_sql": "{% macro last_day(date, datepart) %}\n {{ return(adapter.dispatch('last_day', packages = dbt_utils._get_utils_namespaces()) (date, datepart)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default_last_day": {"unique_id": "macro.dbt_utils.default_last_day", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/last_day.sql", "original_file_path": "macros/cross_db_utils/last_day.sql", "name": "default_last_day", "macro_sql": "\n\n\n{%- macro default_last_day(date, datepart) -%}\n cast(\n {{dbt_utils.dateadd('day', '-1',\n dbt_utils.dateadd(datepart, '1', dbt_utils.date_trunc(datepart, date))\n )}}\n as date)\n{%- endmacro -%}\n\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__last_day": {"unique_id": "macro.dbt_utils.default__last_day", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/last_day.sql", "original_file_path": "macros/cross_db_utils/last_day.sql", "name": "default__last_day", "macro_sql": "{% macro default__last_day(date, datepart) -%}\n {{dbt_utils.default_last_day(date, datepart)}}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.postgres__last_day": {"unique_id": "macro.dbt_utils.postgres__last_day", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/last_day.sql", "original_file_path": "macros/cross_db_utils/last_day.sql", "name": "postgres__last_day", "macro_sql": "{% macro postgres__last_day(date, datepart) -%}\n\n {%- if datepart == 'quarter' -%}\n {{ exceptions.raise_compiler_error(\n \"dbt_utils.last_day is not supported for datepart 'quarter' on this adapter\") }}\n {%- else -%}\n {{dbt_utils.default_last_day(date, datepart)}}\n {%- endif -%}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.split_part": {"unique_id": "macro.dbt_utils.split_part", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/split_part.sql", "original_file_path": "macros/cross_db_utils/split_part.sql", "name": "split_part", "macro_sql": "{% macro split_part(string_text, delimiter_text, part_number) %}\n {{ return(adapter.dispatch('split_part', packages = dbt_utils._get_utils_namespaces()) (string_text, delimiter_text, part_number)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__split_part": {"unique_id": "macro.dbt_utils.default__split_part", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/split_part.sql", "original_file_path": "macros/cross_db_utils/split_part.sql", "name": "default__split_part", "macro_sql": "{% macro default__split_part(string_text, delimiter_text, part_number) %}\n\n split_part(\n {{ string_text }},\n {{ delimiter_text }},\n {{ part_number }}\n )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.bigquery__split_part": {"unique_id": "macro.dbt_utils.bigquery__split_part", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/split_part.sql", "original_file_path": "macros/cross_db_utils/split_part.sql", "name": "bigquery__split_part", "macro_sql": "{% macro bigquery__split_part(string_text, delimiter_text, part_number) %}\n\n split(\n {{ string_text }},\n {{ delimiter_text }}\n )[safe_offset({{ part_number - 1 }})]\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.date_trunc": {"unique_id": "macro.dbt_utils.date_trunc", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/date_trunc.sql", "original_file_path": "macros/cross_db_utils/date_trunc.sql", "name": "date_trunc", "macro_sql": "{% macro date_trunc(datepart, date) -%}\n {{ return(adapter.dispatch('date_trunc', packages = dbt_utils._get_utils_namespaces()) (datepart, date)) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__date_trunc": {"unique_id": "macro.dbt_utils.default__date_trunc", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/date_trunc.sql", "original_file_path": "macros/cross_db_utils/date_trunc.sql", "name": "default__date_trunc", "macro_sql": "{% macro default__date_trunc(datepart, date) %}\n date_trunc('{{datepart}}', {{date}})\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.bigquery__date_trunc": {"unique_id": "macro.dbt_utils.bigquery__date_trunc", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/date_trunc.sql", "original_file_path": "macros/cross_db_utils/date_trunc.sql", "name": "bigquery__date_trunc", "macro_sql": "{% macro bigquery__date_trunc(datepart, date) %}\n timestamp_trunc(\n cast({{date}} as timestamp),\n {{datepart}}\n )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils._is_ephemeral": {"unique_id": "macro.dbt_utils._is_ephemeral", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/_is_ephemeral.sql", "original_file_path": "macros/cross_db_utils/_is_ephemeral.sql", "name": "_is_ephemeral", "macro_sql": "{% macro _is_ephemeral(obj, macro) %}\n {%- if obj.is_cte -%}\n {% set ephemeral_prefix = api.Relation.add_ephemeral_prefix('') %}\n {% if obj.name.startswith(ephemeral_prefix) %}\n {% set model_name = obj.name[(ephemeral_prefix|length):] %}\n {% else %}\n {% set model_name = obj.name %}\n {%- endif -%}\n {% set error_message %}\nThe `{{ macro }}` macro cannot be used with ephemeral models, as it relies on the information schema.\n\n`{{ model_name }}` is an ephemeral model. Consider making it a view or table instead.\n {% endset %}\n {%- do exceptions.raise_compiler_error(error_message) -%}\n {%- endif -%}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.get_period_boundaries": {"unique_id": "macro.dbt_utils.get_period_boundaries", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/materializations/insert_by_period_materialization.sql", "original_file_path": "macros/materializations/insert_by_period_materialization.sql", "name": "get_period_boundaries", "macro_sql": "{% macro get_period_boundaries(target_schema, target_table, timestamp_field, start_date, stop_date, period) -%}\n {{ return(adapter.dispatch('get_period_boundaries', packages = dbt_utils._get_utils_namespaces())(target_schema, target_table, timestamp_field, start_date, stop_date, period)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__get_period_boundaries": {"unique_id": "macro.dbt_utils.default__get_period_boundaries", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/materializations/insert_by_period_materialization.sql", "original_file_path": "macros/materializations/insert_by_period_materialization.sql", "name": "default__get_period_boundaries", "macro_sql": "{% macro default__get_period_boundaries(target_schema, target_table, timestamp_field, start_date, stop_date, period) -%}\n\n {% call statement('period_boundaries', fetch_result=True) -%}\n with data as (\n select\n coalesce(max(\"{{timestamp_field}}\"), '{{start_date}}')::timestamp as start_timestamp,\n coalesce(\n {{dbt_utils.dateadd('millisecond',\n -1,\n \"nullif('\" ~ stop_date ~ \"','')::timestamp\")}},\n {{dbt_utils.current_timestamp()}}\n ) as stop_timestamp\n from \"{{target_schema}}\".\"{{target_table}}\"\n )\n\n select\n start_timestamp,\n stop_timestamp,\n {{dbt_utils.datediff('start_timestamp',\n 'stop_timestamp',\n period)}} + 1 as num_periods\n from data\n {%- endcall %}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.get_period_sql": {"unique_id": "macro.dbt_utils.get_period_sql", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/materializations/insert_by_period_materialization.sql", "original_file_path": "macros/materializations/insert_by_period_materialization.sql", "name": "get_period_sql", "macro_sql": "{% macro get_period_sql(target_cols_csv, sql, timestamp_field, period, start_timestamp, stop_timestamp, offset) -%}\n {{ return(adapter.dispatch('get_period_sql', packages = dbt_utils._get_utils_namespaces())(target_cols_csv, sql, timestamp_field, period, start_timestamp, stop_timestamp, offset)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__get_period_sql": {"unique_id": "macro.dbt_utils.default__get_period_sql", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/materializations/insert_by_period_materialization.sql", "original_file_path": "macros/materializations/insert_by_period_materialization.sql", "name": "default__get_period_sql", "macro_sql": "{% macro default__get_period_sql(target_cols_csv, sql, timestamp_field, period, start_timestamp, stop_timestamp, offset) -%}\n\n {%- set period_filter -%}\n (\"{{timestamp_field}}\" > '{{start_timestamp}}'::timestamp + interval '{{offset}} {{period}}' and\n \"{{timestamp_field}}\" <= '{{start_timestamp}}'::timestamp + interval '{{offset}} {{period}}' + interval '1 {{period}}' and\n \"{{timestamp_field}}\" < '{{stop_timestamp}}'::timestamp)\n {%- endset -%}\n\n {%- set filtered_sql = sql | replace(\"__PERIOD_FILTER__\", period_filter) -%}\n\n select\n {{target_cols_csv}}\n from (\n {{filtered_sql}}\n )\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.materialization_insert_by_period_default": {"unique_id": "macro.dbt_utils.materialization_insert_by_period_default", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/materializations/insert_by_period_materialization.sql", "original_file_path": "macros/materializations/insert_by_period_materialization.sql", "name": "materialization_insert_by_period_default", "macro_sql": "{% materialization insert_by_period, default -%}\n {%- set timestamp_field = config.require('timestamp_field') -%}\n {%- set start_date = config.require('start_date') -%}\n {%- set stop_date = config.get('stop_date') or '' -%}}\n {%- set period = config.get('period') or 'week' -%}\n\n {%- if sql.find('__PERIOD_FILTER__') == -1 -%}\n {%- set error_message -%}\n Model '{{ model.unique_id }}' does not include the required string '__PERIOD_FILTER__' in its sql\n {%- endset -%}\n {{ exceptions.raise_compiler_error(error_message) }}\n {%- endif -%}\n\n {%- set identifier = model['name'] -%}\n\n {%- set old_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) -%}\n {%- set target_relation = api.Relation.create(identifier=identifier, schema=schema, type='table') -%}\n\n {%- set non_destructive_mode = (flags.NON_DESTRUCTIVE == True) -%}\n {%- set full_refresh_mode = (flags.FULL_REFRESH == True) -%}\n\n {%- set exists_as_table = (old_relation is not none and old_relation.is_table) -%}\n {%- set exists_not_as_table = (old_relation is not none and not old_relation.is_table) -%}\n\n {%- set should_truncate = (non_destructive_mode and full_refresh_mode and exists_as_table) -%}\n {%- set should_drop = (not should_truncate and (full_refresh_mode or exists_not_as_table)) -%}\n {%- set force_create = (flags.FULL_REFRESH and not flags.NON_DESTRUCTIVE) -%}\n\n -- setup\n {% if old_relation is none -%}\n -- noop\n {%- elif should_truncate -%}\n {{adapter.truncate_relation(old_relation)}}\n {%- elif should_drop -%}\n {{adapter.drop_relation(old_relation)}}\n {%- set old_relation = none -%}\n {%- endif %}\n\n {{run_hooks(pre_hooks, inside_transaction=False)}}\n\n -- `begin` happens here, so `commit` after it to finish the transaction\n {{run_hooks(pre_hooks, inside_transaction=True)}}\n {% call statement() -%}\n begin; -- make extra sure we've closed out the transaction\n commit;\n {%- endcall %}\n\n -- build model\n {% if force_create or old_relation is none -%}\n {# Create an empty target table -#}\n {% call statement('main') -%}\n {%- set empty_sql = sql | replace(\"__PERIOD_FILTER__\", 'false') -%}\n {{create_table_as(False, target_relation, empty_sql)}};\n {%- endcall %}\n {%- endif %}\n\n {% set _ = dbt_utils.get_period_boundaries(schema,\n identifier,\n timestamp_field,\n start_date,\n stop_date,\n period) %}\n {%- set start_timestamp = load_result('period_boundaries')['data'][0][0] | string -%}\n {%- set stop_timestamp = load_result('period_boundaries')['data'][0][1] | string -%}\n {%- set num_periods = load_result('period_boundaries')['data'][0][2] | int -%}\n\n {% set target_columns = adapter.get_columns_in_relation(target_relation) %}\n {%- set target_cols_csv = target_columns | map(attribute='quoted') | join(', ') -%}\n {%- set loop_vars = {'sum_rows_inserted': 0} -%}\n\n -- commit each period as a separate transaction\n {% for i in range(num_periods) -%}\n {%- set msg = \"Running for \" ~ period ~ \" \" ~ (i + 1) ~ \" of \" ~ (num_periods) -%}\n {{ dbt_utils.log_info(msg) }}\n\n {%- set tmp_identifier = model['name'] ~ '__dbt_incremental_period' ~ i ~ '_tmp' -%}\n {%- set tmp_relation = api.Relation.create(identifier=tmp_identifier,\n schema=schema, type='table') -%}\n {% call statement() -%}\n {% set tmp_table_sql = dbt_utils.get_period_sql(target_cols_csv,\n sql,\n timestamp_field,\n period,\n start_timestamp,\n stop_timestamp,\n i) %}\n {{dbt.create_table_as(True, tmp_relation, tmp_table_sql)}}\n {%- endcall %}\n\n {{adapter.expand_target_column_types(from_relation=tmp_relation,\n to_relation=target_relation)}}\n {%- set name = 'main-' ~ i -%}\n {% call statement(name, fetch_result=True) -%}\n insert into {{target_relation}} ({{target_cols_csv}})\n (\n select\n {{target_cols_csv}}\n from {{tmp_relation.include(schema=False)}}\n );\n {%- endcall %}\n {% set result = load_result('main-' ~ i) %}\n {% if 'response' in result.keys() %} {# added in v0.19.0 #}\n {% set rows_inserted = result['response']['rows_affected'] %}\n {% else %} {# older versions #}\n {% set rows_inserted = result['status'].split(\" \")[2] | int %}\n {% endif %}\n \n {%- set sum_rows_inserted = loop_vars['sum_rows_inserted'] + rows_inserted -%}\n {%- if loop_vars.update({'sum_rows_inserted': sum_rows_inserted}) %} {% endif -%}\n\n {%- set msg = \"Ran for \" ~ period ~ \" \" ~ (i + 1) ~ \" of \" ~ (num_periods) ~ \"; \" ~ rows_inserted ~ \" records inserted\" -%}\n {{ dbt_utils.log_info(msg) }}\n\n {%- endfor %}\n\n {% call statement() -%}\n begin;\n {%- endcall %}\n\n {{run_hooks(post_hooks, inside_transaction=True)}}\n\n {% call statement() -%}\n commit;\n {%- endcall %}\n\n {{run_hooks(post_hooks, inside_transaction=False)}}\n\n {%- set status_string = \"INSERT \" ~ loop_vars['sum_rows_inserted'] -%}\n\n {% call noop_statement('main', status_string) -%}\n -- no-op\n {%- endcall %}\n\n -- Return the relations created in this materialization\n {{ return({'relations': [target_relation]}) }} \n\n{%- endmaterialization %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.pretty_log_format": {"unique_id": "macro.dbt_utils.pretty_log_format", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/logger/pretty_log_format.sql", "original_file_path": "macros/logger/pretty_log_format.sql", "name": "pretty_log_format", "macro_sql": "{% macro pretty_log_format(message) %}\n {{ return(adapter.dispatch('pretty_log_format', packages = dbt_utils._get_utils_namespaces())(message)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__pretty_log_format": {"unique_id": "macro.dbt_utils.default__pretty_log_format", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/logger/pretty_log_format.sql", "original_file_path": "macros/logger/pretty_log_format.sql", "name": "default__pretty_log_format", "macro_sql": "{% macro default__pretty_log_format(message) %}\n {{ return( dbt_utils.pretty_time() ~ ' + ' ~ message) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.pretty_time": {"unique_id": "macro.dbt_utils.pretty_time", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/logger/pretty_time.sql", "original_file_path": "macros/logger/pretty_time.sql", "name": "pretty_time", "macro_sql": "{% macro pretty_time(format='%H:%M:%S') %}\n {{ return(adapter.dispatch('pretty_time', packages = dbt_utils._get_utils_namespaces())(format)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__pretty_time": {"unique_id": "macro.dbt_utils.default__pretty_time", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/logger/pretty_time.sql", "original_file_path": "macros/logger/pretty_time.sql", "name": "default__pretty_time", "macro_sql": "{% macro default__pretty_time(format='%H:%M:%S') %}\n {{ return(modules.datetime.datetime.now().strftime(format)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.log_info": {"unique_id": "macro.dbt_utils.log_info", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/logger/log_info.sql", "original_file_path": "macros/logger/log_info.sql", "name": "log_info", "macro_sql": "{% macro log_info(message) %}\n {{ return(adapter.dispatch('log_info', packages = dbt_utils._get_utils_namespaces())(message)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__log_info": {"unique_id": "macro.dbt_utils.default__log_info", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/logger/log_info.sql", "original_file_path": "macros/logger/log_info.sql", "name": "default__log_info", "macro_sql": "{% macro default__log_info(message) %}\n {{ log(dbt_utils.pretty_log_format(message), info=True) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.get_intervals_between": {"unique_id": "macro.dbt_utils.get_intervals_between", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/datetime/date_spine.sql", "original_file_path": "macros/datetime/date_spine.sql", "name": "get_intervals_between", "macro_sql": "{% macro get_intervals_between(start_date, end_date, datepart) -%}\n {{ return(adapter.dispatch('get_intervals_between', packages = dbt_utils._get_utils_namespaces())(start_date, end_date, datepart)) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__get_intervals_between": {"unique_id": "macro.dbt_utils.default__get_intervals_between", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/datetime/date_spine.sql", "original_file_path": "macros/datetime/date_spine.sql", "name": "default__get_intervals_between", "macro_sql": "{% macro default__get_intervals_between(start_date, end_date, datepart) -%}\n {%- call statement('get_intervals_between', fetch_result=True) %}\n\n select {{dbt_utils.datediff(start_date, end_date, datepart)}}\n\n {%- endcall -%}\n\n {%- set value_list = load_result('get_intervals_between') -%}\n\n {%- if value_list and value_list['data'] -%}\n {%- set values = value_list['data'] | map(attribute=0) | list %}\n {{ return(values[0]) }}\n {%- else -%}\n {{ return(1) }}\n {%- endif -%}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.date_spine": {"unique_id": "macro.dbt_utils.date_spine", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/datetime/date_spine.sql", "original_file_path": "macros/datetime/date_spine.sql", "name": "date_spine", "macro_sql": "{% macro date_spine(datepart, start_date, end_date) %}\n {{ return(adapter.dispatch('date_spine', packages = dbt_utils._get_utils_namespaces())(datepart, start_date, end_date)) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__date_spine": {"unique_id": "macro.dbt_utils.default__date_spine", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/datetime/date_spine.sql", "original_file_path": "macros/datetime/date_spine.sql", "name": "default__date_spine", "macro_sql": "{% macro default__date_spine(datepart, start_date, end_date) %}\n\n/*\ncall as follows:\n\ndate_spine(\n \"day\",\n \"to_date('01/01/2016', 'mm/dd/yyyy')\",\n \"dateadd(week, 1, current_date)\"\n)\n\n*/\n\nwith rawdata as (\n\n {{dbt_utils.generate_series(\n dbt_utils.get_intervals_between(start_date, end_date, datepart)\n )}}\n\n),\n\nall_periods as (\n\n select (\n {{\n dbt_utils.dateadd(\n datepart,\n \"row_number() over (order by 1) - 1\",\n start_date\n )\n }}\n ) as date_{{datepart}}\n from rawdata\n\n),\n\nfiltered as (\n\n select *\n from all_periods\n where date_{{datepart}} <= {{ end_date }}\n\n)\n\nselect * from filtered\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.get_url_host": {"unique_id": "macro.dbt_utils.get_url_host", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/web/get_url_host.sql", "original_file_path": "macros/web/get_url_host.sql", "name": "get_url_host", "macro_sql": "{% macro get_url_host(field) -%}\n {{ return(adapter.dispatch('get_url_host', packages = dbt_utils._get_utils_namespaces())(field)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__get_url_host": {"unique_id": "macro.dbt_utils.default__get_url_host", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/web/get_url_host.sql", "original_file_path": "macros/web/get_url_host.sql", "name": "default__get_url_host", "macro_sql": "{% macro default__get_url_host(field) -%}\n\n{%- set parsed = \n dbt_utils.split_part(\n dbt_utils.split_part(\n dbt_utils.replace(\n dbt_utils.replace(field, \"'http://'\", \"''\"\n ), \"'https://'\", \"''\"\n ), \"'/'\", 1\n ), \"'?'\", 1\n )\n \n-%}\n\n \n {{ dbt_utils.safe_cast(\n parsed,\n dbt_utils.type_string()\n )}}\n \n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.get_url_path": {"unique_id": "macro.dbt_utils.get_url_path", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/web/get_url_path.sql", "original_file_path": "macros/web/get_url_path.sql", "name": "get_url_path", "macro_sql": "{% macro get_url_path(field) -%}\n {{ return(adapter.dispatch('get_url_path', packages = dbt_utils._get_utils_namespaces())(field)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__get_url_path": {"unique_id": "macro.dbt_utils.default__get_url_path", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/web/get_url_path.sql", "original_file_path": "macros/web/get_url_path.sql", "name": "default__get_url_path", "macro_sql": "{% macro default__get_url_path(field) -%}\n\n {%- set stripped_url = \n dbt_utils.replace(\n dbt_utils.replace(field, \"'http://'\", \"''\"), \"'https://'\", \"''\")\n -%}\n\n {%- set first_slash_pos -%}\n coalesce(\n nullif({{dbt_utils.position(\"'/'\", stripped_url)}}, 0),\n {{dbt_utils.position(\"'?'\", stripped_url)}} - 1\n )\n {%- endset -%}\n\n {%- set parsed_path =\n dbt_utils.split_part(\n dbt_utils.right(\n stripped_url, \n dbt_utils.length(stripped_url) ~ \"-\" ~ first_slash_pos\n ), \n \"'?'\", 1\n )\n -%}\n\n {{ dbt_utils.safe_cast(\n parsed_path,\n dbt_utils.type_string()\n )}}\n \n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.get_url_parameter": {"unique_id": "macro.dbt_utils.get_url_parameter", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/web/get_url_parameter.sql", "original_file_path": "macros/web/get_url_parameter.sql", "name": "get_url_parameter", "macro_sql": "{% macro get_url_parameter(field, url_parameter) -%}\n {{ return(adapter.dispatch('get_url_parameter', packages = dbt_utils._get_utils_namespaces())(field, url_parameter)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__get_url_parameter": {"unique_id": "macro.dbt_utils.default__get_url_parameter", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/web/get_url_parameter.sql", "original_file_path": "macros/web/get_url_parameter.sql", "name": "default__get_url_parameter", "macro_sql": "{% macro default__get_url_parameter(field, url_parameter) -%}\n\n{%- set formatted_url_parameter = \"'\" + url_parameter + \"='\" -%}\n\n{%- set split = dbt_utils.split_part(dbt_utils.split_part(field, formatted_url_parameter, 2), \"'&'\", 1) -%}\n\nnullif({{ split }},'')\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.haversine_distance": {"unique_id": "macro.dbt_utils.haversine_distance", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/geo/haversine_distance.sql", "original_file_path": "macros/geo/haversine_distance.sql", "name": "haversine_distance", "macro_sql": "{% macro haversine_distance(lat1,lon1,lat2,lon2) -%}\n {{ return(adapter.dispatch('haversine_distance', packages = dbt_utils._get_utils_namespaces())(lat1,lon1,lat2,lon2)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__haversine_distance": {"unique_id": "macro.dbt_utils.default__haversine_distance", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/geo/haversine_distance.sql", "original_file_path": "macros/geo/haversine_distance.sql", "name": "default__haversine_distance", "macro_sql": "{% macro default__haversine_distance(lat1,lon1,lat2,lon2) -%}\n\n 2 * 3961 * asin(sqrt((sin(radians(({{lat2}} - {{lat1}}) / 2))) ^ 2 +\n cos(radians({{lat1}})) * cos(radians({{lat2}})) *\n (sin(radians(({{lon2}} - {{lon1}}) / 2))) ^ 2))\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.test_equal_rowcount": {"unique_id": "macro.dbt_utils.test_equal_rowcount", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/schema_tests/equal_rowcount.sql", "original_file_path": "macros/schema_tests/equal_rowcount.sql", "name": "test_equal_rowcount", "macro_sql": "{% macro test_equal_rowcount(model) %}\n {{ return(adapter.dispatch('test_equal_rowcount', packages = dbt_utils._get_utils_namespaces())(model, **kwargs)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__test_equal_rowcount": {"unique_id": "macro.dbt_utils.default__test_equal_rowcount", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/schema_tests/equal_rowcount.sql", "original_file_path": "macros/schema_tests/equal_rowcount.sql", "name": "default__test_equal_rowcount", "macro_sql": "{% macro default__test_equal_rowcount(model) %}\n\n{% set compare_model = kwargs.get('compare_model', kwargs.get('arg')) %}\n\n{#-- Prevent querying of db in parsing mode. This works because this macro does not create any new refs. #}\n{%- if not execute -%}\n {{ return('') }}\n{% endif %}\n\nwith a as (\n\n select count(*) as count_a from {{ model }}\n\n),\nb as (\n\n select count(*) as count_b from {{ compare_model }}\n\n),\nfinal as (\n\n select abs(\n (select count_a from a) -\n (select count_b from b)\n )\n as diff_count\n\n)\n\nselect diff_count from final\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.test_relationships_where": {"unique_id": "macro.dbt_utils.test_relationships_where", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/schema_tests/relationships_where.sql", "original_file_path": "macros/schema_tests/relationships_where.sql", "name": "test_relationships_where", "macro_sql": "{% macro test_relationships_where(model, to, field) %}\n {{ return(adapter.dispatch('test_relationships_where', packages = dbt_utils._get_utils_namespaces())(model, to, field, **kwargs)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__test_relationships_where": {"unique_id": "macro.dbt_utils.default__test_relationships_where", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/schema_tests/relationships_where.sql", "original_file_path": "macros/schema_tests/relationships_where.sql", "name": "default__test_relationships_where", "macro_sql": "{% macro default__test_relationships_where(model, to, field) %}\n\n{% set column_name = kwargs.get('column_name', kwargs.get('from')) %}\n{# T-SQL has no boolean data type so we use 1=1 which returns TRUE #}\n{# ref https://stackoverflow.com/a/7170753/3842610 #}\n{% set from_condition = kwargs.get('from_condition', \"1=1\") %}\n{% set to_condition = kwargs.get('to_condition', \"1=1\") %}\n\nwith left_table as (\n\n select\n {{column_name}} as id\n\n from {{model}}\n\n where {{column_name}} is not null\n and {{from_condition}}\n\n),\n\nright_table as (\n\n select\n {{field}} as id\n\n from {{to}}\n\n where {{field}} is not null\n and {{to_condition}}\n\n),\n\nexceptions as (\n\n select\n left_table.id,\n right_table.id as right_id\n\n from left_table\n\n left join right_table\n on left_table.id = right_table.id\n\n where right_table.id is null\n\n)\n\nselect count(*) from exceptions\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.test_recency": {"unique_id": "macro.dbt_utils.test_recency", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/schema_tests/recency.sql", "original_file_path": "macros/schema_tests/recency.sql", "name": "test_recency", "macro_sql": "{% macro test_recency(model, datepart, interval) %}\n {{ return(adapter.dispatch('test_recency', packages = dbt_utils._get_utils_namespaces())(model, datepart, interval, **kwargs)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__test_recency": {"unique_id": "macro.dbt_utils.default__test_recency", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/schema_tests/recency.sql", "original_file_path": "macros/schema_tests/recency.sql", "name": "default__test_recency", "macro_sql": "{% macro default__test_recency(model, datepart, interval) %}\n\n{% set column_name = kwargs.get('column_name', kwargs.get('field')) %}\n\nselect\n case when count(*) > 0 then 0\n else 1\n end as error_result\nfrom {{model}}\nwhere {{column_name}} >=\n {{dbt_utils.dateadd(datepart, interval * -1, dbt_utils.current_timestamp())}}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.test_not_constant": {"unique_id": "macro.dbt_utils.test_not_constant", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/schema_tests/not_constant.sql", "original_file_path": "macros/schema_tests/not_constant.sql", "name": "test_not_constant", "macro_sql": "{% macro test_not_constant(model) %}\n {{ return(adapter.dispatch('test_not_constant', packages = dbt_utils._get_utils_namespaces())(model, **kwargs)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__test_not_constant": {"unique_id": "macro.dbt_utils.default__test_not_constant", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/schema_tests/not_constant.sql", "original_file_path": "macros/schema_tests/not_constant.sql", "name": "default__test_not_constant", "macro_sql": "{% macro default__test_not_constant(model) %}\n\n{% set column_name = kwargs.get('column_name', kwargs.get('arg')) %}\n\nselect count(*)\n\nfrom (\n\n select\n {# In TSQL, subquery aggregate columns need aliases #}\n {# thus: a filler col name, 'filler_column' #}\n count(distinct {{ column_name }}) as filler_column\n\n from {{ model }}\n\n having count(distinct {{ column_name }}) = 1\n\n ) validation_errors\n\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.test_unique_where": {"unique_id": "macro.dbt_utils.test_unique_where", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/schema_tests/test_unique_where.sql", "original_file_path": "macros/schema_tests/test_unique_where.sql", "name": "test_unique_where", "macro_sql": "{% macro test_unique_where(model) %}\r\n {{ return(adapter.dispatch('test_unique_where', packages = dbt_utils._get_utils_namespaces())(model, **kwargs)) }}\r\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__test_unique_where": {"unique_id": "macro.dbt_utils.default__test_unique_where", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/schema_tests/test_unique_where.sql", "original_file_path": "macros/schema_tests/test_unique_where.sql", "name": "default__test_unique_where", "macro_sql": "{% macro default__test_unique_where(model) %}\r\n\r\n{% set column_name = kwargs.get('column_name', kwargs.get('arg')) %}\r\n{% set where = kwargs.get('where', kwargs.get('arg')) %}\r\n\r\nselect count(*)\r\nfrom (\r\n\r\n select\r\n {{ column_name }}\r\n\r\n from {{ model }}\r\n where {{ column_name }} is not null\r\n {% if where %} and {{ where }} {% endif %}\r\n group by {{ column_name }}\r\n having count(*) > 1\r\n\r\n) validation_errors\r\n\r\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.test_at_least_one": {"unique_id": "macro.dbt_utils.test_at_least_one", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/schema_tests/at_least_one.sql", "original_file_path": "macros/schema_tests/at_least_one.sql", "name": "test_at_least_one", "macro_sql": "{% macro test_at_least_one(model) %}\n {{ return(adapter.dispatch('test_at_least_one', packages = dbt_utils._get_utils_namespaces())(model, **kwargs)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__test_at_least_one": {"unique_id": "macro.dbt_utils.default__test_at_least_one", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/schema_tests/at_least_one.sql", "original_file_path": "macros/schema_tests/at_least_one.sql", "name": "default__test_at_least_one", "macro_sql": "{% macro default__test_at_least_one(model) %}\n\n{% set column_name = kwargs.get('column_name', kwargs.get('arg')) %}\n\nselect count(*)\nfrom (\n select\n {# In TSQL, subquery aggregate columns need aliases #}\n {# thus: a filler col name, 'filler_column' #}\n count({{ column_name }}) as filler_column\n\n from {{ model }}\n\n having count({{ column_name }}) = 0\n\n) validation_errors\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.test_unique_combination_of_columns": {"unique_id": "macro.dbt_utils.test_unique_combination_of_columns", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/schema_tests/unique_combination_of_columns.sql", "original_file_path": "macros/schema_tests/unique_combination_of_columns.sql", "name": "test_unique_combination_of_columns", "macro_sql": "{% macro test_unique_combination_of_columns(model, quote_columns = false) %}\n {{ return(adapter.dispatch('test_unique_combination_of_columns', packages = dbt_utils._get_utils_namespaces())(model, quote_columns, **kwargs)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__test_unique_combination_of_columns": {"unique_id": "macro.dbt_utils.default__test_unique_combination_of_columns", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/schema_tests/unique_combination_of_columns.sql", "original_file_path": "macros/schema_tests/unique_combination_of_columns.sql", "name": "default__test_unique_combination_of_columns", "macro_sql": "{% macro default__test_unique_combination_of_columns(model, quote_columns = false) %}\n\n{%- set columns = kwargs.get('combination_of_columns', kwargs.get('arg')) %}\n\n{% if not quote_columns %}\n {%- set column_list=columns %}\n{% elif quote_columns %}\n {%- set column_list=[] %}\n {% for column in columns -%}\n {% set column_list = column_list.append( adapter.quote(column) ) %}\n {%- endfor %}\n{% else %}\n {{ exceptions.raise_compiler_error(\n \"`quote_columns` argument for unique_combination_of_columns test must be one of [True, False] Got: '\" ~ quote ~\"'.'\"\n ) }}\n{% endif %}\n\n{%- set columns_csv=column_list | join(', ') %}\n\n\nwith validation_errors as (\n\n select\n {{ columns_csv }}\n from {{ model }}\n\n group by {{ columns_csv }}\n having count(*) > 1\n\n)\n\nselect count(*)\nfrom validation_errors\n\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.test_cardinality_equality": {"unique_id": "macro.dbt_utils.test_cardinality_equality", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/schema_tests/cardinality_equality.sql", "original_file_path": "macros/schema_tests/cardinality_equality.sql", "name": "test_cardinality_equality", "macro_sql": "{% macro test_cardinality_equality(model, to, field) %}\n\n {{ return(adapter.dispatch('test_cardinality_equality', packages = dbt_utils._get_utils_namespaces())(model, to, field, **kwargs)) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__test_cardinality_equality": {"unique_id": "macro.dbt_utils.default__test_cardinality_equality", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/schema_tests/cardinality_equality.sql", "original_file_path": "macros/schema_tests/cardinality_equality.sql", "name": "default__test_cardinality_equality", "macro_sql": "{% macro default__test_cardinality_equality(model, to, field) %}\n\n{# T-SQL doesn't let you use numbers as aliases for columns #}\n{# Thus, no \"GROUP BY 1\" #}\n\n{% set column_name = kwargs.get('column_name', kwargs.get('from')) %}\n\n\nwith table_a as (\nselect\n {{ column_name }},\n count(*) as num_rows\nfrom {{ model }}\ngroup by {{ column_name }}\n),\n\ntable_b as (\nselect\n {{ field }},\n count(*) as num_rows\nfrom {{ to }}\ngroup by {{ column_name }}\n),\n\nexcept_a as (\n select *\n from table_a\n {{ dbt_utils.except() }}\n select *\n from table_b\n),\n\nexcept_b as (\n select *\n from table_b\n {{ dbt_utils.except() }}\n select *\n from table_a\n),\n\nunioned as (\n select *\n from except_a\n union all\n select *\n from except_b\n)\n\nselect count(*)\nfrom unioned\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.test_expression_is_true": {"unique_id": "macro.dbt_utils.test_expression_is_true", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/schema_tests/expression_is_true.sql", "original_file_path": "macros/schema_tests/expression_is_true.sql", "name": "test_expression_is_true", "macro_sql": "{% macro test_expression_is_true(model, condition='1=1') %}\n{# T-SQL has no boolean data type so we use 1=1 which returns TRUE #}\n{# ref https://stackoverflow.com/a/7170753/3842610 #}\n {{ return(adapter.dispatch('test_expression_is_true', packages = dbt_utils._get_utils_namespaces())(model, condition, **kwargs)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__test_expression_is_true": {"unique_id": "macro.dbt_utils.default__test_expression_is_true", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/schema_tests/expression_is_true.sql", "original_file_path": "macros/schema_tests/expression_is_true.sql", "name": "default__test_expression_is_true", "macro_sql": "{% macro default__test_expression_is_true(model, condition) %}\n\n{% set expression = kwargs.get('expression', kwargs.get('arg')) %}\n\nwith meet_condition as (\n\n select * from {{ model }} where {{ condition }}\n\n),\nvalidation_errors as (\n\n select\n *\n from meet_condition\n where not({{expression}})\n\n)\n\nselect count(*)\nfrom validation_errors\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.test_not_null_where": {"unique_id": "macro.dbt_utils.test_not_null_where", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/schema_tests/test_not_null_where.sql", "original_file_path": "macros/schema_tests/test_not_null_where.sql", "name": "test_not_null_where", "macro_sql": "{% macro test_not_null_where(model) %}\r\n {{ return(adapter.dispatch('test_not_null_where', packages = dbt_utils._get_utils_namespaces())(model, **kwargs)) }}\r\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__test_not_null_where": {"unique_id": "macro.dbt_utils.default__test_not_null_where", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/schema_tests/test_not_null_where.sql", "original_file_path": "macros/schema_tests/test_not_null_where.sql", "name": "default__test_not_null_where", "macro_sql": "{% macro default__test_not_null_where(model) %}\r\n\r\n{% set column_name = kwargs.get('column_name', kwargs.get('arg')) %}\r\n{% set where = kwargs.get('where', kwargs.get('arg')) %}\r\n\r\nselect count(*)\r\nfrom {{ model }}\r\nwhere {{ column_name }} is null\r\n{% if where %} and {{ where }} {% endif %}\r\n\r\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.test_equality": {"unique_id": "macro.dbt_utils.test_equality", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/schema_tests/equality.sql", "original_file_path": "macros/schema_tests/equality.sql", "name": "test_equality", "macro_sql": "{% macro test_equality(model) %}\n {{ return(adapter.dispatch('test_equality', packages = dbt_utils._get_utils_namespaces())(model, **kwargs)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__test_equality": {"unique_id": "macro.dbt_utils.default__test_equality", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/schema_tests/equality.sql", "original_file_path": "macros/schema_tests/equality.sql", "name": "default__test_equality", "macro_sql": "{% macro default__test_equality(model) %}\n\n\n{#-- Prevent querying of db in parsing mode. This works because this macro does not create any new refs. #}\n{%- if not execute -%}\n {{ return('') }}\n{% endif %}\n\n-- setup\n{%- do dbt_utils._is_relation(model, 'test_equality') -%}\n\n{#-\nIf the compare_cols arg is provided, we can run this test without querying the\ninformation schema\u00a0\u2014 this allows the model to be an ephemeral model\n-#}\n{%- set compare_columns = kwargs.get('compare_columns', None) -%}\n\n{%- if not compare_columns -%}\n {%- do dbt_utils._is_ephemeral(model, 'test_equality') -%}\n {%- set compare_columns = adapter.get_columns_in_relation(model) | map(attribute='quoted') -%}\n{%- endif -%}\n\n{% set compare_model = kwargs.get('compare_model', kwargs.get('arg')) %}\n{% set compare_cols_csv = compare_columns | join(', ') %}\n\nwith a as (\n\n select * from {{ model }}\n\n),\n\nb as (\n\n select * from {{ compare_model }}\n\n),\n\na_minus_b as (\n\n select {{compare_cols_csv}} from a\n {{ dbt_utils.except() }}\n select {{compare_cols_csv}} from b\n\n),\n\nb_minus_a as (\n\n select {{compare_cols_csv}} from b\n {{ dbt_utils.except() }}\n select {{compare_cols_csv}} from a\n\n),\n\nunioned as (\n\n select * from a_minus_b\n union all\n select * from b_minus_a\n\n),\n\nfinal as (\n\n select (select count(*) from unioned) +\n (select abs(\n (select count(*) from a_minus_b) -\n (select count(*) from b_minus_a)\n ))\n as count\n\n)\n\nselect count from final\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.test_mutually_exclusive_ranges": {"unique_id": "macro.dbt_utils.test_mutually_exclusive_ranges", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/schema_tests/mutually_exclusive_ranges.sql", "original_file_path": "macros/schema_tests/mutually_exclusive_ranges.sql", "name": "test_mutually_exclusive_ranges", "macro_sql": "{% macro test_mutually_exclusive_ranges(model, lower_bound_column, upper_bound_column, partition_by=None, gaps='allowed') %}\n {{ return(adapter.dispatch('test_mutually_exclusive_ranges', packages = dbt_utils._get_utils_namespaces())(model, lower_bound_column, upper_bound_column, partition_by, gaps)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__test_mutually_exclusive_ranges": {"unique_id": "macro.dbt_utils.default__test_mutually_exclusive_ranges", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/schema_tests/mutually_exclusive_ranges.sql", "original_file_path": "macros/schema_tests/mutually_exclusive_ranges.sql", "name": "default__test_mutually_exclusive_ranges", "macro_sql": "{% macro default__test_mutually_exclusive_ranges(model, lower_bound_column, upper_bound_column, partition_by=None, gaps='allowed') %}\n\n{% if gaps == 'not_allowed' %}\n {% set allow_gaps_operator='=' %}\n {% set allow_gaps_operator_in_words='equal_to' %}\n{% elif gaps == 'allowed' %}\n {% set allow_gaps_operator='<=' %}\n {% set allow_gaps_operator_in_words='less_than_or_equal_to' %}\n{% elif gaps == 'required' %}\n {% set allow_gaps_operator='<' %}\n {% set allow_gaps_operator_in_words='less_than' %}\n{% else %}\n {{ exceptions.raise_compiler_error(\n \"`gaps` argument for mutually_exclusive_ranges test must be one of ['not_allowed', 'allowed', 'required'] Got: '\" ~ gaps ~\"'.'\"\n ) }}\n\n{% endif %}\n\n{% set partition_clause=\"partition by \" ~ partition_by if partition_by else '' %}\n\nwith window_functions as (\n\n select\n {% if partition_by %}\n {{ partition_by }},\n {% endif %}\n {{ lower_bound_column }} as lower_bound,\n {{ upper_bound_column }} as upper_bound,\n\n lead({{ lower_bound_column }}) over (\n {{ partition_clause }}\n order by {{ lower_bound_column }}\n ) as next_lower_bound,\n\n row_number() over (\n {{ partition_clause }}\n order by {{ lower_bound_column }} desc\n ) = 1 as is_last_record\n\n from {{ model }}\n\n),\n\ncalc as (\n -- We want to return records where one of our assumptions fails, so we'll use\n -- the `not` function with `and` statements so we can write our assumptions nore cleanly\n select\n *,\n\n -- For each record: lower_bound should be < upper_bound.\n -- Coalesce it to return an error on the null case (implicit assumption\n -- these columns are not_null)\n coalesce(\n lower_bound < upper_bound,\n false\n ) as lower_bound_less_than_upper_bound,\n\n -- For each record: upper_bound {{ allow_gaps_operator }} the next lower_bound.\n -- Coalesce it to handle null cases for the last record.\n coalesce(\n upper_bound {{ allow_gaps_operator }} next_lower_bound,\n is_last_record,\n false\n ) as upper_bound_{{ allow_gaps_operator_in_words }}_next_lower_bound\n\n from window_functions\n\n),\n\nvalidation_errors as (\n\n select\n *\n from calc\n\n where not(\n -- THE FOLLOWING SHOULD BE TRUE --\n lower_bound_less_than_upper_bound\n and upper_bound_{{ allow_gaps_operator_in_words }}_next_lower_bound\n )\n)\n\nselect count(*) from validation_errors\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.nullcheck_table": {"unique_id": "macro.dbt_utils.nullcheck_table", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/sql/nullcheck_table.sql", "original_file_path": "macros/sql/nullcheck_table.sql", "name": "nullcheck_table", "macro_sql": "{% macro nullcheck_table(relation) %}\n {{ return(adapter.dispatch('nullcheck_table', packages = dbt_utils._get_utils_namespaces())(relation)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__nullcheck_table": {"unique_id": "macro.dbt_utils.default__nullcheck_table", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/sql/nullcheck_table.sql", "original_file_path": "macros/sql/nullcheck_table.sql", "name": "default__nullcheck_table", "macro_sql": "{% macro default__nullcheck_table(relation) %}\n\n {%- do dbt_utils._is_relation(relation, 'nullcheck_table') -%}\n {%- do dbt_utils._is_ephemeral(relation, 'nullcheck_table') -%}\n {% set cols = adapter.get_columns_in_relation(relation) %}\n\n select {{ dbt_utils.nullcheck(cols) }}\n from {{relation}}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.get_relations_by_pattern": {"unique_id": "macro.dbt_utils.get_relations_by_pattern", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/sql/get_relations_by_pattern.sql", "original_file_path": "macros/sql/get_relations_by_pattern.sql", "name": "get_relations_by_pattern", "macro_sql": "{% macro get_relations_by_pattern(schema_pattern, table_pattern, exclude='', database=target.database) %}\n {{ return(adapter.dispatch('get_relations_by_pattern', packages = dbt_utils._get_utils_namespaces())(schema_pattern, table_pattern, exclude, database)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__get_relations_by_pattern": {"unique_id": "macro.dbt_utils.default__get_relations_by_pattern", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/sql/get_relations_by_pattern.sql", "original_file_path": "macros/sql/get_relations_by_pattern.sql", "name": "default__get_relations_by_pattern", "macro_sql": "{% macro default__get_relations_by_pattern(schema_pattern, table_pattern, exclude='', database=target.database) %}\n\n {%- call statement('get_tables', fetch_result=True) %}\n\n {{ dbt_utils.get_tables_by_pattern_sql(schema_pattern, table_pattern, exclude, database) }}\n\n {%- endcall -%}\n\n {%- set table_list = load_result('get_tables') -%}\n\n {%- if table_list and table_list['table'] -%}\n {%- set tbl_relations = [] -%}\n {%- for row in table_list['table'] -%}\n {%- set tbl_relation = api.Relation.create(\n database=database,\n schema=row.table_schema,\n identifier=row.table_name,\n type=row.table_type\n ) -%}\n {%- do tbl_relations.append(tbl_relation) -%}\n {%- endfor -%}\n\n {{ return(tbl_relations) }}\n {%- else -%}\n {{ return([]) }}\n {%- endif -%}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.get_powers_of_two": {"unique_id": "macro.dbt_utils.get_powers_of_two", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/sql/generate_series.sql", "original_file_path": "macros/sql/generate_series.sql", "name": "get_powers_of_two", "macro_sql": "{% macro get_powers_of_two(upper_bound) %}\n {{ return(adapter.dispatch('get_powers_of_two', packages = dbt_utils._get_utils_namespaces())(upper_bound)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__get_powers_of_two": {"unique_id": "macro.dbt_utils.default__get_powers_of_two", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/sql/generate_series.sql", "original_file_path": "macros/sql/generate_series.sql", "name": "default__get_powers_of_two", "macro_sql": "{% macro default__get_powers_of_two(upper_bound) %}\n\n {% if upper_bound <= 0 %}\n {{ exceptions.raise_compiler_error(\"upper bound must be positive\") }}\n {% endif %}\n\n {% for _ in range(1, 100) %}\n {% if upper_bound <= 2 ** loop.index %}{{ return(loop.index) }}{% endif %}\n {% endfor %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.generate_series": {"unique_id": "macro.dbt_utils.generate_series", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/sql/generate_series.sql", "original_file_path": "macros/sql/generate_series.sql", "name": "generate_series", "macro_sql": "{% macro generate_series(upper_bound) %}\n {{ return(adapter.dispatch('generate_series', packages = dbt_utils._get_utils_namespaces())(upper_bound)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__generate_series": {"unique_id": "macro.dbt_utils.default__generate_series", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/sql/generate_series.sql", "original_file_path": "macros/sql/generate_series.sql", "name": "default__generate_series", "macro_sql": "{% macro default__generate_series(upper_bound) %}\n\n {% set n = dbt_utils.get_powers_of_two(upper_bound) %}\n\n with p as (\n select 0 as generated_number union all select 1\n ), unioned as (\n\n select\n\n {% for i in range(n) %}\n p{{i}}.generated_number * pow(2, {{i}})\n {% if not loop.last %} + {% endif %}\n {% endfor %}\n + 1\n as generated_number\n\n from\n\n {% for i in range(n) %}\n p as p{{i}}\n {% if not loop.last %} cross join {% endif %}\n {% endfor %}\n\n )\n\n select *\n from unioned\n where generated_number <= {{upper_bound}}\n order by generated_number\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.get_relations_by_prefix": {"unique_id": "macro.dbt_utils.get_relations_by_prefix", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/sql/get_relations_by_prefix.sql", "original_file_path": "macros/sql/get_relations_by_prefix.sql", "name": "get_relations_by_prefix", "macro_sql": "{% macro get_relations_by_prefix(schema, prefix, exclude='', database=target.database) %}\n {{ return(adapter.dispatch('get_relations_by_prefix', packages = dbt_utils._get_utils_namespaces())(schema, prefix, exclude, database)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__get_relations_by_prefix": {"unique_id": "macro.dbt_utils.default__get_relations_by_prefix", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/sql/get_relations_by_prefix.sql", "original_file_path": "macros/sql/get_relations_by_prefix.sql", "name": "default__get_relations_by_prefix", "macro_sql": "{% macro default__get_relations_by_prefix(schema, prefix, exclude='', database=target.database) %}\n\n {%- call statement('get_tables', fetch_result=True) %}\n\n {{ dbt_utils.get_tables_by_prefix_sql(schema, prefix, exclude, database) }}\n\n {%- endcall -%}\n\n {%- set table_list = load_result('get_tables') -%}\n\n {%- if table_list and table_list['table'] -%}\n {%- set tbl_relations = [] -%}\n {%- for row in table_list['table'] -%}\n {%- set tbl_relation = api.Relation.create(\n database=database,\n schema=row.table_schema,\n identifier=row.table_name,\n type=row.table_type\n ) -%}\n {%- do tbl_relations.append(tbl_relation) -%}\n {%- endfor -%}\n\n {{ return(tbl_relations) }}\n {%- else -%}\n {{ return([]) }}\n {%- endif -%}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.get_tables_by_prefix_sql": {"unique_id": "macro.dbt_utils.get_tables_by_prefix_sql", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/sql/get_tables_by_prefix_sql.sql", "original_file_path": "macros/sql/get_tables_by_prefix_sql.sql", "name": "get_tables_by_prefix_sql", "macro_sql": "{% macro get_tables_by_prefix_sql(schema, prefix, exclude='', database=target.database) %}\n {{ return(adapter.dispatch('get_tables_by_prefix_sql', packages = dbt_utils._get_utils_namespaces())(schema, prefix, exclude, database)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__get_tables_by_prefix_sql": {"unique_id": "macro.dbt_utils.default__get_tables_by_prefix_sql", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/sql/get_tables_by_prefix_sql.sql", "original_file_path": "macros/sql/get_tables_by_prefix_sql.sql", "name": "default__get_tables_by_prefix_sql", "macro_sql": "{% macro default__get_tables_by_prefix_sql(schema, prefix, exclude='', database=target.database) %}\n\n {{ dbt_utils.get_tables_by_pattern_sql(\n schema_pattern = schema,\n table_pattern = prefix ~ '%',\n exclude = exclude,\n database = database\n ) }}\n \n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.star": {"unique_id": "macro.dbt_utils.star", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/sql/star.sql", "original_file_path": "macros/sql/star.sql", "name": "star", "macro_sql": "{% macro star(from, relation_alias=False, except=[]) -%}\n {{ return(adapter.dispatch('star', packages = dbt_utils._get_utils_namespaces())(from, relation_alias, except)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__star": {"unique_id": "macro.dbt_utils.default__star", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/sql/star.sql", "original_file_path": "macros/sql/star.sql", "name": "default__star", "macro_sql": "{% macro default__star(from, relation_alias=False, except=[]) -%}\n {%- do dbt_utils._is_relation(from, 'star') -%}\n {%- do dbt_utils._is_ephemeral(from, 'star') -%}\n\n {#-- Prevent querying of db in parsing mode. This works because this macro does not create any new refs. #}\n {%- if not execute -%}\n {{ return('') }}\n {% endif %}\n\n {%- set include_cols = [] %}\n {%- set cols = adapter.get_columns_in_relation(from) -%}\n\n {%- for col in cols -%}\n\n {%- if col.column not in except -%}\n {% do include_cols.append(col.column) %}\n\n {%- endif %}\n {%- endfor %}\n\n {%- for col in include_cols %}\n\n {%- if relation_alias %}{{ relation_alias }}.{% else %}{%- endif -%}{{ adapter.quote(col)|trim }}\n {%- if not loop.last %},{{ '\\n ' }}{% endif %}\n\n {%- endfor -%}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.unpivot": {"unique_id": "macro.dbt_utils.unpivot", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/sql/unpivot.sql", "original_file_path": "macros/sql/unpivot.sql", "name": "unpivot", "macro_sql": "{% macro unpivot(relation=none, cast_to='varchar', exclude=none, remove=none, field_name='field_name', value_name='value', table=none) -%}\n {{ return(adapter.dispatch('unpivot', packages = dbt_utils._get_utils_namespaces())(relation, cast_to, exclude, remove, field_name, value_name, table)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__unpivot": {"unique_id": "macro.dbt_utils.default__unpivot", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/sql/unpivot.sql", "original_file_path": "macros/sql/unpivot.sql", "name": "default__unpivot", "macro_sql": "{% macro default__unpivot(relation=none, cast_to='varchar', exclude=none, remove=none, field_name='field_name', value_name='value', table=none) -%}\n\n {% if table %}\n {%- set error_message = '\n Warning: the `unpivot` macro no longer accepts a `table` parameter. \\\n This parameter will be deprecated in a future release of dbt-utils. Use the `relation` parameter instead. \\\n The {}.{} model triggered this warning. \\\n '.format(model.package_name, model.name) -%}\n {%- do exceptions.warn(error_message) -%}\n {% endif %}\n\n {% if relation and table %}\n {{ exceptions.raise_compiler_error(\"Error: both the `relation` and `table` parameters were provided to `unpivot` macro. Choose one only (we recommend `relation`).\") }}\n {% elif not relation and table %}\n {% set relation=table %}\n {% elif not relation and not table %}\n {{ exceptions.raise_compiler_error(\"Error: argument `relation` is required for `unpivot` macro.\") }}\n {% endif %}\n\n {%- set exclude = exclude if exclude is not none else [] %}\n {%- set remove = remove if remove is not none else [] %}\n\n {%- set include_cols = [] %}\n\n {%- set table_columns = {} %}\n\n {%- do table_columns.update({relation: []}) %}\n\n {%- do dbt_utils._is_relation(relation, 'unpivot') -%}\n {%- do dbt_utils._is_ephemeral(relation, 'unpivot') -%}\n {%- set cols = adapter.get_columns_in_relation(relation) %}\n\n {%- for col in cols -%}\n {%- if col.column.lower() not in remove|map('lower') and col.column.lower() not in exclude|map('lower') -%}\n {% do include_cols.append(col) %}\n {%- endif %}\n {%- endfor %}\n\n\n {%- for col in include_cols -%}\n select\n {%- for exclude_col in exclude %}\n {{ exclude_col }},\n {%- endfor %}\n\n cast('{{ col.column }}' as {{ dbt_utils.type_string() }}) as {{ field_name }},\n cast({{ col.column }} as {{ cast_to }}) as {{ value_name }}\n\n from {{ relation }}\n\n {% if not loop.last -%}\n union all\n {% endif -%}\n {%- endfor -%}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.union_relations": {"unique_id": "macro.dbt_utils.union_relations", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/sql/union.sql", "original_file_path": "macros/sql/union.sql", "name": "union_relations", "macro_sql": "{%- macro union_relations(relations, column_override=none, include=[], exclude=[], source_column_name='_dbt_source_relation') -%}\n {{ return(adapter.dispatch('union_relations', packages = dbt_utils._get_utils_namespaces())(relations, column_override, include, exclude, source_column_name)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__union_relations": {"unique_id": "macro.dbt_utils.default__union_relations", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/sql/union.sql", "original_file_path": "macros/sql/union.sql", "name": "default__union_relations", "macro_sql": "\n\n{%- macro default__union_relations(relations, column_override=none, include=[], exclude=[], source_column_name='_dbt_source_relation') -%}\n\n {%- if exclude and include -%}\n {{ exceptions.raise_compiler_error(\"Both an exclude and include list were provided to the `union` macro. Only one is allowed\") }}\n {%- endif -%}\n\n {#-- Prevent querying of db in parsing mode. This works because this macro does not create any new refs. -#}\n {%- if not execute %}\n {{ return('') }}\n {% endif -%}\n\n {%- set column_override = column_override if column_override is not none else {} -%}\n\n {%- set relation_columns = {} -%}\n {%- set column_superset = {} -%}\n\n {%- for relation in relations -%}\n\n {%- do relation_columns.update({relation: []}) -%}\n\n {%- do dbt_utils._is_relation(relation, 'union_relations') -%}\n {%- do dbt_utils._is_ephemeral(relation, 'union_relations') -%}\n {%- set cols = adapter.get_columns_in_relation(relation) -%}\n {%- for col in cols -%}\n\n {#- If an exclude list was provided and the column is in the list, do nothing -#}\n {%- if exclude and col.column in exclude -%}\n\n {#- If an include list was provided and the column is not in the list, do nothing -#}\n {%- elif include and col.column not in include -%}\n\n {#- Otherwise add the column to the column superset -#}\n {%- else -%}\n\n {#- update the list of columns in this relation -#}\n {%- do relation_columns[relation].append(col.column) -%}\n\n {%- if col.column in column_superset -%}\n\n {%- set stored = column_superset[col.column] -%}\n {%- if col.is_string() and stored.is_string() and col.string_size() > stored.string_size() -%}\n\n {%- do column_superset.update({col.column: col}) -%}\n\n {%- endif %}\n\n {%- else -%}\n\n {%- do column_superset.update({col.column: col}) -%}\n\n {%- endif -%}\n\n {%- endif -%}\n\n {%- endfor -%}\n {%- endfor -%}\n\n {%- set ordered_column_names = column_superset.keys() -%}\n\n {%- for relation in relations %}\n\n (\n select\n\n cast({{ dbt_utils.string_literal(relation) }} as {{ dbt_utils.type_string() }}) as {{ source_column_name }},\n {% for col_name in ordered_column_names -%}\n\n {%- set col = column_superset[col_name] %}\n {%- set col_type = column_override.get(col.column, col.data_type) %}\n {%- set col_name = adapter.quote(col_name) if col_name in relation_columns[relation] else 'null' %}\n cast({{ col_name }} as {{ col_type }}) as {{ col.quoted }} {% if not loop.last %},{% endif -%}\n\n {%- endfor %}\n\n from {{ relation }}\n )\n\n {% if not loop.last -%}\n union all\n {% endif -%}\n\n {%- endfor -%}\n\n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.group_by": {"unique_id": "macro.dbt_utils.group_by", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/sql/groupby.sql", "original_file_path": "macros/sql/groupby.sql", "name": "group_by", "macro_sql": "{%- macro group_by(n) -%}\n {{ return(adapter.dispatch('group_by', packages = dbt_utils._get_utils_namespaces())(n)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__group_by": {"unique_id": "macro.dbt_utils.default__group_by", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/sql/groupby.sql", "original_file_path": "macros/sql/groupby.sql", "name": "default__group_by", "macro_sql": "\n\n{%- macro default__group_by(n) -%}\n\n group by {% for i in range(1, n + 1) -%}\n {{ i }}{{ ',' if not loop.last }} \n {%- endfor -%}\n\n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.surrogate_key": {"unique_id": "macro.dbt_utils.surrogate_key", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/sql/surrogate_key.sql", "original_file_path": "macros/sql/surrogate_key.sql", "name": "surrogate_key", "macro_sql": "{%- macro surrogate_key(field_list) -%}\n {# needed for safe_add to allow for non-keyword arguments see SO post #}\n {# https://stackoverflow.com/questions/13944751/args-kwargs-in-jinja2-macros #}\n {% set frustrating_jinja_feature = varargs %}\n {{ return(adapter.dispatch('surrogate_key', packages = dbt_utils._get_utils_namespaces())(field_list, *varargs)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__surrogate_key": {"unique_id": "macro.dbt_utils.default__surrogate_key", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/sql/surrogate_key.sql", "original_file_path": "macros/sql/surrogate_key.sql", "name": "default__surrogate_key", "macro_sql": "\n\n{%- macro default__surrogate_key(field_list) -%}\n\n{%- if varargs|length >= 1 or field_list is string %}\n\n{%- set error_message = '\nWarning: the `surrogate_key` macro now takes a single list argument instead of \\\nmultiple string arguments. Support for multiple string arguments will be \\\ndeprecated in a future release of dbt-utils. The {}.{} model triggered this warning. \\\n'.format(model.package_name, model.name) -%}\n\n{%- do exceptions.warn(error_message) -%}\n\n{# first argument is not included in varargs, so add first element to field_list_xf #}\n{%- set field_list_xf = [field_list] -%}\n\n{%- for field in varargs %}\n{%- set _ = field_list_xf.append(field) -%}\n{%- endfor -%}\n\n{%- else -%}\n\n{# if using list, just set field_list_xf as field_list #}\n{%- set field_list_xf = field_list -%}\n\n{%- endif -%}\n\n\n{%- set fields = [] -%}\n\n{%- for field in field_list_xf -%}\n\n {%- set _ = fields.append(\n \"coalesce(cast(\" ~ field ~ \" as \" ~ dbt_utils.type_string() ~ \"), '')\"\n ) -%}\n\n {%- if not loop.last %}\n {%- set _ = fields.append(\"'-'\") -%}\n {%- endif -%}\n\n{%- endfor -%}\n\n{{dbt_utils.hash(dbt_utils.concat(fields))}}\n\n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.safe_add": {"unique_id": "macro.dbt_utils.safe_add", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/sql/safe_add.sql", "original_file_path": "macros/sql/safe_add.sql", "name": "safe_add", "macro_sql": "{%- macro safe_add() -%}\n {# needed for safe_add to allow for non-keyword arguments see SO post #}\n {# https://stackoverflow.com/questions/13944751/args-kwargs-in-jinja2-macros #}\n {% set frustrating_jinja_feature = varargs %}\n {{ return(adapter.dispatch('safe_add', packages = dbt_utils._get_utils_namespaces())(*varargs)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__safe_add": {"unique_id": "macro.dbt_utils.default__safe_add", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/sql/safe_add.sql", "original_file_path": "macros/sql/safe_add.sql", "name": "default__safe_add", "macro_sql": "\n\n{%- macro default__safe_add() -%}\n\n{% set fields = [] %}\n\n{%- for field in varargs -%}\n\n {% do fields.append(\"coalesce(\" ~ field ~ \", 0)\") %}\n\n{%- endfor -%}\n\n{{ fields|join(' +\\n ') }}\n\n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.nullcheck": {"unique_id": "macro.dbt_utils.nullcheck", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/sql/nullcheck.sql", "original_file_path": "macros/sql/nullcheck.sql", "name": "nullcheck", "macro_sql": "{% macro nullcheck(cols) %}\n {{ return(adapter.dispatch('nullcheck', packages = dbt_utils._get_utils_namespaces())(cols)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__nullcheck": {"unique_id": "macro.dbt_utils.default__nullcheck", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/sql/nullcheck.sql", "original_file_path": "macros/sql/nullcheck.sql", "name": "default__nullcheck", "macro_sql": "{% macro default__nullcheck(cols) %}\n{%- for col in cols %}\n\n {% if col.is_string() -%}\n\n nullif({{col.name}},'') as {{col.name}}\n\n {%- else -%}\n\n {{col.name}}\n\n {%- endif -%}\n\n{%- if not loop.last -%} , {%- endif -%}\n\n{%- endfor -%}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.get_tables_by_pattern_sql": {"unique_id": "macro.dbt_utils.get_tables_by_pattern_sql", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/sql/get_tables_by_pattern_sql.sql", "original_file_path": "macros/sql/get_tables_by_pattern_sql.sql", "name": "get_tables_by_pattern_sql", "macro_sql": "{% macro get_tables_by_pattern_sql(schema_pattern, table_pattern, exclude='', database=target.database) %}\n {{ return(adapter.dispatch('get_tables_by_pattern_sql', packages = dbt_utils._get_utils_namespaces())\n (schema_pattern, table_pattern, exclude, database)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__get_tables_by_pattern_sql": {"unique_id": "macro.dbt_utils.default__get_tables_by_pattern_sql", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/sql/get_tables_by_pattern_sql.sql", "original_file_path": "macros/sql/get_tables_by_pattern_sql.sql", "name": "default__get_tables_by_pattern_sql", "macro_sql": "{% macro default__get_tables_by_pattern_sql(schema_pattern, table_pattern, exclude='', database=target.database) %}\n\n select distinct\n table_schema as \"table_schema\",\n table_name as \"table_name\",\n case table_type\n when 'BASE TABLE' then 'table'\n else lower(table_type)\n end as \"table_type\"\n from {{ database }}.information_schema.tables\n where table_schema ilike '{{ schema_pattern }}'\n and table_name ilike '{{ table_pattern }}'\n and table_name not ilike '{{ exclude }}'\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.bigquery__get_tables_by_pattern_sql": {"unique_id": "macro.dbt_utils.bigquery__get_tables_by_pattern_sql", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/sql/get_tables_by_pattern_sql.sql", "original_file_path": "macros/sql/get_tables_by_pattern_sql.sql", "name": "bigquery__get_tables_by_pattern_sql", "macro_sql": "{% macro bigquery__get_tables_by_pattern_sql(schema_pattern, table_pattern, exclude='', database=target.database) %}\n\n {% if '%' in schema_pattern %}\n {% set schemata=dbt_utils._bigquery__get_matching_schemata(schema_pattern, database) %}\n {% else %}\n {% set schemata=[schema_pattern] %}\n {% endif %}\n\n {% set sql %}\n {% for schema in schemata %}\n select distinct\n table_schema,\n table_name,\n case table_type\n when 'BASE TABLE' then 'table'\n else lower(table_type)\n end as table_type\n\n from {{ adapter.quote(database) }}.{{ schema }}.INFORMATION_SCHEMA.TABLES\n where lower(table_name) like lower ('{{ table_pattern }}')\n and lower(table_name) not like lower ('{{ exclude }}')\n\n {% if not loop.last %} union all {% endif %}\n\n {% endfor %}\n {% endset %}\n\n {{ return(sql) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils._bigquery__get_matching_schemata": {"unique_id": "macro.dbt_utils._bigquery__get_matching_schemata", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/sql/get_tables_by_pattern_sql.sql", "original_file_path": "macros/sql/get_tables_by_pattern_sql.sql", "name": "_bigquery__get_matching_schemata", "macro_sql": "{% macro _bigquery__get_matching_schemata(schema_pattern, database) %}\n {% if execute %}\n\n {% set sql %}\n select schema_name from {{ adapter.quote(database) }}.INFORMATION_SCHEMA.SCHEMATA\n where lower(schema_name) like lower('{{ schema_pattern }}')\n {% endset %}\n\n {% set results=run_query(sql) %}\n\n {% set schemata=results.columns['schema_name'].values() %}\n\n {{ return(schemata) }}\n\n {% else %}\n\n {{ return([]) }}\n\n {% endif %}\n\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.get_column_values": {"unique_id": "macro.dbt_utils.get_column_values", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/sql/get_column_values.sql", "original_file_path": "macros/sql/get_column_values.sql", "name": "get_column_values", "macro_sql": "{% macro get_column_values(table, column, max_records=none, default=none) -%}\n {{ return(adapter.dispatch('get_column_values', packages = dbt_utils._get_utils_namespaces())(table, column, max_records, default)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__get_column_values": {"unique_id": "macro.dbt_utils.default__get_column_values", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/sql/get_column_values.sql", "original_file_path": "macros/sql/get_column_values.sql", "name": "default__get_column_values", "macro_sql": "{% macro default__get_column_values(table, column, max_records=none, default=none) -%}\n\n{#-- Prevent querying of db in parsing mode. This works because this macro does not create any new refs. #}\n {%- if not execute -%}\n {{ return('') }}\n {% endif %}\n{#-- #}\n\n {%- set target_relation = adapter.get_relation(database=table.database,\n schema=table.schema,\n identifier=table.identifier) -%}\n\n {%- call statement('get_column_values', fetch_result=true) %}\n\n {%- if not target_relation and default is none -%}\n\n {{ exceptions.raise_compiler_error(\"In get_column_values(): relation \" ~ table ~ \" does not exist and no default value was provided.\") }}\n\n {%- elif not target_relation and default is not none -%}\n\n {{ log(\"Relation \" ~ table ~ \" does not exist. Returning the default value: \" ~ default) }}\n\n {{ return(default) }}\n\n {%- else -%}\n\n select\n {{ column }} as value\n\n from {{ target_relation }}\n group by 1\n order by count(*) desc\n\n {% if max_records is not none %}\n limit {{ max_records }}\n {% endif %}\n\n {% endif %}\n\n {%- endcall -%}\n\n {%- set value_list = load_result('get_column_values') -%}\n\n {%- if value_list and value_list['data'] -%}\n {%- set values = value_list['data'] | map(attribute=0) | list %}\n {{ return(values) }}\n {%- else -%}\n {{ return(default) }}\n {%- endif -%}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.pivot": {"unique_id": "macro.dbt_utils.pivot", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/sql/pivot.sql", "original_file_path": "macros/sql/pivot.sql", "name": "pivot", "macro_sql": "{% macro pivot(column,\n values,\n alias=True,\n agg='sum',\n cmp='=',\n prefix='',\n suffix='',\n then_value=1,\n else_value=0,\n quote_identifiers=True,\n distinct=False) %}\n {{ return(adapter.dispatch('pivot', packages = dbt_utils._get_utils_namespaces())(column, values, alias, agg, cmp, prefix, suffix, then_value, else_value, quote_identifiers, distinct)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__pivot": {"unique_id": "macro.dbt_utils.default__pivot", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/sql/pivot.sql", "original_file_path": "macros/sql/pivot.sql", "name": "default__pivot", "macro_sql": "{% macro default__pivot(column,\n values,\n alias=True,\n agg='sum',\n cmp='=',\n prefix='',\n suffix='',\n then_value=1,\n else_value=0,\n quote_identifiers=True,\n distinct=False) %}\n {% for v in values %}\n {{ agg }}(\n {% if distinct %} distinct {% endif %}\n case\n when {{ column }} {{ cmp }} '{{ v }}'\n then {{ then_value }}\n else {{ else_value }}\n end\n )\n {% if alias %}\n {% if quote_identifiers %}\n as {{ adapter.quote(prefix ~ v ~ suffix) }}\n {% else %}\n as {{prefix ~ v ~ suffix }}\n {% endif %}\n {% endif %}\n {% if not loop.last %},{% endif %}\n {% endfor %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.get_query_results_as_dict": {"unique_id": "macro.dbt_utils.get_query_results_as_dict", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/sql/get_query_results_as_dict.sql", "original_file_path": "macros/sql/get_query_results_as_dict.sql", "name": "get_query_results_as_dict", "macro_sql": "{% macro get_query_results_as_dict(query) %}\n {{ return(adapter.dispatch('get_query_results_as_dict', packages = dbt_utils._get_utils_namespaces())(query)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__get_query_results_as_dict": {"unique_id": "macro.dbt_utils.default__get_query_results_as_dict", "package_name": "dbt_utils", "root_path": "dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/sql/get_query_results_as_dict.sql", "original_file_path": "macros/sql/get_query_results_as_dict.sql", "name": "default__get_query_results_as_dict", "macro_sql": "{% macro default__get_query_results_as_dict(query) %}\n\n{# This macro returns a dictionary of the form {column_name: (tuple_of_results)} #}\n\n {%- call statement('get_query_results', fetch_result=True,auto_begin=false) -%}\n\n {{ query }}\n\n {%- endcall -%}\n\n {% set sql_results={} %}\n\n {%- if execute -%}\n {% set sql_results_table = load_result('get_query_results').table.columns %}\n {% for column_name, column in sql_results_table.items() %}\n {% do sql_results.update({column_name: column.values()}) %}\n {% endfor %}\n {%- endif -%}\n\n {{ return(sql_results) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}}, "docs": {"dbt.__overview__": {"unique_id": "dbt.__overview__", "package_name": "dbt", "root_path": "/Users/niallwoodward/.local/share/virtualenvs/data_warehouse-5lmQyzNX/lib/python3.8/site-packages/dbt/include/global_project", "path": "overview.md", "original_file_path": "docs/overview.md", "name": "__overview__", "block_contents": "### Welcome!\n\nWelcome to the auto-generated documentation for your dbt project!\n\n### Navigation\n\nYou can use the `Project` and `Database` navigation tabs on the left side of the window to explore the models\nin your project.\n\n#### Project Tab\nThe `Project` tab mirrors the directory structure of your dbt project. In this tab, you can see all of the\nmodels defined in your dbt project, as well as models imported from dbt packages.\n\n#### Database Tab\nThe `Database` tab also exposes your models, but in a format that looks more like a database explorer. This view\nshows relations (tables and views) grouped into database schemas. Note that ephemeral models are _not_ shown\nin this interface, as they do not exist in the database.\n\n### Graph Exploration\nYou can click the blue icon on the bottom-right corner of the page to view the lineage graph of your models.\n\nOn model pages, you'll see the immediate parents and children of the model you're exploring. By clicking the `Expand`\nbutton at the top-right of this lineage pane, you'll be able to see all of the models that are used to build,\nor are built from, the model you're exploring.\n\nOnce expanded, you'll be able to use the `--models` and `--exclude` model selection syntax to filter the\nmodels in the graph. For more information on model selection, check out the [dbt docs](https://docs.getdbt.com/docs/model-selection-syntax).\n\nNote that you can also right-click on models to interactively filter and explore the graph.\n\n---\n\n### More information\n\n- [What is dbt](https://docs.getdbt.com/docs/overview)?\n- Read the [dbt viewpoint](https://docs.getdbt.com/docs/viewpoint)\n- [Installation](https://docs.getdbt.com/docs/installation)\n- Join the [chat](https://community.getdbt.com/) on Slack for live questions and support."}}, "exposures": {}, "selectors": {}, "disabled": [], "parent_map": {"model.dbt_artifacts.fct_dbt__latest_full_model_executions": ["model.dbt_artifacts.fct_dbt__model_executions", "model.dbt_artifacts.fct_dbt__run_results"], "model.dbt_artifacts.fct_dbt__critical_path": ["model.dbt_artifacts.fct_dbt__latest_full_model_executions", "model.dbt_artifacts.stg_dbt__models"], "model.dbt_artifacts.stg_dbt__models": ["model.dbt_artifacts.stg_dbt__artifacts"], "model.dbt_artifacts.stg_dbt__run_results_env_keys": ["model.dbt_artifacts.stg_dbt__artifacts"], "model.dbt_artifacts.stg_dbt__sources": ["model.dbt_artifacts.stg_dbt__artifacts"], "model.dbt_artifacts.stg_dbt__artifacts": ["source.dbt_artifacts.dbt_artifacts.artifacts"], "model.dbt_artifacts.stg_dbt__model_executions": ["model.dbt_artifacts.stg_dbt__artifacts"], "model.dbt_artifacts.stg_dbt__run_results": ["model.dbt_artifacts.stg_dbt__artifacts"], "model.dbt_artifacts.int_dbt__model_executions": ["model.dbt_artifacts.stg_dbt__model_executions"], "model.dbt_artifacts.fct_dbt__model_executions": ["model.dbt_artifacts.dim_dbt__models", "model.dbt_artifacts.int_dbt__model_executions"], "model.dbt_artifacts.dim_dbt__sources": ["model.dbt_artifacts.stg_dbt__sources"], "model.dbt_artifacts.dim_dbt__models": ["model.dbt_artifacts.stg_dbt__models"], "model.dbt_artifacts.fct_dbt__run_results": ["model.dbt_artifacts.stg_dbt__run_results", "model.dbt_artifacts.stg_dbt__run_results_env_keys"], "test.dbt_artifacts.unique_fct_dbt__critical_path_node_id": ["model.dbt_artifacts.fct_dbt__critical_path"], "test.dbt_artifacts.not_null_fct_dbt__critical_path_node_id": ["model.dbt_artifacts.fct_dbt__critical_path"], "test.dbt_artifacts.unique_fct_dbt__latest_full_model_executions_node_id": ["model.dbt_artifacts.fct_dbt__latest_full_model_executions"], "test.dbt_artifacts.not_null_fct_dbt__latest_full_model_executions_node_id": ["model.dbt_artifacts.fct_dbt__latest_full_model_executions"], "test.dbt_artifacts.unique_fct_dbt__model_executions_model_execution_id": ["model.dbt_artifacts.fct_dbt__model_executions"], "test.dbt_artifacts.not_null_fct_dbt__model_executions_model_execution_id": ["model.dbt_artifacts.fct_dbt__model_executions"], "test.dbt_artifacts.unique_fct_dbt__run_results_command_invocation_id": ["model.dbt_artifacts.fct_dbt__run_results"], "test.dbt_artifacts.not_null_fct_dbt__run_results_command_invocation_id": ["model.dbt_artifacts.fct_dbt__run_results"], "test.dbt_artifacts.unique_dim_dbt__models_manifest_model_id": ["model.dbt_artifacts.dim_dbt__models"], "test.dbt_artifacts.not_null_dim_dbt__models_manifest_model_id": ["model.dbt_artifacts.dim_dbt__models"], "test.dbt_artifacts.unique_dim_dbt__sources_manifest_source_id": ["model.dbt_artifacts.dim_dbt__sources"], "test.dbt_artifacts.not_null_dim_dbt__sources_manifest_source_id": ["model.dbt_artifacts.dim_dbt__sources"], "source.dbt_artifacts.dbt_artifacts.artifacts": []}, "child_map": {"model.dbt_artifacts.fct_dbt__latest_full_model_executions": ["model.dbt_artifacts.fct_dbt__critical_path", "test.dbt_artifacts.not_null_fct_dbt__latest_full_model_executions_node_id", "test.dbt_artifacts.unique_fct_dbt__latest_full_model_executions_node_id"], "model.dbt_artifacts.fct_dbt__critical_path": ["test.dbt_artifacts.not_null_fct_dbt__critical_path_node_id", "test.dbt_artifacts.unique_fct_dbt__critical_path_node_id"], "model.dbt_artifacts.stg_dbt__models": ["model.dbt_artifacts.dim_dbt__models", "model.dbt_artifacts.fct_dbt__critical_path"], "model.dbt_artifacts.stg_dbt__run_results_env_keys": ["model.dbt_artifacts.fct_dbt__run_results"], "model.dbt_artifacts.stg_dbt__sources": ["model.dbt_artifacts.dim_dbt__sources"], "model.dbt_artifacts.stg_dbt__artifacts": ["model.dbt_artifacts.stg_dbt__model_executions", "model.dbt_artifacts.stg_dbt__models", "model.dbt_artifacts.stg_dbt__run_results", "model.dbt_artifacts.stg_dbt__run_results_env_keys", "model.dbt_artifacts.stg_dbt__sources"], "model.dbt_artifacts.stg_dbt__model_executions": ["model.dbt_artifacts.int_dbt__model_executions"], "model.dbt_artifacts.stg_dbt__run_results": ["model.dbt_artifacts.fct_dbt__run_results"], "model.dbt_artifacts.int_dbt__model_executions": ["model.dbt_artifacts.fct_dbt__model_executions"], "model.dbt_artifacts.fct_dbt__model_executions": ["model.dbt_artifacts.fct_dbt__latest_full_model_executions", "test.dbt_artifacts.not_null_fct_dbt__model_executions_model_execution_id", "test.dbt_artifacts.unique_fct_dbt__model_executions_model_execution_id"], "model.dbt_artifacts.dim_dbt__sources": ["test.dbt_artifacts.not_null_dim_dbt__sources_manifest_source_id", "test.dbt_artifacts.unique_dim_dbt__sources_manifest_source_id"], "model.dbt_artifacts.dim_dbt__models": ["model.dbt_artifacts.fct_dbt__model_executions", "test.dbt_artifacts.not_null_dim_dbt__models_manifest_model_id", "test.dbt_artifacts.unique_dim_dbt__models_manifest_model_id"], "model.dbt_artifacts.fct_dbt__run_results": ["model.dbt_artifacts.fct_dbt__latest_full_model_executions", "test.dbt_artifacts.not_null_fct_dbt__run_results_command_invocation_id", "test.dbt_artifacts.unique_fct_dbt__run_results_command_invocation_id"], "test.dbt_artifacts.unique_fct_dbt__critical_path_node_id": [], "test.dbt_artifacts.not_null_fct_dbt__critical_path_node_id": [], "test.dbt_artifacts.unique_fct_dbt__latest_full_model_executions_node_id": [], "test.dbt_artifacts.not_null_fct_dbt__latest_full_model_executions_node_id": [], "test.dbt_artifacts.unique_fct_dbt__model_executions_model_execution_id": [], "test.dbt_artifacts.not_null_fct_dbt__model_executions_model_execution_id": [], "test.dbt_artifacts.unique_fct_dbt__run_results_command_invocation_id": [], "test.dbt_artifacts.not_null_fct_dbt__run_results_command_invocation_id": [], "test.dbt_artifacts.unique_dim_dbt__models_manifest_model_id": [], "test.dbt_artifacts.not_null_dim_dbt__models_manifest_model_id": [], "test.dbt_artifacts.unique_dim_dbt__sources_manifest_source_id": [], "test.dbt_artifacts.not_null_dim_dbt__sources_manifest_source_id": [], "source.dbt_artifacts.dbt_artifacts.artifacts": ["model.dbt_artifacts.stg_dbt__artifacts"]}} \ No newline at end of file +{"metadata": {"dbt_schema_version": "https://schemas.getdbt.com/dbt/manifest/v1.json", "dbt_version": "0.19.1", "generated_at": "2021-07-07T10:07:24.315893Z", "invocation_id": "21776fd0-5851-493f-ae7d-c0beb4e6da36", "env": {}, "project_id": "80a035c5caa7bfb9378465c4c70ed133", "user_id": "0d46db70-f311-4d75-89c9-db5206140641", "send_anonymous_usage_stats": true, "adapter_type": "snowflake"}, "nodes": {"model.dbt_artifacts.fct_dbt__latest_full_model_executions": {"raw_sql": "with run_results as (\n\n select *\n from {{ ref('fct_dbt__run_results') }}\n\n),\n\nmodel_executions as (\n\n select *\n from {{ ref('fct_dbt__model_executions') }}\n\n),\n\nlatest_full as (\n\n select *\n from run_results\n where selected_models is null and was_full_refresh = false\n order by artifact_generated_at desc\n limit 1\n\n),\n\njoined as (\n\n select\n model_executions.*\n from latest_full\n left join model_executions on\n model_executions.command_invocation_id = latest_full.command_invocation_id\n or model_executions.dbt_cloud_run_id = latest_full.dbt_cloud_run_id\n\n),\n\nfields as (\n\n select\n artifact_generated_at,\n command_invocation_id,\n dbt_cloud_run_id,\n compile_started_at,\n query_completed_at,\n total_node_runtime,\n model_execution_id,\n model_materialization,\n model_schema,\n name,\n node_id,\n thread_id,\n rows_affected,\n status,\n was_full_refresh\n from joined\n\n)\n\nselect * from fields", "compiled": true, "resource_type": "model", "depends_on": {"macros": [], "nodes": ["model.dbt_artifacts.fct_dbt__run_results", "model.dbt_artifacts.fct_dbt__model_executions"]}, "config": {"enabled": true, "materialized": "table", "persist_docs": {}, "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": null, "database": null, "tags": [], "full_refresh": null, "post-hook": [], "pre-hook": []}, "database": "database", "schema": "schema", "fqn": ["dbt_artifacts", "fct_dbt__latest_full_model_executions"], "unique_id": "model.dbt_artifacts.fct_dbt__latest_full_model_executions", "package_name": "dbt_artifacts", "root_path": "/dbt_artifacts", "path": "fct_dbt__latest_full_model_executions.sql", "original_file_path": "models/fct_dbt__latest_full_model_executions.sql", "name": "fct_dbt__latest_full_model_executions", "alias": "fct_dbt__latest_full_model_executions", "checksum": {"name": "sha256", "checksum": "1db7cc8b413fc690d2f4fb6f692ed836551f4288c2fbc454ec7c710d3d6f864e"}, "tags": [], "refs": [["fct_dbt__run_results"], ["fct_dbt__model_executions"]], "sources": [], "description": "A list of all models and executions times from the most recent, incremental run.", "columns": {"node_id": {"name": "node_id", "description": "Primary key.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "artifact_generated_at": {"name": "artifact_generated_at", "description": "Timestamp of when the source artifact was generated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "command_invocation_id": {"name": "command_invocation_id", "description": "Foreign key to fct_dbt_run_results. The id of the command which resulted in the source artifact's generation.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "compile_started_at": {"name": "compile_started_at", "description": "Timestamp of when a model starts to be compiled.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "query_completed_at": {"name": "query_completed_at", "description": "Timestamp of when a model's SQL is completed", "meta": {}, "data_type": null, "quote": null, "tags": []}, "total_node_runtime": {"name": "total_node_runtime", "description": "The duration of time in seconds for the model to run. Note that this is _not_ equal to the delta between `compile_started_at` and `query_completed_at` since it includes extra tasks performed by dbt.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "model_execution_id": {"name": "model_execution_id", "description": "A surrogate key of command_invocation_id and node_id.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "model_materialization": {"name": "model_materialization", "description": "", "meta": {}, "data_type": null, "quote": null, "tags": []}, "model_schema": {"name": "model_schema", "description": "", "meta": {}, "data_type": null, "quote": null, "tags": []}, "name": {"name": "name", "description": "The model name.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "rows_affected": {"name": "rows_affected", "description": "The number of rows affected by the model's execution. Always 1 for non-incremental executions.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "status": {"name": "status", "description": "Success/fail status of the model's execution.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "was_full_refresh": {"name": "was_full_refresh", "description": "Boolean value for whether this model was executed with a --full-refresh flag.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "models/schemas.yml", "build_path": "target/compiled/dbt_artifacts/models/fct_dbt__latest_full_model_executions.sql", "deferred": false, "unrendered_config": {"materialized": "table"}, "compiled_sql": "with run_results as (\n\n select *\n from database.schema.fct_dbt__run_results\n\n),\n\nmodel_executions as (\n\n select *\n from database.schema.fct_dbt__model_executions\n\n),\n\nlatest_full as (\n\n select *\n from run_results\n where selected_models is null and was_full_refresh = false\n order by artifact_generated_at desc\n limit 1\n\n),\n\njoined as (\n\n select\n model_executions.*\n from latest_full\n left join model_executions on\n model_executions.command_invocation_id = latest_full.command_invocation_id\n or model_executions.dbt_cloud_run_id = latest_full.dbt_cloud_run_id\n\n),\n\nfields as (\n\n select\n artifact_generated_at,\n command_invocation_id,\n dbt_cloud_run_id,\n compile_started_at,\n query_completed_at,\n total_node_runtime,\n model_execution_id,\n model_materialization,\n model_schema,\n name,\n node_id,\n thread_id,\n rows_affected,\n status,\n was_full_refresh\n from joined\n\n)\n\nselect * from fields", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "database.schema.fct_dbt__latest_full_model_executions"}, "model.dbt_artifacts.fct_dbt__exposures_updates": {"raw_sql": "with model_executions as (\n\n select * from {{ ref('fct_dbt__model_executions') }}\n\n),\n\nexposures_record as (\n\n select * from {{ ref('dim_dbt__exposures') }}\n\n),\n\n\nmodel_updates as (\n\n select \n max(query_completed_at) as latest_update,\n node_id\n from model_executions\n group by node_id\n\n),\n\nexposures_latest as (\n\n select\n artifact_generated_at as latest_generation,\n node_id,\n name,\n type,\n owner,\n maturity,\n package_name,\n output_feeds\n from exposures_record\n where artifact_generated_at = (select max(artifact_generated_at) from exposures_record)\n\n),\n\nexposures_updates as (\n\n select \n e.latest_generation,\n e.node_id,\n e.name, \n e.type,\n e.owner,\n e.maturity,\n e.package_name,\n e.output_feeds,\n latest_update as feed_latest_update\n from exposures_latest e\n left join model_updates m\n on m.node_id = e.output_feeds\n\n)\n\nselect * from exposures_updates", "compiled": true, "resource_type": "model", "depends_on": {"macros": [], "nodes": ["model.dbt_artifacts.fct_dbt__model_executions", "model.dbt_artifacts.dim_dbt__exposures"]}, "config": {"enabled": true, "materialized": "table", "persist_docs": {}, "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": null, "database": null, "tags": [], "full_refresh": null, "post-hook": [], "pre-hook": []}, "database": "database", "schema": "schema", "fqn": ["dbt_artifacts", "fct_dbt__exposures_updates"], "unique_id": "model.dbt_artifacts.fct_dbt__exposures_updates", "package_name": "dbt_artifacts", "root_path": "/dbt_artifacts", "path": "fct_dbt__exposures_updates.sql", "original_file_path": "models/fct_dbt__exposures_updates.sql", "name": "fct_dbt__exposures_updates", "alias": "fct_dbt__exposures_updates", "checksum": {"name": "sha256", "checksum": "4576e81b8cbe4aed9e61109289fd3a38543a61c05db20c8b9cb78696d56628c6"}, "tags": [], "refs": [["fct_dbt__model_executions"], ["dim_dbt__exposures"]], "sources": [], "description": "A table of exposures and models feeding them. Latest update time for each models is provided.", "columns": {"latest_generation": {"name": "latest_generation", "description": "Timestamp of when the source artifact was generated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "node_id": {"name": "node_id", "description": "Unique id for the node, in the form of exposure.[package_name].[exposure_name]", "meta": {}, "data_type": null, "quote": null, "tags": []}, "name": {"name": "name", "description": "User-defined name of the exposure.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "type": {"name": "type", "description": "User-defined type of the exposure.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "owner": {"name": "owner", "description": "User-defined owner of the exposure.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "maturity": {"name": "maturity", "description": "User-defined name of the exposure.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "package_name": {"name": "package_name", "description": "Source package in which each feed of an exposure was defined.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "output_feeds": {"name": "output_feeds", "description": "Unique id for each feed of an exposure, in the form of model.[package_name].[model_name]", "meta": {}, "data_type": null, "quote": null, "tags": []}, "feed_latest_update": {"name": "feed_latest_update", "description": "Timestamp of the latest update of each feed of an exposure.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "models/schemas.yml", "build_path": "target/compiled/dbt_artifacts/models/fct_dbt__exposures_updates.sql", "deferred": false, "unrendered_config": {"materialized": "table"}, "compiled_sql": "with model_executions as (\n\n select * from database.schema.fct_dbt__model_executions\n\n),\n\nexposures_record as (\n\n select * from database.schema.dim_dbt__exposures\n\n),\n\n\nmodel_updates as (\n\n select \n max(query_completed_at) as latest_update,\n node_id\n from model_executions\n group by node_id\n\n),\n\nexposures_latest as (\n\n select\n artifact_generated_at as latest_generation,\n node_id,\n name,\n type,\n owner,\n maturity,\n package_name,\n output_feeds\n from exposures_record\n where artifact_generated_at = (select max(artifact_generated_at) from exposures_record)\n\n),\n\nexposures_updates as (\n\n select \n e.latest_generation,\n e.node_id,\n e.name, \n e.type,\n e.owner,\n e.maturity,\n e.package_name,\n e.output_feeds,\n latest_update as feed_latest_update\n from exposures_latest e\n left join model_updates m\n on m.node_id = e.output_feeds\n\n)\n\nselect * from exposures_updates", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "database.schema.fct_dbt__exposures_updates"}, "model.dbt_artifacts.fct_dbt__critical_path": {"raw_sql": "with models as (\n\n select *\n from {{ ref('stg_dbt__models') }}\n\n),\n\nlatest_executions as (\n\n select *\n from {{ ref('fct_dbt__latest_full_model_executions') }}\n\n),\n\nlatest_id as (\n -- Find the latest full, incremental execution\n\n select\n any_value(command_invocation_id) as command_invocation_id,\n any_value(dbt_cloud_run_id) as dbt_cloud_run_id\n from latest_executions\n\n),\n\nlatest_models as (\n -- Get the latest set of models for the above execution\n\n select\n models.node_id,\n models.depends_on_nodes,\n models.model_materialization\n from latest_id\n left join models on\n latest_id.command_invocation_id = models.command_invocation_id\n or latest_id.dbt_cloud_run_id = models.dbt_cloud_run_id\n\n\n),\n\nnode_dependencies as (\n -- Create a row for each model and dependency (could be another model, or source)\n\n select\n latest_models.node_id,\n node.value::string as depends_on_node_id,\n regexp_substr(node.value::string, '^([a-z]+)') as depends_on_node_type\n from latest_models,\n lateral flatten(input => latest_models.depends_on_nodes) as node\n\n),\n\nnode_dependencies_deduped as (\n -- depends_on_nodes is simply a list of all the ref() statements used in a model, so it may contain duplicates\n\n select distinct\n node_id,\n depends_on_node_type,\n depends_on_node_id\n from node_dependencies\n\n),\n\nmodel_dependencies_with_total_node_runtime as (\n -- Model dependencies enriched with execution time\n\n select distinct\n node_dependencies_deduped.node_id,\n latest_executions.total_node_runtime,\n depends_on_node_id\n from node_dependencies_deduped\n left join latest_executions on node_dependencies_deduped.node_id = latest_executions.node_id\n where depends_on_node_type = 'model'\n\n),\n\nmodels_with_at_least_one_model_dependency as (\n -- Return a list of model nodes which have at least one model dependency\n\n select distinct\n node_id\n from node_dependencies\n where depends_on_node_type = 'model'\n\n),\n\nmodels_with_no_model_dependencies_with_total_node_runtime as (\n -- Models which have no dependencies enriched with execution time\n -- These are models at the base of the tree\n\n select\n latest_models.node_id,\n latest_executions.total_node_runtime\n from latest_models\n left join models_with_at_least_one_model_dependency\n on latest_models.node_id = models_with_at_least_one_model_dependency.node_id\n left join latest_executions on latest_models.node_id = latest_executions.node_id\n where models_with_at_least_one_model_dependency.node_id is null\n\n),\n\nmodels_with_dependent_models as (\n -- Get a list of all the models which have dependent models\n\n select distinct depends_on_node_id as node_id\n from node_dependencies_deduped\n\n),\n\nmodels_with_no_dependent_models as (\n -- Models which have no dependents\n -- These are models at the tips of the tree\n\n select\n latest_models.node_id\n from latest_models\n left join models_with_dependent_models\n on latest_models.node_id = models_with_dependent_models.node_id\n where models_with_dependent_models.node_id is null\n\n),\n\nanchor as (\n -- The anchor of a recursive CTE is the initial query\n -- The anchor in this case is models which have no dependents, the tips of the tree\n -- The dependencies for these models are joined in to build out the paths during recursion\n\n select\n models_with_no_dependent_models.node_id,\n coalesce(node_dependencies_deduped.depends_on_node_id, '') as depends_on_node_id,\n coalesce(latest_executions.total_node_runtime, 0) as total_node_runtime\n from models_with_no_dependent_models\n left join node_dependencies_deduped on models_with_no_dependent_models.node_id = node_dependencies_deduped.node_id\n left join latest_executions on models_with_no_dependent_models.node_id = latest_executions.node_id\n\n),\n\nall_needed_dependencies as (\n -- Union all the base models with all other dependencies\n -- Use an empty string for depends_on_node_id to avoid NULL result in a non-nullable column error\n -- Nothing will join onto the empty string depends_on_node_id, ending the recursion at the base.\n\n select\n node_id,\n total_node_runtime,\n '' as depends_on_node_id\n from models_with_no_model_dependencies_with_total_node_runtime\n union\n select\n node_id,\n total_node_runtime,\n depends_on_node_id as depends_on_node_id\n from model_dependencies_with_total_node_runtime\n\n),\n\nsearch_path (node_ids, total_time) as (\n -- The recursive part\n -- This CTE creates an array of node_ids and total_time for every possible path through the DAG\n -- Starting with the tips of the tree, work backwards through every path until there's a '' depends_on_node_id\n\n select\n array_construct(depends_on_node_id, node_id),\n total_node_runtime\n from anchor\n union all\n select\n array_cat(to_array(all_needed_dependencies.depends_on_node_id), search_path.node_ids) as node_ids,\n all_needed_dependencies.total_node_runtime + search_path.total_time\n from search_path\n left join all_needed_dependencies\n where get(search_path.node_ids, 0) = all_needed_dependencies.node_id\n\n),\n\nlongest_path_node_ids as (\n -- Find the path with the longest total time\n\n select\n -- Remove any empty strings from the beginning of the array that were introduced in search_path to prevent infinite recursion\n case\n when get(node_ids, 0) = ''\n -- Ensure we keep the last element of the array by using array_size for the last index\n then array_slice(node_ids, 1, array_size(node_ids))\n else node_ids\n end as node_ids,\n total_time\n from search_path\n order by total_time desc\n limit 1\n\n),\n\nflattened as (\n -- Flatten the array of node_ids and keep the index\n\n select\n value as node_id,\n index\n from longest_path_node_ids,\n lateral flatten (input => node_ids)\n\n),\n\nlongest_path_with_times as (\n -- Join the indidivual model execution times back in along with the materializations\n\n select\n flattened.node_id::string as node_id,\n flattened.index,\n latest_executions.total_node_runtime/60 as execution_minutes,\n latest_models.model_materialization\n from flattened\n left join latest_executions on flattened.node_id = latest_executions.node_id\n left join latest_models on flattened.node_id = latest_models.node_id\n\n)\n\nselect * from longest_path_with_times", "compiled": true, "resource_type": "model", "depends_on": {"macros": [], "nodes": ["model.dbt_artifacts.stg_dbt__models", "model.dbt_artifacts.fct_dbt__latest_full_model_executions"]}, "config": {"enabled": true, "materialized": "table", "persist_docs": {}, "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": null, "database": null, "tags": [], "full_refresh": null, "post-hook": [], "pre-hook": []}, "database": "database", "schema": "schema", "fqn": ["dbt_artifacts", "fct_dbt__critical_path"], "unique_id": "model.dbt_artifacts.fct_dbt__critical_path", "package_name": "dbt_artifacts", "root_path": "/dbt_artifacts", "path": "fct_dbt__critical_path.sql", "original_file_path": "models/fct_dbt__critical_path.sql", "name": "fct_dbt__critical_path", "alias": "fct_dbt__critical_path", "checksum": {"name": "sha256", "checksum": "26501656a94a65deb9aa2b1820dfc23fbc1cc44ca8de36a60282c1a8cc09931a"}, "tags": [], "refs": [["stg_dbt__models"], ["fct_dbt__latest_full_model_executions"]], "sources": [], "description": "A table of models and executions times that make up the critical path of a full, incremental run.", "columns": {"node_id": {"name": "node_id", "description": "Primary key.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "index": {"name": "index", "description": "The index of the model in the critical path. Starts at 0.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "execution_minutes": {"name": "execution_minutes", "description": "The duration of time in minutes for the model to run.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "model_materialization": {"name": "model_materialization", "description": "", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "models/schemas.yml", "build_path": "target/compiled/dbt_artifacts/models/fct_dbt__critical_path.sql", "deferred": false, "unrendered_config": {"materialized": "table"}, "compiled_sql": "with models as (\n\n select *\n from database.schema.stg_dbt__models\n\n),\n\nlatest_executions as (\n\n select *\n from database.schema.fct_dbt__latest_full_model_executions\n\n),\n\nlatest_id as (\n -- Find the latest full, incremental execution\n\n select\n any_value(command_invocation_id) as command_invocation_id,\n any_value(dbt_cloud_run_id) as dbt_cloud_run_id\n from latest_executions\n\n),\n\nlatest_models as (\n -- Get the latest set of models for the above execution\n\n select\n models.node_id,\n models.depends_on_nodes,\n models.model_materialization\n from latest_id\n left join models on\n latest_id.command_invocation_id = models.command_invocation_id\n or latest_id.dbt_cloud_run_id = models.dbt_cloud_run_id\n\n\n),\n\nnode_dependencies as (\n -- Create a row for each model and dependency (could be another model, or source)\n\n select\n latest_models.node_id,\n node.value::string as depends_on_node_id,\n regexp_substr(node.value::string, '^([a-z]+)') as depends_on_node_type\n from latest_models,\n lateral flatten(input => latest_models.depends_on_nodes) as node\n\n),\n\nnode_dependencies_deduped as (\n -- depends_on_nodes is simply a list of all the ref() statements used in a model, so it may contain duplicates\n\n select distinct\n node_id,\n depends_on_node_type,\n depends_on_node_id\n from node_dependencies\n\n),\n\nmodel_dependencies_with_total_node_runtime as (\n -- Model dependencies enriched with execution time\n\n select distinct\n node_dependencies_deduped.node_id,\n latest_executions.total_node_runtime,\n depends_on_node_id\n from node_dependencies_deduped\n left join latest_executions on node_dependencies_deduped.node_id = latest_executions.node_id\n where depends_on_node_type = 'model'\n\n),\n\nmodels_with_at_least_one_model_dependency as (\n -- Return a list of model nodes which have at least one model dependency\n\n select distinct\n node_id\n from node_dependencies\n where depends_on_node_type = 'model'\n\n),\n\nmodels_with_no_model_dependencies_with_total_node_runtime as (\n -- Models which have no dependencies enriched with execution time\n -- These are models at the base of the tree\n\n select\n latest_models.node_id,\n latest_executions.total_node_runtime\n from latest_models\n left join models_with_at_least_one_model_dependency\n on latest_models.node_id = models_with_at_least_one_model_dependency.node_id\n left join latest_executions on latest_models.node_id = latest_executions.node_id\n where models_with_at_least_one_model_dependency.node_id is null\n\n),\n\nmodels_with_dependent_models as (\n -- Get a list of all the models which have dependent models\n\n select distinct depends_on_node_id as node_id\n from node_dependencies_deduped\n\n),\n\nmodels_with_no_dependent_models as (\n -- Models which have no dependents\n -- These are models at the tips of the tree\n\n select\n latest_models.node_id\n from latest_models\n left join models_with_dependent_models\n on latest_models.node_id = models_with_dependent_models.node_id\n where models_with_dependent_models.node_id is null\n\n),\n\nanchor as (\n -- The anchor of a recursive CTE is the initial query\n -- The anchor in this case is models which have no dependents, the tips of the tree\n -- The dependencies for these models are joined in to build out the paths during recursion\n\n select\n models_with_no_dependent_models.node_id,\n coalesce(node_dependencies_deduped.depends_on_node_id, '') as depends_on_node_id,\n coalesce(latest_executions.total_node_runtime, 0) as total_node_runtime\n from models_with_no_dependent_models\n left join node_dependencies_deduped on models_with_no_dependent_models.node_id = node_dependencies_deduped.node_id\n left join latest_executions on models_with_no_dependent_models.node_id = latest_executions.node_id\n\n),\n\nall_needed_dependencies as (\n -- Union all the base models with all other dependencies\n -- Use an empty string for depends_on_node_id to avoid NULL result in a non-nullable column error\n -- Nothing will join onto the empty string depends_on_node_id, ending the recursion at the base.\n\n select\n node_id,\n total_node_runtime,\n '' as depends_on_node_id\n from models_with_no_model_dependencies_with_total_node_runtime\n union\n select\n node_id,\n total_node_runtime,\n depends_on_node_id as depends_on_node_id\n from model_dependencies_with_total_node_runtime\n\n),\n\nsearch_path (node_ids, total_time) as (\n -- The recursive part\n -- This CTE creates an array of node_ids and total_time for every possible path through the DAG\n -- Starting with the tips of the tree, work backwards through every path until there's a '' depends_on_node_id\n\n select\n array_construct(depends_on_node_id, node_id),\n total_node_runtime\n from anchor\n union all\n select\n array_cat(to_array(all_needed_dependencies.depends_on_node_id), search_path.node_ids) as node_ids,\n all_needed_dependencies.total_node_runtime + search_path.total_time\n from search_path\n left join all_needed_dependencies\n where get(search_path.node_ids, 0) = all_needed_dependencies.node_id\n\n),\n\nlongest_path_node_ids as (\n -- Find the path with the longest total time\n\n select\n -- Remove any empty strings from the beginning of the array that were introduced in search_path to prevent infinite recursion\n case\n when get(node_ids, 0) = ''\n -- Ensure we keep the last element of the array by using array_size for the last index\n then array_slice(node_ids, 1, array_size(node_ids))\n else node_ids\n end as node_ids,\n total_time\n from search_path\n order by total_time desc\n limit 1\n\n),\n\nflattened as (\n -- Flatten the array of node_ids and keep the index\n\n select\n value as node_id,\n index\n from longest_path_node_ids,\n lateral flatten (input => node_ids)\n\n),\n\nlongest_path_with_times as (\n -- Join the indidivual model execution times back in along with the materializations\n\n select\n flattened.node_id::string as node_id,\n flattened.index,\n latest_executions.total_node_runtime/60 as execution_minutes,\n latest_models.model_materialization\n from flattened\n left join latest_executions on flattened.node_id = latest_executions.node_id\n left join latest_models on flattened.node_id = latest_models.node_id\n\n)\n\nselect * from longest_path_with_times", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "database.schema.fct_dbt__critical_path"}, "model.dbt_artifacts.stg_dbt__models": {"raw_sql": "with base as (\n\n select *\n from {{ ref('stg_dbt__artifacts') }}\n\n),\n\nmanifests as (\n\n select *\n from base\n where artifact_type = 'manifest.json'\n\n),\n\nflatten as (\n\n select\n command_invocation_id,\n dbt_cloud_run_id,\n generated_at as artifact_generated_at,\n node.key as node_id,\n node.value:database::string as model_database,\n node.value:schema::string as model_schema,\n node.value:name::string as name,\n to_array(node.value:depends_on:nodes) as depends_on_nodes,\n node.value:package_name::string as package_name,\n node.value:path::string as model_path,\n node.value:checksum.checksum::string as checksum,\n node.value:config.materialized::string as model_materialization\n from manifests,\n lateral flatten(input => data:nodes) as node\n where node.value:resource_type = 'model'\n\n),\n\nsurrogate_key as (\n\n select\n {{ dbt_utils.surrogate_key(['command_invocation_id', 'node_id']) }} as manifest_model_id,\n command_invocation_id,\n dbt_cloud_run_id,\n artifact_generated_at,\n node_id,\n model_database,\n model_schema,\n name,\n depends_on_nodes,\n package_name,\n model_path,\n checksum,\n model_materialization\n from flatten\n\n)\n\nselect * from surrogate_key", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.dbt_utils.surrogate_key"], "nodes": ["model.dbt_artifacts.stg_dbt__artifacts"]}, "config": {"enabled": true, "materialized": "view", "persist_docs": {}, "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": null, "database": null, "tags": [], "full_refresh": null, "post-hook": [], "pre-hook": []}, "database": "database", "schema": "schema", "fqn": ["dbt_artifacts", "staging", "stg_dbt__models"], "unique_id": "model.dbt_artifacts.stg_dbt__models", "package_name": "dbt_artifacts", "root_path": "/dbt_artifacts", "path": "staging/stg_dbt__models.sql", "original_file_path": "models/staging/stg_dbt__models.sql", "name": "stg_dbt__models", "alias": "stg_dbt__models", "checksum": {"name": "sha256", "checksum": "62f40a8717fbc9c2ff5e961f00b59c8d7bd31ed333f591c69f14272e37205e93"}, "tags": [], "refs": [["stg_dbt__artifacts"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": "target/compiled/dbt_artifacts/models/staging/stg_dbt__models.sql", "deferred": false, "unrendered_config": {"materialized": "view"}, "compiled_sql": "with base as (\n\n select *\n from database.schema.stg_dbt__artifacts\n\n),\n\nmanifests as (\n\n select *\n from base\n where artifact_type = 'manifest.json'\n\n),\n\nflatten as (\n\n select\n command_invocation_id,\n dbt_cloud_run_id,\n generated_at as artifact_generated_at,\n node.key as node_id,\n node.value:database::string as model_database,\n node.value:schema::string as model_schema,\n node.value:name::string as name,\n to_array(node.value:depends_on:nodes) as depends_on_nodes,\n node.value:package_name::string as package_name,\n node.value:path::string as model_path,\n node.value:checksum.checksum::string as checksum,\n node.value:config.materialized::string as model_materialization\n from manifests,\n lateral flatten(input => data:nodes) as node\n where node.value:resource_type = 'model'\n\n),\n\nsurrogate_key as (\n\n select\n md5(cast(\n \n coalesce(cast(command_invocation_id as \n varchar\n), '') || '-' || coalesce(cast(node_id as \n varchar\n), '')\n\n as \n varchar\n)) as manifest_model_id,\n command_invocation_id,\n dbt_cloud_run_id,\n artifact_generated_at,\n node_id,\n model_database,\n model_schema,\n name,\n depends_on_nodes,\n package_name,\n model_path,\n checksum,\n model_materialization\n from flatten\n\n)\n\nselect * from surrogate_key", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "database.schema.stg_dbt__models"}, "model.dbt_artifacts.stg_dbt__run_results_env_keys": {"raw_sql": "with base as (\n\n select *\n from {{ ref('stg_dbt__artifacts') }}\n\n),\n\nrun_results as (\n\n select *\n from base\n where artifact_type = 'run_results.json'\n\n),\n\ndbt_run as (\n\n select *\n from run_results\n where data:args:which = 'run'\n\n),\n\nenv_keys as (\n\n select\n distinct(env.key)\n from dbt_run,\n lateral flatten(input => data:metadata:env) as env\n -- Sort results to ensure things are deterministic\n order by 1\n\n)\n\nselect * from env_keys", "compiled": true, "resource_type": "model", "depends_on": {"macros": [], "nodes": ["model.dbt_artifacts.stg_dbt__artifacts"]}, "config": {"enabled": true, "materialized": "view", "persist_docs": {}, "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": null, "database": null, "tags": [], "full_refresh": null, "post-hook": [], "pre-hook": []}, "database": "database", "schema": "schema", "fqn": ["dbt_artifacts", "staging", "stg_dbt__run_results_env_keys"], "unique_id": "model.dbt_artifacts.stg_dbt__run_results_env_keys", "package_name": "dbt_artifacts", "root_path": "/dbt_artifacts", "path": "staging/stg_dbt__run_results_env_keys.sql", "original_file_path": "models/staging/stg_dbt__run_results_env_keys.sql", "name": "stg_dbt__run_results_env_keys", "alias": "stg_dbt__run_results_env_keys", "checksum": {"name": "sha256", "checksum": "fee22d08223cd2536fecb09556ad48b21483e72146b5535812c53ef731603651"}, "tags": [], "refs": [["stg_dbt__artifacts"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": "target/compiled/dbt_artifacts/models/staging/stg_dbt__run_results_env_keys.sql", "deferred": false, "unrendered_config": {"materialized": "view"}, "compiled_sql": "with base as (\n\n select *\n from database.schema.stg_dbt__artifacts\n\n),\n\nrun_results as (\n\n select *\n from base\n where artifact_type = 'run_results.json'\n\n),\n\ndbt_run as (\n\n select *\n from run_results\n where data:args:which = 'run'\n\n),\n\nenv_keys as (\n\n select\n distinct(env.key)\n from dbt_run,\n lateral flatten(input => data:metadata:env) as env\n -- Sort results to ensure things are deterministic\n order by 1\n\n)\n\nselect * from env_keys", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "database.schema.stg_dbt__run_results_env_keys"}, "model.dbt_artifacts.stg_dbt__exposures": {"raw_sql": "with base as (\n\n select *\n from {{ ref('stg_dbt__artifacts') }}\n\n),\n\nmanifests as (\n\n select *\n from base\n where artifact_type = 'manifest.json'\n\n),\n\nflatten as (\n\n select\n command_invocation_id,\n dbt_cloud_run_id,\n generated_at as artifact_generated_at,\n node.key as node_id,\n node.value:name::string as name,\n to_array(node.value:depends_on:nodes) as depends_on_nodes,\n to_array(node.value:sources:nodes) as depends_on_sources,\n node.value:type::string as type,\n node.value:owner:name::string as owner,\n node.value:maturity::string as maturity,\n node.value:package_name::string as package_name\n from manifests,\n lateral flatten(input => data:exposures) as node\n\n),\n\nsurrogate_key as (\n\n select\n {{ dbt_utils.surrogate_key(['command_invocation_id', 'node_id']) }} as manifest_model_id,\n command_invocation_id,\n dbt_cloud_run_id,\n artifact_generated_at,\n node_id,\n name,\n depends_on_nodes,\n depends_on_sources,\n type,\n owner,\n maturity,\n package_name\n from flatten\n\n)\n\nselect * from surrogate_key", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.dbt_utils.surrogate_key"], "nodes": ["model.dbt_artifacts.stg_dbt__artifacts"]}, "config": {"enabled": true, "materialized": "view", "persist_docs": {}, "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": null, "database": null, "tags": [], "full_refresh": null, "post-hook": [], "pre-hook": []}, "database": "database", "schema": "schema", "fqn": ["dbt_artifacts", "staging", "stg_dbt__exposures"], "unique_id": "model.dbt_artifacts.stg_dbt__exposures", "package_name": "dbt_artifacts", "root_path": "/dbt_artifacts", "path": "staging/stg_dbt__exposures.sql", "original_file_path": "models/staging/stg_dbt__exposures.sql", "name": "stg_dbt__exposures", "alias": "stg_dbt__exposures", "checksum": {"name": "sha256", "checksum": "bf35674d9f92eca84841231602eea633efae7555a9cc5057a1555001b1ac14b2"}, "tags": [], "refs": [["stg_dbt__artifacts"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": "target/compiled/dbt_artifacts/models/staging/stg_dbt__exposures.sql", "deferred": false, "unrendered_config": {"materialized": "view"}, "compiled_sql": "with base as (\n\n select *\n from database.schema.stg_dbt__artifacts\n\n),\n\nmanifests as (\n\n select *\n from base\n where artifact_type = 'manifest.json'\n\n),\n\nflatten as (\n\n select\n command_invocation_id,\n dbt_cloud_run_id,\n generated_at as artifact_generated_at,\n node.key as node_id,\n node.value:name::string as name,\n to_array(node.value:depends_on:nodes) as depends_on_nodes,\n to_array(node.value:sources:nodes) as depends_on_sources,\n node.value:type::string as type,\n node.value:owner:name::string as owner,\n node.value:maturity::string as maturity,\n node.value:package_name::string as package_name\n from manifests,\n lateral flatten(input => data:exposures) as node\n\n),\n\nsurrogate_key as (\n\n select\n md5(cast(\n \n coalesce(cast(command_invocation_id as \n varchar\n), '') || '-' || coalesce(cast(node_id as \n varchar\n), '')\n\n as \n varchar\n)) as manifest_model_id,\n command_invocation_id,\n dbt_cloud_run_id,\n artifact_generated_at,\n node_id,\n name,\n depends_on_nodes,\n depends_on_sources,\n type,\n owner,\n maturity,\n package_name\n from flatten\n\n)\n\nselect * from surrogate_key", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "database.schema.stg_dbt__exposures"}, "model.dbt_artifacts.stg_dbt__test_executions": {"raw_sql": "with base as (\n\n select *\n from {{ ref('stg_dbt__artifacts') }}\n\n),\n\nrun_results as (\n\n select *\n from base\n where artifact_type = 'run_results.json'\n\n),\n\ndbt_run as (\n\n select *\n from run_results\n where data:args:which = 'test'\n\n),\n\nfields as (\n\n select\n command_invocation_id,\n dbt_cloud_run_id,\n generated_at as artifact_generated_at,\n coalesce(data:args:full_refresh, 'false')::boolean as was_full_refresh,\n result.value:unique_id::string as node_id,\n split(result.value:thread_id::string, '-')[1]::integer as thread_id,\n result.value:status::string as status,\n result.value:message::string as message,\n\n -- The first item in the timing array is the model-level `compile`\n result.value:timing[0]:started_at::timestamp_ntz as compile_started_at,\n\n -- The second item in the timing array is `execute`.\n result.value:timing[1]:completed_at::timestamp_ntz as query_completed_at,\n\n -- Confusingly, this does not match the delta of the above two timestamps.\n -- should we calculate it instead?\n coalesce(result.value:execution_time::float, 0) as total_node_runtime,\n\n result.value:adapter_response:rows_affected::int as rows_affected\n from dbt_run,\n lateral flatten(input => data:results) as result\n\n),\n\nsurrogate_key as (\n\n select\n {{ dbt_utils.surrogate_key(['command_invocation_id', 'node_id']) }} as model_execution_id,\n command_invocation_id,\n dbt_cloud_run_id,\n artifact_generated_at,\n was_full_refresh,\n node_id,\n thread_id,\n status,\n message,\n compile_started_at,\n query_completed_at,\n total_node_runtime,\n rows_affected\n from fields\n\n)\n\nselect * from surrogate_key", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.dbt_utils.surrogate_key"], "nodes": ["model.dbt_artifacts.stg_dbt__artifacts"]}, "config": {"enabled": true, "materialized": "view", "persist_docs": {}, "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": null, "database": null, "tags": [], "full_refresh": null, "post-hook": [], "pre-hook": []}, "database": "database", "schema": "schema", "fqn": ["dbt_artifacts", "staging", "stg_dbt__test_executions"], "unique_id": "model.dbt_artifacts.stg_dbt__test_executions", "package_name": "dbt_artifacts", "root_path": "/dbt_artifacts", "path": "staging/stg_dbt__test_executions.sql", "original_file_path": "models/staging/stg_dbt__test_executions.sql", "name": "stg_dbt__test_executions", "alias": "stg_dbt__test_executions", "checksum": {"name": "sha256", "checksum": "9d5a7fdd7416b004e7c160c49cc12024c3f1eb8304c365ec28c21fddc226b992"}, "tags": [], "refs": [["stg_dbt__artifacts"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": "target/compiled/dbt_artifacts/models/staging/stg_dbt__test_executions.sql", "deferred": false, "unrendered_config": {"materialized": "view"}, "compiled_sql": "with base as (\n\n select *\n from database.schema.stg_dbt__artifacts\n\n),\n\nrun_results as (\n\n select *\n from base\n where artifact_type = 'run_results.json'\n\n),\n\ndbt_run as (\n\n select *\n from run_results\n where data:args:which = 'test'\n\n),\n\nfields as (\n\n select\n command_invocation_id,\n dbt_cloud_run_id,\n generated_at as artifact_generated_at,\n coalesce(data:args:full_refresh, 'false')::boolean as was_full_refresh,\n result.value:unique_id::string as node_id,\n split(result.value:thread_id::string, '-')[1]::integer as thread_id,\n result.value:status::string as status,\n result.value:message::string as message,\n\n -- The first item in the timing array is the model-level `compile`\n result.value:timing[0]:started_at::timestamp_ntz as compile_started_at,\n\n -- The second item in the timing array is `execute`.\n result.value:timing[1]:completed_at::timestamp_ntz as query_completed_at,\n\n -- Confusingly, this does not match the delta of the above two timestamps.\n -- should we calculate it instead?\n coalesce(result.value:execution_time::float, 0) as total_node_runtime,\n\n result.value:adapter_response:rows_affected::int as rows_affected\n from dbt_run,\n lateral flatten(input => data:results) as result\n\n),\n\nsurrogate_key as (\n\n select\n md5(cast(\n \n coalesce(cast(command_invocation_id as \n varchar\n), '') || '-' || coalesce(cast(node_id as \n varchar\n), '')\n\n as \n varchar\n)) as model_execution_id,\n command_invocation_id,\n dbt_cloud_run_id,\n artifact_generated_at,\n was_full_refresh,\n node_id,\n thread_id,\n status,\n message,\n compile_started_at,\n query_completed_at,\n total_node_runtime,\n rows_affected\n from fields\n\n)\n\nselect * from surrogate_key", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "database.schema.stg_dbt__test_executions"}, "model.dbt_artifacts.stg_dbt__sources": {"raw_sql": "with base as (\n\n select *\n from {{ ref('stg_dbt__artifacts') }}\n\n),\n\nmanifests as (\n\n select *\n from base\n where artifact_type = 'manifest.json'\n\n),\n\nflatten as (\n\n select\n command_invocation_id,\n dbt_cloud_run_id,\n generated_at as artifact_generated_at,\n node.key as node_id,\n node.value:name::string as name,\n node.value:source_name::string as source_name,\n node.value:schema::string as source_schema,\n node.value:package_name::string as package_name,\n node.value:relation_name::string as relation_name,\n node.value:path::string as source_path\n from manifests,\n lateral flatten(input => data:sources) as node\n where node.value:resource_type = 'source'\n\n),\n\nsurrogate_key as (\n\n select\n {{ dbt_utils.surrogate_key(['command_invocation_id', 'node_id']) }} as manifest_source_id,\n command_invocation_id,\n dbt_cloud_run_id,\n artifact_generated_at,\n node_id,\n name,\n source_name,\n source_schema,\n package_name,\n relation_name,\n source_path\n from flatten\n\n)\n\nselect * from surrogate_key", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.dbt_utils.surrogate_key"], "nodes": ["model.dbt_artifacts.stg_dbt__artifacts"]}, "config": {"enabled": true, "materialized": "view", "persist_docs": {}, "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": null, "database": null, "tags": [], "full_refresh": null, "post-hook": [], "pre-hook": []}, "database": "database", "schema": "schema", "fqn": ["dbt_artifacts", "staging", "stg_dbt__sources"], "unique_id": "model.dbt_artifacts.stg_dbt__sources", "package_name": "dbt_artifacts", "root_path": "/dbt_artifacts", "path": "staging/stg_dbt__sources.sql", "original_file_path": "models/staging/stg_dbt__sources.sql", "name": "stg_dbt__sources", "alias": "stg_dbt__sources", "checksum": {"name": "sha256", "checksum": "d78cd9140513a7ba667ffd88894295f53dd90986f05637154802c50a1f1bd720"}, "tags": [], "refs": [["stg_dbt__artifacts"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": "target/compiled/dbt_artifacts/models/staging/stg_dbt__sources.sql", "deferred": false, "unrendered_config": {"materialized": "view"}, "compiled_sql": "with base as (\n\n select *\n from database.schema.stg_dbt__artifacts\n\n),\n\nmanifests as (\n\n select *\n from base\n where artifact_type = 'manifest.json'\n\n),\n\nflatten as (\n\n select\n command_invocation_id,\n dbt_cloud_run_id,\n generated_at as artifact_generated_at,\n node.key as node_id,\n node.value:name::string as name,\n node.value:source_name::string as source_name,\n node.value:schema::string as source_schema,\n node.value:package_name::string as package_name,\n node.value:relation_name::string as relation_name,\n node.value:path::string as source_path\n from manifests,\n lateral flatten(input => data:sources) as node\n where node.value:resource_type = 'source'\n\n),\n\nsurrogate_key as (\n\n select\n md5(cast(\n \n coalesce(cast(command_invocation_id as \n varchar\n), '') || '-' || coalesce(cast(node_id as \n varchar\n), '')\n\n as \n varchar\n)) as manifest_source_id,\n command_invocation_id,\n dbt_cloud_run_id,\n artifact_generated_at,\n node_id,\n name,\n source_name,\n source_schema,\n package_name,\n relation_name,\n source_path\n from flatten\n\n)\n\nselect * from surrogate_key", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "database.schema.stg_dbt__sources"}, "model.dbt_artifacts.stg_dbt__artifacts": {"raw_sql": "with base as (\n\n select *\n from {{ source('dbt_artifacts', 'artifacts') }}\n\n),\n\nfields as (\n\n select\n data:metadata:invocation_id::string as command_invocation_id,\n data:metadata:env:DBT_CLOUD_RUN_ID::int as dbt_cloud_run_id,\n generated_at,\n path,\n artifact_type,\n data\n from base\n\n),\n\ndeduped as (\n\n select\n *,\n row_number() over (\n partition by command_invocation_id, artifact_type\n order by generated_at desc\n ) as index\n from fields\n qualify index = 1\n\n),\n\nartifacts as (\n\n select\n command_invocation_id,\n dbt_cloud_run_id,\n generated_at,\n path,\n artifact_type,\n data\n from deduped\n\n)\n\nselect * from artifacts", "compiled": true, "resource_type": "model", "depends_on": {"macros": [], "nodes": ["source.dbt_artifacts.dbt_artifacts.artifacts"]}, "config": {"enabled": true, "materialized": "view", "persist_docs": {}, "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": null, "database": null, "tags": [], "full_refresh": null, "post-hook": [], "pre-hook": []}, "database": "database", "schema": "schema", "fqn": ["dbt_artifacts", "staging", "stg_dbt__artifacts"], "unique_id": "model.dbt_artifacts.stg_dbt__artifacts", "package_name": "dbt_artifacts", "root_path": "/dbt_artifacts", "path": "staging/stg_dbt__artifacts.sql", "original_file_path": "models/staging/stg_dbt__artifacts.sql", "name": "stg_dbt__artifacts", "alias": "stg_dbt__artifacts", "checksum": {"name": "sha256", "checksum": "c33590d0b759dcaf3473cf8d59773d541dfe810d253ae31eaacade1c21d80b61"}, "tags": [], "refs": [], "sources": [["dbt_artifacts", "artifacts"]], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": "target/compiled/dbt_artifacts/models/staging/stg_dbt__artifacts.sql", "deferred": false, "unrendered_config": {"materialized": "view"}, "compiled_sql": "with base as (\n\n select *\n from dbt_artifacts.dbt_artifacts.artifacts\n\n),\n\nfields as (\n\n select\n data:metadata:invocation_id::string as command_invocation_id,\n data:metadata:env:DBT_CLOUD_RUN_ID::int as dbt_cloud_run_id,\n generated_at,\n path,\n artifact_type,\n data\n from base\n\n),\n\ndeduped as (\n\n select\n *,\n row_number() over (\n partition by command_invocation_id, artifact_type\n order by generated_at desc\n ) as index\n from fields\n qualify index = 1\n\n),\n\nartifacts as (\n\n select\n command_invocation_id,\n dbt_cloud_run_id,\n generated_at,\n path,\n artifact_type,\n data\n from deduped\n\n)\n\nselect * from artifacts", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "database.schema.stg_dbt__artifacts"}, "model.dbt_artifacts.stg_dbt__model_executions": {"raw_sql": "with base as (\n\n select *\n from {{ ref('stg_dbt__artifacts') }}\n\n),\n\nrun_results as (\n\n select *\n from base\n where artifact_type = 'run_results.json'\n\n),\n\ndbt_run as (\n\n select *\n from run_results\n where data:args:which = 'run'\n\n),\n\nfields as (\n\n select\n command_invocation_id,\n dbt_cloud_run_id,\n generated_at as artifact_generated_at,\n coalesce(data:args:full_refresh, 'false')::boolean as was_full_refresh,\n result.value:unique_id::string as node_id,\n split(result.value:thread_id::string, '-')[1]::integer as thread_id,\n result.value:status::string as status,\n\n -- The first item in the timing array is the model-level `compile`\n result.value:timing[0]:started_at::timestamp_ntz as compile_started_at,\n\n -- The second item in the timing array is `execute`.\n result.value:timing[1]:completed_at::timestamp_ntz as query_completed_at,\n\n -- Confusingly, this does not match the delta of the above two timestamps.\n -- should we calculate it instead?\n coalesce(result.value:execution_time::float, 0) as total_node_runtime,\n\n result.value:adapter_response:rows_affected::int as rows_affected\n from dbt_run,\n lateral flatten(input => data:results) as result\n\n),\n\nsurrogate_key as (\n\n select\n {{ dbt_utils.surrogate_key(['command_invocation_id', 'node_id']) }} as model_execution_id,\n command_invocation_id,\n dbt_cloud_run_id,\n artifact_generated_at,\n was_full_refresh,\n node_id,\n thread_id,\n status,\n compile_started_at,\n query_completed_at,\n total_node_runtime,\n rows_affected\n from fields\n\n)\n\nselect * from surrogate_key", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.dbt_utils.surrogate_key"], "nodes": ["model.dbt_artifacts.stg_dbt__artifacts"]}, "config": {"enabled": true, "materialized": "view", "persist_docs": {}, "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": null, "database": null, "tags": [], "full_refresh": null, "post-hook": [], "pre-hook": []}, "database": "database", "schema": "schema", "fqn": ["dbt_artifacts", "staging", "stg_dbt__model_executions"], "unique_id": "model.dbt_artifacts.stg_dbt__model_executions", "package_name": "dbt_artifacts", "root_path": "/dbt_artifacts", "path": "staging/stg_dbt__model_executions.sql", "original_file_path": "models/staging/stg_dbt__model_executions.sql", "name": "stg_dbt__model_executions", "alias": "stg_dbt__model_executions", "checksum": {"name": "sha256", "checksum": "8db08623fcf016a53b49936e8d85714d26f66da943f0f4eae0914dc0a559584c"}, "tags": [], "refs": [["stg_dbt__artifacts"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": "target/compiled/dbt_artifacts/models/staging/stg_dbt__model_executions.sql", "deferred": false, "unrendered_config": {"materialized": "view"}, "compiled_sql": "with base as (\n\n select *\n from database.schema.stg_dbt__artifacts\n\n),\n\nrun_results as (\n\n select *\n from base\n where artifact_type = 'run_results.json'\n\n),\n\ndbt_run as (\n\n select *\n from run_results\n where data:args:which = 'run'\n\n),\n\nfields as (\n\n select\n command_invocation_id,\n dbt_cloud_run_id,\n generated_at as artifact_generated_at,\n coalesce(data:args:full_refresh, 'false')::boolean as was_full_refresh,\n result.value:unique_id::string as node_id,\n split(result.value:thread_id::string, '-')[1]::integer as thread_id,\n result.value:status::string as status,\n\n -- The first item in the timing array is the model-level `compile`\n result.value:timing[0]:started_at::timestamp_ntz as compile_started_at,\n\n -- The second item in the timing array is `execute`.\n result.value:timing[1]:completed_at::timestamp_ntz as query_completed_at,\n\n -- Confusingly, this does not match the delta of the above two timestamps.\n -- should we calculate it instead?\n coalesce(result.value:execution_time::float, 0) as total_node_runtime,\n\n result.value:adapter_response:rows_affected::int as rows_affected\n from dbt_run,\n lateral flatten(input => data:results) as result\n\n),\n\nsurrogate_key as (\n\n select\n md5(cast(\n \n coalesce(cast(command_invocation_id as \n varchar\n), '') || '-' || coalesce(cast(node_id as \n varchar\n), '')\n\n as \n varchar\n)) as model_execution_id,\n command_invocation_id,\n dbt_cloud_run_id,\n artifact_generated_at,\n was_full_refresh,\n node_id,\n thread_id,\n status,\n compile_started_at,\n query_completed_at,\n total_node_runtime,\n rows_affected\n from fields\n\n)\n\nselect * from surrogate_key", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "database.schema.stg_dbt__model_executions"}, "model.dbt_artifacts.stg_dbt__run_results": {"raw_sql": "with base as (\n\n select *\n from {{ ref('stg_dbt__artifacts') }}\n\n),\n\nrun_results as (\n\n select *\n from base\n where artifact_type = 'run_results.json'\n\n),\n\ndbt_run as (\n\n select *\n from run_results\n where data:args:which = 'run'\n\n),\n\nfields as (\n\n select\n generated_at as artifact_generated_at,\n command_invocation_id,\n dbt_cloud_run_id,\n data:metadata:dbt_version::string as dbt_version,\n data:metadata:env as env,\n data:elapsed_time::float as elapsed_time,\n data:args:which::string as execution_command,\n coalesce(data:args:full_refresh, 'false')::boolean as was_full_refresh,\n data:args:models as selected_models,\n data:args:target::string as target\n from dbt_run\n\n)\n\nselect * from fields", "compiled": true, "resource_type": "model", "depends_on": {"macros": [], "nodes": ["model.dbt_artifacts.stg_dbt__artifacts"]}, "config": {"enabled": true, "materialized": "view", "persist_docs": {}, "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": null, "database": null, "tags": [], "full_refresh": null, "post-hook": [], "pre-hook": []}, "database": "database", "schema": "schema", "fqn": ["dbt_artifacts", "staging", "stg_dbt__run_results"], "unique_id": "model.dbt_artifacts.stg_dbt__run_results", "package_name": "dbt_artifacts", "root_path": "/dbt_artifacts", "path": "staging/stg_dbt__run_results.sql", "original_file_path": "models/staging/stg_dbt__run_results.sql", "name": "stg_dbt__run_results", "alias": "stg_dbt__run_results", "checksum": {"name": "sha256", "checksum": "8219a132f9eb92629931470f29221924b6f82052aba58ec8c2ec91a409eafa93"}, "tags": [], "refs": [["stg_dbt__artifacts"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": "target/compiled/dbt_artifacts/models/staging/stg_dbt__run_results.sql", "deferred": false, "unrendered_config": {"materialized": "view"}, "compiled_sql": "with base as (\n\n select *\n from database.schema.stg_dbt__artifacts\n\n),\n\nrun_results as (\n\n select *\n from base\n where artifact_type = 'run_results.json'\n\n),\n\ndbt_run as (\n\n select *\n from run_results\n where data:args:which = 'run'\n\n),\n\nfields as (\n\n select\n generated_at as artifact_generated_at,\n command_invocation_id,\n dbt_cloud_run_id,\n data:metadata:dbt_version::string as dbt_version,\n data:metadata:env as env,\n data:elapsed_time::float as elapsed_time,\n data:args:which::string as execution_command,\n coalesce(data:args:full_refresh, 'false')::boolean as was_full_refresh,\n data:args:models as selected_models,\n data:args:target::string as target\n from dbt_run\n\n)\n\nselect * from fields", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "database.schema.stg_dbt__run_results"}, "model.dbt_artifacts.int_dbt__model_executions": {"raw_sql": "{{ config( materialized='incremental', unique_key='model_execution_id' ) }}\n\nwith model_executions as (\n\n select *\n from {{ ref('stg_dbt__model_executions') }}\n\n),\n\nmodel_executions_incremental as (\n\n select *\n from model_executions\n\n {% if is_incremental() %}\n -- this filter will only be applied on an incremental run\n where artifact_generated_at > (select max(artifact_generated_at) from {{ this }})\n {% endif %}\n\n),\n\nfields as (\n\n select\n model_execution_id,\n command_invocation_id,\n dbt_cloud_run_id,\n artifact_generated_at,\n was_full_refresh,\n node_id,\n thread_id,\n status,\n compile_started_at,\n query_completed_at,\n total_node_runtime,\n rows_affected\n from model_executions_incremental\n\n)\n\nselect * from fields", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.dbt.is_incremental"], "nodes": ["model.dbt_artifacts.stg_dbt__model_executions"]}, "config": {"enabled": true, "materialized": "incremental", "persist_docs": {}, "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": null, "database": null, "tags": [], "full_refresh": null, "unique_key": "model_execution_id", "post-hook": [], "pre-hook": []}, "database": "database", "schema": "schema", "fqn": ["dbt_artifacts", "incremental", "int_dbt__model_executions"], "unique_id": "model.dbt_artifacts.int_dbt__model_executions", "package_name": "dbt_artifacts", "root_path": "/dbt_artifacts", "path": "incremental/int_dbt__model_executions.sql", "original_file_path": "models/incremental/int_dbt__model_executions.sql", "name": "int_dbt__model_executions", "alias": "int_dbt__model_executions", "checksum": {"name": "sha256", "checksum": "c07703978fe740876c6b9d545a3c438171c7377ec307571a290d73d73306cbab"}, "tags": [], "refs": [["stg_dbt__model_executions"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": "target/compiled/dbt_artifacts/models/incremental/int_dbt__model_executions.sql", "deferred": false, "unrendered_config": {"materialized": "incremental", "unique_key": "model_execution_id"}, "compiled_sql": "\n\nwith model_executions as (\n\n select *\n from database.schema.stg_dbt__model_executions\n\n),\n\nmodel_executions_incremental as (\n\n select *\n from model_executions\n\n \n -- this filter will only be applied on an incremental run\n where artifact_generated_at > (select max(artifact_generated_at) from database.schema.int_dbt__model_executions)\n \n\n),\n\nfields as (\n\n select\n model_execution_id,\n command_invocation_id,\n dbt_cloud_run_id,\n artifact_generated_at,\n was_full_refresh,\n node_id,\n thread_id,\n status,\n compile_started_at,\n query_completed_at,\n total_node_runtime,\n rows_affected\n from model_executions_incremental\n\n)\n\nselect * from fields", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "database.schema.int_dbt__model_executions"}, "model.dbt_artifacts.fct_dbt__test_executions": {"raw_sql": "{{ config( materialized='incremental', unique_key='model_execution_id' ) }}\n\nwith model_executions as (\n\n select *\n from {{ ref('stg_dbt__test_executions') }}\n\n),\n\nmodel_executions_incremental as (\n\n select *\n from model_executions\n\n {% if is_incremental() %}\n -- this filter will only be applied on an incremental run\n where artifact_generated_at > (select max(artifact_generated_at) from {{ this }})\n {% endif %}\n\n),\n\nfields as (\n\n select\n model_execution_id,\n command_invocation_id,\n dbt_cloud_run_id,\n artifact_generated_at,\n was_full_refresh,\n node_id,\n thread_id,\n status,\n compile_started_at,\n query_completed_at,\n total_node_runtime,\n rows_affected\n from model_executions_incremental\n\n)\n\nselect * from fields", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.dbt.is_incremental"], "nodes": ["model.dbt_artifacts.stg_dbt__test_executions"]}, "config": {"enabled": true, "materialized": "incremental", "persist_docs": {}, "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": null, "database": null, "tags": [], "full_refresh": null, "unique_key": "model_execution_id", "post-hook": [], "pre-hook": []}, "database": "database", "schema": "schema", "fqn": ["dbt_artifacts", "incremental", "fct_dbt__test_executions"], "unique_id": "model.dbt_artifacts.fct_dbt__test_executions", "package_name": "dbt_artifacts", "root_path": "/dbt_artifacts", "path": "incremental/fct_dbt__test_executions.sql", "original_file_path": "models/incremental/fct_dbt__test_executions.sql", "name": "fct_dbt__test_executions", "alias": "fct_dbt__test_executions", "checksum": {"name": "sha256", "checksum": "63f088d2bea4f1fe4af6e663a413dbdbc8b2d8fa1a4f9f66111324df8b86be3d"}, "tags": [], "refs": [["stg_dbt__test_executions"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": "target/compiled/dbt_artifacts/models/incremental/fct_dbt__test_executions.sql", "deferred": false, "unrendered_config": {"materialized": "incremental", "unique_key": "model_execution_id"}, "compiled_sql": "\n\nwith model_executions as (\n\n select *\n from database.schema.stg_dbt__test_executions\n\n),\n\nmodel_executions_incremental as (\n\n select *\n from model_executions\n\n \n -- this filter will only be applied on an incremental run\n where artifact_generated_at > (select max(artifact_generated_at) from database.schema.fct_dbt__test_executions)\n \n\n),\n\nfields as (\n\n select\n model_execution_id,\n command_invocation_id,\n dbt_cloud_run_id,\n artifact_generated_at,\n was_full_refresh,\n node_id,\n thread_id,\n status,\n compile_started_at,\n query_completed_at,\n total_node_runtime,\n rows_affected\n from model_executions_incremental\n\n)\n\nselect * from fields", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "database.schema.fct_dbt__test_executions"}, "model.dbt_artifacts.fct_dbt__model_executions": {"raw_sql": "{{ config( materialized='incremental', unique_key='model_execution_id' ) }}\n\nwith models as (\n\n select *\n from {{ ref('dim_dbt__models') }}\n\n),\n\nmodel_executions as (\n\n select *\n from {{ ref('int_dbt__model_executions') }}\n\n),\n\nmodel_executions_incremental as (\n\n select *\n from model_executions\n\n {% if is_incremental() %}\n -- this filter will only be applied on an incremental run\n where artifact_generated_at > (select max(artifact_generated_at) from {{ this }})\n {% endif %}\n\n),\n\nmodel_executions_with_materialization as (\n\n select\n model_executions_incremental.*,\n models.model_materialization,\n models.model_schema,\n models.name\n from model_executions_incremental\n left join models on\n (\n model_executions_incremental.command_invocation_id = models.command_invocation_id\n or model_executions_incremental.dbt_cloud_run_id = models.dbt_cloud_run_id\n )\n and model_executions_incremental.node_id = models.node_id\n\n),\n\nfields as (\n\n select\n model_execution_id,\n command_invocation_id,\n dbt_cloud_run_id,\n artifact_generated_at,\n was_full_refresh,\n node_id,\n thread_id,\n status,\n compile_started_at,\n query_completed_at,\n total_node_runtime,\n rows_affected,\n model_materialization,\n model_schema,\n name\n from model_executions_with_materialization\n\n)\n\nselect * from fields", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.dbt.is_incremental"], "nodes": ["model.dbt_artifacts.dim_dbt__models", "model.dbt_artifacts.int_dbt__model_executions"]}, "config": {"enabled": true, "materialized": "incremental", "persist_docs": {}, "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": null, "database": null, "tags": [], "full_refresh": null, "unique_key": "model_execution_id", "post-hook": [], "pre-hook": []}, "database": "database", "schema": "schema", "fqn": ["dbt_artifacts", "incremental", "fct_dbt__model_executions"], "unique_id": "model.dbt_artifacts.fct_dbt__model_executions", "package_name": "dbt_artifacts", "root_path": "/dbt_artifacts", "path": "incremental/fct_dbt__model_executions.sql", "original_file_path": "models/incremental/fct_dbt__model_executions.sql", "name": "fct_dbt__model_executions", "alias": "fct_dbt__model_executions", "checksum": {"name": "sha256", "checksum": "77e952e7773cd4b0ff5effb8a03d6181a24fcd4ba13c50d4837505215a5717e2"}, "tags": [], "refs": [["dim_dbt__models"], ["int_dbt__model_executions"]], "sources": [], "description": "All historic dbt model executions.", "columns": {"model_execution_id": {"name": "model_execution_id", "description": "Primary key.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "name": {"name": "name", "description": "The name of the model.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "model_schema": {"name": "model_schema", "description": "The schema containing the model.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "was_full_refresh": {"name": "was_full_refresh", "description": "Boolean value for whether this model was executed with a --full-refresh flag.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "model_materialization": {"name": "model_materialization", "description": "The configured materialization of the model.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "compile_started_at": {"name": "compile_started_at", "description": "Timestamp of when a model starts to be compiled.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "query_completed_at": {"name": "query_completed_at", "description": "Timestamp of when a model's SQL is completed", "meta": {}, "data_type": null, "quote": null, "tags": []}, "total_node_runtime": {"name": "total_node_runtime", "description": "The duration of time in seconds for the model to run. Note that this is _not_ equal to the delta between `compile_started_at` and `query_completed_at` since it includes extra tasks performed by dbt.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "status": {"name": "status", "description": "Success/fail status of the model's execution.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "command_invocation_id": {"name": "command_invocation_id", "description": "Foreign key to fct_dbt_run_results. The id of the command which resulted in the source artifact's generation.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "artifact_generated_at": {"name": "artifact_generated_at", "description": "Timestamp of when the source artifact was generated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "node_id": {"name": "node_id", "description": "Unique id for the node, in the form of model.[package_name].[model_name]", "meta": {}, "data_type": null, "quote": null, "tags": []}, "rows_affected": {"name": "rows_affected", "description": "The number of rows affected by the model's execution. Always 1 for non-incremental executions.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "models/schemas.yml", "build_path": "target/compiled/dbt_artifacts/models/incremental/fct_dbt__model_executions.sql", "deferred": false, "unrendered_config": {"materialized": "incremental", "unique_key": "model_execution_id"}, "compiled_sql": "\n\nwith models as (\n\n select *\n from database.schema.dim_dbt__models\n\n),\n\nmodel_executions as (\n\n select *\n from database.schema.int_dbt__model_executions\n\n),\n\nmodel_executions_incremental as (\n\n select *\n from model_executions\n\n \n -- this filter will only be applied on an incremental run\n where artifact_generated_at > (select max(artifact_generated_at) from database.schema.fct_dbt__model_executions)\n \n\n),\n\nmodel_executions_with_materialization as (\n\n select\n model_executions_incremental.*,\n models.model_materialization,\n models.model_schema,\n models.name\n from model_executions_incremental\n left join models on\n (\n model_executions_incremental.command_invocation_id = models.command_invocation_id\n or model_executions_incremental.dbt_cloud_run_id = models.dbt_cloud_run_id\n )\n and model_executions_incremental.node_id = models.node_id\n\n),\n\nfields as (\n\n select\n model_execution_id,\n command_invocation_id,\n dbt_cloud_run_id,\n artifact_generated_at,\n was_full_refresh,\n node_id,\n thread_id,\n status,\n compile_started_at,\n query_completed_at,\n total_node_runtime,\n rows_affected,\n model_materialization,\n model_schema,\n name\n from model_executions_with_materialization\n\n)\n\nselect * from fields", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "database.schema.fct_dbt__model_executions"}, "model.dbt_artifacts.dim_dbt__sources": {"raw_sql": "{{ config( materialized='incremental', unique_key='manifest_source_id' ) }}\n\nwith dbt_sources as (\n\n select * from {{ ref('stg_dbt__sources') }}\n\n),\n\ndbt_sources_incremental as (\n\n select *\n from dbt_sources\n\n {% if is_incremental() %}\n -- this filter will only be applied on an incremental run\n where artifact_generated_at > (select max(artifact_generated_at) from {{ this }})\n {% endif %}\n\n),\n\nfields as (\n\n select\n manifest_source_id,\n command_invocation_id,\n dbt_cloud_run_id,\n artifact_generated_at,\n node_id,\n name,\n source_name,\n source_schema,\n package_name,\n relation_name,\n source_path\n from dbt_sources_incremental\n\n)\n\nselect * from fields", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.dbt.is_incremental"], "nodes": ["model.dbt_artifacts.stg_dbt__sources"]}, "config": {"enabled": true, "materialized": "incremental", "persist_docs": {}, "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": null, "database": null, "tags": [], "full_refresh": null, "unique_key": "manifest_source_id", "post-hook": [], "pre-hook": []}, "database": "database", "schema": "schema", "fqn": ["dbt_artifacts", "incremental", "dim_dbt__sources"], "unique_id": "model.dbt_artifacts.dim_dbt__sources", "package_name": "dbt_artifacts", "root_path": "/dbt_artifacts", "path": "incremental/dim_dbt__sources.sql", "original_file_path": "models/incremental/dim_dbt__sources.sql", "name": "dim_dbt__sources", "alias": "dim_dbt__sources", "checksum": {"name": "sha256", "checksum": "139f5314ed2b4fd6ccee7ecb3f36f4981f8a2a1dfbdecc96c9d77d6c60918a15"}, "tags": [], "refs": [["stg_dbt__sources"]], "sources": [], "description": "All dbt source metadata from every manifest.json.", "columns": {"manifest_source_id": {"name": "manifest_source_id", "description": "Primary key generated from the command_invocation_id and checksum.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "command_invocation_id": {"name": "command_invocation_id", "description": "The id of the command which resulted in the source artifact's generation.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "artifact_generated_at": {"name": "artifact_generated_at", "description": "Timestamp of when the source artifact was generated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "node_id": {"name": "node_id", "description": "Unique id for the node, in the form of model.[package_name].[model_name]", "meta": {}, "data_type": null, "quote": null, "tags": []}, "name": {"name": "name", "description": "The source node name.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "source_name": {"name": "source_name", "description": "The name of the source.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "source_schema": {"name": "source_schema", "description": "", "meta": {}, "data_type": null, "quote": null, "tags": []}, "package_name": {"name": "package_name", "description": "Package source is defined in.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "relation_name": {"name": "relation_name", "description": "Name of the database entity this source resolved to.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "source_path": {"name": "source_path", "description": "Filepath of the source.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "models/schemas.yml", "build_path": "target/compiled/dbt_artifacts/models/incremental/dim_dbt__sources.sql", "deferred": false, "unrendered_config": {"materialized": "incremental", "unique_key": "manifest_source_id"}, "compiled_sql": "\n\nwith dbt_sources as (\n\n select * from database.schema.stg_dbt__sources\n\n),\n\ndbt_sources_incremental as (\n\n select *\n from dbt_sources\n\n \n -- this filter will only be applied on an incremental run\n where artifact_generated_at > (select max(artifact_generated_at) from database.schema.dim_dbt__sources)\n \n\n),\n\nfields as (\n\n select\n manifest_source_id,\n command_invocation_id,\n dbt_cloud_run_id,\n artifact_generated_at,\n node_id,\n name,\n source_name,\n source_schema,\n package_name,\n relation_name,\n source_path\n from dbt_sources_incremental\n\n)\n\nselect * from fields", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "database.schema.dim_dbt__sources"}, "model.dbt_artifacts.dim_dbt__exposures": {"raw_sql": "{{\n config(\n materialized='incremental',\n unique_key='manifest_model_id'\n )\n}}\n\nwith dbt_models as (\n\n select * from {{ ref('stg_dbt__exposures') }}\n\n),\n\ndbt_models_incremental as (\n\n select *\n from dbt_models\n\n {% if is_incremental() %}\n -- this filter will only be applied on an incremental run\n where artifact_generated_at > (select max(artifact_generated_at) from {{ this }})\n {% endif %}\n\n),\n\nfields as (\n\n select\n t.manifest_model_id,\n t.command_invocation_id,\n t.dbt_cloud_run_id,\n t.artifact_generated_at,\n t.node_id,\n t.name,\n t.type,\n t.owner,\n t.maturity,\n f.value::string as output_feeds,\n t.package_name\n from dbt_models_incremental as t,\n lateral flatten(input => depends_on_nodes) as f\n\n)\n\nselect * from fields", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.dbt.is_incremental"], "nodes": ["model.dbt_artifacts.stg_dbt__exposures"]}, "config": {"enabled": true, "materialized": "incremental", "persist_docs": {}, "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": null, "database": null, "tags": [], "full_refresh": null, "unique_key": "manifest_model_id", "post-hook": [], "pre-hook": []}, "database": "database", "schema": "schema", "fqn": ["dbt_artifacts", "incremental", "dim_dbt__exposures"], "unique_id": "model.dbt_artifacts.dim_dbt__exposures", "package_name": "dbt_artifacts", "root_path": "/dbt_artifacts", "path": "incremental/dim_dbt__exposures.sql", "original_file_path": "models/incremental/dim_dbt__exposures.sql", "name": "dim_dbt__exposures", "alias": "dim_dbt__exposures", "checksum": {"name": "sha256", "checksum": "40be79b84f7ec54fa6c4c0f19c9b5fa5be64c8e1abc355301d7bf1cfab8f6208"}, "tags": [], "refs": [["stg_dbt__exposures"]], "sources": [], "description": "All dbt exposures metadata from every manifest.json.", "columns": {"manifest_model_id": {"name": "manifest_model_id", "description": "Primary key generated from the command_invocation_id and checksum. Note,\nthis is not unique for a given exposure.\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "command_invocation_id": {"name": "command_invocation_id", "description": "The id of the command which resulted in the source artifact's generation.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "artifact_generated_at": {"name": "artifact_generated_at", "description": "Timestamp of when the source artifact was generated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "node_id": {"name": "node_id", "description": "Unique id for the node, in the form of exposure.[package_name].[exposure_name]", "meta": {}, "data_type": null, "quote": null, "tags": []}, "name": {"name": "name", "description": "User-defined name of the exposure.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "type": {"name": "type", "description": "User-defined type of the exposure.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "owner": {"name": "owner", "description": "User-defined owner of the exposure.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "maturity": {"name": "maturity", "description": "User-defined name of the exposure.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "output_feeds": {"name": "output_feeds", "description": "Models exposed in the exposure, in the form of model.[package_name].[model_name]", "meta": {}, "data_type": null, "quote": null, "tags": []}, "package_name": {"name": "package_name", "description": "Source package in which each feed of an exposure was defined.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "models/schemas.yml", "build_path": "target/compiled/dbt_artifacts/models/incremental/dim_dbt__exposures.sql", "deferred": false, "unrendered_config": {"materialized": "incremental", "unique_key": "manifest_model_id"}, "compiled_sql": "\n\nwith dbt_models as (\n\n select * from database.schema.stg_dbt__exposures\n\n),\n\ndbt_models_incremental as (\n\n select *\n from dbt_models\n\n \n -- this filter will only be applied on an incremental run\n where artifact_generated_at > (select max(artifact_generated_at) from database.schema.dim_dbt__exposures)\n \n\n),\n\nfields as (\n\n select\n t.manifest_model_id,\n t.command_invocation_id,\n t.dbt_cloud_run_id,\n t.artifact_generated_at,\n t.node_id,\n t.name,\n t.type,\n t.owner,\n t.maturity,\n f.value::string as output_feeds,\n t.package_name\n from dbt_models_incremental as t,\n lateral flatten(input => depends_on_nodes) as f\n\n)\n\nselect * from fields", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "database.schema.dim_dbt__exposures"}, "model.dbt_artifacts.dim_dbt__models": {"raw_sql": "{{ config( materialized='incremental', unique_key='manifest_model_id' ) }}\n\nwith dbt_models as (\n\n select * from {{ ref('stg_dbt__models') }}\n\n),\n\ndbt_models_incremental as (\n\n select *\n from dbt_models\n\n {% if is_incremental() %}\n -- this filter will only be applied on an incremental run\n where artifact_generated_at > (select max(artifact_generated_at) from {{ this }})\n {% endif %}\n\n),\n\nfields as (\n\n select\n manifest_model_id,\n command_invocation_id,\n dbt_cloud_run_id,\n artifact_generated_at,\n node_id,\n model_database,\n model_schema,\n name,\n depends_on_nodes,\n package_name,\n model_path,\n checksum,\n model_materialization\n from dbt_models_incremental\n\n)\n\nselect * from fields", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.dbt.is_incremental"], "nodes": ["model.dbt_artifacts.stg_dbt__models"]}, "config": {"enabled": true, "materialized": "incremental", "persist_docs": {}, "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": null, "database": null, "tags": [], "full_refresh": null, "unique_key": "manifest_model_id", "post-hook": [], "pre-hook": []}, "database": "database", "schema": "schema", "fqn": ["dbt_artifacts", "incremental", "dim_dbt__models"], "unique_id": "model.dbt_artifacts.dim_dbt__models", "package_name": "dbt_artifacts", "root_path": "/dbt_artifacts", "path": "incremental/dim_dbt__models.sql", "original_file_path": "models/incremental/dim_dbt__models.sql", "name": "dim_dbt__models", "alias": "dim_dbt__models", "checksum": {"name": "sha256", "checksum": "6665964075d2b9cfa81e73402c4e0d687bc6df1c6b55a2708f3185e21202f381"}, "tags": [], "refs": [["stg_dbt__models"]], "sources": [], "description": "All dbt model metadata from every manifest.json.", "columns": {"manifest_model_id": {"name": "manifest_model_id", "description": "Primary key generated from the command_invocation_id and checksum.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "command_invocation_id": {"name": "command_invocation_id", "description": "The id of the command which resulted in the source artifact's generation.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "artifact_generated_at": {"name": "artifact_generated_at", "description": "Timestamp of when the source artifact was generated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "node_id": {"name": "node_id", "description": "Unique id for the node, in the form of model.[package_name].[model_name]", "meta": {}, "data_type": null, "quote": null, "tags": []}, "name": {"name": "name", "description": "The model name.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "model_schema": {"name": "model_schema", "description": "", "meta": {}, "data_type": null, "quote": null, "tags": []}, "depends_on_nodes": {"name": "depends_on_nodes", "description": "List of node ids the model depends on.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "package_name": {"name": "package_name", "description": "", "meta": {}, "data_type": null, "quote": null, "tags": []}, "model_path": {"name": "model_path", "description": "Filepath of the model.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "checksum": {"name": "checksum", "description": "Unique identifier for the model. If a model is unchanged between separate executions this will remain the same.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "model_materialization": {"name": "model_materialization", "description": "", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "models/schemas.yml", "build_path": "target/compiled/dbt_artifacts/models/incremental/dim_dbt__models.sql", "deferred": false, "unrendered_config": {"materialized": "incremental", "unique_key": "manifest_model_id"}, "compiled_sql": "\n\nwith dbt_models as (\n\n select * from database.schema.stg_dbt__models\n\n),\n\ndbt_models_incremental as (\n\n select *\n from dbt_models\n\n \n -- this filter will only be applied on an incremental run\n where artifact_generated_at > (select max(artifact_generated_at) from database.schema.dim_dbt__models)\n \n\n),\n\nfields as (\n\n select\n manifest_model_id,\n command_invocation_id,\n dbt_cloud_run_id,\n artifact_generated_at,\n node_id,\n model_database,\n model_schema,\n name,\n depends_on_nodes,\n package_name,\n model_path,\n checksum,\n model_materialization\n from dbt_models_incremental\n\n)\n\nselect * from fields", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "database.schema.dim_dbt__models"}, "model.dbt_artifacts.fct_dbt__run_results": {"raw_sql": "{{ config( materialized='incremental', unique_key='command_invocation_id' ) }}\n\n{% set env_keys = dbt_utils.get_column_values(table=ref('stg_dbt__run_results_env_keys'), column='key', default=[]) %}\n\nwith run_results as (\n\n select *\n from {{ ref('stg_dbt__run_results') }}\n\n),\n\nincremental_run_results as (\n\n select *\n from run_results\n\n {% if is_incremental() %}\n -- this filter will only be applied on an incremental run\n where artifact_generated_at > (select max(artifact_generated_at) from {{ this }})\n {% endif %}\n\n),\n\nfields as (\n\n select\n artifact_generated_at,\n command_invocation_id,\n dbt_cloud_run_id,\n dbt_version,\n elapsed_time,\n execution_command,\n selected_models,\n target,\n was_full_refresh\n\n {% if env_keys %}\n -- Environment keys are sorted for determinism.\n {% for key in env_keys|sort %}\n ,env:{{ key }} as env_{{ key }}\n {% endfor %}\n {% endif %}\n from incremental_run_results\n\n)\n\nselect * from fields", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.dbt_utils.get_column_values", "macro.dbt.is_incremental"], "nodes": ["model.dbt_artifacts.stg_dbt__run_results_env_keys", "model.dbt_artifacts.stg_dbt__run_results"]}, "config": {"enabled": true, "materialized": "incremental", "persist_docs": {}, "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": null, "database": null, "tags": [], "full_refresh": null, "unique_key": "command_invocation_id", "post-hook": [], "pre-hook": []}, "database": "database", "schema": "schema", "fqn": ["dbt_artifacts", "incremental", "fct_dbt__run_results"], "unique_id": "model.dbt_artifacts.fct_dbt__run_results", "package_name": "dbt_artifacts", "root_path": "/dbt_artifacts", "path": "incremental/fct_dbt__run_results.sql", "original_file_path": "models/incremental/fct_dbt__run_results.sql", "name": "fct_dbt__run_results", "alias": "fct_dbt__run_results", "checksum": {"name": "sha256", "checksum": "4cc5e33cca22aa846c1dd7dcc4e9a852aade17b2e777ecdfd72292786025b3d7"}, "tags": [], "refs": [["stg_dbt__run_results_env_keys"], ["stg_dbt__run_results"]], "sources": [], "description": "Metadata for dbt run commands.", "columns": {"command_invocation_id": {"name": "command_invocation_id", "description": "The id of the command which resulted in the source artifact's generation.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "artifact_generated_at": {"name": "artifact_generated_at", "description": "Timestamp of when the source artifact was generated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "dbt_version": {"name": "dbt_version", "description": "The version of dbt used to generate the source artifact.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "elapsed_time": {"name": "elapsed_time", "description": "The total run time of the command.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "execution_command": {"name": "execution_command", "description": "The actual command used.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "selected_models": {"name": "selected_models", "description": "A list of model selectors used in the command.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "target": {"name": "target", "description": "The configured target for the command.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "was_full_refresh": {"name": "was_full_refresh", "description": "Was the run executed with a --full-refresh flag?", "meta": {}, "data_type": null, "quote": null, "tags": []}, "env_*": {"name": "env_*", "description": "Columns for the environment variables set when the command was executed.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "models/schemas.yml", "build_path": "target/compiled/dbt_artifacts/models/incremental/fct_dbt__run_results.sql", "deferred": false, "unrendered_config": {"materialized": "incremental", "unique_key": "command_invocation_id"}, "compiled_sql": "\n\n\n\nwith run_results as (\n\n select *\n from database.schema.stg_dbt__run_results\n\n),\n\nincremental_run_results as (\n\n select *\n from run_results\n\n \n -- this filter will only be applied on an incremental run\n where artifact_generated_at > (select max(artifact_generated_at) from database.schema.fct_dbt__run_results)\n \n\n),\n\nfields as (\n\n select\n artifact_generated_at,\n command_invocation_id,\n dbt_cloud_run_id,\n dbt_version,\n elapsed_time,\n execution_command,\n selected_models,\n target,\n was_full_refresh\n\n \n -- Environment keys are sorted for determinism.\n \n ,env:DBT_CLOUD_JOB_ID as env_DBT_CLOUD_JOB_ID\n \n ,env:DBT_CLOUD_PROJECT_ID as env_DBT_CLOUD_PROJECT_ID\n \n ,env:DBT_CLOUD_RUN_ID as env_DBT_CLOUD_RUN_ID\n \n ,env:DBT_CLOUD_RUN_REASON as env_DBT_CLOUD_RUN_REASON\n \n ,env:DBT_CLOUD_RUN_REASON_CATEGORY as env_DBT_CLOUD_RUN_REASON_CATEGORY\n \n \n from incremental_run_results\n\n)\n\nselect * from fields", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "database.schema.fct_dbt__run_results"}, "test.dbt_artifacts.unique_fct_dbt__critical_path_node_id": {"raw_sql": "{{ config(severity='ERROR') }}{{ test_unique(**_dbt_schema_test_kwargs) }}", "test_metadata": {"name": "unique", "kwargs": {"column_name": "node_id", "model": "{{ ref('fct_dbt__critical_path') }}"}, "namespace": null}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_unique"], "nodes": ["model.dbt_artifacts.fct_dbt__critical_path"]}, "config": {"enabled": true, "materialized": "table", "persist_docs": {}, "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": null, "database": null, "tags": [], "full_refresh": null, "severity": "ERROR", "post-hook": [], "pre-hook": []}, "database": "database", "schema": "schema", "fqn": ["dbt_artifacts", "schema_test", "unique_fct_dbt__critical_path_node_id"], "unique_id": "test.dbt_artifacts.unique_fct_dbt__critical_path_node_id", "package_name": "dbt_artifacts", "root_path": "/dbt_artifacts", "path": "schema_test/unique_fct_dbt__critical_path_node_id.sql", "original_file_path": "models/schemas.yml", "name": "unique_fct_dbt__critical_path_node_id", "alias": "unique_fct_dbt__critical_path_node_id", "checksum": {"name": "none", "checksum": ""}, "tags": ["schema"], "refs": [["fct_dbt__critical_path"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": "target/compiled/dbt_artifacts/models/schemas.yml/schema_test/unique_fct_dbt__critical_path_node_id.sql", "deferred": false, "unrendered_config": {"materialized": "table", "severity": "ERROR"}, "compiled_sql": "\n \n \n\n\n\nselect count(*) as validation_errors\nfrom (\n\n select\n node_id\n\n from database.schema.fct_dbt__critical_path\n where node_id is not null\n group by node_id\n having count(*) > 1\n\n) validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "node_id"}, "test.dbt_artifacts.not_null_fct_dbt__critical_path_node_id": {"raw_sql": "{{ config(severity='ERROR') }}{{ test_not_null(**_dbt_schema_test_kwargs) }}", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "node_id", "model": "{{ ref('fct_dbt__critical_path') }}"}, "namespace": null}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_not_null"], "nodes": ["model.dbt_artifacts.fct_dbt__critical_path"]}, "config": {"enabled": true, "materialized": "table", "persist_docs": {}, "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": null, "database": null, "tags": [], "full_refresh": null, "severity": "ERROR", "post-hook": [], "pre-hook": []}, "database": "database", "schema": "schema", "fqn": ["dbt_artifacts", "schema_test", "not_null_fct_dbt__critical_path_node_id"], "unique_id": "test.dbt_artifacts.not_null_fct_dbt__critical_path_node_id", "package_name": "dbt_artifacts", "root_path": "/dbt_artifacts", "path": "schema_test/not_null_fct_dbt__critical_path_node_id.sql", "original_file_path": "models/schemas.yml", "name": "not_null_fct_dbt__critical_path_node_id", "alias": "not_null_fct_dbt__critical_path_node_id", "checksum": {"name": "none", "checksum": ""}, "tags": ["schema"], "refs": [["fct_dbt__critical_path"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": "target/compiled/dbt_artifacts/models/schemas.yml/schema_test/not_null_fct_dbt__critical_path_node_id.sql", "deferred": false, "unrendered_config": {"materialized": "table", "severity": "ERROR"}, "compiled_sql": "\n \n \n\n\n\nselect count(*) as validation_errors\nfrom database.schema.fct_dbt__critical_path\nwhere node_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "node_id"}, "test.dbt_artifacts.unique_fct_dbt__latest_full_model_executions_node_id": {"raw_sql": "{{ config(severity='ERROR') }}{{ test_unique(**_dbt_schema_test_kwargs) }}", "test_metadata": {"name": "unique", "kwargs": {"column_name": "node_id", "model": "{{ ref('fct_dbt__latest_full_model_executions') }}"}, "namespace": null}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_unique"], "nodes": ["model.dbt_artifacts.fct_dbt__latest_full_model_executions"]}, "config": {"enabled": true, "materialized": "table", "persist_docs": {}, "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": null, "database": null, "tags": [], "full_refresh": null, "severity": "ERROR", "post-hook": [], "pre-hook": []}, "database": "database", "schema": "schema", "fqn": ["dbt_artifacts", "schema_test", "unique_fct_dbt__latest_full_model_executions_node_id"], "unique_id": "test.dbt_artifacts.unique_fct_dbt__latest_full_model_executions_node_id", "package_name": "dbt_artifacts", "root_path": "/dbt_artifacts", "path": "schema_test/unique_fct_dbt__latest_full_model_executions_node_id.sql", "original_file_path": "models/schemas.yml", "name": "unique_fct_dbt__latest_full_model_executions_node_id", "alias": "unique_fct_dbt__latest_full_model_executions_node_id", "checksum": {"name": "none", "checksum": ""}, "tags": ["schema"], "refs": [["fct_dbt__latest_full_model_executions"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": "target/compiled/dbt_artifacts/models/schemas.yml/schema_test/unique_fct_dbt__latest_full_model_executions_node_id.sql", "deferred": false, "unrendered_config": {"materialized": "table", "severity": "ERROR"}, "compiled_sql": "\n \n \n\n\n\nselect count(*) as validation_errors\nfrom (\n\n select\n node_id\n\n from database.schema.fct_dbt__latest_full_model_executions\n where node_id is not null\n group by node_id\n having count(*) > 1\n\n) validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "node_id"}, "test.dbt_artifacts.not_null_fct_dbt__latest_full_model_executions_node_id": {"raw_sql": "{{ config(severity='ERROR') }}{{ test_not_null(**_dbt_schema_test_kwargs) }}", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "node_id", "model": "{{ ref('fct_dbt__latest_full_model_executions') }}"}, "namespace": null}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_not_null"], "nodes": ["model.dbt_artifacts.fct_dbt__latest_full_model_executions"]}, "config": {"enabled": true, "materialized": "table", "persist_docs": {}, "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": null, "database": null, "tags": [], "full_refresh": null, "severity": "ERROR", "post-hook": [], "pre-hook": []}, "database": "database", "schema": "schema", "fqn": ["dbt_artifacts", "schema_test", "not_null_fct_dbt__latest_full_model_executions_node_id"], "unique_id": "test.dbt_artifacts.not_null_fct_dbt__latest_full_model_executions_node_id", "package_name": "dbt_artifacts", "root_path": "/dbt_artifacts", "path": "schema_test/not_null_fct_dbt__latest_full_model_executions_node_id.sql", "original_file_path": "models/schemas.yml", "name": "not_null_fct_dbt__latest_full_model_executions_node_id", "alias": "not_null_fct_dbt__latest_full_model_executions_node_id", "checksum": {"name": "none", "checksum": ""}, "tags": ["schema"], "refs": [["fct_dbt__latest_full_model_executions"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": "target/compiled/dbt_artifacts/models/schemas.yml/schema_test/not_null_fct_dbt__latest_full_model_executions_node_id.sql", "deferred": false, "unrendered_config": {"materialized": "table", "severity": "ERROR"}, "compiled_sql": "\n \n \n\n\n\nselect count(*) as validation_errors\nfrom database.schema.fct_dbt__latest_full_model_executions\nwhere node_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "node_id"}, "test.dbt_artifacts.unique_fct_dbt__model_executions_model_execution_id": {"raw_sql": "{{ config(severity='ERROR') }}{{ test_unique(**_dbt_schema_test_kwargs) }}", "test_metadata": {"name": "unique", "kwargs": {"column_name": "model_execution_id", "model": "{{ ref('fct_dbt__model_executions') }}"}, "namespace": null}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_unique"], "nodes": ["model.dbt_artifacts.fct_dbt__model_executions"]}, "config": {"enabled": true, "materialized": "table", "persist_docs": {}, "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": null, "database": null, "tags": [], "full_refresh": null, "severity": "ERROR", "post-hook": [], "pre-hook": []}, "database": "database", "schema": "schema", "fqn": ["dbt_artifacts", "schema_test", "unique_fct_dbt__model_executions_model_execution_id"], "unique_id": "test.dbt_artifacts.unique_fct_dbt__model_executions_model_execution_id", "package_name": "dbt_artifacts", "root_path": "/dbt_artifacts", "path": "schema_test/unique_fct_dbt__model_executions_model_execution_id.sql", "original_file_path": "models/schemas.yml", "name": "unique_fct_dbt__model_executions_model_execution_id", "alias": "unique_fct_dbt__model_executions_model_execution_id", "checksum": {"name": "none", "checksum": ""}, "tags": ["schema"], "refs": [["fct_dbt__model_executions"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": "target/compiled/dbt_artifacts/models/schemas.yml/schema_test/unique_fct_dbt__model_executions_model_execution_id.sql", "deferred": false, "unrendered_config": {"materialized": "table", "severity": "ERROR"}, "compiled_sql": "\n \n \n\n\n\nselect count(*) as validation_errors\nfrom (\n\n select\n model_execution_id\n\n from database.schema.fct_dbt__model_executions\n where model_execution_id is not null\n group by model_execution_id\n having count(*) > 1\n\n) validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "model_execution_id"}, "test.dbt_artifacts.not_null_fct_dbt__model_executions_model_execution_id": {"raw_sql": "{{ config(severity='ERROR') }}{{ test_not_null(**_dbt_schema_test_kwargs) }}", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "model_execution_id", "model": "{{ ref('fct_dbt__model_executions') }}"}, "namespace": null}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_not_null"], "nodes": ["model.dbt_artifacts.fct_dbt__model_executions"]}, "config": {"enabled": true, "materialized": "table", "persist_docs": {}, "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": null, "database": null, "tags": [], "full_refresh": null, "severity": "ERROR", "post-hook": [], "pre-hook": []}, "database": "database", "schema": "schema", "fqn": ["dbt_artifacts", "schema_test", "not_null_fct_dbt__model_executions_model_execution_id"], "unique_id": "test.dbt_artifacts.not_null_fct_dbt__model_executions_model_execution_id", "package_name": "dbt_artifacts", "root_path": "/dbt_artifacts", "path": "schema_test/not_null_fct_dbt__model_executions_model_execution_id.sql", "original_file_path": "models/schemas.yml", "name": "not_null_fct_dbt__model_executions_model_execution_id", "alias": "not_null_fct_dbt__model_executions_model_execution_id", "checksum": {"name": "none", "checksum": ""}, "tags": ["schema"], "refs": [["fct_dbt__model_executions"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": "target/compiled/dbt_artifacts/models/schemas.yml/schema_test/not_null_fct_dbt__model_executions_model_execution_id.sql", "deferred": false, "unrendered_config": {"materialized": "table", "severity": "ERROR"}, "compiled_sql": "\n \n \n\n\n\nselect count(*) as validation_errors\nfrom database.schema.fct_dbt__model_executions\nwhere model_execution_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "model_execution_id"}, "test.dbt_artifacts.unique_fct_dbt__run_results_command_invocation_id": {"raw_sql": "{{ config(severity='ERROR') }}{{ test_unique(**_dbt_schema_test_kwargs) }}", "test_metadata": {"name": "unique", "kwargs": {"column_name": "command_invocation_id", "model": "{{ ref('fct_dbt__run_results') }}"}, "namespace": null}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_unique"], "nodes": ["model.dbt_artifacts.fct_dbt__run_results"]}, "config": {"enabled": true, "materialized": "table", "persist_docs": {}, "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": null, "database": null, "tags": [], "full_refresh": null, "severity": "ERROR", "post-hook": [], "pre-hook": []}, "database": "database", "schema": "schema", "fqn": ["dbt_artifacts", "schema_test", "unique_fct_dbt__run_results_command_invocation_id"], "unique_id": "test.dbt_artifacts.unique_fct_dbt__run_results_command_invocation_id", "package_name": "dbt_artifacts", "root_path": "/dbt_artifacts", "path": "schema_test/unique_fct_dbt__run_results_command_invocation_id.sql", "original_file_path": "models/schemas.yml", "name": "unique_fct_dbt__run_results_command_invocation_id", "alias": "unique_fct_dbt__run_results_command_invocation_id", "checksum": {"name": "none", "checksum": ""}, "tags": ["schema"], "refs": [["fct_dbt__run_results"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": "target/compiled/dbt_artifacts/models/schemas.yml/schema_test/unique_fct_dbt__run_results_command_invocation_id.sql", "deferred": false, "unrendered_config": {"materialized": "table", "severity": "ERROR"}, "compiled_sql": "\n \n \n\n\n\nselect count(*) as validation_errors\nfrom (\n\n select\n command_invocation_id\n\n from database.schema.fct_dbt__run_results\n where command_invocation_id is not null\n group by command_invocation_id\n having count(*) > 1\n\n) validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "command_invocation_id"}, "test.dbt_artifacts.not_null_fct_dbt__run_results_command_invocation_id": {"raw_sql": "{{ config(severity='ERROR') }}{{ test_not_null(**_dbt_schema_test_kwargs) }}", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "command_invocation_id", "model": "{{ ref('fct_dbt__run_results') }}"}, "namespace": null}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_not_null"], "nodes": ["model.dbt_artifacts.fct_dbt__run_results"]}, "config": {"enabled": true, "materialized": "table", "persist_docs": {}, "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": null, "database": null, "tags": [], "full_refresh": null, "severity": "ERROR", "post-hook": [], "pre-hook": []}, "database": "database", "schema": "schema", "fqn": ["dbt_artifacts", "schema_test", "not_null_fct_dbt__run_results_command_invocation_id"], "unique_id": "test.dbt_artifacts.not_null_fct_dbt__run_results_command_invocation_id", "package_name": "dbt_artifacts", "root_path": "/dbt_artifacts", "path": "schema_test/not_null_fct_dbt__run_results_command_invocation_id.sql", "original_file_path": "models/schemas.yml", "name": "not_null_fct_dbt__run_results_command_invocation_id", "alias": "not_null_fct_dbt__run_results_command_invocation_id", "checksum": {"name": "none", "checksum": ""}, "tags": ["schema"], "refs": [["fct_dbt__run_results"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": "target/compiled/dbt_artifacts/models/schemas.yml/schema_test/not_null_fct_dbt__run_results_command_invocation_id.sql", "deferred": false, "unrendered_config": {"materialized": "table", "severity": "ERROR"}, "compiled_sql": "\n \n \n\n\n\nselect count(*) as validation_errors\nfrom database.schema.fct_dbt__run_results\nwhere command_invocation_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "command_invocation_id"}, "test.dbt_artifacts.not_null_dim_dbt__exposures_manifest_model_id": {"raw_sql": "{{ config(severity='ERROR') }}{{ test_not_null(**_dbt_schema_test_kwargs) }}", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "manifest_model_id", "model": "{{ ref('dim_dbt__exposures') }}"}, "namespace": null}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_not_null"], "nodes": ["model.dbt_artifacts.dim_dbt__exposures"]}, "config": {"enabled": true, "materialized": "table", "persist_docs": {}, "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": null, "database": null, "tags": [], "full_refresh": null, "severity": "ERROR", "post-hook": [], "pre-hook": []}, "database": "database", "schema": "schema", "fqn": ["dbt_artifacts", "schema_test", "not_null_dim_dbt__exposures_manifest_model_id"], "unique_id": "test.dbt_artifacts.not_null_dim_dbt__exposures_manifest_model_id", "package_name": "dbt_artifacts", "root_path": "/dbt_artifacts", "path": "schema_test/not_null_dim_dbt__exposures_manifest_model_id.sql", "original_file_path": "models/schemas.yml", "name": "not_null_dim_dbt__exposures_manifest_model_id", "alias": "not_null_dim_dbt__exposures_manifest_model_id", "checksum": {"name": "none", "checksum": ""}, "tags": ["schema"], "refs": [["dim_dbt__exposures"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": "target/compiled/dbt_artifacts/models/schemas.yml/schema_test/not_null_dim_dbt__exposures_manifest_model_id.sql", "deferred": false, "unrendered_config": {"materialized": "table", "severity": "ERROR"}, "compiled_sql": "\n \n \n\n\n\nselect count(*) as validation_errors\nfrom database.schema.dim_dbt__exposures\nwhere manifest_model_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "manifest_model_id"}, "test.dbt_artifacts.unique_dim_dbt__exposures_manifest_model_id_output_feeds": {"raw_sql": "{{ config(severity='ERROR') }}{{ test_unique(**_dbt_schema_test_kwargs) }}", "test_metadata": {"name": "unique", "kwargs": {"column_name": "manifest_model_id || '-' || output_feeds", "model": "{{ ref('dim_dbt__exposures') }}"}, "namespace": null}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_unique"], "nodes": ["model.dbt_artifacts.dim_dbt__exposures"]}, "config": {"enabled": true, "materialized": "table", "persist_docs": {}, "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": null, "database": null, "tags": [], "full_refresh": null, "severity": "ERROR", "post-hook": [], "pre-hook": []}, "database": "database", "schema": "schema", "fqn": ["dbt_artifacts", "schema_test", "unique_dim_dbt__exposures_manifest_model_id_output_feeds"], "unique_id": "test.dbt_artifacts.unique_dim_dbt__exposures_manifest_model_id_output_feeds", "package_name": "dbt_artifacts", "root_path": "/dbt_artifacts", "path": "schema_test/unique_dim_dbt__exposures_manifest_model_id_output_feeds.sql", "original_file_path": "models/schemas.yml", "name": "unique_dim_dbt__exposures_manifest_model_id_output_feeds", "alias": "unique_dim_dbt__exposures_manifest_model_id_output_feeds", "checksum": {"name": "none", "checksum": ""}, "tags": ["schema"], "refs": [["dim_dbt__exposures"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": "target/compiled/dbt_artifacts/models/schemas.yml/schema_test/unique_dim_dbt__exposures_manifest_model_id_output_feeds.sql", "deferred": false, "unrendered_config": {"materialized": "table", "severity": "ERROR"}, "compiled_sql": "\n \n \n\n\n\nselect count(*) as validation_errors\nfrom (\n\n select\n manifest_model_id || '-' || output_feeds\n\n from database.schema.dim_dbt__exposures\n where manifest_model_id || '-' || output_feeds is not null\n group by manifest_model_id || '-' || output_feeds\n having count(*) > 1\n\n) validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": null}, "test.dbt_artifacts.unique_dim_dbt__models_manifest_model_id": {"raw_sql": "{{ config(severity='ERROR') }}{{ test_unique(**_dbt_schema_test_kwargs) }}", "test_metadata": {"name": "unique", "kwargs": {"column_name": "manifest_model_id", "model": "{{ ref('dim_dbt__models') }}"}, "namespace": null}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_unique"], "nodes": ["model.dbt_artifacts.dim_dbt__models"]}, "config": {"enabled": true, "materialized": "table", "persist_docs": {}, "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": null, "database": null, "tags": [], "full_refresh": null, "severity": "ERROR", "post-hook": [], "pre-hook": []}, "database": "database", "schema": "schema", "fqn": ["dbt_artifacts", "schema_test", "unique_dim_dbt__models_manifest_model_id"], "unique_id": "test.dbt_artifacts.unique_dim_dbt__models_manifest_model_id", "package_name": "dbt_artifacts", "root_path": "/dbt_artifacts", "path": "schema_test/unique_dim_dbt__models_manifest_model_id.sql", "original_file_path": "models/schemas.yml", "name": "unique_dim_dbt__models_manifest_model_id", "alias": "unique_dim_dbt__models_manifest_model_id", "checksum": {"name": "none", "checksum": ""}, "tags": ["schema"], "refs": [["dim_dbt__models"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": "target/compiled/dbt_artifacts/models/schemas.yml/schema_test/unique_dim_dbt__models_manifest_model_id.sql", "deferred": false, "unrendered_config": {"materialized": "table", "severity": "ERROR"}, "compiled_sql": "\n \n \n\n\n\nselect count(*) as validation_errors\nfrom (\n\n select\n manifest_model_id\n\n from database.schema.dim_dbt__models\n where manifest_model_id is not null\n group by manifest_model_id\n having count(*) > 1\n\n) validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "manifest_model_id"}, "test.dbt_artifacts.not_null_dim_dbt__models_manifest_model_id": {"raw_sql": "{{ config(severity='ERROR') }}{{ test_not_null(**_dbt_schema_test_kwargs) }}", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "manifest_model_id", "model": "{{ ref('dim_dbt__models') }}"}, "namespace": null}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_not_null"], "nodes": ["model.dbt_artifacts.dim_dbt__models"]}, "config": {"enabled": true, "materialized": "table", "persist_docs": {}, "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": null, "database": null, "tags": [], "full_refresh": null, "severity": "ERROR", "post-hook": [], "pre-hook": []}, "database": "database", "schema": "schema", "fqn": ["dbt_artifacts", "schema_test", "not_null_dim_dbt__models_manifest_model_id"], "unique_id": "test.dbt_artifacts.not_null_dim_dbt__models_manifest_model_id", "package_name": "dbt_artifacts", "root_path": "/dbt_artifacts", "path": "schema_test/not_null_dim_dbt__models_manifest_model_id.sql", "original_file_path": "models/schemas.yml", "name": "not_null_dim_dbt__models_manifest_model_id", "alias": "not_null_dim_dbt__models_manifest_model_id", "checksum": {"name": "none", "checksum": ""}, "tags": ["schema"], "refs": [["dim_dbt__models"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": "target/compiled/dbt_artifacts/models/schemas.yml/schema_test/not_null_dim_dbt__models_manifest_model_id.sql", "deferred": false, "unrendered_config": {"materialized": "table", "severity": "ERROR"}, "compiled_sql": "\n \n \n\n\n\nselect count(*) as validation_errors\nfrom database.schema.dim_dbt__models\nwhere manifest_model_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "manifest_model_id"}, "test.dbt_artifacts.unique_dim_dbt__sources_manifest_source_id": {"raw_sql": "{{ config(severity='ERROR') }}{{ test_unique(**_dbt_schema_test_kwargs) }}", "test_metadata": {"name": "unique", "kwargs": {"column_name": "manifest_source_id", "model": "{{ ref('dim_dbt__sources') }}"}, "namespace": null}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_unique"], "nodes": ["model.dbt_artifacts.dim_dbt__sources"]}, "config": {"enabled": true, "materialized": "table", "persist_docs": {}, "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": null, "database": null, "tags": [], "full_refresh": null, "severity": "ERROR", "post-hook": [], "pre-hook": []}, "database": "database", "schema": "schema", "fqn": ["dbt_artifacts", "schema_test", "unique_dim_dbt__sources_manifest_source_id"], "unique_id": "test.dbt_artifacts.unique_dim_dbt__sources_manifest_source_id", "package_name": "dbt_artifacts", "root_path": "/dbt_artifacts", "path": "schema_test/unique_dim_dbt__sources_manifest_source_id.sql", "original_file_path": "models/schemas.yml", "name": "unique_dim_dbt__sources_manifest_source_id", "alias": "unique_dim_dbt__sources_manifest_source_id", "checksum": {"name": "none", "checksum": ""}, "tags": ["schema"], "refs": [["dim_dbt__sources"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": "target/compiled/dbt_artifacts/models/schemas.yml/schema_test/unique_dim_dbt__sources_manifest_source_id.sql", "deferred": false, "unrendered_config": {"materialized": "table", "severity": "ERROR"}, "compiled_sql": "\n \n \n\n\n\nselect count(*) as validation_errors\nfrom (\n\n select\n manifest_source_id\n\n from database.schema.dim_dbt__sources\n where manifest_source_id is not null\n group by manifest_source_id\n having count(*) > 1\n\n) validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "manifest_source_id"}, "test.dbt_artifacts.not_null_dim_dbt__sources_manifest_source_id": {"raw_sql": "{{ config(severity='ERROR') }}{{ test_not_null(**_dbt_schema_test_kwargs) }}", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "manifest_source_id", "model": "{{ ref('dim_dbt__sources') }}"}, "namespace": null}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_not_null"], "nodes": ["model.dbt_artifacts.dim_dbt__sources"]}, "config": {"enabled": true, "materialized": "table", "persist_docs": {}, "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": null, "database": null, "tags": [], "full_refresh": null, "severity": "ERROR", "post-hook": [], "pre-hook": []}, "database": "database", "schema": "schema", "fqn": ["dbt_artifacts", "schema_test", "not_null_dim_dbt__sources_manifest_source_id"], "unique_id": "test.dbt_artifacts.not_null_dim_dbt__sources_manifest_source_id", "package_name": "dbt_artifacts", "root_path": "/dbt_artifacts", "path": "schema_test/not_null_dim_dbt__sources_manifest_source_id.sql", "original_file_path": "models/schemas.yml", "name": "not_null_dim_dbt__sources_manifest_source_id", "alias": "not_null_dim_dbt__sources_manifest_source_id", "checksum": {"name": "none", "checksum": ""}, "tags": ["schema"], "refs": [["dim_dbt__sources"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": "target/compiled/dbt_artifacts/models/schemas.yml/schema_test/not_null_dim_dbt__sources_manifest_source_id.sql", "deferred": false, "unrendered_config": {"materialized": "table", "severity": "ERROR"}, "compiled_sql": "\n \n \n\n\n\nselect count(*) as validation_errors\nfrom database.schema.dim_dbt__sources\nwhere manifest_source_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "manifest_source_id"}}, "sources": {"source.dbt_artifacts.dbt_artifacts.artifacts": {"fqn": ["dbt_artifacts", "staging", "dbt_artifacts", "artifacts"], "database": "dbt_artifacts", "schema": "dbt_artifacts", "unique_id": "source.dbt_artifacts.dbt_artifacts.artifacts", "package_name": "dbt_artifacts", "root_path": "/dbt_artifacts", "path": "models/staging/sources.yml", "original_file_path": "models/staging/sources.yml", "name": "artifacts", "source_name": "dbt_artifacts", "source_description": "", "loader": "", "identifier": "artifacts", "resource_type": "source", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": null, "freshness": {"warn_after": null, "error_after": null, "filter": null}, "external": null, "description": "The source table containing loaded dbt artifacts. All of the artifacts must be loaded into this table. See the README for more info.\n", "columns": {"data": {"name": "data", "description": "A variant type object containing all the artifact's data.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "generated_at": {"name": "generated_at", "description": "Timestamp for when the artifact was generated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "path": {"name": "path", "description": "The path of the artifact in the external stage.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "artifact_type": {"name": "artifact_type", "description": "The type of the artifact, e.g. manifest.json", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "dbt_artifacts.dbt_artifacts.artifacts"}}, "macros": {"macro.dbt_artifacts.upload_dbt_artifacts": {"unique_id": "macro.dbt_artifacts.upload_dbt_artifacts", "package_name": "dbt_artifacts", "root_path": "/dbt_artifacts", "path": "macros/upload_artifacts.sql", "original_file_path": "macros/upload_artifacts.sql", "name": "upload_dbt_artifacts", "macro_sql": "{% macro upload_dbt_artifacts(filenames) %}\n\n{% set src_dbt_artifacts = source('dbt_artifacts', 'artifacts') %}\n\n{% set remove_query %}\n remove @{{ src_dbt_artifacts }} pattern='.*.json.gz';\n{% endset %}\n\n{% do log(\"Clearing existing files from Stage: \" ~ remove_query, info=True) %}\n{% do run_query(remove_query) %}\n\n{% for filename in filenames %}\n\n {% set file = filename ~ '.json' %}\n\n {% set put_query %}\n put file://target/{{ file }} @{{ src_dbt_artifacts }} auto_compress=true;\n {% endset %}\n\n {% do log(\"Uploading \" ~ file ~ \" to Stage: \" ~ put_query, info=True) %}\n {% do run_query(put_query) %}\n\n {% set copy_query %}\n begin;\n copy into {{ src_dbt_artifacts }} from\n (\n select\n $1 as data,\n $1:metadata:generated_at::timestamp_ntz as generated_at,\n metadata$filename as path,\n regexp_substr(metadata$filename, '([a-z_]+.json)') as artifact_type\n from @{{ src_dbt_artifacts }}\n )\n file_format=(type='JSON')\n on_error='skip_file';\n commit;\n {% endset %}\n\n {% do log(\"Copying \" ~ file ~ \" from Stage: \" ~ copy_query, info=True) %}\n {% do run_query(copy_query) %}\n\n{% endfor %}\n\n{% do log(\"Clearing new files from Stage: \" ~ remove_query, info=True) %}\n{% do run_query(remove_query) %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_artifacts.create_artifact_resources": {"unique_id": "macro.dbt_artifacts.create_artifact_resources", "package_name": "dbt_artifacts", "root_path": "/dbt_artifacts", "path": "macros/create_artifact_resources.sql", "original_file_path": "macros/create_artifact_resources.sql", "name": "create_artifact_resources", "macro_sql": "{% macro create_artifact_resources() %}\n\n{% set src_dbt_artifacts = source('dbt_artifacts', 'artifacts') %}\n\n{{ create_schema( src_dbt_artifacts ) }}\n\n{% set create_stage_query %}\ncreate stage if not exists {{ src_dbt_artifacts }}\nfile_format = ( type = json );\n{% endset %}\n\n{% set create_table_query %}\ncreate table if not exists {{ src_dbt_artifacts }} (\n data variant,\n generated_at timestamp,\n path string,\n artifact_type string\n);\n\n{% endset %}\n\n\n{% do log(\"Creating Stage: \" ~ create_stage_query, info=True) %}\n{% do run_query(create_stage_query) %}\n\n{% do log(\"Creating Table: \" ~ create_table_query, info=True) %}\n{% do run_query(create_table_query) %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_snowflake.snowflake__get_catalog": {"unique_id": "macro.dbt_snowflake.snowflake__get_catalog", "package_name": "dbt_snowflake", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/snowflake", "path": "macros/catalog.sql", "original_file_path": "macros/catalog.sql", "name": "snowflake__get_catalog", "macro_sql": "{% macro snowflake__get_catalog(information_schema, schemas) -%}\n {% set query %}\n with tables as (\n\n select\n table_catalog as \"table_database\",\n table_schema as \"table_schema\",\n table_name as \"table_name\",\n table_type as \"table_type\",\n comment as \"table_comment\",\n\n -- note: this is the _role_ that owns the table\n table_owner as \"table_owner\",\n\n 'Clustering Key' as \"stats:clustering_key:label\",\n clustering_key as \"stats:clustering_key:value\",\n 'The key used to cluster this table' as \"stats:clustering_key:description\",\n (clustering_key is not null) as \"stats:clustering_key:include\",\n\n 'Row Count' as \"stats:row_count:label\",\n row_count as \"stats:row_count:value\",\n 'An approximate count of rows in this table' as \"stats:row_count:description\",\n (row_count is not null) as \"stats:row_count:include\",\n\n 'Approximate Size' as \"stats:bytes:label\",\n bytes as \"stats:bytes:value\",\n 'Approximate size of the table as reported by Snowflake' as \"stats:bytes:description\",\n (bytes is not null) as \"stats:bytes:include\",\n\n 'Last Modified' as \"stats:last_modified:label\",\n to_varchar(convert_timezone('UTC', last_altered), 'yyyy-mm-dd HH24:MI'||'UTC') as \"stats:last_modified:value\",\n 'The timestamp for last update/change' as \"stats:last_modified:description\",\n (last_altered is not null and table_type='BASE TABLE') as \"stats:last_modified:include\"\n\n from {{ information_schema }}.tables\n\n ),\n\n columns as (\n\n select\n table_catalog as \"table_database\",\n table_schema as \"table_schema\",\n table_name as \"table_name\",\n\n column_name as \"column_name\",\n ordinal_position as \"column_index\",\n data_type as \"column_type\",\n comment as \"column_comment\"\n\n from {{ information_schema }}.columns\n )\n\n select *\n from tables\n join columns using (\"table_database\", \"table_schema\", \"table_name\")\n where (\n {%- for schema in schemas -%}\n upper(\"table_schema\") = upper('{{ schema }}'){%- if not loop.last %} or {% endif -%}\n {%- endfor -%}\n )\n order by \"column_index\"\n {%- endset -%}\n\n {{ return(run_query(query)) }}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_snowflake.snowflake__create_table_as": {"unique_id": "macro.dbt_snowflake.snowflake__create_table_as", "package_name": "dbt_snowflake", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "snowflake__create_table_as", "macro_sql": "{% macro snowflake__create_table_as(temporary, relation, sql) -%}\n {%- set transient = config.get('transient', default=true) -%}\n {%- set cluster_by_keys = config.get('cluster_by', default=none) -%}\n {%- set enable_automatic_clustering = config.get('automatic_clustering', default=false) -%}\n {%- set copy_grants = config.get('copy_grants', default=false) -%}\n\n {%- if cluster_by_keys is not none and cluster_by_keys is string -%}\n {%- set cluster_by_keys = [cluster_by_keys] -%}\n {%- endif -%}\n {%- if cluster_by_keys is not none -%}\n {%- set cluster_by_string = cluster_by_keys|join(\", \")-%}\n {% else %}\n {%- set cluster_by_string = none -%}\n {%- endif -%}\n {%- set sql_header = config.get('sql_header', none) -%}\n\n {{ sql_header if sql_header is not none }}\n\n create or replace {% if temporary -%}\n temporary\n {%- elif transient -%}\n transient\n {%- endif %} table {{ relation }} {% if copy_grants and not temporary -%} copy grants {%- endif %} as\n (\n {%- if cluster_by_string is not none -%}\n select * from(\n {{ sql }}\n ) order by ({{ cluster_by_string }})\n {%- else -%}\n {{ sql }}\n {%- endif %}\n );\n {% if cluster_by_string is not none and not temporary -%}\n alter table {{relation}} cluster by ({{cluster_by_string}});\n {%- endif -%}\n {% if enable_automatic_clustering and cluster_by_string is not none and not temporary -%}\n alter table {{relation}} resume recluster;\n {%- endif -%}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_snowflake.snowflake__create_view_as": {"unique_id": "macro.dbt_snowflake.snowflake__create_view_as", "package_name": "dbt_snowflake", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "snowflake__create_view_as", "macro_sql": "{% macro snowflake__create_view_as(relation, sql) -%}\n {%- set secure = config.get('secure', default=false) -%}\n {%- set copy_grants = config.get('copy_grants', default=false) -%}\n {%- set sql_header = config.get('sql_header', none) -%}\n\n {{ sql_header if sql_header is not none }}\n create or replace {% if secure -%}\n secure\n {%- endif %} view {{ relation }} {% if copy_grants -%} copy grants {%- endif %} as (\n {{ sql }}\n );\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_snowflake.snowflake__get_columns_in_relation": {"unique_id": "macro.dbt_snowflake.snowflake__get_columns_in_relation", "package_name": "dbt_snowflake", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "snowflake__get_columns_in_relation", "macro_sql": "{% macro snowflake__get_columns_in_relation(relation) -%}\n {%- set sql -%}\n describe table {{ relation }}\n {%- endset -%}\n {%- set result = run_query(sql) -%}\n\n {% set maximum = 10000 %}\n {% if (result | length) >= maximum %}\n {% set msg %}\n Too many columns in relation {{ relation }}! dbt can only get\n information about relations with fewer than {{ maximum }} columns.\n {% endset %}\n {% do exceptions.raise_compiler_error(msg) %}\n {% endif %}\n\n {% set columns = [] %}\n {% for row in result %}\n {% do columns.append(api.Column.from_description(row['name'], row['type'])) %}\n {% endfor %}\n {% do return(columns) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_snowflake.snowflake__list_schemas": {"unique_id": "macro.dbt_snowflake.snowflake__list_schemas", "package_name": "dbt_snowflake", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "snowflake__list_schemas", "macro_sql": "{% macro snowflake__list_schemas(database) -%}\n {# 10k limit from here: https://docs.snowflake.net/manuals/sql-reference/sql/show-schemas.html#usage-notes #}\n {% set maximum = 10000 %}\n {% set sql -%}\n show terse schemas in database {{ database }}\n limit {{ maximum }}\n {%- endset %}\n {% set result = run_query(sql) %}\n {% if (result | length) >= maximum %}\n {% set msg %}\n Too many schemas in database {{ database }}! dbt can only get\n information about databases with fewer than {{ maximum }} schemas.\n {% endset %}\n {% do exceptions.raise_compiler_error(msg) %}\n {% endif %}\n {{ return(result) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_snowflake.snowflake__list_relations_without_caching": {"unique_id": "macro.dbt_snowflake.snowflake__list_relations_without_caching", "package_name": "dbt_snowflake", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "snowflake__list_relations_without_caching", "macro_sql": "{% macro snowflake__list_relations_without_caching(schema_relation) %}\n {%- set sql -%}\n show terse objects in {{ schema_relation }}\n {%- endset -%}\n\n {%- set result = run_query(sql) -%}\n {% set maximum = 10000 %}\n {% if (result | length) >= maximum %}\n {% set msg %}\n Too many schemas in schema {{ schema_relation }}! dbt can only get\n information about schemas with fewer than {{ maximum }} objects.\n {% endset %}\n {% do exceptions.raise_compiler_error(msg) %}\n {% endif %}\n {%- do return(result) -%}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_snowflake.snowflake__check_schema_exists": {"unique_id": "macro.dbt_snowflake.snowflake__check_schema_exists", "package_name": "dbt_snowflake", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "snowflake__check_schema_exists", "macro_sql": "{% macro snowflake__check_schema_exists(information_schema, schema) -%}\n {% call statement('check_schema_exists', fetch_result=True) -%}\n select count(*)\n from {{ information_schema }}.schemata\n where upper(schema_name) = upper('{{ schema }}')\n and upper(catalog_name) = upper('{{ information_schema.database }}')\n {%- endcall %}\n {{ return(load_result('check_schema_exists').table) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_snowflake.snowflake__current_timestamp": {"unique_id": "macro.dbt_snowflake.snowflake__current_timestamp", "package_name": "dbt_snowflake", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "snowflake__current_timestamp", "macro_sql": "{% macro snowflake__current_timestamp() -%}\n convert_timezone('UTC', current_timestamp())\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_snowflake.snowflake__snapshot_string_as_time": {"unique_id": "macro.dbt_snowflake.snowflake__snapshot_string_as_time", "package_name": "dbt_snowflake", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "snowflake__snapshot_string_as_time", "macro_sql": "{% macro snowflake__snapshot_string_as_time(timestamp) -%}\n {%- set result = \"to_timestamp_ntz('\" ~ timestamp ~ \"')\" -%}\n {{ return(result) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_snowflake.snowflake__snapshot_get_time": {"unique_id": "macro.dbt_snowflake.snowflake__snapshot_get_time", "package_name": "dbt_snowflake", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "snowflake__snapshot_get_time", "macro_sql": "{% macro snowflake__snapshot_get_time() -%}\n to_timestamp_ntz({{ current_timestamp() }})\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_snowflake.snowflake__rename_relation": {"unique_id": "macro.dbt_snowflake.snowflake__rename_relation", "package_name": "dbt_snowflake", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "snowflake__rename_relation", "macro_sql": "{% macro snowflake__rename_relation(from_relation, to_relation) -%}\n {% call statement('rename_relation') -%}\n alter table {{ from_relation }} rename to {{ to_relation }}\n {%- endcall %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_snowflake.snowflake__alter_column_type": {"unique_id": "macro.dbt_snowflake.snowflake__alter_column_type", "package_name": "dbt_snowflake", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "snowflake__alter_column_type", "macro_sql": "{% macro snowflake__alter_column_type(relation, column_name, new_column_type) -%}\n {% call statement('alter_column_type') %}\n alter table {{ relation }} alter {{ adapter.quote(column_name) }} set data type {{ new_column_type }};\n {% endcall %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_snowflake.snowflake__alter_relation_comment": {"unique_id": "macro.dbt_snowflake.snowflake__alter_relation_comment", "package_name": "dbt_snowflake", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "snowflake__alter_relation_comment", "macro_sql": "{% macro snowflake__alter_relation_comment(relation, relation_comment) -%}\n comment on {{ relation.type }} {{ relation }} IS $${{ relation_comment | replace('$', '[$]') }}$$;\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_snowflake.snowflake__alter_column_comment": {"unique_id": "macro.dbt_snowflake.snowflake__alter_column_comment", "package_name": "dbt_snowflake", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "snowflake__alter_column_comment", "macro_sql": "{% macro snowflake__alter_column_comment(relation, column_dict) -%}\n alter {{ relation.type }} {{ relation }} alter\n {% for column_name in column_dict %}\n {{ adapter.quote(column_name) if column_dict[column_name]['quote'] else column_name }} COMMENT $${{ column_dict[column_name]['description'] | replace('$', '[$]') }}$$ {{ ',' if not loop.last else ';' }}\n {% endfor %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_snowflake.get_current_query_tag": {"unique_id": "macro.dbt_snowflake.get_current_query_tag", "package_name": "dbt_snowflake", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "get_current_query_tag", "macro_sql": "{% macro get_current_query_tag() -%}\n {{ return(run_query(\"show parameters like 'query_tag' in session\").rows[0]['value']) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_snowflake.set_query_tag": {"unique_id": "macro.dbt_snowflake.set_query_tag", "package_name": "dbt_snowflake", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "set_query_tag", "macro_sql": "{% macro set_query_tag() -%}\n {% set new_query_tag = config.get('query_tag') %}\n {% if new_query_tag %}\n {% set original_query_tag = get_current_query_tag() %}\n {{ log(\"Setting query_tag to '\" ~ new_query_tag ~ \"'. Will reset to '\" ~ original_query_tag ~ \"' after materialization.\") }}\n {% do run_query(\"alter session set query_tag = '{}'\".format(new_query_tag)) %}\n {{ return(original_query_tag)}}\n {% endif %}\n {{ return(none)}}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_snowflake.unset_query_tag": {"unique_id": "macro.dbt_snowflake.unset_query_tag", "package_name": "dbt_snowflake", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "unset_query_tag", "macro_sql": "{% macro unset_query_tag(original_query_tag) -%}\n {% set new_query_tag = config.get('query_tag') %}\n {% if new_query_tag %}\n {% if original_query_tag %}\n {{ log(\"Resetting query_tag to '\" ~ original_query_tag ~ \"'.\") }}\n {% do run_query(\"alter session set query_tag = '{}'\".format(original_query_tag)) %}\n {% else %}\n {{ log(\"No original query_tag, unsetting parameter.\") }}\n {% do run_query(\"alter session unset query_tag\") %}\n {% endif %}\n {% endif %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_snowflake.snowflake__get_merge_sql": {"unique_id": "macro.dbt_snowflake.snowflake__get_merge_sql", "package_name": "dbt_snowflake", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/snowflake", "path": "macros/materializations/merge.sql", "original_file_path": "macros/materializations/merge.sql", "name": "snowflake__get_merge_sql", "macro_sql": "{% macro snowflake__get_merge_sql(target, source_sql, unique_key, dest_columns, predicates) -%}\n\n {#\n Workaround for Snowflake not being happy with a merge on a constant-false predicate.\n When no unique_key is provided, this macro will do a regular insert. If a unique_key\n is provided, then this macro will do a proper merge instead.\n #}\n\n {%- set dest_cols_csv = get_quoted_csv(dest_columns | map(attribute='name')) -%}\n {%- set sql_header = config.get('sql_header', none) -%}\n\n {%- if unique_key is none -%}\n\n {{ sql_header if sql_header is not none }}\n\n insert into {{ target }} ({{ dest_cols_csv }})\n (\n select {{ dest_cols_csv }}\n from {{ source_sql }}\n );\n\n {%- else -%}\n\n {{ default__get_merge_sql(target, source_sql, unique_key, dest_columns, predicates) }}\n\n {%- endif -%}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_snowflake.materialization_view_snowflake": {"unique_id": "macro.dbt_snowflake.materialization_view_snowflake", "package_name": "dbt_snowflake", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/snowflake", "path": "macros/materializations/view.sql", "original_file_path": "macros/materializations/view.sql", "name": "materialization_view_snowflake", "macro_sql": "{% materialization view, adapter='snowflake' -%}\n\n {% set original_query_tag = set_query_tag() %}\n {% set to_return = create_or_replace_view() %}\n\n {% set target_relation = this.incorporate(type='view') %}\n {% do persist_docs(target_relation, model, for_columns=false) %}\n\n {% do return(to_return) %}\n\n {% do unset_query_tag(original_query_tag) %}\n\n{%- endmaterialization %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_snowflake.materialization_table_snowflake": {"unique_id": "macro.dbt_snowflake.materialization_table_snowflake", "package_name": "dbt_snowflake", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/snowflake", "path": "macros/materializations/table.sql", "original_file_path": "macros/materializations/table.sql", "name": "materialization_table_snowflake", "macro_sql": "{% materialization table, adapter='snowflake' %}\n\n {% set original_query_tag = set_query_tag() %}\n\n {%- set identifier = model['alias'] -%}\n\n {%- set old_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) -%}\n {%- set target_relation = api.Relation.create(identifier=identifier,\n schema=schema,\n database=database, type='table') -%}\n\n {{ run_hooks(pre_hooks, inside_transaction=False) }}\n\n -- `BEGIN` happens here:\n {{ run_hooks(pre_hooks, inside_transaction=True) }}\n\n {#-- Drop the relation if it was a view to \"convert\" it in a table. This may lead to\n -- downtime, but it should be a relatively infrequent occurrence #}\n {% if old_relation is not none and not old_relation.is_table %}\n {{ log(\"Dropping relation \" ~ old_relation ~ \" because it is of type \" ~ old_relation.type) }}\n {{ drop_relation_if_exists(old_relation) }}\n {% endif %}\n\n --build model\n {% call statement('main') -%}\n {{ create_table_as(false, target_relation, sql) }}\n {%- endcall %}\n\n {{ run_hooks(post_hooks, inside_transaction=True) }}\n\n -- `COMMIT` happens here\n {{ adapter.commit() }}\n\n {{ run_hooks(post_hooks, inside_transaction=False) }}\n\n {% do persist_docs(target_relation, model) %}\n\n {% do unset_query_tag(original_query_tag) %}\n\n {{ return({'relations': [target_relation]}) }}\n\n{% endmaterialization %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_snowflake.dbt_snowflake_validate_get_incremental_strategy": {"unique_id": "macro.dbt_snowflake.dbt_snowflake_validate_get_incremental_strategy", "package_name": "dbt_snowflake", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/snowflake", "path": "macros/materializations/incremental.sql", "original_file_path": "macros/materializations/incremental.sql", "name": "dbt_snowflake_validate_get_incremental_strategy", "macro_sql": "{% macro dbt_snowflake_validate_get_incremental_strategy(config) %}\n {#-- Find and validate the incremental strategy #}\n {%- set strategy = config.get(\"incremental_strategy\", default=\"merge\") -%}\n\n {% set invalid_strategy_msg -%}\n Invalid incremental strategy provided: {{ strategy }}\n Expected one of: 'merge', 'delete+insert'\n {%- endset %}\n {% if strategy not in ['merge', 'delete+insert'] %}\n {% do exceptions.raise_compiler_error(invalid_strategy_msg) %}\n {% endif %}\n\n {% do return(strategy) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_snowflake.dbt_snowflake_get_incremental_sql": {"unique_id": "macro.dbt_snowflake.dbt_snowflake_get_incremental_sql", "package_name": "dbt_snowflake", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/snowflake", "path": "macros/materializations/incremental.sql", "original_file_path": "macros/materializations/incremental.sql", "name": "dbt_snowflake_get_incremental_sql", "macro_sql": "{% macro dbt_snowflake_get_incremental_sql(strategy, tmp_relation, target_relation, unique_key, dest_columns) %}\n {% if strategy == 'merge' %}\n {% do return(get_merge_sql(target_relation, tmp_relation, unique_key, dest_columns)) %}\n {% elif strategy == 'delete+insert' %}\n {% do return(get_delete_insert_merge_sql(target_relation, tmp_relation, unique_key, dest_columns)) %}\n {% else %}\n {% do exceptions.raise_compiler_error('invalid strategy: ' ~ strategy) %}\n {% endif %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_snowflake.materialization_incremental_snowflake": {"unique_id": "macro.dbt_snowflake.materialization_incremental_snowflake", "package_name": "dbt_snowflake", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/snowflake", "path": "macros/materializations/incremental.sql", "original_file_path": "macros/materializations/incremental.sql", "name": "materialization_incremental_snowflake", "macro_sql": "{% materialization incremental, adapter='snowflake' -%}\n\n {% set original_query_tag = set_query_tag() %}\n\n {%- set unique_key = config.get('unique_key') -%}\n {%- set full_refresh_mode = (should_full_refresh()) -%}\n\n {% set target_relation = this %}\n {% set existing_relation = load_relation(this) %}\n {% set tmp_relation = make_temp_relation(this) %}\n\n {#-- Validate early so we don't run SQL if the strategy is invalid --#}\n {% set strategy = dbt_snowflake_validate_get_incremental_strategy(config) -%}\n\n -- setup\n {{ run_hooks(pre_hooks, inside_transaction=False) }}\n\n -- `BEGIN` happens here:\n {{ run_hooks(pre_hooks, inside_transaction=True) }}\n\n {% if existing_relation is none %}\n {% set build_sql = create_table_as(False, target_relation, sql) %}\n {% elif existing_relation.is_view %}\n {#-- Can't overwrite a view with a table - we must drop --#}\n {{ log(\"Dropping relation \" ~ target_relation ~ \" because it is a view and this model is a table.\") }}\n {% do adapter.drop_relation(existing_relation) %}\n {% set build_sql = create_table_as(False, target_relation, sql) %}\n {% elif full_refresh_mode %}\n {% set build_sql = create_table_as(False, target_relation, sql) %}\n {% else %}\n {% do run_query(create_table_as(True, tmp_relation, sql)) %}\n {% do adapter.expand_target_column_types(\n from_relation=tmp_relation,\n to_relation=target_relation) %}\n {% set dest_columns = adapter.get_columns_in_relation(target_relation) %}\n {% set build_sql = dbt_snowflake_get_incremental_sql(strategy, tmp_relation, target_relation, unique_key, dest_columns) %}\n {% endif %}\n\n {%- call statement('main') -%}\n {{ build_sql }}\n {%- endcall -%}\n\n {{ run_hooks(post_hooks, inside_transaction=True) }}\n\n -- `COMMIT` happens here\n {{ adapter.commit() }}\n\n {{ run_hooks(post_hooks, inside_transaction=False) }}\n\n {% set target_relation = target_relation.incorporate(type='table') %}\n {% do persist_docs(target_relation, model) %}\n\n {% do unset_query_tag(original_query_tag) %}\n\n {{ return({'relations': [target_relation]}) }}\n\n{%- endmaterialization %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.statement": {"unique_id": "macro.dbt.statement", "package_name": "dbt", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/core.sql", "original_file_path": "macros/core.sql", "name": "statement", "macro_sql": "{% macro statement(name=None, fetch_result=False, auto_begin=True) -%}\n {%- if execute: -%}\n {%- set sql = caller() -%}\n\n {%- if name == 'main' -%}\n {{ log('Writing runtime SQL for node \"{}\"'.format(model['unique_id'])) }}\n {{ write(sql) }}\n {%- endif -%}\n\n {%- set res, table = adapter.execute(sql, auto_begin=auto_begin, fetch=fetch_result) -%}\n {%- if name is not none -%}\n {{ store_result(name, response=res, agate_table=table) }}\n {%- endif -%}\n\n {%- endif -%}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.noop_statement": {"unique_id": "macro.dbt.noop_statement", "package_name": "dbt", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/core.sql", "original_file_path": "macros/core.sql", "name": "noop_statement", "macro_sql": "{% macro noop_statement(name=None, message=None, code=None, rows_affected=None, res=None) -%}\n {%- set sql = caller() -%}\n\n {%- if name == 'main' -%}\n {{ log('Writing runtime SQL for node \"{}\"'.format(model['unique_id'])) }}\n {{ write(sql) }}\n {%- endif -%}\n\n {%- if name is not none -%}\n {{ store_raw_result(name, message=message, code=code, rows_affected=rows_affected, agate_table=res) }}\n {%- endif -%}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.run_hooks": {"unique_id": "macro.dbt.run_hooks", "package_name": "dbt", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/helpers.sql", "original_file_path": "macros/materializations/helpers.sql", "name": "run_hooks", "macro_sql": "{% macro run_hooks(hooks, inside_transaction=True) %}\n {% for hook in hooks | selectattr('transaction', 'equalto', inside_transaction) %}\n {% if not inside_transaction and loop.first %}\n {% call statement(auto_begin=inside_transaction) %}\n commit;\n {% endcall %}\n {% endif %}\n {% set rendered = render(hook.get('sql')) | trim %}\n {% if (rendered | length) > 0 %}\n {% call statement(auto_begin=inside_transaction) %}\n {{ rendered }}\n {% endcall %}\n {% endif %}\n {% endfor %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.column_list": {"unique_id": "macro.dbt.column_list", "package_name": "dbt", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/helpers.sql", "original_file_path": "macros/materializations/helpers.sql", "name": "column_list", "macro_sql": "{% macro column_list(columns) %}\n {%- for col in columns %}\n {{ col.name }} {% if not loop.last %},{% endif %}\n {% endfor -%}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.column_list_for_create_table": {"unique_id": "macro.dbt.column_list_for_create_table", "package_name": "dbt", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/helpers.sql", "original_file_path": "macros/materializations/helpers.sql", "name": "column_list_for_create_table", "macro_sql": "{% macro column_list_for_create_table(columns) %}\n {%- for col in columns %}\n {{ col.name }} {{ col.data_type }} {%- if not loop.last %},{% endif %}\n {% endfor -%}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.make_hook_config": {"unique_id": "macro.dbt.make_hook_config", "package_name": "dbt", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/helpers.sql", "original_file_path": "macros/materializations/helpers.sql", "name": "make_hook_config", "macro_sql": "{% macro make_hook_config(sql, inside_transaction) %}\n {{ tojson({\"sql\": sql, \"transaction\": inside_transaction}) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.before_begin": {"unique_id": "macro.dbt.before_begin", "package_name": "dbt", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/helpers.sql", "original_file_path": "macros/materializations/helpers.sql", "name": "before_begin", "macro_sql": "{% macro before_begin(sql) %}\n {{ make_hook_config(sql, inside_transaction=False) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.in_transaction": {"unique_id": "macro.dbt.in_transaction", "package_name": "dbt", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/helpers.sql", "original_file_path": "macros/materializations/helpers.sql", "name": "in_transaction", "macro_sql": "{% macro in_transaction(sql) %}\n {{ make_hook_config(sql, inside_transaction=True) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.after_commit": {"unique_id": "macro.dbt.after_commit", "package_name": "dbt", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/helpers.sql", "original_file_path": "macros/materializations/helpers.sql", "name": "after_commit", "macro_sql": "{% macro after_commit(sql) %}\n {{ make_hook_config(sql, inside_transaction=False) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.drop_relation_if_exists": {"unique_id": "macro.dbt.drop_relation_if_exists", "package_name": "dbt", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/helpers.sql", "original_file_path": "macros/materializations/helpers.sql", "name": "drop_relation_if_exists", "macro_sql": "{% macro drop_relation_if_exists(relation) %}\n {% if relation is not none %}\n {{ adapter.drop_relation(relation) }}\n {% endif %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.load_relation": {"unique_id": "macro.dbt.load_relation", "package_name": "dbt", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/helpers.sql", "original_file_path": "macros/materializations/helpers.sql", "name": "load_relation", "macro_sql": "{% macro load_relation(relation) %}\n {% do return(adapter.get_relation(\n database=relation.database,\n schema=relation.schema,\n identifier=relation.identifier\n )) -%}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.should_full_refresh": {"unique_id": "macro.dbt.should_full_refresh", "package_name": "dbt", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/helpers.sql", "original_file_path": "macros/materializations/helpers.sql", "name": "should_full_refresh", "macro_sql": "{% macro should_full_refresh() %}\n {% set config_full_refresh = config.get('full_refresh') %}\n {% if config_full_refresh is none %}\n {% set config_full_refresh = flags.FULL_REFRESH %}\n {% endif %}\n {% do return(config_full_refresh) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.snapshot_merge_sql": {"unique_id": "macro.dbt.snapshot_merge_sql", "package_name": "dbt", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshot/snapshot_merge.sql", "original_file_path": "macros/materializations/snapshot/snapshot_merge.sql", "name": "snapshot_merge_sql", "macro_sql": "{% macro snapshot_merge_sql(target, source, insert_cols) -%}\n {{ adapter.dispatch('snapshot_merge_sql')(target, source, insert_cols) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.default__snapshot_merge_sql": {"unique_id": "macro.dbt.default__snapshot_merge_sql", "package_name": "dbt", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshot/snapshot_merge.sql", "original_file_path": "macros/materializations/snapshot/snapshot_merge.sql", "name": "default__snapshot_merge_sql", "macro_sql": "{% macro default__snapshot_merge_sql(target, source, insert_cols) -%}\n {%- set insert_cols_csv = insert_cols | join(', ') -%}\n\n merge into {{ target }} as DBT_INTERNAL_DEST\n using {{ source }} as DBT_INTERNAL_SOURCE\n on DBT_INTERNAL_SOURCE.dbt_scd_id = DBT_INTERNAL_DEST.dbt_scd_id\n\n when matched\n and DBT_INTERNAL_DEST.dbt_valid_to is null\n and DBT_INTERNAL_SOURCE.dbt_change_type in ('update', 'delete')\n then update\n set dbt_valid_to = DBT_INTERNAL_SOURCE.dbt_valid_to\n\n when not matched\n and DBT_INTERNAL_SOURCE.dbt_change_type = 'insert'\n then insert ({{ insert_cols_csv }})\n values ({{ insert_cols_csv }})\n ;\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.strategy_dispatch": {"unique_id": "macro.dbt.strategy_dispatch", "package_name": "dbt", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshot/strategies.sql", "original_file_path": "macros/materializations/snapshot/strategies.sql", "name": "strategy_dispatch", "macro_sql": "{% macro strategy_dispatch(name) -%}\n{% set original_name = name %}\n {% if '.' in name %}\n {% set package_name, name = name.split(\".\", 1) %}\n {% else %}\n {% set package_name = none %}\n {% endif %}\n\n {% if package_name is none %}\n {% set package_context = context %}\n {% elif package_name in context %}\n {% set package_context = context[package_name] %}\n {% else %}\n {% set error_msg %}\n Could not find package '{{package_name}}', called with '{{original_name}}'\n {% endset %}\n {{ exceptions.raise_compiler_error(error_msg | trim) }}\n {% endif %}\n\n {%- set search_name = 'snapshot_' ~ name ~ '_strategy' -%}\n\n {% if search_name not in package_context %}\n {% set error_msg %}\n The specified strategy macro '{{name}}' was not found in package '{{ package_name }}'\n {% endset %}\n {{ exceptions.raise_compiler_error(error_msg | trim) }}\n {% endif %}\n {{ return(package_context[search_name]) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.snapshot_hash_arguments": {"unique_id": "macro.dbt.snapshot_hash_arguments", "package_name": "dbt", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshot/strategies.sql", "original_file_path": "macros/materializations/snapshot/strategies.sql", "name": "snapshot_hash_arguments", "macro_sql": "{% macro snapshot_hash_arguments(args) -%}\n {{ adapter.dispatch('snapshot_hash_arguments')(args) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.default__snapshot_hash_arguments": {"unique_id": "macro.dbt.default__snapshot_hash_arguments", "package_name": "dbt", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshot/strategies.sql", "original_file_path": "macros/materializations/snapshot/strategies.sql", "name": "default__snapshot_hash_arguments", "macro_sql": "{% macro default__snapshot_hash_arguments(args) -%}\n md5({%- for arg in args -%}\n coalesce(cast({{ arg }} as varchar ), '')\n {% if not loop.last %} || '|' || {% endif %}\n {%- endfor -%})\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.snapshot_get_time": {"unique_id": "macro.dbt.snapshot_get_time", "package_name": "dbt", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshot/strategies.sql", "original_file_path": "macros/materializations/snapshot/strategies.sql", "name": "snapshot_get_time", "macro_sql": "{% macro snapshot_get_time() -%}\n {{ adapter.dispatch('snapshot_get_time')() }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.default__snapshot_get_time": {"unique_id": "macro.dbt.default__snapshot_get_time", "package_name": "dbt", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshot/strategies.sql", "original_file_path": "macros/materializations/snapshot/strategies.sql", "name": "default__snapshot_get_time", "macro_sql": "{% macro default__snapshot_get_time() -%}\n {{ current_timestamp() }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.snapshot_timestamp_strategy": {"unique_id": "macro.dbt.snapshot_timestamp_strategy", "package_name": "dbt", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshot/strategies.sql", "original_file_path": "macros/materializations/snapshot/strategies.sql", "name": "snapshot_timestamp_strategy", "macro_sql": "{% macro snapshot_timestamp_strategy(node, snapshotted_rel, current_rel, config, target_exists) %}\n {% set primary_key = config['unique_key'] %}\n {% set updated_at = config['updated_at'] %}\n {% set invalidate_hard_deletes = config.get('invalidate_hard_deletes', false) %}\n\n {#/*\n The snapshot relation might not have an {{ updated_at }} value if the\n snapshot strategy is changed from `check` to `timestamp`. We\n should use a dbt-created column for the comparison in the snapshot\n table instead of assuming that the user-supplied {{ updated_at }}\n will be present in the historical data.\n\n See https://github.com/fishtown-analytics/dbt/issues/2350\n */ #}\n {% set row_changed_expr -%}\n ({{ snapshotted_rel }}.dbt_valid_from < {{ current_rel }}.{{ updated_at }})\n {%- endset %}\n\n {% set scd_id_expr = snapshot_hash_arguments([primary_key, updated_at]) %}\n\n {% do return({\n \"unique_key\": primary_key,\n \"updated_at\": updated_at,\n \"row_changed\": row_changed_expr,\n \"scd_id\": scd_id_expr,\n \"invalidate_hard_deletes\": invalidate_hard_deletes\n }) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.snapshot_string_as_time": {"unique_id": "macro.dbt.snapshot_string_as_time", "package_name": "dbt", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshot/strategies.sql", "original_file_path": "macros/materializations/snapshot/strategies.sql", "name": "snapshot_string_as_time", "macro_sql": "{% macro snapshot_string_as_time(timestamp) -%}\n {{ adapter.dispatch('snapshot_string_as_time')(timestamp) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.default__snapshot_string_as_time": {"unique_id": "macro.dbt.default__snapshot_string_as_time", "package_name": "dbt", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshot/strategies.sql", "original_file_path": "macros/materializations/snapshot/strategies.sql", "name": "default__snapshot_string_as_time", "macro_sql": "{% macro default__snapshot_string_as_time(timestamp) %}\n {% do exceptions.raise_not_implemented(\n 'snapshot_string_as_time macro not implemented for adapter '+adapter.type()\n ) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.snapshot_check_all_get_existing_columns": {"unique_id": "macro.dbt.snapshot_check_all_get_existing_columns", "package_name": "dbt", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshot/strategies.sql", "original_file_path": "macros/materializations/snapshot/strategies.sql", "name": "snapshot_check_all_get_existing_columns", "macro_sql": "{% macro snapshot_check_all_get_existing_columns(node, target_exists) -%}\n {%- set query_columns = get_columns_in_query(node['compiled_sql']) -%}\n {%- if not target_exists -%}\n {# no table yet -> return whatever the query does #}\n {{ return([false, query_columns]) }}\n {%- endif -%}\n {# handle any schema changes #}\n {%- set target_table = node.get('alias', node.get('name')) -%}\n {%- set target_relation = adapter.get_relation(database=node.database, schema=node.schema, identifier=target_table) -%}\n {%- set existing_cols = get_columns_in_query('select * from ' ~ target_relation) -%}\n {%- set ns = namespace() -%} {# handle for-loop scoping with a namespace #}\n {%- set ns.column_added = false -%}\n\n {%- set intersection = [] -%}\n {%- for col in query_columns -%}\n {%- if col in existing_cols -%}\n {%- do intersection.append(col) -%}\n {%- else -%}\n {% set ns.column_added = true %}\n {%- endif -%}\n {%- endfor -%}\n {{ return([ns.column_added, intersection]) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.snapshot_check_strategy": {"unique_id": "macro.dbt.snapshot_check_strategy", "package_name": "dbt", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshot/strategies.sql", "original_file_path": "macros/materializations/snapshot/strategies.sql", "name": "snapshot_check_strategy", "macro_sql": "{% macro snapshot_check_strategy(node, snapshotted_rel, current_rel, config, target_exists) %}\n {% set check_cols_config = config['check_cols'] %}\n {% set primary_key = config['unique_key'] %}\n {% set invalidate_hard_deletes = config.get('invalidate_hard_deletes', false) %}\n \n {% set select_current_time -%}\n select {{ snapshot_get_time() }} as snapshot_start\n {%- endset %}\n\n {#-- don't access the column by name, to avoid dealing with casing issues on snowflake #}\n {%- set now = run_query(select_current_time)[0][0] -%}\n {% if now is none or now is undefined -%}\n {%- do exceptions.raise_compiler_error('Could not get a snapshot start time from the database') -%}\n {%- endif %}\n {% set updated_at = snapshot_string_as_time(now) %}\n\n {% set column_added = false %}\n\n {% if check_cols_config == 'all' %}\n {% set column_added, check_cols = snapshot_check_all_get_existing_columns(node, target_exists) %}\n {% elif check_cols_config is iterable and (check_cols_config | length) > 0 %}\n {% set check_cols = check_cols_config %}\n {% else %}\n {% do exceptions.raise_compiler_error(\"Invalid value for 'check_cols': \" ~ check_cols_config) %}\n {% endif %}\n\n {%- set row_changed_expr -%}\n (\n {%- if column_added -%}\n TRUE\n {%- else -%}\n {%- for col in check_cols -%}\n {{ snapshotted_rel }}.{{ col }} != {{ current_rel }}.{{ col }}\n or\n (\n (({{ snapshotted_rel }}.{{ col }} is null) and not ({{ current_rel }}.{{ col }} is null))\n or\n ((not {{ snapshotted_rel }}.{{ col }} is null) and ({{ current_rel }}.{{ col }} is null))\n )\n {%- if not loop.last %} or {% endif -%}\n {%- endfor -%}\n {%- endif -%}\n )\n {%- endset %}\n\n {% set scd_id_expr = snapshot_hash_arguments([primary_key, updated_at]) %}\n\n {% do return({\n \"unique_key\": primary_key,\n \"updated_at\": updated_at,\n \"row_changed\": row_changed_expr,\n \"scd_id\": scd_id_expr,\n \"invalidate_hard_deletes\": invalidate_hard_deletes\n }) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.create_columns": {"unique_id": "macro.dbt.create_columns", "package_name": "dbt", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshot/snapshot.sql", "original_file_path": "macros/materializations/snapshot/snapshot.sql", "name": "create_columns", "macro_sql": "{% macro create_columns(relation, columns) %}\n {{ adapter.dispatch('create_columns')(relation, columns) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.default__create_columns": {"unique_id": "macro.dbt.default__create_columns", "package_name": "dbt", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshot/snapshot.sql", "original_file_path": "macros/materializations/snapshot/snapshot.sql", "name": "default__create_columns", "macro_sql": "{% macro default__create_columns(relation, columns) %}\n {% for column in columns %}\n {% call statement() %}\n alter table {{ relation }} add column \"{{ column.name }}\" {{ column.data_type }};\n {% endcall %}\n {% endfor %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.post_snapshot": {"unique_id": "macro.dbt.post_snapshot", "package_name": "dbt", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshot/snapshot.sql", "original_file_path": "macros/materializations/snapshot/snapshot.sql", "name": "post_snapshot", "macro_sql": "{% macro post_snapshot(staging_relation) %}\n {{ adapter.dispatch('post_snapshot')(staging_relation) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.default__post_snapshot": {"unique_id": "macro.dbt.default__post_snapshot", "package_name": "dbt", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshot/snapshot.sql", "original_file_path": "macros/materializations/snapshot/snapshot.sql", "name": "default__post_snapshot", "macro_sql": "{% macro default__post_snapshot(staging_relation) %}\n {# no-op #}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.snapshot_staging_table": {"unique_id": "macro.dbt.snapshot_staging_table", "package_name": "dbt", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshot/snapshot.sql", "original_file_path": "macros/materializations/snapshot/snapshot.sql", "name": "snapshot_staging_table", "macro_sql": "{% macro snapshot_staging_table(strategy, source_sql, target_relation) -%}\n\n with snapshot_query as (\n\n {{ source_sql }}\n\n ),\n\n snapshotted_data as (\n\n select *,\n {{ strategy.unique_key }} as dbt_unique_key\n\n from {{ target_relation }}\n where dbt_valid_to is null\n\n ),\n\n insertions_source_data as (\n\n select\n *,\n {{ strategy.unique_key }} as dbt_unique_key,\n {{ strategy.updated_at }} as dbt_updated_at,\n {{ strategy.updated_at }} as dbt_valid_from,\n nullif({{ strategy.updated_at }}, {{ strategy.updated_at }}) as dbt_valid_to,\n {{ strategy.scd_id }} as dbt_scd_id\n\n from snapshot_query\n ),\n\n updates_source_data as (\n\n select\n *,\n {{ strategy.unique_key }} as dbt_unique_key,\n {{ strategy.updated_at }} as dbt_updated_at,\n {{ strategy.updated_at }} as dbt_valid_from,\n {{ strategy.updated_at }} as dbt_valid_to\n\n from snapshot_query\n ),\n\n {%- if strategy.invalidate_hard_deletes %}\n\n deletes_source_data as (\n\n select \n *,\n {{ strategy.unique_key }} as dbt_unique_key\n from snapshot_query\n ),\n {% endif %}\n\n insertions as (\n\n select\n 'insert' as dbt_change_type,\n source_data.*\n\n from insertions_source_data as source_data\n left outer join snapshotted_data on snapshotted_data.dbt_unique_key = source_data.dbt_unique_key\n where snapshotted_data.dbt_unique_key is null\n or (\n snapshotted_data.dbt_unique_key is not null\n and (\n {{ strategy.row_changed }}\n )\n )\n\n ),\n\n updates as (\n\n select\n 'update' as dbt_change_type,\n source_data.*,\n snapshotted_data.dbt_scd_id\n\n from updates_source_data as source_data\n join snapshotted_data on snapshotted_data.dbt_unique_key = source_data.dbt_unique_key\n where (\n {{ strategy.row_changed }}\n )\n )\n\n {%- if strategy.invalidate_hard_deletes -%}\n ,\n\n deletes as (\n \n select\n 'delete' as dbt_change_type,\n source_data.*,\n {{ snapshot_get_time() }} as dbt_valid_from,\n {{ snapshot_get_time() }} as dbt_updated_at,\n {{ snapshot_get_time() }} as dbt_valid_to,\n snapshotted_data.dbt_scd_id\n \n from snapshotted_data\n left join deletes_source_data as source_data on snapshotted_data.dbt_unique_key = source_data.dbt_unique_key\n where source_data.dbt_unique_key is null\n )\n {%- endif %}\n\n select * from insertions\n union all\n select * from updates\n {%- if strategy.invalidate_hard_deletes %}\n union all\n select * from deletes\n {%- endif %}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.build_snapshot_table": {"unique_id": "macro.dbt.build_snapshot_table", "package_name": "dbt", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshot/snapshot.sql", "original_file_path": "macros/materializations/snapshot/snapshot.sql", "name": "build_snapshot_table", "macro_sql": "{% macro build_snapshot_table(strategy, sql) %}\n\n select *,\n {{ strategy.scd_id }} as dbt_scd_id,\n {{ strategy.updated_at }} as dbt_updated_at,\n {{ strategy.updated_at }} as dbt_valid_from,\n nullif({{ strategy.updated_at }}, {{ strategy.updated_at }}) as dbt_valid_to\n from (\n {{ sql }}\n ) sbq\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.get_or_create_relation": {"unique_id": "macro.dbt.get_or_create_relation", "package_name": "dbt", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshot/snapshot.sql", "original_file_path": "macros/materializations/snapshot/snapshot.sql", "name": "get_or_create_relation", "macro_sql": "{% macro get_or_create_relation(database, schema, identifier, type) %}\n {%- set target_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) %}\n\n {% if target_relation %}\n {% do return([true, target_relation]) %}\n {% endif %}\n\n {%- set new_relation = api.Relation.create(\n database=database,\n schema=schema,\n identifier=identifier,\n type=type\n ) -%}\n {% do return([false, new_relation]) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.build_snapshot_staging_table": {"unique_id": "macro.dbt.build_snapshot_staging_table", "package_name": "dbt", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshot/snapshot.sql", "original_file_path": "macros/materializations/snapshot/snapshot.sql", "name": "build_snapshot_staging_table", "macro_sql": "{% macro build_snapshot_staging_table(strategy, sql, target_relation) %}\n {% set tmp_relation = make_temp_relation(target_relation) %}\n\n {% set select = snapshot_staging_table(strategy, sql, target_relation) %}\n\n {% call statement('build_snapshot_staging_relation') %}\n {{ create_table_as(True, tmp_relation, select) }}\n {% endcall %}\n\n {% do return(tmp_relation) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.materialization_snapshot_default": {"unique_id": "macro.dbt.materialization_snapshot_default", "package_name": "dbt", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshot/snapshot.sql", "original_file_path": "macros/materializations/snapshot/snapshot.sql", "name": "materialization_snapshot_default", "macro_sql": "{% materialization snapshot, default %}\n {%- set config = model['config'] -%}\n\n {%- set target_table = model.get('alias', model.get('name')) -%}\n\n {%- set strategy_name = config.get('strategy') -%}\n {%- set unique_key = config.get('unique_key') %}\n\n {% if not adapter.check_schema_exists(model.database, model.schema) %}\n {% do create_schema(model.database, model.schema) %}\n {% endif %}\n\n {% set target_relation_exists, target_relation = get_or_create_relation(\n database=model.database,\n schema=model.schema,\n identifier=target_table,\n type='table') -%}\n\n {%- if not target_relation.is_table -%}\n {% do exceptions.relation_wrong_type(target_relation, 'table') %}\n {%- endif -%}\n\n\n {{ run_hooks(pre_hooks, inside_transaction=False) }}\n\n {{ run_hooks(pre_hooks, inside_transaction=True) }}\n\n {% set strategy_macro = strategy_dispatch(strategy_name) %}\n {% set strategy = strategy_macro(model, \"snapshotted_data\", \"source_data\", config, target_relation_exists) %}\n\n {% if not target_relation_exists %}\n\n {% set build_sql = build_snapshot_table(strategy, model['compiled_sql']) %}\n {% set final_sql = create_table_as(False, target_relation, build_sql) %}\n\n {% else %}\n\n {{ adapter.valid_snapshot_target(target_relation) }}\n\n {% set staging_table = build_snapshot_staging_table(strategy, sql, target_relation) %}\n\n -- this may no-op if the database does not require column expansion\n {% do adapter.expand_target_column_types(from_relation=staging_table,\n to_relation=target_relation) %}\n\n {% set missing_columns = adapter.get_missing_columns(staging_table, target_relation)\n | rejectattr('name', 'equalto', 'dbt_change_type')\n | rejectattr('name', 'equalto', 'DBT_CHANGE_TYPE')\n | rejectattr('name', 'equalto', 'dbt_unique_key')\n | rejectattr('name', 'equalto', 'DBT_UNIQUE_KEY')\n | list %}\n\n {% do create_columns(target_relation, missing_columns) %}\n\n {% set source_columns = adapter.get_columns_in_relation(staging_table)\n | rejectattr('name', 'equalto', 'dbt_change_type')\n | rejectattr('name', 'equalto', 'DBT_CHANGE_TYPE')\n | rejectattr('name', 'equalto', 'dbt_unique_key')\n | rejectattr('name', 'equalto', 'DBT_UNIQUE_KEY')\n | list %}\n\n {% set quoted_source_columns = [] %}\n {% for column in source_columns %}\n {% do quoted_source_columns.append(adapter.quote(column.name)) %}\n {% endfor %}\n\n {% set final_sql = snapshot_merge_sql(\n target = target_relation,\n source = staging_table,\n insert_cols = quoted_source_columns\n )\n %}\n\n {% endif %}\n\n {% call statement('main') %}\n {{ final_sql }}\n {% endcall %}\n\n {% do persist_docs(target_relation, model) %}\n\n {{ run_hooks(post_hooks, inside_transaction=True) }}\n\n {{ adapter.commit() }}\n\n {% if staging_table is defined %}\n {% do post_snapshot(staging_table) %}\n {% endif %}\n\n {{ run_hooks(post_hooks, inside_transaction=False) }}\n\n {{ return({'relations': [target_relation]}) }}\n\n{% endmaterialization %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.create_csv_table": {"unique_id": "macro.dbt.create_csv_table", "package_name": "dbt", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/seed/seed.sql", "original_file_path": "macros/materializations/seed/seed.sql", "name": "create_csv_table", "macro_sql": "{% macro create_csv_table(model, agate_table) -%}\n {{ adapter.dispatch('create_csv_table')(model, agate_table) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.reset_csv_table": {"unique_id": "macro.dbt.reset_csv_table", "package_name": "dbt", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/seed/seed.sql", "original_file_path": "macros/materializations/seed/seed.sql", "name": "reset_csv_table", "macro_sql": "{% macro reset_csv_table(model, full_refresh, old_relation, agate_table) -%}\n {{ adapter.dispatch('reset_csv_table')(model, full_refresh, old_relation, agate_table) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.load_csv_rows": {"unique_id": "macro.dbt.load_csv_rows", "package_name": "dbt", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/seed/seed.sql", "original_file_path": "macros/materializations/seed/seed.sql", "name": "load_csv_rows", "macro_sql": "{% macro load_csv_rows(model, agate_table) -%}\n {{ adapter.dispatch('load_csv_rows')(model, agate_table) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.default__create_csv_table": {"unique_id": "macro.dbt.default__create_csv_table", "package_name": "dbt", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/seed/seed.sql", "original_file_path": "macros/materializations/seed/seed.sql", "name": "default__create_csv_table", "macro_sql": "{% macro default__create_csv_table(model, agate_table) %}\n {%- set column_override = model['config'].get('column_types', {}) -%}\n {%- set quote_seed_column = model['config'].get('quote_columns', None) -%}\n\n {% set sql %}\n create table {{ this.render() }} (\n {%- for col_name in agate_table.column_names -%}\n {%- set inferred_type = adapter.convert_type(agate_table, loop.index0) -%}\n {%- set type = column_override.get(col_name, inferred_type) -%}\n {%- set column_name = (col_name | string) -%}\n {{ adapter.quote_seed_column(column_name, quote_seed_column) }} {{ type }} {%- if not loop.last -%}, {%- endif -%}\n {%- endfor -%}\n )\n {% endset %}\n\n {% call statement('_') -%}\n {{ sql }}\n {%- endcall %}\n\n {{ return(sql) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.default__reset_csv_table": {"unique_id": "macro.dbt.default__reset_csv_table", "package_name": "dbt", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/seed/seed.sql", "original_file_path": "macros/materializations/seed/seed.sql", "name": "default__reset_csv_table", "macro_sql": "{% macro default__reset_csv_table(model, full_refresh, old_relation, agate_table) %}\n {% set sql = \"\" %}\n {% if full_refresh %}\n {{ adapter.drop_relation(old_relation) }}\n {% set sql = create_csv_table(model, agate_table) %}\n {% else %}\n {{ adapter.truncate_relation(old_relation) }}\n {% set sql = \"truncate table \" ~ old_relation %}\n {% endif %}\n\n {{ return(sql) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.get_seed_column_quoted_csv": {"unique_id": "macro.dbt.get_seed_column_quoted_csv", "package_name": "dbt", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/seed/seed.sql", "original_file_path": "macros/materializations/seed/seed.sql", "name": "get_seed_column_quoted_csv", "macro_sql": "{% macro get_seed_column_quoted_csv(model, column_names) %}\n {%- set quote_seed_column = model['config'].get('quote_columns', None) -%}\n {% set quoted = [] %}\n {% for col in column_names -%}\n {%- do quoted.append(adapter.quote_seed_column(col, quote_seed_column)) -%}\n {%- endfor %}\n\n {%- set dest_cols_csv = quoted | join(', ') -%}\n {{ return(dest_cols_csv) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.basic_load_csv_rows": {"unique_id": "macro.dbt.basic_load_csv_rows", "package_name": "dbt", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/seed/seed.sql", "original_file_path": "macros/materializations/seed/seed.sql", "name": "basic_load_csv_rows", "macro_sql": "{% macro basic_load_csv_rows(model, batch_size, agate_table) %}\n {% set cols_sql = get_seed_column_quoted_csv(model, agate_table.column_names) %}\n {% set bindings = [] %}\n\n {% set statements = [] %}\n\n {% for chunk in agate_table.rows | batch(batch_size) %}\n {% set bindings = [] %}\n\n {% for row in chunk %}\n {% do bindings.extend(row) %}\n {% endfor %}\n\n {% set sql %}\n insert into {{ this.render() }} ({{ cols_sql }}) values\n {% for row in chunk -%}\n ({%- for column in agate_table.column_names -%}\n %s\n {%- if not loop.last%},{%- endif %}\n {%- endfor -%})\n {%- if not loop.last%},{%- endif %}\n {%- endfor %}\n {% endset %}\n\n {% do adapter.add_query(sql, bindings=bindings, abridge_sql_log=True) %}\n\n {% if loop.index0 == 0 %}\n {% do statements.append(sql) %}\n {% endif %}\n {% endfor %}\n\n {# Return SQL so we can render it out into the compiled files #}\n {{ return(statements[0]) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.default__load_csv_rows": {"unique_id": "macro.dbt.default__load_csv_rows", "package_name": "dbt", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/seed/seed.sql", "original_file_path": "macros/materializations/seed/seed.sql", "name": "default__load_csv_rows", "macro_sql": "{% macro default__load_csv_rows(model, agate_table) %}\n {{ return(basic_load_csv_rows(model, 10000, agate_table) )}}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.materialization_seed_default": {"unique_id": "macro.dbt.materialization_seed_default", "package_name": "dbt", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/seed/seed.sql", "original_file_path": "macros/materializations/seed/seed.sql", "name": "materialization_seed_default", "macro_sql": "{% materialization seed, default %}\n\n {%- set identifier = model['alias'] -%}\n {%- set full_refresh_mode = (should_full_refresh()) -%}\n\n {%- set old_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) -%}\n\n {%- set exists_as_table = (old_relation is not none and old_relation.is_table) -%}\n {%- set exists_as_view = (old_relation is not none and old_relation.is_view) -%}\n\n {%- set agate_table = load_agate_table() -%}\n {%- do store_result('agate_table', response='OK', agate_table=agate_table) -%}\n\n {{ run_hooks(pre_hooks, inside_transaction=False) }}\n\n -- `BEGIN` happens here:\n {{ run_hooks(pre_hooks, inside_transaction=True) }}\n\n -- build model\n {% set create_table_sql = \"\" %}\n {% if exists_as_view %}\n {{ exceptions.raise_compiler_error(\"Cannot seed to '{}', it is a view\".format(old_relation)) }}\n {% elif exists_as_table %}\n {% set create_table_sql = reset_csv_table(model, full_refresh_mode, old_relation, agate_table) %}\n {% else %}\n {% set create_table_sql = create_csv_table(model, agate_table) %}\n {% endif %}\n\n {% set code = 'CREATE' if full_refresh_mode else 'INSERT' %}\n {% set rows_affected = (agate_table.rows | length) %}\n {% set sql = load_csv_rows(model, agate_table) %}\n\n {% call noop_statement('main', code ~ ' ' ~ rows_affected, code, rows_affected) %}\n {{ create_table_sql }};\n -- dbt seed --\n {{ sql }}\n {% endcall %}\n\n {% set target_relation = this.incorporate(type='table') %}\n {% do persist_docs(target_relation, model) %}\n\n {{ run_hooks(post_hooks, inside_transaction=True) }}\n\n -- `COMMIT` happens here\n {{ adapter.commit() }}\n\n {{ run_hooks(post_hooks, inside_transaction=False) }}\n\n {{ return({'relations': [target_relation]}) }}\n\n{% endmaterialization %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.incremental_upsert": {"unique_id": "macro.dbt.incremental_upsert", "package_name": "dbt", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/incremental/helpers.sql", "original_file_path": "macros/materializations/incremental/helpers.sql", "name": "incremental_upsert", "macro_sql": "{% macro incremental_upsert(tmp_relation, target_relation, unique_key=none, statement_name=\"main\") %}\n {%- set dest_columns = adapter.get_columns_in_relation(target_relation) -%}\n {%- set dest_cols_csv = dest_columns | map(attribute='quoted') | join(', ') -%}\n\n {%- if unique_key is not none -%}\n delete\n from {{ target_relation }}\n where ({{ unique_key }}) in (\n select ({{ unique_key }})\n from {{ tmp_relation }}\n );\n {%- endif %}\n\n insert into {{ target_relation }} ({{ dest_cols_csv }})\n (\n select {{ dest_cols_csv }}\n from {{ tmp_relation }}\n );\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.materialization_incremental_default": {"unique_id": "macro.dbt.materialization_incremental_default", "package_name": "dbt", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/incremental/incremental.sql", "original_file_path": "macros/materializations/incremental/incremental.sql", "name": "materialization_incremental_default", "macro_sql": "{% materialization incremental, default -%}\n\n {% set unique_key = config.get('unique_key') %}\n\n {% set target_relation = this.incorporate(type='table') %}\n {% set existing_relation = load_relation(this) %}\n {% set tmp_relation = make_temp_relation(this) %}\n\n {{ run_hooks(pre_hooks, inside_transaction=False) }}\n\n -- `BEGIN` happens here:\n {{ run_hooks(pre_hooks, inside_transaction=True) }}\n\n {% set to_drop = [] %}\n {% if existing_relation is none %}\n {% set build_sql = create_table_as(False, target_relation, sql) %}\n {% elif existing_relation.is_view or should_full_refresh() %}\n {#-- Make sure the backup doesn't exist so we don't encounter issues with the rename below #}\n {% set backup_identifier = existing_relation.identifier ~ \"__dbt_backup\" %}\n {% set backup_relation = existing_relation.incorporate(path={\"identifier\": backup_identifier}) %}\n {% do adapter.drop_relation(backup_relation) %}\n\n {% do adapter.rename_relation(target_relation, backup_relation) %}\n {% set build_sql = create_table_as(False, target_relation, sql) %}\n {% do to_drop.append(backup_relation) %}\n {% else %}\n {% set tmp_relation = make_temp_relation(target_relation) %}\n {% do run_query(create_table_as(True, tmp_relation, sql)) %}\n {% do adapter.expand_target_column_types(\n from_relation=tmp_relation,\n to_relation=target_relation) %}\n {% set build_sql = incremental_upsert(tmp_relation, target_relation, unique_key=unique_key) %}\n {% endif %}\n\n {% call statement(\"main\") %}\n {{ build_sql }}\n {% endcall %}\n\n {% do persist_docs(target_relation, model) %}\n\n {{ run_hooks(post_hooks, inside_transaction=True) }}\n\n -- `COMMIT` happens here\n {% do adapter.commit() %}\n\n {% for rel in to_drop %}\n {% do adapter.drop_relation(rel) %}\n {% endfor %}\n\n {{ run_hooks(post_hooks, inside_transaction=False) }}\n\n {{ return({'relations': [target_relation]}) }}\n\n{%- endmaterialization %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.get_merge_sql": {"unique_id": "macro.dbt.get_merge_sql", "package_name": "dbt", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/common/merge.sql", "original_file_path": "macros/materializations/common/merge.sql", "name": "get_merge_sql", "macro_sql": "{% macro get_merge_sql(target, source, unique_key, dest_columns, predicates=none) -%}\n {{ adapter.dispatch('get_merge_sql')(target, source, unique_key, dest_columns, predicates) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.get_delete_insert_merge_sql": {"unique_id": "macro.dbt.get_delete_insert_merge_sql", "package_name": "dbt", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/common/merge.sql", "original_file_path": "macros/materializations/common/merge.sql", "name": "get_delete_insert_merge_sql", "macro_sql": "{% macro get_delete_insert_merge_sql(target, source, unique_key, dest_columns) -%}\n {{ adapter.dispatch('get_delete_insert_merge_sql')(target, source, unique_key, dest_columns) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.get_insert_overwrite_merge_sql": {"unique_id": "macro.dbt.get_insert_overwrite_merge_sql", "package_name": "dbt", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/common/merge.sql", "original_file_path": "macros/materializations/common/merge.sql", "name": "get_insert_overwrite_merge_sql", "macro_sql": "{% macro get_insert_overwrite_merge_sql(target, source, dest_columns, predicates, include_sql_header=false) -%}\n {{ adapter.dispatch('get_insert_overwrite_merge_sql')(target, source, dest_columns, predicates, include_sql_header) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.default__get_merge_sql": {"unique_id": "macro.dbt.default__get_merge_sql", "package_name": "dbt", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/common/merge.sql", "original_file_path": "macros/materializations/common/merge.sql", "name": "default__get_merge_sql", "macro_sql": "{% macro default__get_merge_sql(target, source, unique_key, dest_columns, predicates) -%}\n {%- set predicates = [] if predicates is none else [] + predicates -%}\n {%- set dest_cols_csv = get_quoted_csv(dest_columns | map(attribute=\"name\")) -%}\n {%- set sql_header = config.get('sql_header', none) -%}\n\n {% if unique_key %}\n {% set unique_key_match %}\n DBT_INTERNAL_SOURCE.{{ unique_key }} = DBT_INTERNAL_DEST.{{ unique_key }}\n {% endset %}\n {% do predicates.append(unique_key_match) %}\n {% else %}\n {% do predicates.append('FALSE') %}\n {% endif %}\n\n {{ sql_header if sql_header is not none }}\n\n merge into {{ target }} as DBT_INTERNAL_DEST\n using {{ source }} as DBT_INTERNAL_SOURCE\n on {{ predicates | join(' and ') }}\n\n {% if unique_key %}\n when matched then update set\n {% for column in dest_columns -%}\n {{ adapter.quote(column.name) }} = DBT_INTERNAL_SOURCE.{{ adapter.quote(column.name) }}\n {%- if not loop.last %}, {%- endif %}\n {%- endfor %}\n {% endif %}\n\n when not matched then insert\n ({{ dest_cols_csv }})\n values\n ({{ dest_cols_csv }})\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.get_quoted_csv": {"unique_id": "macro.dbt.get_quoted_csv", "package_name": "dbt", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/common/merge.sql", "original_file_path": "macros/materializations/common/merge.sql", "name": "get_quoted_csv", "macro_sql": "{% macro get_quoted_csv(column_names) %}\n {% set quoted = [] %}\n {% for col in column_names -%}\n {%- do quoted.append(adapter.quote(col)) -%}\n {%- endfor %}\n\n {%- set dest_cols_csv = quoted | join(', ') -%}\n {{ return(dest_cols_csv) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.common_get_delete_insert_merge_sql": {"unique_id": "macro.dbt.common_get_delete_insert_merge_sql", "package_name": "dbt", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/common/merge.sql", "original_file_path": "macros/materializations/common/merge.sql", "name": "common_get_delete_insert_merge_sql", "macro_sql": "{% macro common_get_delete_insert_merge_sql(target, source, unique_key, dest_columns) -%}\n\n {%- set dest_cols_csv = get_quoted_csv(dest_columns | map(attribute=\"name\")) -%}\n\n {% if unique_key is not none %}\n delete from {{ target }}\n where ({{ unique_key }}) in (\n select ({{ unique_key }})\n from {{ source }}\n );\n {% endif %}\n\n insert into {{ target }} ({{ dest_cols_csv }})\n (\n select {{ dest_cols_csv }}\n from {{ source }}\n );\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.default__get_delete_insert_merge_sql": {"unique_id": "macro.dbt.default__get_delete_insert_merge_sql", "package_name": "dbt", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/common/merge.sql", "original_file_path": "macros/materializations/common/merge.sql", "name": "default__get_delete_insert_merge_sql", "macro_sql": "{% macro default__get_delete_insert_merge_sql(target, source, unique_key, dest_columns) -%}\n {{ common_get_delete_insert_merge_sql(target, source, unique_key, dest_columns) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.default__get_insert_overwrite_merge_sql": {"unique_id": "macro.dbt.default__get_insert_overwrite_merge_sql", "package_name": "dbt", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/common/merge.sql", "original_file_path": "macros/materializations/common/merge.sql", "name": "default__get_insert_overwrite_merge_sql", "macro_sql": "{% macro default__get_insert_overwrite_merge_sql(target, source, dest_columns, predicates, include_sql_header) -%}\n {%- set predicates = [] if predicates is none else [] + predicates -%}\n {%- set dest_cols_csv = get_quoted_csv(dest_columns | map(attribute=\"name\")) -%}\n {%- set sql_header = config.get('sql_header', none) -%}\n\n {{ sql_header if sql_header is not none and include_sql_header }}\n\n merge into {{ target }} as DBT_INTERNAL_DEST\n using {{ source }} as DBT_INTERNAL_SOURCE\n on FALSE\n\n when not matched by source\n {% if predicates %} and {{ predicates | join(' and ') }} {% endif %}\n then delete\n\n when not matched then insert\n ({{ dest_cols_csv }})\n values\n ({{ dest_cols_csv }})\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.materialization_table_default": {"unique_id": "macro.dbt.materialization_table_default", "package_name": "dbt", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/table/table.sql", "original_file_path": "macros/materializations/table/table.sql", "name": "materialization_table_default", "macro_sql": "{% materialization table, default %}\n {%- set identifier = model['alias'] -%}\n {%- set tmp_identifier = model['name'] + '__dbt_tmp' -%}\n {%- set backup_identifier = model['name'] + '__dbt_backup' -%}\n\n {%- set old_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) -%}\n {%- set target_relation = api.Relation.create(identifier=identifier,\n schema=schema,\n database=database,\n type='table') -%}\n {%- set intermediate_relation = api.Relation.create(identifier=tmp_identifier,\n schema=schema,\n database=database,\n type='table') -%}\n\n /*\n See ../view/view.sql for more information about this relation.\n */\n {%- set backup_relation_type = 'table' if old_relation is none else old_relation.type -%}\n {%- set backup_relation = api.Relation.create(identifier=backup_identifier,\n schema=schema,\n database=database,\n type=backup_relation_type) -%}\n\n {%- set exists_as_table = (old_relation is not none and old_relation.is_table) -%}\n {%- set exists_as_view = (old_relation is not none and old_relation.is_view) -%}\n\n\n -- drop the temp relations if they exists for some reason\n {{ adapter.drop_relation(intermediate_relation) }}\n {{ adapter.drop_relation(backup_relation) }}\n\n {{ run_hooks(pre_hooks, inside_transaction=False) }}\n\n -- `BEGIN` happens here:\n {{ run_hooks(pre_hooks, inside_transaction=True) }}\n\n -- build model\n {% call statement('main') -%}\n {{ create_table_as(False, intermediate_relation, sql) }}\n {%- endcall %}\n\n -- cleanup\n {% if old_relation is not none %}\n {{ adapter.rename_relation(target_relation, backup_relation) }}\n {% endif %}\n\n {{ adapter.rename_relation(intermediate_relation, target_relation) }}\n\n {{ run_hooks(post_hooks, inside_transaction=True) }}\n\n {% do persist_docs(target_relation, model) %}\n\n -- `COMMIT` happens here\n {{ adapter.commit() }}\n\n -- finally, drop the existing/backup relation after the commit\n {{ drop_relation_if_exists(backup_relation) }}\n\n {{ run_hooks(post_hooks, inside_transaction=False) }}\n\n {{ return({'relations': [target_relation]}) }}\n{% endmaterialization %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.materialization_view_default": {"unique_id": "macro.dbt.materialization_view_default", "package_name": "dbt", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/view/view.sql", "original_file_path": "macros/materializations/view/view.sql", "name": "materialization_view_default", "macro_sql": "{%- materialization view, default -%}\n\n {%- set identifier = model['alias'] -%}\n {%- set tmp_identifier = model['name'] + '__dbt_tmp' -%}\n {%- set backup_identifier = model['name'] + '__dbt_backup' -%}\n\n {%- set old_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) -%}\n {%- set target_relation = api.Relation.create(identifier=identifier, schema=schema, database=database,\n type='view') -%}\n {%- set intermediate_relation = api.Relation.create(identifier=tmp_identifier,\n schema=schema, database=database, type='view') -%}\n\n /*\n This relation (probably) doesn't exist yet. If it does exist, it's a leftover from\n a previous run, and we're going to try to drop it immediately. At the end of this\n materialization, we're going to rename the \"old_relation\" to this identifier,\n and then we're going to drop it. In order to make sure we run the correct one of:\n - drop view ...\n - drop table ...\n\n We need to set the type of this relation to be the type of the old_relation, if it exists,\n or else \"view\" as a sane default if it does not. Note that if the old_relation does not\n exist, then there is nothing to move out of the way and subsequentally drop. In that case,\n this relation will be effectively unused.\n */\n {%- set backup_relation_type = 'view' if old_relation is none else old_relation.type -%}\n {%- set backup_relation = api.Relation.create(identifier=backup_identifier,\n schema=schema, database=database,\n type=backup_relation_type) -%}\n\n {%- set exists_as_view = (old_relation is not none and old_relation.is_view) -%}\n\n {{ run_hooks(pre_hooks, inside_transaction=False) }}\n\n -- drop the temp relations if they exists for some reason\n {{ adapter.drop_relation(intermediate_relation) }}\n {{ adapter.drop_relation(backup_relation) }}\n\n -- `BEGIN` happens here:\n {{ run_hooks(pre_hooks, inside_transaction=True) }}\n\n -- build model\n {% call statement('main') -%}\n {{ create_view_as(intermediate_relation, sql) }}\n {%- endcall %}\n\n -- cleanup\n -- move the existing view out of the way\n {% if old_relation is not none %}\n {{ adapter.rename_relation(target_relation, backup_relation) }}\n {% endif %}\n {{ adapter.rename_relation(intermediate_relation, target_relation) }}\n\n {% do persist_docs(target_relation, model) %}\n\n {{ run_hooks(post_hooks, inside_transaction=True) }}\n\n {{ adapter.commit() }}\n\n {{ drop_relation_if_exists(backup_relation) }}\n\n {{ run_hooks(post_hooks, inside_transaction=False) }}\n\n {{ return({'relations': [target_relation]}) }}\n\n{%- endmaterialization -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.handle_existing_table": {"unique_id": "macro.dbt.handle_existing_table", "package_name": "dbt", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/view/create_or_replace_view.sql", "original_file_path": "macros/materializations/view/create_or_replace_view.sql", "name": "handle_existing_table", "macro_sql": "{% macro handle_existing_table(full_refresh, old_relation) %}\n {{ adapter.dispatch(\"handle_existing_table\", packages=['dbt'])(full_refresh, old_relation) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.default__handle_existing_table": {"unique_id": "macro.dbt.default__handle_existing_table", "package_name": "dbt", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/view/create_or_replace_view.sql", "original_file_path": "macros/materializations/view/create_or_replace_view.sql", "name": "default__handle_existing_table", "macro_sql": "{% macro default__handle_existing_table(full_refresh, old_relation) %}\n {{ adapter.drop_relation(old_relation) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.create_or_replace_view": {"unique_id": "macro.dbt.create_or_replace_view", "package_name": "dbt", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/view/create_or_replace_view.sql", "original_file_path": "macros/materializations/view/create_or_replace_view.sql", "name": "create_or_replace_view", "macro_sql": "{% macro create_or_replace_view(run_outside_transaction_hooks=True) %}\n {%- set identifier = model['alias'] -%}\n\n {%- set old_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) -%}\n\n {%- set exists_as_view = (old_relation is not none and old_relation.is_view) -%}\n\n {%- set target_relation = api.Relation.create(\n identifier=identifier, schema=schema, database=database,\n type='view') -%}\n\n {% if run_outside_transaction_hooks %}\n -- no transactions on BigQuery\n {{ run_hooks(pre_hooks, inside_transaction=False) }}\n {% endif %}\n\n -- `BEGIN` happens here on Snowflake\n {{ run_hooks(pre_hooks, inside_transaction=True) }}\n\n -- If there's a table with the same name and we weren't told to full refresh,\n -- that's an error. If we were told to full refresh, drop it. This behavior differs\n -- for Snowflake and BigQuery, so multiple dispatch is used.\n {%- if old_relation is not none and old_relation.is_table -%}\n {{ handle_existing_table(should_full_refresh(), old_relation) }}\n {%- endif -%}\n\n -- build model\n {% call statement('main') -%}\n {{ create_view_as(target_relation, sql) }}\n {%- endcall %}\n\n {{ run_hooks(post_hooks, inside_transaction=True) }}\n\n {{ adapter.commit() }}\n\n {% if run_outside_transaction_hooks %}\n -- No transactions on BigQuery\n {{ run_hooks(post_hooks, inside_transaction=False) }}\n {% endif %}\n\n {{ return({'relations': [target_relation]}) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.generate_alias_name": {"unique_id": "macro.dbt.generate_alias_name", "package_name": "dbt", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/etc/get_custom_alias.sql", "original_file_path": "macros/etc/get_custom_alias.sql", "name": "generate_alias_name", "macro_sql": "{% macro generate_alias_name(custom_alias_name=none, node=none) -%}\n\n {%- if custom_alias_name is none -%}\n\n {{ node.name }}\n\n {%- else -%}\n\n {{ custom_alias_name | trim }}\n\n {%- endif -%}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.run_query": {"unique_id": "macro.dbt.run_query", "package_name": "dbt", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/etc/query.sql", "original_file_path": "macros/etc/query.sql", "name": "run_query", "macro_sql": "{% macro run_query(sql) %}\n {% call statement(\"run_query_statement\", fetch_result=true, auto_begin=false) %}\n {{ sql }}\n {% endcall %}\n\n {% do return(load_result(\"run_query_statement\").table) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.is_incremental": {"unique_id": "macro.dbt.is_incremental", "package_name": "dbt", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/etc/is_incremental.sql", "original_file_path": "macros/etc/is_incremental.sql", "name": "is_incremental", "macro_sql": "{% macro is_incremental() %}\n {#-- do not run introspective queries in parsing #}\n {% if not execute %}\n {{ return(False) }}\n {% else %}\n {% set relation = adapter.get_relation(this.database, this.schema, this.table) %}\n {{ return(relation is not none\n and relation.type == 'table'\n and model.config.materialized == 'incremental'\n and not should_full_refresh()) }}\n {% endif %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.convert_datetime": {"unique_id": "macro.dbt.convert_datetime", "package_name": "dbt", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/etc/datetime.sql", "original_file_path": "macros/etc/datetime.sql", "name": "convert_datetime", "macro_sql": "{% macro convert_datetime(date_str, date_fmt) %}\n\n {% set error_msg -%}\n The provided partition date '{{ date_str }}' does not match the expected format '{{ date_fmt }}'\n {%- endset %}\n\n {% set res = try_or_compiler_error(error_msg, modules.datetime.datetime.strptime, date_str.strip(), date_fmt) %}\n {{ return(res) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.dates_in_range": {"unique_id": "macro.dbt.dates_in_range", "package_name": "dbt", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/etc/datetime.sql", "original_file_path": "macros/etc/datetime.sql", "name": "dates_in_range", "macro_sql": "{% macro dates_in_range(start_date_str, end_date_str=none, in_fmt=\"%Y%m%d\", out_fmt=\"%Y%m%d\") %}\n {% set end_date_str = start_date_str if end_date_str is none else end_date_str %}\n\n {% set start_date = convert_datetime(start_date_str, in_fmt) %}\n {% set end_date = convert_datetime(end_date_str, in_fmt) %}\n\n {% set day_count = (end_date - start_date).days %}\n {% if day_count < 0 %}\n {% set msg -%}\n Partiton start date is after the end date ({{ start_date }}, {{ end_date }})\n {%- endset %}\n\n {{ exceptions.raise_compiler_error(msg, model) }}\n {% endif %}\n\n {% set date_list = [] %}\n {% for i in range(0, day_count + 1) %}\n {% set the_date = (modules.datetime.timedelta(days=i) + start_date) %}\n {% if not out_fmt %}\n {% set _ = date_list.append(the_date) %}\n {% else %}\n {% set _ = date_list.append(the_date.strftime(out_fmt)) %}\n {% endif %}\n {% endfor %}\n\n {{ return(date_list) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.partition_range": {"unique_id": "macro.dbt.partition_range", "package_name": "dbt", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/etc/datetime.sql", "original_file_path": "macros/etc/datetime.sql", "name": "partition_range", "macro_sql": "{% macro partition_range(raw_partition_date, date_fmt='%Y%m%d') %}\n {% set partition_range = (raw_partition_date | string).split(\",\") %}\n\n {% if (partition_range | length) == 1 %}\n {% set start_date = partition_range[0] %}\n {% set end_date = none %}\n {% elif (partition_range | length) == 2 %}\n {% set start_date = partition_range[0] %}\n {% set end_date = partition_range[1] %}\n {% else %}\n {{ exceptions.raise_compiler_error(\"Invalid partition time. Expected format: {Start Date}[,{End Date}]. Got: \" ~ raw_partition_date) }}\n {% endif %}\n\n {{ return(dates_in_range(start_date, end_date, in_fmt=date_fmt)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.py_current_timestring": {"unique_id": "macro.dbt.py_current_timestring", "package_name": "dbt", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/etc/datetime.sql", "original_file_path": "macros/etc/datetime.sql", "name": "py_current_timestring", "macro_sql": "{% macro py_current_timestring() %}\n {% set dt = modules.datetime.datetime.now() %}\n {% do return(dt.strftime(\"%Y%m%d%H%M%S%f\")) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.generate_schema_name": {"unique_id": "macro.dbt.generate_schema_name", "package_name": "dbt", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/etc/get_custom_schema.sql", "original_file_path": "macros/etc/get_custom_schema.sql", "name": "generate_schema_name", "macro_sql": "{% macro generate_schema_name(custom_schema_name, node) -%}\n\n {%- set default_schema = target.schema -%}\n {%- if custom_schema_name is none -%}\n\n {{ default_schema }}\n\n {%- else -%}\n\n {{ default_schema }}_{{ custom_schema_name | trim }}\n\n {%- endif -%}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.generate_schema_name_for_env": {"unique_id": "macro.dbt.generate_schema_name_for_env", "package_name": "dbt", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/etc/get_custom_schema.sql", "original_file_path": "macros/etc/get_custom_schema.sql", "name": "generate_schema_name_for_env", "macro_sql": "{% macro generate_schema_name_for_env(custom_schema_name, node) -%}\n\n {%- set default_schema = target.schema -%}\n {%- if target.name == 'prod' and custom_schema_name is not none -%}\n\n {{ custom_schema_name | trim }}\n\n {%- else -%}\n\n {{ default_schema }}\n\n {%- endif -%}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.generate_database_name": {"unique_id": "macro.dbt.generate_database_name", "package_name": "dbt", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/etc/get_custom_database.sql", "original_file_path": "macros/etc/get_custom_database.sql", "name": "generate_database_name", "macro_sql": "{% macro generate_database_name(custom_database_name=none, node=none) -%}\n {% do return(adapter.dispatch('generate_database_name')(custom_database_name, node)) %}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__generate_database_name"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.default__generate_database_name": {"unique_id": "macro.dbt.default__generate_database_name", "package_name": "dbt", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/etc/get_custom_database.sql", "original_file_path": "macros/etc/get_custom_database.sql", "name": "default__generate_database_name", "macro_sql": "{% macro default__generate_database_name(custom_database_name=none, node=none) -%}\n {%- set default_database = target.database -%}\n {%- if custom_database_name is none -%}\n\n {{ default_database }}\n\n {%- else -%}\n\n {{ custom_database_name }}\n\n {%- endif -%}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.get_columns_in_query": {"unique_id": "macro.dbt.get_columns_in_query", "package_name": "dbt", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "get_columns_in_query", "macro_sql": "{% macro get_columns_in_query(select_sql) -%}\n {{ return(adapter.dispatch('get_columns_in_query')(select_sql)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.default__get_columns_in_query": {"unique_id": "macro.dbt.default__get_columns_in_query", "package_name": "dbt", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "default__get_columns_in_query", "macro_sql": "{% macro default__get_columns_in_query(select_sql) %}\n {% call statement('get_columns_in_query', fetch_result=True, auto_begin=False) -%}\n select * from (\n {{ select_sql }}\n ) as __dbt_sbq\n where false\n limit 0\n {% endcall %}\n\n {{ return(load_result('get_columns_in_query').table.columns | map(attribute='name') | list) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.create_schema": {"unique_id": "macro.dbt.create_schema", "package_name": "dbt", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "create_schema", "macro_sql": "{% macro create_schema(relation) -%}\n {{ adapter.dispatch('create_schema')(relation) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.default__create_schema": {"unique_id": "macro.dbt.default__create_schema", "package_name": "dbt", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "default__create_schema", "macro_sql": "{% macro default__create_schema(relation) -%}\n {%- call statement('create_schema') -%}\n create schema if not exists {{ relation.without_identifier() }}\n {% endcall %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.drop_schema": {"unique_id": "macro.dbt.drop_schema", "package_name": "dbt", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "drop_schema", "macro_sql": "{% macro drop_schema(relation) -%}\n {{ adapter.dispatch('drop_schema')(relation) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.default__drop_schema": {"unique_id": "macro.dbt.default__drop_schema", "package_name": "dbt", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "default__drop_schema", "macro_sql": "{% macro default__drop_schema(relation) -%}\n {%- call statement('drop_schema') -%}\n drop schema if exists {{ relation.without_identifier() }} cascade\n {% endcall %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.create_table_as": {"unique_id": "macro.dbt.create_table_as", "package_name": "dbt", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "create_table_as", "macro_sql": "{% macro create_table_as(temporary, relation, sql) -%}\n {{ adapter.dispatch('create_table_as')(temporary, relation, sql) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.default__create_table_as": {"unique_id": "macro.dbt.default__create_table_as", "package_name": "dbt", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "default__create_table_as", "macro_sql": "{% macro default__create_table_as(temporary, relation, sql) -%}\n {%- set sql_header = config.get('sql_header', none) -%}\n\n {{ sql_header if sql_header is not none }}\n\n create {% if temporary: -%}temporary{%- endif %} table\n {{ relation.include(database=(not temporary), schema=(not temporary)) }}\n as (\n {{ sql }}\n );\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.create_view_as": {"unique_id": "macro.dbt.create_view_as", "package_name": "dbt", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "create_view_as", "macro_sql": "{% macro create_view_as(relation, sql) -%}\n {{ adapter.dispatch('create_view_as')(relation, sql) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.default__create_view_as": {"unique_id": "macro.dbt.default__create_view_as", "package_name": "dbt", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "default__create_view_as", "macro_sql": "{% macro default__create_view_as(relation, sql) -%}\n {%- set sql_header = config.get('sql_header', none) -%}\n\n {{ sql_header if sql_header is not none }}\n create view {{ relation }} as (\n {{ sql }}\n );\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.get_catalog": {"unique_id": "macro.dbt.get_catalog", "package_name": "dbt", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "get_catalog", "macro_sql": "{% macro get_catalog(information_schema, schemas) -%}\n {{ return(adapter.dispatch('get_catalog')(information_schema, schemas)) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__get_catalog"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.default__get_catalog": {"unique_id": "macro.dbt.default__get_catalog", "package_name": "dbt", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "default__get_catalog", "macro_sql": "{% macro default__get_catalog(information_schema, schemas) -%}\n\n {% set typename = adapter.type() %}\n {% set msg -%}\n get_catalog not implemented for {{ typename }}\n {%- endset %}\n\n {{ exceptions.raise_compiler_error(msg) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.get_columns_in_relation": {"unique_id": "macro.dbt.get_columns_in_relation", "package_name": "dbt", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "get_columns_in_relation", "macro_sql": "{% macro get_columns_in_relation(relation) -%}\n {{ return(adapter.dispatch('get_columns_in_relation')(relation)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.sql_convert_columns_in_relation": {"unique_id": "macro.dbt.sql_convert_columns_in_relation", "package_name": "dbt", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "sql_convert_columns_in_relation", "macro_sql": "{% macro sql_convert_columns_in_relation(table) -%}\n {% set columns = [] %}\n {% for row in table %}\n {% do columns.append(api.Column(*row)) %}\n {% endfor %}\n {{ return(columns) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.default__get_columns_in_relation": {"unique_id": "macro.dbt.default__get_columns_in_relation", "package_name": "dbt", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "default__get_columns_in_relation", "macro_sql": "{% macro default__get_columns_in_relation(relation) -%}\n {{ exceptions.raise_not_implemented(\n 'get_columns_in_relation macro not implemented for adapter '+adapter.type()) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.alter_column_type": {"unique_id": "macro.dbt.alter_column_type", "package_name": "dbt", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "alter_column_type", "macro_sql": "{% macro alter_column_type(relation, column_name, new_column_type) -%}\n {{ return(adapter.dispatch('alter_column_type')(relation, column_name, new_column_type)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.alter_column_comment": {"unique_id": "macro.dbt.alter_column_comment", "package_name": "dbt", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "alter_column_comment", "macro_sql": "{% macro alter_column_comment(relation, column_dict) -%}\n {{ return(adapter.dispatch('alter_column_comment')(relation, column_dict)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.default__alter_column_comment": {"unique_id": "macro.dbt.default__alter_column_comment", "package_name": "dbt", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "default__alter_column_comment", "macro_sql": "{% macro default__alter_column_comment(relation, column_dict) -%}\n {{ exceptions.raise_not_implemented(\n 'alter_column_comment macro not implemented for adapter '+adapter.type()) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.alter_relation_comment": {"unique_id": "macro.dbt.alter_relation_comment", "package_name": "dbt", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "alter_relation_comment", "macro_sql": "{% macro alter_relation_comment(relation, relation_comment) -%}\n {{ return(adapter.dispatch('alter_relation_comment')(relation, relation_comment)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.default__alter_relation_comment": {"unique_id": "macro.dbt.default__alter_relation_comment", "package_name": "dbt", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "default__alter_relation_comment", "macro_sql": "{% macro default__alter_relation_comment(relation, relation_comment) -%}\n {{ exceptions.raise_not_implemented(\n 'alter_relation_comment macro not implemented for adapter '+adapter.type()) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.persist_docs": {"unique_id": "macro.dbt.persist_docs", "package_name": "dbt", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "persist_docs", "macro_sql": "{% macro persist_docs(relation, model, for_relation=true, for_columns=true) -%}\n {{ return(adapter.dispatch('persist_docs')(relation, model, for_relation, for_columns)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.default__persist_docs": {"unique_id": "macro.dbt.default__persist_docs", "package_name": "dbt", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "default__persist_docs", "macro_sql": "{% macro default__persist_docs(relation, model, for_relation, for_columns) -%}\n {% if for_relation and config.persist_relation_docs() and model.description %}\n {% do run_query(alter_relation_comment(relation, model.description)) %}\n {% endif %}\n\n {% if for_columns and config.persist_column_docs() and model.columns %}\n {% do run_query(alter_column_comment(relation, model.columns)) %}\n {% endif %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.default__alter_column_type": {"unique_id": "macro.dbt.default__alter_column_type", "package_name": "dbt", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "default__alter_column_type", "macro_sql": "{% macro default__alter_column_type(relation, column_name, new_column_type) -%}\n {#\n 1. Create a new column (w/ temp name and correct type)\n 2. Copy data over to it\n 3. Drop the existing column (cascade!)\n 4. Rename the new column to existing column\n #}\n {%- set tmp_column = column_name + \"__dbt_alter\" -%}\n\n {% call statement('alter_column_type') %}\n alter table {{ relation }} add column {{ adapter.quote(tmp_column) }} {{ new_column_type }};\n update {{ relation }} set {{ adapter.quote(tmp_column) }} = {{ adapter.quote(column_name) }};\n alter table {{ relation }} drop column {{ adapter.quote(column_name) }} cascade;\n alter table {{ relation }} rename column {{ adapter.quote(tmp_column) }} to {{ adapter.quote(column_name) }}\n {% endcall %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.drop_relation": {"unique_id": "macro.dbt.drop_relation", "package_name": "dbt", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "drop_relation", "macro_sql": "{% macro drop_relation(relation) -%}\n {{ return(adapter.dispatch('drop_relation')(relation)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.default__drop_relation": {"unique_id": "macro.dbt.default__drop_relation", "package_name": "dbt", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "default__drop_relation", "macro_sql": "{% macro default__drop_relation(relation) -%}\n {% call statement('drop_relation', auto_begin=False) -%}\n drop {{ relation.type }} if exists {{ relation }} cascade\n {%- endcall %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.truncate_relation": {"unique_id": "macro.dbt.truncate_relation", "package_name": "dbt", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "truncate_relation", "macro_sql": "{% macro truncate_relation(relation) -%}\n {{ return(adapter.dispatch('truncate_relation')(relation)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.default__truncate_relation": {"unique_id": "macro.dbt.default__truncate_relation", "package_name": "dbt", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "default__truncate_relation", "macro_sql": "{% macro default__truncate_relation(relation) -%}\n {% call statement('truncate_relation') -%}\n truncate table {{ relation }}\n {%- endcall %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.rename_relation": {"unique_id": "macro.dbt.rename_relation", "package_name": "dbt", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "rename_relation", "macro_sql": "{% macro rename_relation(from_relation, to_relation) -%}\n {{ return(adapter.dispatch('rename_relation')(from_relation, to_relation)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.default__rename_relation": {"unique_id": "macro.dbt.default__rename_relation", "package_name": "dbt", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "default__rename_relation", "macro_sql": "{% macro default__rename_relation(from_relation, to_relation) -%}\n {% set target_name = adapter.quote_as_configured(to_relation.identifier, 'identifier') %}\n {% call statement('rename_relation') -%}\n alter table {{ from_relation }} rename to {{ target_name }}\n {%- endcall %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.information_schema_name": {"unique_id": "macro.dbt.information_schema_name", "package_name": "dbt", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "information_schema_name", "macro_sql": "{% macro information_schema_name(database) %}\n {{ return(adapter.dispatch('information_schema_name')(database)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.default__information_schema_name": {"unique_id": "macro.dbt.default__information_schema_name", "package_name": "dbt", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "default__information_schema_name", "macro_sql": "{% macro default__information_schema_name(database) -%}\n {%- if database -%}\n {{ database }}.INFORMATION_SCHEMA\n {%- else -%}\n INFORMATION_SCHEMA\n {%- endif -%}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.list_schemas": {"unique_id": "macro.dbt.list_schemas", "package_name": "dbt", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "list_schemas", "macro_sql": "{% macro list_schemas(database) -%}\n {{ return(adapter.dispatch('list_schemas')(database)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.default__list_schemas": {"unique_id": "macro.dbt.default__list_schemas", "package_name": "dbt", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "default__list_schemas", "macro_sql": "{% macro default__list_schemas(database) -%}\n {% set sql %}\n select distinct schema_name\n from {{ information_schema_name(database) }}.SCHEMATA\n where catalog_name ilike '{{ database }}'\n {% endset %}\n {{ return(run_query(sql)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.check_schema_exists": {"unique_id": "macro.dbt.check_schema_exists", "package_name": "dbt", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "check_schema_exists", "macro_sql": "{% macro check_schema_exists(information_schema, schema) -%}\n {{ return(adapter.dispatch('check_schema_exists')(information_schema, schema)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.default__check_schema_exists": {"unique_id": "macro.dbt.default__check_schema_exists", "package_name": "dbt", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "default__check_schema_exists", "macro_sql": "{% macro default__check_schema_exists(information_schema, schema) -%}\n {% set sql -%}\n select count(*)\n from {{ information_schema.replace(information_schema_view='SCHEMATA') }}\n where catalog_name='{{ information_schema.database }}'\n and schema_name='{{ schema }}'\n {%- endset %}\n {{ return(run_query(sql)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.list_relations_without_caching": {"unique_id": "macro.dbt.list_relations_without_caching", "package_name": "dbt", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "list_relations_without_caching", "macro_sql": "{% macro list_relations_without_caching(schema_relation) %}\n {{ return(adapter.dispatch('list_relations_without_caching')(schema_relation)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__list_relations_without_caching"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.default__list_relations_without_caching": {"unique_id": "macro.dbt.default__list_relations_without_caching", "package_name": "dbt", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "default__list_relations_without_caching", "macro_sql": "{% macro default__list_relations_without_caching(schema_relation) %}\n {{ exceptions.raise_not_implemented(\n 'list_relations_without_caching macro not implemented for adapter '+adapter.type()) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.current_timestamp": {"unique_id": "macro.dbt.current_timestamp", "package_name": "dbt", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "current_timestamp", "macro_sql": "{% macro current_timestamp() -%}\n {{ adapter.dispatch('current_timestamp')() }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.default__current_timestamp": {"unique_id": "macro.dbt.default__current_timestamp", "package_name": "dbt", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "default__current_timestamp", "macro_sql": "{% macro default__current_timestamp() -%}\n {{ exceptions.raise_not_implemented(\n 'current_timestamp macro not implemented for adapter '+adapter.type()) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.collect_freshness": {"unique_id": "macro.dbt.collect_freshness", "package_name": "dbt", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "collect_freshness", "macro_sql": "{% macro collect_freshness(source, loaded_at_field, filter) %}\n {{ return(adapter.dispatch('collect_freshness')(source, loaded_at_field, filter))}}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.default__collect_freshness": {"unique_id": "macro.dbt.default__collect_freshness", "package_name": "dbt", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "default__collect_freshness", "macro_sql": "{% macro default__collect_freshness(source, loaded_at_field, filter) %}\n {% call statement('collect_freshness', fetch_result=True, auto_begin=False) -%}\n select\n max({{ loaded_at_field }}) as max_loaded_at,\n {{ current_timestamp() }} as snapshotted_at\n from {{ source }}\n {% if filter %}\n where {{ filter }}\n {% endif %}\n {% endcall %}\n {{ return(load_result('collect_freshness').table) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.make_temp_relation": {"unique_id": "macro.dbt.make_temp_relation", "package_name": "dbt", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "make_temp_relation", "macro_sql": "{% macro make_temp_relation(base_relation, suffix='__dbt_tmp') %}\n {{ return(adapter.dispatch('make_temp_relation')(base_relation, suffix))}}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.default__make_temp_relation": {"unique_id": "macro.dbt.default__make_temp_relation", "package_name": "dbt", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "default__make_temp_relation", "macro_sql": "{% macro default__make_temp_relation(base_relation, suffix) %}\n {% set tmp_identifier = base_relation.identifier ~ suffix %}\n {% set tmp_relation = base_relation.incorporate(\n path={\"identifier\": tmp_identifier}) -%}\n\n {% do return(tmp_relation) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.set_sql_header": {"unique_id": "macro.dbt.set_sql_header", "package_name": "dbt", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "set_sql_header", "macro_sql": "{% macro set_sql_header(config) -%}\n {{ config.set('sql_header', caller()) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.default__test_relationships": {"unique_id": "macro.dbt.default__test_relationships", "package_name": "dbt", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/schema_tests/relationships.sql", "original_file_path": "macros/schema_tests/relationships.sql", "name": "default__test_relationships", "macro_sql": "{% macro default__test_relationships(model, to, field) %}\n\n{% set column_name = kwargs.get('column_name', kwargs.get('from')) %}\n\n\nselect count(*) as validation_errors\nfrom (\n select {{ column_name }} as id from {{ model }}\n) as child\nleft join (\n select {{ field }} as id from {{ to }}\n) as parent on parent.id = child.id\nwhere child.id is not null\n and parent.id is null\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.test_relationships": {"unique_id": "macro.dbt.test_relationships", "package_name": "dbt", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/schema_tests/relationships.sql", "original_file_path": "macros/schema_tests/relationships.sql", "name": "test_relationships", "macro_sql": "{% macro test_relationships(model, to, field) %}\n {% set macro = adapter.dispatch('test_relationships') %}\n {{ macro(model, to, field, **kwargs) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.default__test_not_null": {"unique_id": "macro.dbt.default__test_not_null", "package_name": "dbt", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/schema_tests/not_null.sql", "original_file_path": "macros/schema_tests/not_null.sql", "name": "default__test_not_null", "macro_sql": "{% macro default__test_not_null(model) %}\n\n{% set column_name = kwargs.get('column_name', kwargs.get('arg')) %}\n\nselect count(*) as validation_errors\nfrom {{ model }}\nwhere {{ column_name }} is null\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.test_not_null": {"unique_id": "macro.dbt.test_not_null", "package_name": "dbt", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/schema_tests/not_null.sql", "original_file_path": "macros/schema_tests/not_null.sql", "name": "test_not_null", "macro_sql": "{% macro test_not_null(model) %}\n {% set macro = adapter.dispatch('test_not_null') %}\n {{ macro(model, **kwargs) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.default__test_unique": {"unique_id": "macro.dbt.default__test_unique", "package_name": "dbt", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/schema_tests/unique.sql", "original_file_path": "macros/schema_tests/unique.sql", "name": "default__test_unique", "macro_sql": "{% macro default__test_unique(model) %}\n\n{% set column_name = kwargs.get('column_name', kwargs.get('arg')) %}\n\nselect count(*) as validation_errors\nfrom (\n\n select\n {{ column_name }}\n\n from {{ model }}\n where {{ column_name }} is not null\n group by {{ column_name }}\n having count(*) > 1\n\n) validation_errors\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.test_unique": {"unique_id": "macro.dbt.test_unique", "package_name": "dbt", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/schema_tests/unique.sql", "original_file_path": "macros/schema_tests/unique.sql", "name": "test_unique", "macro_sql": "{% macro test_unique(model) %}\n {% set macro = adapter.dispatch('test_unique') %}\n {{ macro(model, **kwargs) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.default__test_accepted_values": {"unique_id": "macro.dbt.default__test_accepted_values", "package_name": "dbt", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/schema_tests/accepted_values.sql", "original_file_path": "macros/schema_tests/accepted_values.sql", "name": "default__test_accepted_values", "macro_sql": "{% macro default__test_accepted_values(model, values) %}\n\n{% set column_name = kwargs.get('column_name', kwargs.get('field')) %}\n{% set quote_values = kwargs.get('quote', True) %}\n\nwith all_values as (\n\n select distinct\n {{ column_name }} as value_field\n\n from {{ model }}\n\n),\n\nvalidation_errors as (\n\n select\n value_field\n\n from all_values\n where value_field not in (\n {% for value in values -%}\n {% if quote_values -%}\n '{{ value }}'\n {%- else -%}\n {{ value }}\n {%- endif -%}\n {%- if not loop.last -%},{%- endif %}\n {%- endfor %}\n )\n)\n\nselect count(*) as validation_errors\nfrom validation_errors\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.test_accepted_values": {"unique_id": "macro.dbt.test_accepted_values", "package_name": "dbt", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/schema_tests/accepted_values.sql", "original_file_path": "macros/schema_tests/accepted_values.sql", "name": "test_accepted_values", "macro_sql": "{% macro test_accepted_values(model, values) %}\n {% set macro = adapter.dispatch('test_accepted_values') %}\n {{ macro(model, values, **kwargs) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.except": {"unique_id": "macro.dbt_utils.except", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/except.sql", "original_file_path": "macros/cross_db_utils/except.sql", "name": "except", "macro_sql": "{% macro except() %}\n {{ return(adapter.dispatch('except', packages = dbt_utils._get_utils_namespaces())()) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__except": {"unique_id": "macro.dbt_utils.default__except", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/except.sql", "original_file_path": "macros/cross_db_utils/except.sql", "name": "default__except", "macro_sql": "{% macro default__except() %}\n\n except\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.bigquery__except": {"unique_id": "macro.dbt_utils.bigquery__except", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/except.sql", "original_file_path": "macros/cross_db_utils/except.sql", "name": "bigquery__except", "macro_sql": "{% macro bigquery__except() %}\n\n except distinct\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.replace": {"unique_id": "macro.dbt_utils.replace", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/replace.sql", "original_file_path": "macros/cross_db_utils/replace.sql", "name": "replace", "macro_sql": "{% macro replace(field, old_chars, new_chars) -%}\n {{ return(adapter.dispatch('replace', packages = dbt_utils._get_utils_namespaces()) (field, old_chars, new_chars)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__replace": {"unique_id": "macro.dbt_utils.default__replace", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/replace.sql", "original_file_path": "macros/cross_db_utils/replace.sql", "name": "default__replace", "macro_sql": "{% macro default__replace(field, old_chars, new_chars) %}\n\n replace(\n {{ field }},\n {{ old_chars }},\n {{ new_chars }}\n )\n \n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.concat": {"unique_id": "macro.dbt_utils.concat", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/concat.sql", "original_file_path": "macros/cross_db_utils/concat.sql", "name": "concat", "macro_sql": "{% macro concat(fields) -%}\n {{ return(adapter.dispatch('concat', packages = dbt_utils._get_utils_namespaces())(fields)) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__concat": {"unique_id": "macro.dbt_utils.default__concat", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/concat.sql", "original_file_path": "macros/cross_db_utils/concat.sql", "name": "default__concat", "macro_sql": "{% macro default__concat(fields) -%}\n concat({{ fields|join(', ') }})\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.alternative_concat": {"unique_id": "macro.dbt_utils.alternative_concat", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/concat.sql", "original_file_path": "macros/cross_db_utils/concat.sql", "name": "alternative_concat", "macro_sql": "{% macro alternative_concat(fields) %}\n {{ fields|join(' || ') }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.redshift__concat": {"unique_id": "macro.dbt_utils.redshift__concat", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/concat.sql", "original_file_path": "macros/cross_db_utils/concat.sql", "name": "redshift__concat", "macro_sql": "{% macro redshift__concat(fields) %}\n {{ dbt_utils.alternative_concat(fields) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.snowflake__concat": {"unique_id": "macro.dbt_utils.snowflake__concat", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/concat.sql", "original_file_path": "macros/cross_db_utils/concat.sql", "name": "snowflake__concat", "macro_sql": "{% macro snowflake__concat(fields) %}\n {{ dbt_utils.alternative_concat(fields) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.type_string": {"unique_id": "macro.dbt_utils.type_string", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "type_string", "macro_sql": "\n\n{%- macro type_string() -%}\n {{ return(adapter.dispatch('type_string', packages = dbt_utils._get_utils_namespaces())()) }}\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__type_string": {"unique_id": "macro.dbt_utils.default__type_string", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "default__type_string", "macro_sql": "{% macro default__type_string() %}\n string\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.redshift__type_string": {"unique_id": "macro.dbt_utils.redshift__type_string", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "redshift__type_string", "macro_sql": "\n\n{%- macro redshift__type_string() -%}\n varchar\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.postgres__type_string": {"unique_id": "macro.dbt_utils.postgres__type_string", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "postgres__type_string", "macro_sql": "{% macro postgres__type_string() %}\n varchar\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.snowflake__type_string": {"unique_id": "macro.dbt_utils.snowflake__type_string", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "snowflake__type_string", "macro_sql": "{% macro snowflake__type_string() %}\n varchar\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.type_timestamp": {"unique_id": "macro.dbt_utils.type_timestamp", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "type_timestamp", "macro_sql": "\n\n{%- macro type_timestamp() -%}\n {{ return(adapter.dispatch('type_timestamp', packages = dbt_utils._get_utils_namespaces())()) }}\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__type_timestamp": {"unique_id": "macro.dbt_utils.default__type_timestamp", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "default__type_timestamp", "macro_sql": "{% macro default__type_timestamp() %}\n timestamp\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.snowflake__type_timestamp": {"unique_id": "macro.dbt_utils.snowflake__type_timestamp", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "snowflake__type_timestamp", "macro_sql": "{% macro snowflake__type_timestamp() %}\n timestamp_ntz\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.type_float": {"unique_id": "macro.dbt_utils.type_float", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "type_float", "macro_sql": "\n\n{%- macro type_float() -%}\n {{ return(adapter.dispatch('type_float', packages = dbt_utils._get_utils_namespaces())()) }}\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__type_float": {"unique_id": "macro.dbt_utils.default__type_float", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "default__type_float", "macro_sql": "{% macro default__type_float() %}\n float\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.bigquery__type_float": {"unique_id": "macro.dbt_utils.bigquery__type_float", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "bigquery__type_float", "macro_sql": "{% macro bigquery__type_float() %}\n float64\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.type_numeric": {"unique_id": "macro.dbt_utils.type_numeric", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "type_numeric", "macro_sql": "\n\n{%- macro type_numeric() -%}\n {{ return(adapter.dispatch('type_numeric', packages = dbt_utils._get_utils_namespaces())()) }}\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__type_numeric": {"unique_id": "macro.dbt_utils.default__type_numeric", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "default__type_numeric", "macro_sql": "{% macro default__type_numeric() %}\n numeric(28, 6)\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.bigquery__type_numeric": {"unique_id": "macro.dbt_utils.bigquery__type_numeric", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "bigquery__type_numeric", "macro_sql": "{% macro bigquery__type_numeric() %}\n numeric\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.type_bigint": {"unique_id": "macro.dbt_utils.type_bigint", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "type_bigint", "macro_sql": "\n\n{%- macro type_bigint() -%}\n {{ return(adapter.dispatch('type_bigint', packages = dbt_utils._get_utils_namespaces())()) }}\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__type_bigint": {"unique_id": "macro.dbt_utils.default__type_bigint", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "default__type_bigint", "macro_sql": "{% macro default__type_bigint() %}\n bigint\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.bigquery__type_bigint": {"unique_id": "macro.dbt_utils.bigquery__type_bigint", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "bigquery__type_bigint", "macro_sql": "{% macro bigquery__type_bigint() %}\n int64\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.type_int": {"unique_id": "macro.dbt_utils.type_int", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "type_int", "macro_sql": "\n\n{%- macro type_int() -%}\n {{ return(adapter.dispatch('type_int', packages = dbt_utils._get_utils_namespaces())()) }}\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__type_int": {"unique_id": "macro.dbt_utils.default__type_int", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "default__type_int", "macro_sql": "{% macro default__type_int() %}\n int\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.bigquery__type_int": {"unique_id": "macro.dbt_utils.bigquery__type_int", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "bigquery__type_int", "macro_sql": "{% macro bigquery__type_int() %}\n int64\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils._is_relation": {"unique_id": "macro.dbt_utils._is_relation", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/_is_relation.sql", "original_file_path": "macros/cross_db_utils/_is_relation.sql", "name": "_is_relation", "macro_sql": "{% macro _is_relation(obj, macro) %}\n {%- if not (obj is mapping and obj.get('metadata', {}).get('type', '').endswith('Relation')) -%}\n {%- do exceptions.raise_compiler_error(\"Macro \" ~ macro ~ \" expected a Relation but received the value: \" ~ obj) -%}\n {%- endif -%}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.length": {"unique_id": "macro.dbt_utils.length", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/length.sql", "original_file_path": "macros/cross_db_utils/length.sql", "name": "length", "macro_sql": "{% macro length(expression) -%}\n {{ return(adapter.dispatch('length', packages = dbt_utils._get_utils_namespaces()) (expression)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__length": {"unique_id": "macro.dbt_utils.default__length", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/length.sql", "original_file_path": "macros/cross_db_utils/length.sql", "name": "default__length", "macro_sql": "{% macro default__length(expression) %}\n \n length(\n {{ expression }}\n )\n \n{%- endmacro -%}\n\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.redshift__length": {"unique_id": "macro.dbt_utils.redshift__length", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/length.sql", "original_file_path": "macros/cross_db_utils/length.sql", "name": "redshift__length", "macro_sql": "{% macro redshift__length(expression) %}\n\n len(\n {{ expression }}\n )\n \n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.dateadd": {"unique_id": "macro.dbt_utils.dateadd", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/dateadd.sql", "original_file_path": "macros/cross_db_utils/dateadd.sql", "name": "dateadd", "macro_sql": "{% macro dateadd(datepart, interval, from_date_or_timestamp) %}\n {{ return(adapter.dispatch('dateadd', packages = dbt_utils._get_utils_namespaces())(datepart, interval, from_date_or_timestamp)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__dateadd": {"unique_id": "macro.dbt_utils.default__dateadd", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/dateadd.sql", "original_file_path": "macros/cross_db_utils/dateadd.sql", "name": "default__dateadd", "macro_sql": "{% macro default__dateadd(datepart, interval, from_date_or_timestamp) %}\n\n dateadd(\n {{ datepart }},\n {{ interval }},\n {{ from_date_or_timestamp }}\n )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.bigquery__dateadd": {"unique_id": "macro.dbt_utils.bigquery__dateadd", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/dateadd.sql", "original_file_path": "macros/cross_db_utils/dateadd.sql", "name": "bigquery__dateadd", "macro_sql": "{% macro bigquery__dateadd(datepart, interval, from_date_or_timestamp) %}\n\n datetime_add(\n cast( {{ from_date_or_timestamp }} as datetime),\n interval {{ interval }} {{ datepart }}\n )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.postgres__dateadd": {"unique_id": "macro.dbt_utils.postgres__dateadd", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/dateadd.sql", "original_file_path": "macros/cross_db_utils/dateadd.sql", "name": "postgres__dateadd", "macro_sql": "{% macro postgres__dateadd(datepart, interval, from_date_or_timestamp) %}\n\n {{ from_date_or_timestamp }} + ((interval '1 {{ datepart }}') * ({{ interval }}))\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.intersect": {"unique_id": "macro.dbt_utils.intersect", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/intersect.sql", "original_file_path": "macros/cross_db_utils/intersect.sql", "name": "intersect", "macro_sql": "{% macro intersect() %}\n {{ return(adapter.dispatch('intersect', packages = dbt_utils._get_utils_namespaces())()) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__intersect": {"unique_id": "macro.dbt_utils.default__intersect", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/intersect.sql", "original_file_path": "macros/cross_db_utils/intersect.sql", "name": "default__intersect", "macro_sql": "{% macro default__intersect() %}\n\n intersect\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.bigquery__intersect": {"unique_id": "macro.dbt_utils.bigquery__intersect", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/intersect.sql", "original_file_path": "macros/cross_db_utils/intersect.sql", "name": "bigquery__intersect", "macro_sql": "{% macro bigquery__intersect() %}\n\n intersect distinct\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.right": {"unique_id": "macro.dbt_utils.right", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/right.sql", "original_file_path": "macros/cross_db_utils/right.sql", "name": "right", "macro_sql": "{% macro right(string_text, length_expression) -%}\n {{ return(adapter.dispatch('right', packages = dbt_utils._get_utils_namespaces()) (string_text, length_expression)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__right": {"unique_id": "macro.dbt_utils.default__right", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/right.sql", "original_file_path": "macros/cross_db_utils/right.sql", "name": "default__right", "macro_sql": "{% macro default__right(string_text, length_expression) %}\n\n right(\n {{ string_text }},\n {{ length_expression }}\n )\n \n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.bigquery__right": {"unique_id": "macro.dbt_utils.bigquery__right", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/right.sql", "original_file_path": "macros/cross_db_utils/right.sql", "name": "bigquery__right", "macro_sql": "{% macro bigquery__right(string_text, length_expression) %}\n\n case when {{ length_expression }} = 0 \n then ''\n else \n substr(\n {{ string_text }},\n -1 * ({{ length_expression }})\n )\n end\n\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.snowflake__right": {"unique_id": "macro.dbt_utils.snowflake__right", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/right.sql", "original_file_path": "macros/cross_db_utils/right.sql", "name": "snowflake__right", "macro_sql": "{% macro snowflake__right(string_text, length_expression) %}\n\n case when {{ length_expression }} = 0 \n then ''\n else \n right(\n {{ string_text }},\n {{ length_expression }}\n )\n end\n\n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.datediff": {"unique_id": "macro.dbt_utils.datediff", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/datediff.sql", "original_file_path": "macros/cross_db_utils/datediff.sql", "name": "datediff", "macro_sql": "{% macro datediff(first_date, second_date, datepart) %}\n {{ return(adapter.dispatch('datediff', packages = dbt_utils._get_utils_namespaces())(first_date, second_date, datepart)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__datediff": {"unique_id": "macro.dbt_utils.default__datediff", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/datediff.sql", "original_file_path": "macros/cross_db_utils/datediff.sql", "name": "default__datediff", "macro_sql": "{% macro default__datediff(first_date, second_date, datepart) %}\n\n datediff(\n {{ datepart }},\n {{ first_date }},\n {{ second_date }}\n )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.bigquery__datediff": {"unique_id": "macro.dbt_utils.bigquery__datediff", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/datediff.sql", "original_file_path": "macros/cross_db_utils/datediff.sql", "name": "bigquery__datediff", "macro_sql": "{% macro bigquery__datediff(first_date, second_date, datepart) %}\n\n datetime_diff(\n cast({{second_date}} as datetime),\n cast({{first_date}} as datetime),\n {{datepart}}\n )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.postgres__datediff": {"unique_id": "macro.dbt_utils.postgres__datediff", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/datediff.sql", "original_file_path": "macros/cross_db_utils/datediff.sql", "name": "postgres__datediff", "macro_sql": "{% macro postgres__datediff(first_date, second_date, datepart) %}\n\n {% if datepart == 'year' %}\n (date_part('year', ({{second_date}})::date) - date_part('year', ({{first_date}})::date))\n {% elif datepart == 'quarter' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'year') }} * 4 + date_part('quarter', ({{second_date}})::date) - date_part('quarter', ({{first_date}})::date))\n {% elif datepart == 'month' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'year') }} * 12 + date_part('month', ({{second_date}})::date) - date_part('month', ({{first_date}})::date))\n {% elif datepart == 'day' %}\n (({{second_date}})::date - ({{first_date}})::date)\n {% elif datepart == 'week' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'day') }} / 7 + case\n when date_part('dow', ({{first_date}})::timestamp) <= date_part('dow', ({{second_date}})::timestamp) then\n case when {{first_date}} <= {{second_date}} then 0 else -1 end\n else\n case when {{first_date}} <= {{second_date}} then 1 else 0 end\n end)\n {% elif datepart == 'hour' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'day') }} * 24 + date_part('hour', ({{second_date}})::timestamp) - date_part('hour', ({{first_date}})::timestamp))\n {% elif datepart == 'minute' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'hour') }} * 60 + date_part('minute', ({{second_date}})::timestamp) - date_part('minute', ({{first_date}})::timestamp))\n {% elif datepart == 'second' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'minute') }} * 60 + floor(date_part('second', ({{second_date}})::timestamp)) - floor(date_part('second', ({{first_date}})::timestamp)))\n {% elif datepart == 'millisecond' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'minute') }} * 60000 + floor(date_part('millisecond', ({{second_date}})::timestamp)) - floor(date_part('millisecond', ({{first_date}})::timestamp)))\n {% elif datepart == 'microsecond' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'minute') }} * 60000000 + floor(date_part('microsecond', ({{second_date}})::timestamp)) - floor(date_part('microsecond', ({{first_date}})::timestamp)))\n {% else %}\n {{ exceptions.raise_compiler_error(\"Unsupported datepart for macro datediff in postgres: {!r}\".format(datepart)) }}\n {% endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.safe_cast": {"unique_id": "macro.dbt_utils.safe_cast", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/safe_cast.sql", "original_file_path": "macros/cross_db_utils/safe_cast.sql", "name": "safe_cast", "macro_sql": "{% macro safe_cast(field, type) %}\n {{ return(adapter.dispatch('safe_cast', packages = dbt_utils._get_utils_namespaces()) (field, type)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__safe_cast": {"unique_id": "macro.dbt_utils.default__safe_cast", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/safe_cast.sql", "original_file_path": "macros/cross_db_utils/safe_cast.sql", "name": "default__safe_cast", "macro_sql": "{% macro default__safe_cast(field, type) %}\n {# most databases don't support this function yet\n so we just need to use cast #}\n cast({{field}} as {{type}})\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.snowflake__safe_cast": {"unique_id": "macro.dbt_utils.snowflake__safe_cast", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/safe_cast.sql", "original_file_path": "macros/cross_db_utils/safe_cast.sql", "name": "snowflake__safe_cast", "macro_sql": "{% macro snowflake__safe_cast(field, type) %}\n try_cast({{field}} as {{type}})\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.bigquery__safe_cast": {"unique_id": "macro.dbt_utils.bigquery__safe_cast", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/safe_cast.sql", "original_file_path": "macros/cross_db_utils/safe_cast.sql", "name": "bigquery__safe_cast", "macro_sql": "{% macro bigquery__safe_cast(field, type) %}\n safe_cast({{field}} as {{type}})\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.hash": {"unique_id": "macro.dbt_utils.hash", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/hash.sql", "original_file_path": "macros/cross_db_utils/hash.sql", "name": "hash", "macro_sql": "{% macro hash(field) -%}\n {{ return(adapter.dispatch('hash', packages = dbt_utils._get_utils_namespaces()) (field)) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__hash": {"unique_id": "macro.dbt_utils.default__hash", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/hash.sql", "original_file_path": "macros/cross_db_utils/hash.sql", "name": "default__hash", "macro_sql": "{% macro default__hash(field) -%}\n md5(cast({{field}} as {{dbt_utils.type_string()}}))\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.bigquery__hash": {"unique_id": "macro.dbt_utils.bigquery__hash", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/hash.sql", "original_file_path": "macros/cross_db_utils/hash.sql", "name": "bigquery__hash", "macro_sql": "{% macro bigquery__hash(field) -%}\n to_hex({{dbt_utils.default__hash(field)}})\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.cast_bool_to_text": {"unique_id": "macro.dbt_utils.cast_bool_to_text", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/cast_bool_to_text.sql", "original_file_path": "macros/cross_db_utils/cast_bool_to_text.sql", "name": "cast_bool_to_text", "macro_sql": "{% macro cast_bool_to_text(field) %}\n {{ adapter.dispatch('cast_bool_to_text', packages = dbt_utils._get_utils_namespaces()) (field) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__cast_bool_to_text": {"unique_id": "macro.dbt_utils.default__cast_bool_to_text", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/cast_bool_to_text.sql", "original_file_path": "macros/cross_db_utils/cast_bool_to_text.sql", "name": "default__cast_bool_to_text", "macro_sql": "{% macro default__cast_bool_to_text(field) %}\n cast({{ field }} as {{ dbt_utils.type_string() }})\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.redshift__cast_bool_to_text": {"unique_id": "macro.dbt_utils.redshift__cast_bool_to_text", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/cast_bool_to_text.sql", "original_file_path": "macros/cross_db_utils/cast_bool_to_text.sql", "name": "redshift__cast_bool_to_text", "macro_sql": "{% macro redshift__cast_bool_to_text(field) %}\n case\n when {{ field }} is true then 'true'\n when {{ field }} is false then 'false'\n end::text\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.identifier": {"unique_id": "macro.dbt_utils.identifier", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/identifier.sql", "original_file_path": "macros/cross_db_utils/identifier.sql", "name": "identifier", "macro_sql": "{% macro identifier(value) %}\t\n {%- set error_message = '\n Warning: the `identifier` macro is no longer supported and will be deprecated in a future release of dbt-utils. \\\n Use `adapter.quote` instead. The {}.{} model triggered this warning. \\\n '.format(model.package_name, model.name) -%}\n {%- do exceptions.warn(error_message) -%}\n {{ return(adapter.dispatch('identifier', packages = dbt_utils._get_utils_namespaces()) (value)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__identifier": {"unique_id": "macro.dbt_utils.default__identifier", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/identifier.sql", "original_file_path": "macros/cross_db_utils/identifier.sql", "name": "default__identifier", "macro_sql": "{% macro default__identifier(value) -%}\t\n \"{{ value }}\"\t\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.bigquery__identifier": {"unique_id": "macro.dbt_utils.bigquery__identifier", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/identifier.sql", "original_file_path": "macros/cross_db_utils/identifier.sql", "name": "bigquery__identifier", "macro_sql": "{% macro bigquery__identifier(value) -%}\t\n `{{ value }}`\t\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.position": {"unique_id": "macro.dbt_utils.position", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/position.sql", "original_file_path": "macros/cross_db_utils/position.sql", "name": "position", "macro_sql": "{% macro position(substring_text, string_text) -%}\n {{ return(adapter.dispatch('position', packages = dbt_utils._get_utils_namespaces()) (substring_text, string_text)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__position": {"unique_id": "macro.dbt_utils.default__position", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/position.sql", "original_file_path": "macros/cross_db_utils/position.sql", "name": "default__position", "macro_sql": "{% macro default__position(substring_text, string_text) %}\n\n position(\n {{ substring_text }} in {{ string_text }}\n )\n \n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.bigquery__position": {"unique_id": "macro.dbt_utils.bigquery__position", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/position.sql", "original_file_path": "macros/cross_db_utils/position.sql", "name": "bigquery__position", "macro_sql": "{% macro bigquery__position(substring_text, string_text) %}\n\n strpos(\n {{ string_text }},\n {{ substring_text }}\n \n )\n \n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.string_literal": {"unique_id": "macro.dbt_utils.string_literal", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/literal.sql", "original_file_path": "macros/cross_db_utils/literal.sql", "name": "string_literal", "macro_sql": "{%- macro string_literal(value) -%}\n {{ return(adapter.dispatch('string_literal', packages = dbt_utils._get_utils_namespaces()) (value)) }}\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__string_literal": {"unique_id": "macro.dbt_utils.default__string_literal", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/literal.sql", "original_file_path": "macros/cross_db_utils/literal.sql", "name": "default__string_literal", "macro_sql": "{% macro default__string_literal(value) -%}\n '{{ value }}'\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.current_timestamp": {"unique_id": "macro.dbt_utils.current_timestamp", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/current_timestamp.sql", "original_file_path": "macros/cross_db_utils/current_timestamp.sql", "name": "current_timestamp", "macro_sql": "{% macro current_timestamp() -%}\n {{ return(adapter.dispatch('current_timestamp', packages = dbt_utils._get_utils_namespaces())()) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__current_timestamp": {"unique_id": "macro.dbt_utils.default__current_timestamp", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/current_timestamp.sql", "original_file_path": "macros/cross_db_utils/current_timestamp.sql", "name": "default__current_timestamp", "macro_sql": "{% macro default__current_timestamp() %}\n current_timestamp::{{dbt_utils.type_timestamp()}}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.redshift__current_timestamp": {"unique_id": "macro.dbt_utils.redshift__current_timestamp", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/current_timestamp.sql", "original_file_path": "macros/cross_db_utils/current_timestamp.sql", "name": "redshift__current_timestamp", "macro_sql": "{% macro redshift__current_timestamp() %}\n getdate()\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.bigquery__current_timestamp": {"unique_id": "macro.dbt_utils.bigquery__current_timestamp", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/current_timestamp.sql", "original_file_path": "macros/cross_db_utils/current_timestamp.sql", "name": "bigquery__current_timestamp", "macro_sql": "{% macro bigquery__current_timestamp() %}\n current_timestamp\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.current_timestamp_in_utc": {"unique_id": "macro.dbt_utils.current_timestamp_in_utc", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/current_timestamp.sql", "original_file_path": "macros/cross_db_utils/current_timestamp.sql", "name": "current_timestamp_in_utc", "macro_sql": "{% macro current_timestamp_in_utc() -%}\n {{ return(adapter.dispatch('current_timestamp_in_utc', packages = dbt_utils._get_utils_namespaces())()) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__current_timestamp_in_utc": {"unique_id": "macro.dbt_utils.default__current_timestamp_in_utc", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/current_timestamp.sql", "original_file_path": "macros/cross_db_utils/current_timestamp.sql", "name": "default__current_timestamp_in_utc", "macro_sql": "{% macro default__current_timestamp_in_utc() %}\n {{dbt_utils.current_timestamp()}}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.snowflake__current_timestamp_in_utc": {"unique_id": "macro.dbt_utils.snowflake__current_timestamp_in_utc", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/current_timestamp.sql", "original_file_path": "macros/cross_db_utils/current_timestamp.sql", "name": "snowflake__current_timestamp_in_utc", "macro_sql": "{% macro snowflake__current_timestamp_in_utc() %}\n convert_timezone('UTC', {{dbt_utils.current_timestamp()}})::{{dbt_utils.type_timestamp()}}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.postgres__current_timestamp_in_utc": {"unique_id": "macro.dbt_utils.postgres__current_timestamp_in_utc", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/current_timestamp.sql", "original_file_path": "macros/cross_db_utils/current_timestamp.sql", "name": "postgres__current_timestamp_in_utc", "macro_sql": "{% macro postgres__current_timestamp_in_utc() %}\n (current_timestamp at time zone 'utc')::{{dbt_utils.type_timestamp()}}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.width_bucket": {"unique_id": "macro.dbt_utils.width_bucket", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/width_bucket.sql", "original_file_path": "macros/cross_db_utils/width_bucket.sql", "name": "width_bucket", "macro_sql": "{% macro width_bucket(expr, min_value, max_value, num_buckets) %}\n {{ return(adapter.dispatch('width_bucket', packages = dbt_utils._get_utils_namespaces()) (expr, min_value, max_value, num_buckets)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__width_bucket": {"unique_id": "macro.dbt_utils.default__width_bucket", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/width_bucket.sql", "original_file_path": "macros/cross_db_utils/width_bucket.sql", "name": "default__width_bucket", "macro_sql": "{% macro default__width_bucket(expr, min_value, max_value, num_buckets) -%}\n\n {% set bin_size -%}\n (( {{ max_value }} - {{ min_value }} ) / {{ num_buckets }} )\n {%- endset %}\n (\n -- to break ties when the amount is eaxtly at the bucket egde\n case\n when\n mod(\n {{ dbt_utils.safe_cast(expr, dbt_utils.type_numeric() ) }},\n {{ dbt_utils.safe_cast(bin_size, dbt_utils.type_numeric() ) }}\n ) = 0\n then 1\n else 0\n end\n ) +\n -- Anything over max_value goes the N+1 bucket\n least(\n ceil(\n ({{ expr }} - {{ min_value }})/{{ bin_size }}\n ),\n {{ num_buckets }} + 1\n )\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.redshift__width_bucket": {"unique_id": "macro.dbt_utils.redshift__width_bucket", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/width_bucket.sql", "original_file_path": "macros/cross_db_utils/width_bucket.sql", "name": "redshift__width_bucket", "macro_sql": "{% macro redshift__width_bucket(expr, min_value, max_value, num_buckets) -%}\n\n {% set bin_size -%}\n (( {{ max_value }} - {{ min_value }} ) / {{ num_buckets }} )\n {%- endset %}\n (\n -- to break ties when the amount is exactly at the bucket edge\n case\n when\n {{ dbt_utils.safe_cast(expr, dbt_utils.type_numeric() ) }} %\n {{ dbt_utils.safe_cast(bin_size, dbt_utils.type_numeric() ) }}\n = 0\n then 1\n else 0\n end\n ) +\n -- Anything over max_value goes the N+1 bucket\n least(\n ceil(\n ({{ expr }} - {{ min_value }})/{{ bin_size }}\n ),\n {{ num_buckets }} + 1\n )\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.snowflake__width_bucket": {"unique_id": "macro.dbt_utils.snowflake__width_bucket", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/width_bucket.sql", "original_file_path": "macros/cross_db_utils/width_bucket.sql", "name": "snowflake__width_bucket", "macro_sql": "{% macro snowflake__width_bucket(expr, min_value, max_value, num_buckets) %}\n width_bucket({{ expr }}, {{ min_value }}, {{ max_value }}, {{ num_buckets }} )\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils._get_utils_namespaces": {"unique_id": "macro.dbt_utils._get_utils_namespaces", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/_get_utils_namespaces.sql", "original_file_path": "macros/cross_db_utils/_get_utils_namespaces.sql", "name": "_get_utils_namespaces", "macro_sql": "{% macro _get_utils_namespaces() %}\n {% set override_namespaces = var('dbt_utils_dispatch_list', []) %}\n {% do return(override_namespaces + ['dbt_utils']) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.last_day": {"unique_id": "macro.dbt_utils.last_day", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/last_day.sql", "original_file_path": "macros/cross_db_utils/last_day.sql", "name": "last_day", "macro_sql": "{% macro last_day(date, datepart) %}\n {{ return(adapter.dispatch('last_day', packages = dbt_utils._get_utils_namespaces()) (date, datepart)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default_last_day": {"unique_id": "macro.dbt_utils.default_last_day", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/last_day.sql", "original_file_path": "macros/cross_db_utils/last_day.sql", "name": "default_last_day", "macro_sql": "\n\n\n{%- macro default_last_day(date, datepart) -%}\n cast(\n {{dbt_utils.dateadd('day', '-1',\n dbt_utils.dateadd(datepart, '1', dbt_utils.date_trunc(datepart, date))\n )}}\n as date)\n{%- endmacro -%}\n\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__last_day": {"unique_id": "macro.dbt_utils.default__last_day", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/last_day.sql", "original_file_path": "macros/cross_db_utils/last_day.sql", "name": "default__last_day", "macro_sql": "{% macro default__last_day(date, datepart) -%}\n {{dbt_utils.default_last_day(date, datepart)}}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.postgres__last_day": {"unique_id": "macro.dbt_utils.postgres__last_day", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/last_day.sql", "original_file_path": "macros/cross_db_utils/last_day.sql", "name": "postgres__last_day", "macro_sql": "{% macro postgres__last_day(date, datepart) -%}\n\n {%- if datepart == 'quarter' -%}\n -- postgres dateadd does not support quarter interval.\n cast(\n {{dbt_utils.dateadd('day', '-1',\n dbt_utils.dateadd('month', '3', dbt_utils.date_trunc(datepart, date))\n )}}\n as date)\n {%- else -%}\n {{dbt_utils.default_last_day(date, datepart)}}\n {%- endif -%}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.split_part": {"unique_id": "macro.dbt_utils.split_part", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/split_part.sql", "original_file_path": "macros/cross_db_utils/split_part.sql", "name": "split_part", "macro_sql": "{% macro split_part(string_text, delimiter_text, part_number) %}\n {{ return(adapter.dispatch('split_part', packages = dbt_utils._get_utils_namespaces()) (string_text, delimiter_text, part_number)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__split_part": {"unique_id": "macro.dbt_utils.default__split_part", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/split_part.sql", "original_file_path": "macros/cross_db_utils/split_part.sql", "name": "default__split_part", "macro_sql": "{% macro default__split_part(string_text, delimiter_text, part_number) %}\n\n split_part(\n {{ string_text }},\n {{ delimiter_text }},\n {{ part_number }}\n )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.bigquery__split_part": {"unique_id": "macro.dbt_utils.bigquery__split_part", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/split_part.sql", "original_file_path": "macros/cross_db_utils/split_part.sql", "name": "bigquery__split_part", "macro_sql": "{% macro bigquery__split_part(string_text, delimiter_text, part_number) %}\n\n split(\n {{ string_text }},\n {{ delimiter_text }}\n )[safe_offset({{ part_number - 1 }})]\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.date_trunc": {"unique_id": "macro.dbt_utils.date_trunc", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/date_trunc.sql", "original_file_path": "macros/cross_db_utils/date_trunc.sql", "name": "date_trunc", "macro_sql": "{% macro date_trunc(datepart, date) -%}\n {{ return(adapter.dispatch('date_trunc', packages = dbt_utils._get_utils_namespaces()) (datepart, date)) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__date_trunc": {"unique_id": "macro.dbt_utils.default__date_trunc", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/date_trunc.sql", "original_file_path": "macros/cross_db_utils/date_trunc.sql", "name": "default__date_trunc", "macro_sql": "{% macro default__date_trunc(datepart, date) %}\n date_trunc('{{datepart}}', {{date}})\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.bigquery__date_trunc": {"unique_id": "macro.dbt_utils.bigquery__date_trunc", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/date_trunc.sql", "original_file_path": "macros/cross_db_utils/date_trunc.sql", "name": "bigquery__date_trunc", "macro_sql": "{% macro bigquery__date_trunc(datepart, date) %}\n timestamp_trunc(\n cast({{date}} as timestamp),\n {{datepart}}\n )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils._is_ephemeral": {"unique_id": "macro.dbt_utils._is_ephemeral", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/_is_ephemeral.sql", "original_file_path": "macros/cross_db_utils/_is_ephemeral.sql", "name": "_is_ephemeral", "macro_sql": "{% macro _is_ephemeral(obj, macro) %}\n {%- if obj.is_cte -%}\n {% set ephemeral_prefix = api.Relation.add_ephemeral_prefix('') %}\n {% if obj.name.startswith(ephemeral_prefix) %}\n {% set model_name = obj.name[(ephemeral_prefix|length):] %}\n {% else %}\n {% set model_name = obj.name %}\n {%- endif -%}\n {% set error_message %}\nThe `{{ macro }}` macro cannot be used with ephemeral models, as it relies on the information schema.\n\n`{{ model_name }}` is an ephemeral model. Consider making it a view or table instead.\n {% endset %}\n {%- do exceptions.raise_compiler_error(error_message) -%}\n {%- endif -%}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.get_period_boundaries": {"unique_id": "macro.dbt_utils.get_period_boundaries", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/materializations/insert_by_period_materialization.sql", "original_file_path": "macros/materializations/insert_by_period_materialization.sql", "name": "get_period_boundaries", "macro_sql": "{% macro get_period_boundaries(target_schema, target_table, timestamp_field, start_date, stop_date, period) -%}\n {{ return(adapter.dispatch('get_period_boundaries', packages = dbt_utils._get_utils_namespaces())(target_schema, target_table, timestamp_field, start_date, stop_date, period)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__get_period_boundaries": {"unique_id": "macro.dbt_utils.default__get_period_boundaries", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/materializations/insert_by_period_materialization.sql", "original_file_path": "macros/materializations/insert_by_period_materialization.sql", "name": "default__get_period_boundaries", "macro_sql": "{% macro default__get_period_boundaries(target_schema, target_table, timestamp_field, start_date, stop_date, period) -%}\n\n {% call statement('period_boundaries', fetch_result=True) -%}\n with data as (\n select\n coalesce(max(\"{{timestamp_field}}\"), '{{start_date}}')::timestamp as start_timestamp,\n coalesce(\n {{dbt_utils.dateadd('millisecond',\n -1,\n \"nullif('\" ~ stop_date ~ \"','')::timestamp\")}},\n {{dbt_utils.current_timestamp()}}\n ) as stop_timestamp\n from \"{{target_schema}}\".\"{{target_table}}\"\n )\n\n select\n start_timestamp,\n stop_timestamp,\n {{dbt_utils.datediff('start_timestamp',\n 'stop_timestamp',\n period)}} + 1 as num_periods\n from data\n {%- endcall %}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.get_period_sql": {"unique_id": "macro.dbt_utils.get_period_sql", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/materializations/insert_by_period_materialization.sql", "original_file_path": "macros/materializations/insert_by_period_materialization.sql", "name": "get_period_sql", "macro_sql": "{% macro get_period_sql(target_cols_csv, sql, timestamp_field, period, start_timestamp, stop_timestamp, offset) -%}\n {{ return(adapter.dispatch('get_period_sql', packages = dbt_utils._get_utils_namespaces())(target_cols_csv, sql, timestamp_field, period, start_timestamp, stop_timestamp, offset)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__get_period_sql": {"unique_id": "macro.dbt_utils.default__get_period_sql", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/materializations/insert_by_period_materialization.sql", "original_file_path": "macros/materializations/insert_by_period_materialization.sql", "name": "default__get_period_sql", "macro_sql": "{% macro default__get_period_sql(target_cols_csv, sql, timestamp_field, period, start_timestamp, stop_timestamp, offset) -%}\n\n {%- set period_filter -%}\n (\"{{timestamp_field}}\" > '{{start_timestamp}}'::timestamp + interval '{{offset}} {{period}}' and\n \"{{timestamp_field}}\" <= '{{start_timestamp}}'::timestamp + interval '{{offset}} {{period}}' + interval '1 {{period}}' and\n \"{{timestamp_field}}\" < '{{stop_timestamp}}'::timestamp)\n {%- endset -%}\n\n {%- set filtered_sql = sql | replace(\"__PERIOD_FILTER__\", period_filter) -%}\n\n select\n {{target_cols_csv}}\n from (\n {{filtered_sql}}\n )\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.materialization_insert_by_period_default": {"unique_id": "macro.dbt_utils.materialization_insert_by_period_default", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/materializations/insert_by_period_materialization.sql", "original_file_path": "macros/materializations/insert_by_period_materialization.sql", "name": "materialization_insert_by_period_default", "macro_sql": "{% materialization insert_by_period, default -%}\n {%- set timestamp_field = config.require('timestamp_field') -%}\n {%- set start_date = config.require('start_date') -%}\n {%- set stop_date = config.get('stop_date') or '' -%}}\n {%- set period = config.get('period') or 'week' -%}\n\n {%- if sql.find('__PERIOD_FILTER__') == -1 -%}\n {%- set error_message -%}\n Model '{{ model.unique_id }}' does not include the required string '__PERIOD_FILTER__' in its sql\n {%- endset -%}\n {{ exceptions.raise_compiler_error(error_message) }}\n {%- endif -%}\n\n {%- set identifier = model['name'] -%}\n\n {%- set old_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) -%}\n {%- set target_relation = api.Relation.create(identifier=identifier, schema=schema, type='table') -%}\n\n {%- set non_destructive_mode = (flags.NON_DESTRUCTIVE == True) -%}\n {%- set full_refresh_mode = (flags.FULL_REFRESH == True) -%}\n\n {%- set exists_as_table = (old_relation is not none and old_relation.is_table) -%}\n {%- set exists_not_as_table = (old_relation is not none and not old_relation.is_table) -%}\n\n {%- set should_truncate = (non_destructive_mode and full_refresh_mode and exists_as_table) -%}\n {%- set should_drop = (not should_truncate and (full_refresh_mode or exists_not_as_table)) -%}\n {%- set force_create = (flags.FULL_REFRESH and not flags.NON_DESTRUCTIVE) -%}\n\n -- setup\n {% if old_relation is none -%}\n -- noop\n {%- elif should_truncate -%}\n {{adapter.truncate_relation(old_relation)}}\n {%- elif should_drop -%}\n {{adapter.drop_relation(old_relation)}}\n {%- set old_relation = none -%}\n {%- endif %}\n\n {{run_hooks(pre_hooks, inside_transaction=False)}}\n\n -- `begin` happens here, so `commit` after it to finish the transaction\n {{run_hooks(pre_hooks, inside_transaction=True)}}\n {% call statement() -%}\n begin; -- make extra sure we've closed out the transaction\n commit;\n {%- endcall %}\n\n -- build model\n {% if force_create or old_relation is none -%}\n {# Create an empty target table -#}\n {% call statement('main') -%}\n {%- set empty_sql = sql | replace(\"__PERIOD_FILTER__\", 'false') -%}\n {{create_table_as(False, target_relation, empty_sql)}};\n {%- endcall %}\n {%- endif %}\n\n {% set _ = dbt_utils.get_period_boundaries(schema,\n identifier,\n timestamp_field,\n start_date,\n stop_date,\n period) %}\n {%- set start_timestamp = load_result('period_boundaries')['data'][0][0] | string -%}\n {%- set stop_timestamp = load_result('period_boundaries')['data'][0][1] | string -%}\n {%- set num_periods = load_result('period_boundaries')['data'][0][2] | int -%}\n\n {% set target_columns = adapter.get_columns_in_relation(target_relation) %}\n {%- set target_cols_csv = target_columns | map(attribute='quoted') | join(', ') -%}\n {%- set loop_vars = {'sum_rows_inserted': 0} -%}\n\n -- commit each period as a separate transaction\n {% for i in range(num_periods) -%}\n {%- set msg = \"Running for \" ~ period ~ \" \" ~ (i + 1) ~ \" of \" ~ (num_periods) -%}\n {{ dbt_utils.log_info(msg) }}\n\n {%- set tmp_identifier = model['name'] ~ '__dbt_incremental_period' ~ i ~ '_tmp' -%}\n {%- set tmp_relation = api.Relation.create(identifier=tmp_identifier,\n schema=schema, type='table') -%}\n {% call statement() -%}\n {% set tmp_table_sql = dbt_utils.get_period_sql(target_cols_csv,\n sql,\n timestamp_field,\n period,\n start_timestamp,\n stop_timestamp,\n i) %}\n {{dbt.create_table_as(True, tmp_relation, tmp_table_sql)}}\n {%- endcall %}\n\n {{adapter.expand_target_column_types(from_relation=tmp_relation,\n to_relation=target_relation)}}\n {%- set name = 'main-' ~ i -%}\n {% call statement(name, fetch_result=True) -%}\n insert into {{target_relation}} ({{target_cols_csv}})\n (\n select\n {{target_cols_csv}}\n from {{tmp_relation.include(schema=False)}}\n );\n {%- endcall %}\n {% set result = load_result('main-' ~ i) %}\n {% if 'response' in result.keys() %} {# added in v0.19.0 #}\n {% set rows_inserted = result['response']['rows_affected'] %}\n {% else %} {# older versions #}\n {% set rows_inserted = result['status'].split(\" \")[2] | int %}\n {% endif %}\n \n {%- set sum_rows_inserted = loop_vars['sum_rows_inserted'] + rows_inserted -%}\n {%- if loop_vars.update({'sum_rows_inserted': sum_rows_inserted}) %} {% endif -%}\n\n {%- set msg = \"Ran for \" ~ period ~ \" \" ~ (i + 1) ~ \" of \" ~ (num_periods) ~ \"; \" ~ rows_inserted ~ \" records inserted\" -%}\n {{ dbt_utils.log_info(msg) }}\n\n {%- endfor %}\n\n {% call statement() -%}\n begin;\n {%- endcall %}\n\n {{run_hooks(post_hooks, inside_transaction=True)}}\n\n {% call statement() -%}\n commit;\n {%- endcall %}\n\n {{run_hooks(post_hooks, inside_transaction=False)}}\n\n {%- set status_string = \"INSERT \" ~ loop_vars['sum_rows_inserted'] -%}\n\n {% call noop_statement('main', status_string) -%}\n -- no-op\n {%- endcall %}\n\n -- Return the relations created in this materialization\n {{ return({'relations': [target_relation]}) }} \n\n{%- endmaterialization %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.pretty_log_format": {"unique_id": "macro.dbt_utils.pretty_log_format", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/logger/pretty_log_format.sql", "original_file_path": "macros/logger/pretty_log_format.sql", "name": "pretty_log_format", "macro_sql": "{% macro pretty_log_format(message) %}\n {{ return(adapter.dispatch('pretty_log_format', packages = dbt_utils._get_utils_namespaces())(message)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__pretty_log_format": {"unique_id": "macro.dbt_utils.default__pretty_log_format", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/logger/pretty_log_format.sql", "original_file_path": "macros/logger/pretty_log_format.sql", "name": "default__pretty_log_format", "macro_sql": "{% macro default__pretty_log_format(message) %}\n {{ return( dbt_utils.pretty_time() ~ ' + ' ~ message) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.pretty_time": {"unique_id": "macro.dbt_utils.pretty_time", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/logger/pretty_time.sql", "original_file_path": "macros/logger/pretty_time.sql", "name": "pretty_time", "macro_sql": "{% macro pretty_time(format='%H:%M:%S') %}\n {{ return(adapter.dispatch('pretty_time', packages = dbt_utils._get_utils_namespaces())(format)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__pretty_time": {"unique_id": "macro.dbt_utils.default__pretty_time", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/logger/pretty_time.sql", "original_file_path": "macros/logger/pretty_time.sql", "name": "default__pretty_time", "macro_sql": "{% macro default__pretty_time(format='%H:%M:%S') %}\n {{ return(modules.datetime.datetime.now().strftime(format)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.log_info": {"unique_id": "macro.dbt_utils.log_info", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/logger/log_info.sql", "original_file_path": "macros/logger/log_info.sql", "name": "log_info", "macro_sql": "{% macro log_info(message) %}\n {{ return(adapter.dispatch('log_info', packages = dbt_utils._get_utils_namespaces())(message)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__log_info": {"unique_id": "macro.dbt_utils.default__log_info", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/logger/log_info.sql", "original_file_path": "macros/logger/log_info.sql", "name": "default__log_info", "macro_sql": "{% macro default__log_info(message) %}\n {{ log(dbt_utils.pretty_log_format(message), info=True) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.get_url_host": {"unique_id": "macro.dbt_utils.get_url_host", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/web/get_url_host.sql", "original_file_path": "macros/web/get_url_host.sql", "name": "get_url_host", "macro_sql": "{% macro get_url_host(field) -%}\n {{ return(adapter.dispatch('get_url_host', packages = dbt_utils._get_utils_namespaces())(field)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__get_url_host": {"unique_id": "macro.dbt_utils.default__get_url_host", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/web/get_url_host.sql", "original_file_path": "macros/web/get_url_host.sql", "name": "default__get_url_host", "macro_sql": "{% macro default__get_url_host(field) -%}\n\n{%- set parsed = \n dbt_utils.split_part(\n dbt_utils.split_part(\n dbt_utils.replace(\n dbt_utils.replace(field, \"'http://'\", \"''\"\n ), \"'https://'\", \"''\"\n ), \"'/'\", 1\n ), \"'?'\", 1\n )\n \n-%}\n\n \n {{ dbt_utils.safe_cast(\n parsed,\n dbt_utils.type_string()\n )}}\n \n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.get_url_path": {"unique_id": "macro.dbt_utils.get_url_path", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/web/get_url_path.sql", "original_file_path": "macros/web/get_url_path.sql", "name": "get_url_path", "macro_sql": "{% macro get_url_path(field) -%}\n {{ return(adapter.dispatch('get_url_path', packages = dbt_utils._get_utils_namespaces())(field)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__get_url_path": {"unique_id": "macro.dbt_utils.default__get_url_path", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/web/get_url_path.sql", "original_file_path": "macros/web/get_url_path.sql", "name": "default__get_url_path", "macro_sql": "{% macro default__get_url_path(field) -%}\n\n {%- set stripped_url = \n dbt_utils.replace(\n dbt_utils.replace(field, \"'http://'\", \"''\"), \"'https://'\", \"''\")\n -%}\n\n {%- set first_slash_pos -%}\n coalesce(\n nullif({{dbt_utils.position(\"'/'\", stripped_url)}}, 0),\n {{dbt_utils.position(\"'?'\", stripped_url)}} - 1\n )\n {%- endset -%}\n\n {%- set parsed_path =\n dbt_utils.split_part(\n dbt_utils.right(\n stripped_url, \n dbt_utils.length(stripped_url) ~ \"-\" ~ first_slash_pos\n ), \n \"'?'\", 1\n )\n -%}\n\n {{ dbt_utils.safe_cast(\n parsed_path,\n dbt_utils.type_string()\n )}}\n \n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.get_url_parameter": {"unique_id": "macro.dbt_utils.get_url_parameter", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/web/get_url_parameter.sql", "original_file_path": "macros/web/get_url_parameter.sql", "name": "get_url_parameter", "macro_sql": "{% macro get_url_parameter(field, url_parameter) -%}\n {{ return(adapter.dispatch('get_url_parameter', packages = dbt_utils._get_utils_namespaces())(field, url_parameter)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__get_url_parameter": {"unique_id": "macro.dbt_utils.default__get_url_parameter", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/web/get_url_parameter.sql", "original_file_path": "macros/web/get_url_parameter.sql", "name": "default__get_url_parameter", "macro_sql": "{% macro default__get_url_parameter(field, url_parameter) -%}\n\n{%- set formatted_url_parameter = \"'\" + url_parameter + \"='\" -%}\n\n{%- set split = dbt_utils.split_part(dbt_utils.split_part(field, formatted_url_parameter, 2), \"'&'\", 1) -%}\n\nnullif({{ split }},'')\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.test_fewer_rows_than": {"unique_id": "macro.dbt_utils.test_fewer_rows_than", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/schema_tests/fewer_rows_than.sql", "original_file_path": "macros/schema_tests/fewer_rows_than.sql", "name": "test_fewer_rows_than", "macro_sql": "{% macro test_fewer_rows_than(model) %}\n {{ return(adapter.dispatch('test_fewer_rows_than', packages = dbt_utils._get_utils_namespaces())(model, combination_of_columns, quote_columns, where)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__test_fewer_rows_than": {"unique_id": "macro.dbt_utils.default__test_fewer_rows_than", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/schema_tests/fewer_rows_than.sql", "original_file_path": "macros/schema_tests/fewer_rows_than.sql", "name": "default__test_fewer_rows_than", "macro_sql": "{% macro default__test_fewer_rows_than(model) %}\n\n{% set compare_model = kwargs.get('compare_model', kwargs.get('arg')) %}\n\nwith a as (\n\n select count(*) as count_ourmodel from {{ model }}\n\n),\nb as (\n\n select count(*) as count_comparisonmodel from {{ compare_model }}\n\n),\ncounts as (\n\n select\n (select count_ourmodel from a) as count_model_with_fewer_rows,\n (select count_comparisonmodel from b) as count_model_with_more_rows\n\n),\nfinal as (\n\n select\n case\n -- fail the test if we have more rows than the reference model and return the row count delta\n when count_model_with_fewer_rows > count_model_with_more_rows then (count_model_with_fewer_rows - count_model_with_more_rows)\n -- fail the test if they are the same number\n when count_model = count_comparison then 1\n -- pass the test if the delta is positive (i.e. return the number 0)\n else 0\n end as row_count_delta\n from counts\n\n)\n\nselect row_count_delta from final\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.test_equal_rowcount": {"unique_id": "macro.dbt_utils.test_equal_rowcount", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/schema_tests/equal_rowcount.sql", "original_file_path": "macros/schema_tests/equal_rowcount.sql", "name": "test_equal_rowcount", "macro_sql": "{% macro test_equal_rowcount(model) %}\n {{ return(adapter.dispatch('test_equal_rowcount', packages = dbt_utils._get_utils_namespaces())(model, **kwargs)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__test_equal_rowcount": {"unique_id": "macro.dbt_utils.default__test_equal_rowcount", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/schema_tests/equal_rowcount.sql", "original_file_path": "macros/schema_tests/equal_rowcount.sql", "name": "default__test_equal_rowcount", "macro_sql": "{% macro default__test_equal_rowcount(model) %}\n\n{% set compare_model = kwargs.get('compare_model', kwargs.get('arg')) %}\n\n{#-- Prevent querying of db in parsing mode. This works because this macro does not create any new refs. #}\n{%- if not execute -%}\n {{ return('') }}\n{% endif %}\n\nwith a as (\n\n select count(*) as count_a from {{ model }}\n\n),\nb as (\n\n select count(*) as count_b from {{ compare_model }}\n\n),\nfinal as (\n\n select abs(\n (select count_a from a) -\n (select count_b from b)\n )\n as diff_count\n\n)\n\nselect diff_count from final\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.test_relationships_where": {"unique_id": "macro.dbt_utils.test_relationships_where", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/schema_tests/relationships_where.sql", "original_file_path": "macros/schema_tests/relationships_where.sql", "name": "test_relationships_where", "macro_sql": "{% macro test_relationships_where(model, to, field) %}\n {{ return(adapter.dispatch('test_relationships_where', packages = dbt_utils._get_utils_namespaces())(model, to, field, **kwargs)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__test_relationships_where": {"unique_id": "macro.dbt_utils.default__test_relationships_where", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/schema_tests/relationships_where.sql", "original_file_path": "macros/schema_tests/relationships_where.sql", "name": "default__test_relationships_where", "macro_sql": "{% macro default__test_relationships_where(model, to, field) %}\n\n{% set column_name = kwargs.get('column_name', kwargs.get('from')) %}\n{# T-SQL has no boolean data type so we use 1=1 which returns TRUE #}\n{# ref https://stackoverflow.com/a/7170753/3842610 #}\n{% set from_condition = kwargs.get('from_condition', \"1=1\") %}\n{% set to_condition = kwargs.get('to_condition', \"1=1\") %}\n\nwith left_table as (\n\n select\n {{column_name}} as id\n\n from {{model}}\n\n where {{column_name}} is not null\n and {{from_condition}}\n\n),\n\nright_table as (\n\n select\n {{field}} as id\n\n from {{to}}\n\n where {{field}} is not null\n and {{to_condition}}\n\n),\n\nexceptions as (\n\n select\n left_table.id,\n right_table.id as right_id\n\n from left_table\n\n left join right_table\n on left_table.id = right_table.id\n\n where right_table.id is null\n\n)\n\nselect count(*) from exceptions\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.test_recency": {"unique_id": "macro.dbt_utils.test_recency", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/schema_tests/recency.sql", "original_file_path": "macros/schema_tests/recency.sql", "name": "test_recency", "macro_sql": "{% macro test_recency(model, datepart, interval) %}\n {{ return(adapter.dispatch('test_recency', packages = dbt_utils._get_utils_namespaces())(model, datepart, interval, **kwargs)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__test_recency": {"unique_id": "macro.dbt_utils.default__test_recency", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/schema_tests/recency.sql", "original_file_path": "macros/schema_tests/recency.sql", "name": "default__test_recency", "macro_sql": "{% macro default__test_recency(model, datepart, interval) %}\n\n{% set column_name = kwargs.get('column_name', kwargs.get('field')) %}\n\nselect\n case when count(*) > 0 then 0\n else 1\n end as error_result\nfrom {{model}}\nwhere {{column_name}} >=\n {{dbt_utils.dateadd(datepart, interval * -1, dbt_utils.current_timestamp())}}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.test_not_constant": {"unique_id": "macro.dbt_utils.test_not_constant", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/schema_tests/not_constant.sql", "original_file_path": "macros/schema_tests/not_constant.sql", "name": "test_not_constant", "macro_sql": "{% macro test_not_constant(model) %}\n {{ return(adapter.dispatch('test_not_constant', packages = dbt_utils._get_utils_namespaces())(model, **kwargs)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__test_not_constant": {"unique_id": "macro.dbt_utils.default__test_not_constant", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/schema_tests/not_constant.sql", "original_file_path": "macros/schema_tests/not_constant.sql", "name": "default__test_not_constant", "macro_sql": "{% macro default__test_not_constant(model) %}\n\n{% set column_name = kwargs.get('column_name', kwargs.get('arg')) %}\n\nselect count(*)\n\nfrom (\n\n select\n {# In TSQL, subquery aggregate columns need aliases #}\n {# thus: a filler col name, 'filler_column' #}\n count(distinct {{ column_name }}) as filler_column\n\n from {{ model }}\n\n having count(distinct {{ column_name }}) = 1\n\n ) validation_errors\n\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.test_accepted_range": {"unique_id": "macro.dbt_utils.test_accepted_range", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/schema_tests/accepted_range.sql", "original_file_path": "macros/schema_tests/accepted_range.sql", "name": "test_accepted_range", "macro_sql": "{% macro test_accepted_range(model, min_value = none, max_value = none, inclusive = true, where = \"true\") %}\n\n{%- set column_name = kwargs.get('column_name', kwargs.get('field')) -%}\n\nwith meet_condition as(\n select {{ column_name }} \n from {{ model }}\n where {{ where }}\n),\n\nvalidation_errors as (\n select *\n from meet_condition\n where \n -- never true, defaults to an empty result set. Exists to ensure any combo of the `or` clauses below succeeds\n 1 = 2 \n\n {%- if min_value is not none %}\n -- records with a value >= min_value are permitted. The `not` flips this to find records that don't meet the rule.\n or not {{ column_name }} > {{- \"=\" if inclusive }} {{ min_value }} \n {%- endif %}\n\n {%- if max_value is not none %}\n -- records with a value <= max_value are permitted. The `not` flips this to find records that don't meet the rule.\n or not {{ column_name }} < {{- \"=\" if inclusive }} {{ max_value }}\n {%- endif %}\n)\n\nselect count(*)\nfrom validation_errors\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.test_not_accepted_values": {"unique_id": "macro.dbt_utils.test_not_accepted_values", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/schema_tests/not_accepted_values.sql", "original_file_path": "macros/schema_tests/not_accepted_values.sql", "name": "test_not_accepted_values", "macro_sql": "{% macro test_not_accepted_values(model, values) %}\n\n{% set column_name = kwargs.get('column_name', kwargs.get('field')) %}\n{% set quote_values = kwargs.get('quote', True) %}\n\nwith all_values as (\n\n select distinct\n {{ column_name }} as value_field\n\n from {{ model }}\n\n),\n\nvalidation_errors as (\n\n select\n value_field\n\n from all_values\n where value_field in (\n {% for value in values -%}\n {% if quote_values -%}\n '{{ value }}'\n {%- else -%}\n {{ value }}\n {%- endif -%}\n {%- if not loop.last -%},{%- endif %}\n {%- endfor %}\n )\n\n)\n\nselect count(*) as validation_errors\nfrom validation_errors\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.test_unique_where": {"unique_id": "macro.dbt_utils.test_unique_where", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/schema_tests/test_unique_where.sql", "original_file_path": "macros/schema_tests/test_unique_where.sql", "name": "test_unique_where", "macro_sql": "{% macro test_unique_where(model) %}\r\n {{ return(adapter.dispatch('test_unique_where', packages = dbt_utils._get_utils_namespaces())(model, **kwargs)) }}\r\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__test_unique_where": {"unique_id": "macro.dbt_utils.default__test_unique_where", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/schema_tests/test_unique_where.sql", "original_file_path": "macros/schema_tests/test_unique_where.sql", "name": "default__test_unique_where", "macro_sql": "{% macro default__test_unique_where(model) %}\r\n\r\n{% set column_name = kwargs.get('column_name', kwargs.get('arg')) %}\r\n{% set where = kwargs.get('where', kwargs.get('arg')) %}\r\n\r\nselect count(*)\r\nfrom (\r\n\r\n select\r\n {{ column_name }}\r\n\r\n from {{ model }}\r\n where {{ column_name }} is not null\r\n {% if where %} and {{ where }} {% endif %}\r\n group by {{ column_name }}\r\n having count(*) > 1\r\n\r\n) validation_errors\r\n\r\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.test_at_least_one": {"unique_id": "macro.dbt_utils.test_at_least_one", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/schema_tests/at_least_one.sql", "original_file_path": "macros/schema_tests/at_least_one.sql", "name": "test_at_least_one", "macro_sql": "{% macro test_at_least_one(model) %}\n {{ return(adapter.dispatch('test_at_least_one', packages = dbt_utils._get_utils_namespaces())(model, **kwargs)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__test_at_least_one": {"unique_id": "macro.dbt_utils.default__test_at_least_one", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/schema_tests/at_least_one.sql", "original_file_path": "macros/schema_tests/at_least_one.sql", "name": "default__test_at_least_one", "macro_sql": "{% macro default__test_at_least_one(model) %}\n\n{% set column_name = kwargs.get('column_name', kwargs.get('arg')) %}\n\nselect count(*)\nfrom (\n select\n {# In TSQL, subquery aggregate columns need aliases #}\n {# thus: a filler col name, 'filler_column' #}\n count({{ column_name }}) as filler_column\n\n from {{ model }}\n\n having count({{ column_name }}) = 0\n\n) validation_errors\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.test_unique_combination_of_columns": {"unique_id": "macro.dbt_utils.test_unique_combination_of_columns", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/schema_tests/unique_combination_of_columns.sql", "original_file_path": "macros/schema_tests/unique_combination_of_columns.sql", "name": "test_unique_combination_of_columns", "macro_sql": "{% macro test_unique_combination_of_columns(model, quote_columns = false) %}\n {{ return(adapter.dispatch('test_unique_combination_of_columns', packages = dbt_utils._get_utils_namespaces())(model, quote_columns, **kwargs)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__test_unique_combination_of_columns": {"unique_id": "macro.dbt_utils.default__test_unique_combination_of_columns", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/schema_tests/unique_combination_of_columns.sql", "original_file_path": "macros/schema_tests/unique_combination_of_columns.sql", "name": "default__test_unique_combination_of_columns", "macro_sql": "{% macro default__test_unique_combination_of_columns(model, quote_columns = false) %}\n\n{%- set columns = kwargs.get('combination_of_columns', kwargs.get('arg')) %}\n\n{% if not quote_columns %}\n {%- set column_list=columns %}\n{% elif quote_columns %}\n {%- set column_list=[] %}\n {% for column in columns -%}\n {% set column_list = column_list.append( adapter.quote(column) ) %}\n {%- endfor %}\n{% else %}\n {{ exceptions.raise_compiler_error(\n \"`quote_columns` argument for unique_combination_of_columns test must be one of [True, False] Got: '\" ~ quote ~\"'.'\"\n ) }}\n{% endif %}\n\n{%- set columns_csv=column_list | join(', ') %}\n\n\nwith validation_errors as (\n\n select\n {{ columns_csv }}\n from {{ model }}\n\n group by {{ columns_csv }}\n having count(*) > 1\n\n)\n\nselect count(*)\nfrom validation_errors\n\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.test_cardinality_equality": {"unique_id": "macro.dbt_utils.test_cardinality_equality", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/schema_tests/cardinality_equality.sql", "original_file_path": "macros/schema_tests/cardinality_equality.sql", "name": "test_cardinality_equality", "macro_sql": "{% macro test_cardinality_equality(model, to, field) %}\n\n {{ return(adapter.dispatch('test_cardinality_equality', packages = dbt_utils._get_utils_namespaces())(model, to, field, **kwargs)) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__test_cardinality_equality": {"unique_id": "macro.dbt_utils.default__test_cardinality_equality", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/schema_tests/cardinality_equality.sql", "original_file_path": "macros/schema_tests/cardinality_equality.sql", "name": "default__test_cardinality_equality", "macro_sql": "{% macro default__test_cardinality_equality(model, to, field) %}\n\n{# T-SQL doesn't let you use numbers as aliases for columns #}\n{# Thus, no \"GROUP BY 1\" #}\n\n{% set column_name = kwargs.get('column_name', kwargs.get('from')) %}\n\n\nwith table_a as (\nselect\n {{ column_name }},\n count(*) as num_rows\nfrom {{ model }}\ngroup by {{ column_name }}\n),\n\ntable_b as (\nselect\n {{ field }},\n count(*) as num_rows\nfrom {{ to }}\ngroup by {{ field }}\n),\n\nexcept_a as (\n select *\n from table_a\n {{ dbt_utils.except() }}\n select *\n from table_b\n),\n\nexcept_b as (\n select *\n from table_b\n {{ dbt_utils.except() }}\n select *\n from table_a\n),\n\nunioned as (\n select *\n from except_a\n union all\n select *\n from except_b\n)\n\nselect count(*)\nfrom unioned\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.test_expression_is_true": {"unique_id": "macro.dbt_utils.test_expression_is_true", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/schema_tests/expression_is_true.sql", "original_file_path": "macros/schema_tests/expression_is_true.sql", "name": "test_expression_is_true", "macro_sql": "{% macro test_expression_is_true(model, condition='1=1') %}\n{# T-SQL has no boolean data type so we use 1=1 which returns TRUE #}\n{# ref https://stackoverflow.com/a/7170753/3842610 #}\n {{ return(adapter.dispatch('test_expression_is_true', packages = dbt_utils._get_utils_namespaces())(model, condition, **kwargs)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__test_expression_is_true": {"unique_id": "macro.dbt_utils.default__test_expression_is_true", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/schema_tests/expression_is_true.sql", "original_file_path": "macros/schema_tests/expression_is_true.sql", "name": "default__test_expression_is_true", "macro_sql": "{% macro default__test_expression_is_true(model, condition) %}\n\n{% set expression = kwargs.get('expression', kwargs.get('arg')) %}\n{% set column_name = kwargs.get('column_name') %}\n\nwith meet_condition as (\n\n select * from {{ model }} where {{ condition }}\n\n),\nvalidation_errors as (\n\n select\n *\n from meet_condition\n {% if column_name is none %}\n where not({{ expression }})\n {%- else %}\n where not({{ column_name }} {{ expression }})\n {%- endif %}\n\n)\n\nselect count(*)\nfrom validation_errors\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.test_sequential_values": {"unique_id": "macro.dbt_utils.test_sequential_values", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/schema_tests/sequential_values.sql", "original_file_path": "macros/schema_tests/sequential_values.sql", "name": "test_sequential_values", "macro_sql": "{% macro test_sequential_values(model, column_name, interval=1, datepart=None) %}\n\n {{ return(adapter.dispatch('test_sequential_values', packages=dbt_utils._get_utils_namespaces())(model, column_name, interval, datepart, **kwargs)) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__test_sequential_values": {"unique_id": "macro.dbt_utils.default__test_sequential_values", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/schema_tests/sequential_values.sql", "original_file_path": "macros/schema_tests/sequential_values.sql", "name": "default__test_sequential_values", "macro_sql": "{% macro default__test_sequential_values(model, column_name, interval, datepart) %}\n\nwith windowed as (\n\n select\n {{ column_name }},\n lag({{ column_name }}) over (\n order by {{ column_name }}\n ) as previous_{{ column_name }}\n from {{ model }}\n),\n\nvalidation_errors as (\n select\n *\n from windowed\n {% if datepart %}\n where not(cast({{ column_name }} as {{ dbt_utils.type_timestamp() }})= cast({{ dbt_utils.dateadd(datepart, interval, 'previous_' + column_name) }} as {{ dbt_utils.type_timestamp() }}))\n {% else %}\n where not({{ column_name }} = previous_{{ column_name }} + {{ interval }})\n {% endif %}\n)\n\nselect\n count(*)\nfrom validation_errors\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.test_not_null_where": {"unique_id": "macro.dbt_utils.test_not_null_where", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/schema_tests/test_not_null_where.sql", "original_file_path": "macros/schema_tests/test_not_null_where.sql", "name": "test_not_null_where", "macro_sql": "{% macro test_not_null_where(model) %}\r\n {{ return(adapter.dispatch('test_not_null_where', packages = dbt_utils._get_utils_namespaces())(model, **kwargs)) }}\r\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__test_not_null_where": {"unique_id": "macro.dbt_utils.default__test_not_null_where", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/schema_tests/test_not_null_where.sql", "original_file_path": "macros/schema_tests/test_not_null_where.sql", "name": "default__test_not_null_where", "macro_sql": "{% macro default__test_not_null_where(model) %}\r\n\r\n{% set column_name = kwargs.get('column_name', kwargs.get('arg')) %}\r\n{% set where = kwargs.get('where', kwargs.get('arg')) %}\r\n\r\nselect count(*)\r\nfrom {{ model }}\r\nwhere {{ column_name }} is null\r\n{% if where %} and {{ where }} {% endif %}\r\n\r\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.test_equality": {"unique_id": "macro.dbt_utils.test_equality", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/schema_tests/equality.sql", "original_file_path": "macros/schema_tests/equality.sql", "name": "test_equality", "macro_sql": "{% macro test_equality(model) %}\n {{ return(adapter.dispatch('test_equality', packages = dbt_utils._get_utils_namespaces())(model, **kwargs)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__test_equality": {"unique_id": "macro.dbt_utils.default__test_equality", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/schema_tests/equality.sql", "original_file_path": "macros/schema_tests/equality.sql", "name": "default__test_equality", "macro_sql": "{% macro default__test_equality(model) %}\n\n\n{#-- Prevent querying of db in parsing mode. This works because this macro does not create any new refs. #}\n{%- if not execute -%}\n {{ return('') }}\n{% endif %}\n\n-- setup\n{%- do dbt_utils._is_relation(model, 'test_equality') -%}\n\n{#-\nIf the compare_cols arg is provided, we can run this test without querying the\ninformation schema\u00a0\u2014 this allows the model to be an ephemeral model\n-#}\n{%- set compare_columns = kwargs.get('compare_columns', None) -%}\n\n{%- if not compare_columns -%}\n {%- do dbt_utils._is_ephemeral(model, 'test_equality') -%}\n {%- set compare_columns = adapter.get_columns_in_relation(model) | map(attribute='quoted') -%}\n{%- endif -%}\n\n{% set compare_model = kwargs.get('compare_model', kwargs.get('arg')) %}\n{% set compare_cols_csv = compare_columns | join(', ') %}\n\nwith a as (\n\n select * from {{ model }}\n\n),\n\nb as (\n\n select * from {{ compare_model }}\n\n),\n\na_minus_b as (\n\n select {{compare_cols_csv}} from a\n {{ dbt_utils.except() }}\n select {{compare_cols_csv}} from b\n\n),\n\nb_minus_a as (\n\n select {{compare_cols_csv}} from b\n {{ dbt_utils.except() }}\n select {{compare_cols_csv}} from a\n\n),\n\nunioned as (\n\n select * from a_minus_b\n union all\n select * from b_minus_a\n\n),\n\nfinal as (\n\n select (select count(*) from unioned) +\n (select abs(\n (select count(*) from a_minus_b) -\n (select count(*) from b_minus_a)\n ))\n as count\n\n)\n\nselect count from final\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.test_mutually_exclusive_ranges": {"unique_id": "macro.dbt_utils.test_mutually_exclusive_ranges", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/schema_tests/mutually_exclusive_ranges.sql", "original_file_path": "macros/schema_tests/mutually_exclusive_ranges.sql", "name": "test_mutually_exclusive_ranges", "macro_sql": "{% macro test_mutually_exclusive_ranges(model, lower_bound_column, upper_bound_column, partition_by=None, gaps='allowed', zero_length_range_allowed=False) %}\n {{ return(adapter.dispatch('test_mutually_exclusive_ranges', packages = dbt_utils._get_utils_namespaces())(model, lower_bound_column, upper_bound_column, partition_by, gaps, zero_length_range_allowed)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__test_mutually_exclusive_ranges": {"unique_id": "macro.dbt_utils.default__test_mutually_exclusive_ranges", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/schema_tests/mutually_exclusive_ranges.sql", "original_file_path": "macros/schema_tests/mutually_exclusive_ranges.sql", "name": "default__test_mutually_exclusive_ranges", "macro_sql": "{% macro default__test_mutually_exclusive_ranges(model, lower_bound_column, upper_bound_column, partition_by=None, gaps='allowed', zero_length_range_allowed=False) %}\n{% if gaps == 'not_allowed' %}\n {% set allow_gaps_operator='=' %}\n {% set allow_gaps_operator_in_words='equal_to' %}\n{% elif gaps == 'allowed' %}\n {% set allow_gaps_operator='<=' %}\n {% set allow_gaps_operator_in_words='less_than_or_equal_to' %}\n{% elif gaps == 'required' %}\n {% set allow_gaps_operator='<' %}\n {% set allow_gaps_operator_in_words='less_than' %}\n{% else %}\n {{ exceptions.raise_compiler_error(\n \"`gaps` argument for mutually_exclusive_ranges test must be one of ['not_allowed', 'allowed', 'required'] Got: '\" ~ gaps ~\"'.'\"\n ) }}\n{% endif %}\n{% if not zero_length_range_allowed %}\n {% set allow_zero_length_operator='<' %}\n {% set allow_zero_length_operator_in_words='less_than' %}\n{% elif zero_length_range_allowed %}\n {% set allow_zero_length_operator='<=' %}\n {% set allow_zero_length_operator_in_words='less_than_or_equal_to' %}\n{% else %}\n {{ exceptions.raise_compiler_error(\n \"`zero_length_range_allowed` argument for mutually_exclusive_ranges test must be one of [true, false] Got: '\" ~ zero_length_range_allowed ~\"'.'\"\n ) }}\n{% endif %}\n\n{% set partition_clause=\"partition by \" ~ partition_by if partition_by else '' %}\n\nwith window_functions as (\n\n select\n {% if partition_by %}\n {{ partition_by }},\n {% endif %}\n {{ lower_bound_column }} as lower_bound,\n {{ upper_bound_column }} as upper_bound,\n\n lead({{ lower_bound_column }}) over (\n {{ partition_clause }}\n order by {{ lower_bound_column }}\n ) as next_lower_bound,\n\n row_number() over (\n {{ partition_clause }}\n order by {{ lower_bound_column }} desc\n ) = 1 as is_last_record\n\n from {{ model }}\n\n),\n\ncalc as (\n -- We want to return records where one of our assumptions fails, so we'll use\n -- the `not` function with `and` statements so we can write our assumptions nore cleanly\n select\n *,\n\n -- For each record: lower_bound should be < upper_bound.\n -- Coalesce it to return an error on the null case (implicit assumption\n -- these columns are not_null)\n coalesce(\n lower_bound {{ allow_zero_length_operator }} upper_bound,\n false\n ) as lower_bound_{{ allow_zero_length_operator_in_words }}_upper_bound,\n\n -- For each record: upper_bound {{ allow_gaps_operator }} the next lower_bound.\n -- Coalesce it to handle null cases for the last record.\n coalesce(\n upper_bound {{ allow_gaps_operator }} next_lower_bound,\n is_last_record,\n false\n ) as upper_bound_{{ allow_gaps_operator_in_words }}_next_lower_bound\n\n from window_functions\n\n),\n\nvalidation_errors as (\n\n select\n *\n from calc\n\n where not(\n -- THE FOLLOWING SHOULD BE TRUE --\n lower_bound_{{ allow_zero_length_operator_in_words }}_upper_bound\n and upper_bound_{{ allow_gaps_operator_in_words }}_next_lower_bound\n )\n)\n\nselect count(*) from validation_errors\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.get_intervals_between": {"unique_id": "macro.dbt_utils.get_intervals_between", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/sql/date_spine.sql", "original_file_path": "macros/sql/date_spine.sql", "name": "get_intervals_between", "macro_sql": "{% macro get_intervals_between(start_date, end_date, datepart) -%}\n {{ return(adapter.dispatch('get_intervals_between', packages = dbt_utils._get_utils_namespaces())(start_date, end_date, datepart)) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__get_intervals_between": {"unique_id": "macro.dbt_utils.default__get_intervals_between", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/sql/date_spine.sql", "original_file_path": "macros/sql/date_spine.sql", "name": "default__get_intervals_between", "macro_sql": "{% macro default__get_intervals_between(start_date, end_date, datepart) -%}\n {%- call statement('get_intervals_between', fetch_result=True) %}\n\n select {{dbt_utils.datediff(start_date, end_date, datepart)}}\n\n {%- endcall -%}\n\n {%- set value_list = load_result('get_intervals_between') -%}\n\n {%- if value_list and value_list['data'] -%}\n {%- set values = value_list['data'] | map(attribute=0) | list %}\n {{ return(values[0]) }}\n {%- else -%}\n {{ return(1) }}\n {%- endif -%}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.date_spine": {"unique_id": "macro.dbt_utils.date_spine", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/sql/date_spine.sql", "original_file_path": "macros/sql/date_spine.sql", "name": "date_spine", "macro_sql": "{% macro date_spine(datepart, start_date, end_date) %}\n {{ return(adapter.dispatch('date_spine', packages = dbt_utils._get_utils_namespaces())(datepart, start_date, end_date)) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__date_spine": {"unique_id": "macro.dbt_utils.default__date_spine", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/sql/date_spine.sql", "original_file_path": "macros/sql/date_spine.sql", "name": "default__date_spine", "macro_sql": "{% macro default__date_spine(datepart, start_date, end_date) %}\n\n/*\ncall as follows:\n\ndate_spine(\n \"day\",\n \"to_date('01/01/2016', 'mm/dd/yyyy')\",\n \"dateadd(week, 1, current_date)\"\n)\n\n*/\n\nwith rawdata as (\n\n {{dbt_utils.generate_series(\n dbt_utils.get_intervals_between(start_date, end_date, datepart)\n )}}\n\n),\n\nall_periods as (\n\n select (\n {{\n dbt_utils.dateadd(\n datepart,\n \"row_number() over (order by 1) - 1\",\n start_date\n )\n }}\n ) as date_{{datepart}}\n from rawdata\n\n),\n\nfiltered as (\n\n select *\n from all_periods\n where date_{{datepart}} <= {{ end_date }}\n\n)\n\nselect * from filtered\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.nullcheck_table": {"unique_id": "macro.dbt_utils.nullcheck_table", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/sql/nullcheck_table.sql", "original_file_path": "macros/sql/nullcheck_table.sql", "name": "nullcheck_table", "macro_sql": "{% macro nullcheck_table(relation) %}\n {{ return(adapter.dispatch('nullcheck_table', packages = dbt_utils._get_utils_namespaces())(relation)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__nullcheck_table": {"unique_id": "macro.dbt_utils.default__nullcheck_table", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/sql/nullcheck_table.sql", "original_file_path": "macros/sql/nullcheck_table.sql", "name": "default__nullcheck_table", "macro_sql": "{% macro default__nullcheck_table(relation) %}\n\n {%- do dbt_utils._is_relation(relation, 'nullcheck_table') -%}\n {%- do dbt_utils._is_ephemeral(relation, 'nullcheck_table') -%}\n {% set cols = adapter.get_columns_in_relation(relation) %}\n\n select {{ dbt_utils.nullcheck(cols) }}\n from {{relation}}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.get_relations_by_pattern": {"unique_id": "macro.dbt_utils.get_relations_by_pattern", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/sql/get_relations_by_pattern.sql", "original_file_path": "macros/sql/get_relations_by_pattern.sql", "name": "get_relations_by_pattern", "macro_sql": "{% macro get_relations_by_pattern(schema_pattern, table_pattern, exclude='', database=target.database) %}\n {{ return(adapter.dispatch('get_relations_by_pattern', packages = dbt_utils._get_utils_namespaces())(schema_pattern, table_pattern, exclude, database)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__get_relations_by_pattern": {"unique_id": "macro.dbt_utils.default__get_relations_by_pattern", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/sql/get_relations_by_pattern.sql", "original_file_path": "macros/sql/get_relations_by_pattern.sql", "name": "default__get_relations_by_pattern", "macro_sql": "{% macro default__get_relations_by_pattern(schema_pattern, table_pattern, exclude='', database=target.database) %}\n\n {%- call statement('get_tables', fetch_result=True) %}\n\n {{ dbt_utils.get_tables_by_pattern_sql(schema_pattern, table_pattern, exclude, database) }}\n\n {%- endcall -%}\n\n {%- set table_list = load_result('get_tables') -%}\n\n {%- if table_list and table_list['table'] -%}\n {%- set tbl_relations = [] -%}\n {%- for row in table_list['table'] -%}\n {%- set tbl_relation = api.Relation.create(\n database=database,\n schema=row.table_schema,\n identifier=row.table_name,\n type=row.table_type\n ) -%}\n {%- do tbl_relations.append(tbl_relation) -%}\n {%- endfor -%}\n\n {{ return(tbl_relations) }}\n {%- else -%}\n {{ return([]) }}\n {%- endif -%}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.get_powers_of_two": {"unique_id": "macro.dbt_utils.get_powers_of_two", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/sql/generate_series.sql", "original_file_path": "macros/sql/generate_series.sql", "name": "get_powers_of_two", "macro_sql": "{% macro get_powers_of_two(upper_bound) %}\n {{ return(adapter.dispatch('get_powers_of_two', packages = dbt_utils._get_utils_namespaces())(upper_bound)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__get_powers_of_two": {"unique_id": "macro.dbt_utils.default__get_powers_of_two", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/sql/generate_series.sql", "original_file_path": "macros/sql/generate_series.sql", "name": "default__get_powers_of_two", "macro_sql": "{% macro default__get_powers_of_two(upper_bound) %}\n\n {% if upper_bound <= 0 %}\n {{ exceptions.raise_compiler_error(\"upper bound must be positive\") }}\n {% endif %}\n\n {% for _ in range(1, 100) %}\n {% if upper_bound <= 2 ** loop.index %}{{ return(loop.index) }}{% endif %}\n {% endfor %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.generate_series": {"unique_id": "macro.dbt_utils.generate_series", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/sql/generate_series.sql", "original_file_path": "macros/sql/generate_series.sql", "name": "generate_series", "macro_sql": "{% macro generate_series(upper_bound) %}\n {{ return(adapter.dispatch('generate_series', packages = dbt_utils._get_utils_namespaces())(upper_bound)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__generate_series": {"unique_id": "macro.dbt_utils.default__generate_series", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/sql/generate_series.sql", "original_file_path": "macros/sql/generate_series.sql", "name": "default__generate_series", "macro_sql": "{% macro default__generate_series(upper_bound) %}\n\n {% set n = dbt_utils.get_powers_of_two(upper_bound) %}\n\n with p as (\n select 0 as generated_number union all select 1\n ), unioned as (\n\n select\n\n {% for i in range(n) %}\n p{{i}}.generated_number * pow(2, {{i}})\n {% if not loop.last %} + {% endif %}\n {% endfor %}\n + 1\n as generated_number\n\n from\n\n {% for i in range(n) %}\n p as p{{i}}\n {% if not loop.last %} cross join {% endif %}\n {% endfor %}\n\n )\n\n select *\n from unioned\n where generated_number <= {{upper_bound}}\n order by generated_number\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.get_relations_by_prefix": {"unique_id": "macro.dbt_utils.get_relations_by_prefix", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/sql/get_relations_by_prefix.sql", "original_file_path": "macros/sql/get_relations_by_prefix.sql", "name": "get_relations_by_prefix", "macro_sql": "{% macro get_relations_by_prefix(schema, prefix, exclude='', database=target.database) %}\n {{ return(adapter.dispatch('get_relations_by_prefix', packages = dbt_utils._get_utils_namespaces())(schema, prefix, exclude, database)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__get_relations_by_prefix": {"unique_id": "macro.dbt_utils.default__get_relations_by_prefix", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/sql/get_relations_by_prefix.sql", "original_file_path": "macros/sql/get_relations_by_prefix.sql", "name": "default__get_relations_by_prefix", "macro_sql": "{% macro default__get_relations_by_prefix(schema, prefix, exclude='', database=target.database) %}\n\n {%- call statement('get_tables', fetch_result=True) %}\n\n {{ dbt_utils.get_tables_by_prefix_sql(schema, prefix, exclude, database) }}\n\n {%- endcall -%}\n\n {%- set table_list = load_result('get_tables') -%}\n\n {%- if table_list and table_list['table'] -%}\n {%- set tbl_relations = [] -%}\n {%- for row in table_list['table'] -%}\n {%- set tbl_relation = api.Relation.create(\n database=database,\n schema=row.table_schema,\n identifier=row.table_name,\n type=row.table_type\n ) -%}\n {%- do tbl_relations.append(tbl_relation) -%}\n {%- endfor -%}\n\n {{ return(tbl_relations) }}\n {%- else -%}\n {{ return([]) }}\n {%- endif -%}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.get_tables_by_prefix_sql": {"unique_id": "macro.dbt_utils.get_tables_by_prefix_sql", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/sql/get_tables_by_prefix_sql.sql", "original_file_path": "macros/sql/get_tables_by_prefix_sql.sql", "name": "get_tables_by_prefix_sql", "macro_sql": "{% macro get_tables_by_prefix_sql(schema, prefix, exclude='', database=target.database) %}\n {{ return(adapter.dispatch('get_tables_by_prefix_sql', packages = dbt_utils._get_utils_namespaces())(schema, prefix, exclude, database)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__get_tables_by_prefix_sql": {"unique_id": "macro.dbt_utils.default__get_tables_by_prefix_sql", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/sql/get_tables_by_prefix_sql.sql", "original_file_path": "macros/sql/get_tables_by_prefix_sql.sql", "name": "default__get_tables_by_prefix_sql", "macro_sql": "{% macro default__get_tables_by_prefix_sql(schema, prefix, exclude='', database=target.database) %}\n\n {{ dbt_utils.get_tables_by_pattern_sql(\n schema_pattern = schema,\n table_pattern = prefix ~ '%',\n exclude = exclude,\n database = database\n ) }}\n \n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.star": {"unique_id": "macro.dbt_utils.star", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/sql/star.sql", "original_file_path": "macros/sql/star.sql", "name": "star", "macro_sql": "{% macro star(from, relation_alias=False, except=[]) -%}\n {{ return(adapter.dispatch('star', packages = dbt_utils._get_utils_namespaces())(from, relation_alias, except)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__star": {"unique_id": "macro.dbt_utils.default__star", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/sql/star.sql", "original_file_path": "macros/sql/star.sql", "name": "default__star", "macro_sql": "{% macro default__star(from, relation_alias=False, except=[]) -%}\n {%- do dbt_utils._is_relation(from, 'star') -%}\n {%- do dbt_utils._is_ephemeral(from, 'star') -%}\n\n {#-- Prevent querying of db in parsing mode. This works because this macro does not create any new refs. #}\n {%- if not execute -%}\n {{ return('') }}\n {% endif %}\n\n {%- set include_cols = [] %}\n {%- set cols = adapter.get_columns_in_relation(from) -%}\n\n {%- for col in cols -%}\n\n {%- if col.column not in except -%}\n {% do include_cols.append(col.column) %}\n\n {%- endif %}\n {%- endfor %}\n\n {%- for col in include_cols %}\n\n {%- if relation_alias %}{{ relation_alias }}.{% else %}{%- endif -%}{{ adapter.quote(col)|trim }}\n {%- if not loop.last %},{{ '\\n ' }}{% endif %}\n\n {%- endfor -%}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.unpivot": {"unique_id": "macro.dbt_utils.unpivot", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/sql/unpivot.sql", "original_file_path": "macros/sql/unpivot.sql", "name": "unpivot", "macro_sql": "{% macro unpivot(relation=none, cast_to='varchar', exclude=none, remove=none, field_name='field_name', value_name='value', table=none) -%}\n {{ return(adapter.dispatch('unpivot', packages = dbt_utils._get_utils_namespaces())(relation, cast_to, exclude, remove, field_name, value_name, table)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__unpivot": {"unique_id": "macro.dbt_utils.default__unpivot", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/sql/unpivot.sql", "original_file_path": "macros/sql/unpivot.sql", "name": "default__unpivot", "macro_sql": "{% macro default__unpivot(relation=none, cast_to='varchar', exclude=none, remove=none, field_name='field_name', value_name='value', table=none) -%}\n\n {% if table %}\n {%- set error_message = '\n Warning: the `unpivot` macro no longer accepts a `table` parameter. \\\n This parameter will be deprecated in a future release of dbt-utils. Use the `relation` parameter instead. \\\n The {}.{} model triggered this warning. \\\n '.format(model.package_name, model.name) -%}\n {%- do exceptions.warn(error_message) -%}\n {% endif %}\n\n {% if relation and table %}\n {{ exceptions.raise_compiler_error(\"Error: both the `relation` and `table` parameters were provided to `unpivot` macro. Choose one only (we recommend `relation`).\") }}\n {% elif not relation and table %}\n {% set relation=table %}\n {% elif not relation and not table %}\n {{ exceptions.raise_compiler_error(\"Error: argument `relation` is required for `unpivot` macro.\") }}\n {% endif %}\n\n {%- set exclude = exclude if exclude is not none else [] %}\n {%- set remove = remove if remove is not none else [] %}\n\n {%- set include_cols = [] %}\n\n {%- set table_columns = {} %}\n\n {%- do table_columns.update({relation: []}) %}\n\n {%- do dbt_utils._is_relation(relation, 'unpivot') -%}\n {%- do dbt_utils._is_ephemeral(relation, 'unpivot') -%}\n {%- set cols = adapter.get_columns_in_relation(relation) %}\n\n {%- for col in cols -%}\n {%- if col.column.lower() not in remove|map('lower') and col.column.lower() not in exclude|map('lower') -%}\n {% do include_cols.append(col) %}\n {%- endif %}\n {%- endfor %}\n\n\n {%- for col in include_cols -%}\n select\n {%- for exclude_col in exclude %}\n {{ exclude_col }},\n {%- endfor %}\n\n cast('{{ col.column }}' as {{ dbt_utils.type_string() }}) as {{ field_name }},\n cast( {% if col.data_type == 'boolean' %}\n {{ dbt_utils.cast_bool_to_text(col.column) }}\n {% else %}\n {{ col.column }}\n {% endif %}\n as {{ cast_to }}) as {{ value_name }}\n\n from {{ relation }}\n\n {% if not loop.last -%}\n union all\n {% endif -%}\n {%- endfor -%}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.union_relations": {"unique_id": "macro.dbt_utils.union_relations", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/sql/union.sql", "original_file_path": "macros/sql/union.sql", "name": "union_relations", "macro_sql": "{%- macro union_relations(relations, column_override=none, include=[], exclude=[], source_column_name='_dbt_source_relation') -%}\n {{ return(adapter.dispatch('union_relations', packages = dbt_utils._get_utils_namespaces())(relations, column_override, include, exclude, source_column_name)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__union_relations": {"unique_id": "macro.dbt_utils.default__union_relations", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/sql/union.sql", "original_file_path": "macros/sql/union.sql", "name": "default__union_relations", "macro_sql": "\n\n{%- macro default__union_relations(relations, column_override=none, include=[], exclude=[], source_column_name='_dbt_source_relation') -%}\n\n {%- if exclude and include -%}\n {{ exceptions.raise_compiler_error(\"Both an exclude and include list were provided to the `union` macro. Only one is allowed\") }}\n {%- endif -%}\n\n {#-- Prevent querying of db in parsing mode. This works because this macro does not create any new refs. -#}\n {%- if not execute %}\n {{ return('') }}\n {% endif -%}\n\n {%- set column_override = column_override if column_override is not none else {} -%}\n\n {%- set relation_columns = {} -%}\n {%- set column_superset = {} -%}\n\n {%- for relation in relations -%}\n\n {%- do relation_columns.update({relation: []}) -%}\n\n {%- do dbt_utils._is_relation(relation, 'union_relations') -%}\n {%- do dbt_utils._is_ephemeral(relation, 'union_relations') -%}\n {%- set cols = adapter.get_columns_in_relation(relation) -%}\n {%- for col in cols -%}\n\n {#- If an exclude list was provided and the column is in the list, do nothing -#}\n {%- if exclude and col.column in exclude -%}\n\n {#- If an include list was provided and the column is not in the list, do nothing -#}\n {%- elif include and col.column not in include -%}\n\n {#- Otherwise add the column to the column superset -#}\n {%- else -%}\n\n {#- update the list of columns in this relation -#}\n {%- do relation_columns[relation].append(col.column) -%}\n\n {%- if col.column in column_superset -%}\n\n {%- set stored = column_superset[col.column] -%}\n {%- if col.is_string() and stored.is_string() and col.string_size() > stored.string_size() -%}\n\n {%- do column_superset.update({col.column: col}) -%}\n\n {%- endif %}\n\n {%- else -%}\n\n {%- do column_superset.update({col.column: col}) -%}\n\n {%- endif -%}\n\n {%- endif -%}\n\n {%- endfor -%}\n {%- endfor -%}\n\n {%- set ordered_column_names = column_superset.keys() -%}\n\n {%- for relation in relations %}\n\n (\n select\n\n cast({{ dbt_utils.string_literal(relation) }} as {{ dbt_utils.type_string() }}) as {{ source_column_name }},\n {% for col_name in ordered_column_names -%}\n\n {%- set col = column_superset[col_name] %}\n {%- set col_type = column_override.get(col.column, col.data_type) %}\n {%- set col_name = adapter.quote(col_name) if col_name in relation_columns[relation] else 'null' %}\n cast({{ col_name }} as {{ col_type }}) as {{ col.quoted }} {% if not loop.last %},{% endif -%}\n\n {%- endfor %}\n\n from {{ relation }}\n )\n\n {% if not loop.last -%}\n union all\n {% endif -%}\n\n {%- endfor -%}\n\n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.group_by": {"unique_id": "macro.dbt_utils.group_by", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/sql/groupby.sql", "original_file_path": "macros/sql/groupby.sql", "name": "group_by", "macro_sql": "{%- macro group_by(n) -%}\n {{ return(adapter.dispatch('group_by', packages = dbt_utils._get_utils_namespaces())(n)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__group_by": {"unique_id": "macro.dbt_utils.default__group_by", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/sql/groupby.sql", "original_file_path": "macros/sql/groupby.sql", "name": "default__group_by", "macro_sql": "\n\n{%- macro default__group_by(n) -%}\n\n group by {% for i in range(1, n + 1) -%}\n {{ i }}{{ ',' if not loop.last }} \n {%- endfor -%}\n\n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.surrogate_key": {"unique_id": "macro.dbt_utils.surrogate_key", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/sql/surrogate_key.sql", "original_file_path": "macros/sql/surrogate_key.sql", "name": "surrogate_key", "macro_sql": "{%- macro surrogate_key(field_list) -%}\n {# needed for safe_add to allow for non-keyword arguments see SO post #}\n {# https://stackoverflow.com/questions/13944751/args-kwargs-in-jinja2-macros #}\n {% set frustrating_jinja_feature = varargs %}\n {{ return(adapter.dispatch('surrogate_key', packages = dbt_utils._get_utils_namespaces())(field_list, *varargs)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__surrogate_key": {"unique_id": "macro.dbt_utils.default__surrogate_key", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/sql/surrogate_key.sql", "original_file_path": "macros/sql/surrogate_key.sql", "name": "default__surrogate_key", "macro_sql": "\n\n{%- macro default__surrogate_key(field_list) -%}\n\n{%- if varargs|length >= 1 or field_list is string %}\n\n{%- set error_message = '\nWarning: the `surrogate_key` macro now takes a single list argument instead of \\\nmultiple string arguments. Support for multiple string arguments will be \\\ndeprecated in a future release of dbt-utils. The {}.{} model triggered this warning. \\\n'.format(model.package_name, model.name) -%}\n\n{%- do exceptions.warn(error_message) -%}\n\n{# first argument is not included in varargs, so add first element to field_list_xf #}\n{%- set field_list_xf = [field_list] -%}\n\n{%- for field in varargs %}\n{%- set _ = field_list_xf.append(field) -%}\n{%- endfor -%}\n\n{%- else -%}\n\n{# if using list, just set field_list_xf as field_list #}\n{%- set field_list_xf = field_list -%}\n\n{%- endif -%}\n\n\n{%- set fields = [] -%}\n\n{%- for field in field_list_xf -%}\n\n {%- set _ = fields.append(\n \"coalesce(cast(\" ~ field ~ \" as \" ~ dbt_utils.type_string() ~ \"), '')\"\n ) -%}\n\n {%- if not loop.last %}\n {%- set _ = fields.append(\"'-'\") -%}\n {%- endif -%}\n\n{%- endfor -%}\n\n{{dbt_utils.hash(dbt_utils.concat(fields))}}\n\n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.safe_add": {"unique_id": "macro.dbt_utils.safe_add", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/sql/safe_add.sql", "original_file_path": "macros/sql/safe_add.sql", "name": "safe_add", "macro_sql": "{%- macro safe_add() -%}\n {# needed for safe_add to allow for non-keyword arguments see SO post #}\n {# https://stackoverflow.com/questions/13944751/args-kwargs-in-jinja2-macros #}\n {% set frustrating_jinja_feature = varargs %}\n {{ return(adapter.dispatch('safe_add', packages = dbt_utils._get_utils_namespaces())(*varargs)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__safe_add": {"unique_id": "macro.dbt_utils.default__safe_add", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/sql/safe_add.sql", "original_file_path": "macros/sql/safe_add.sql", "name": "default__safe_add", "macro_sql": "\n\n{%- macro default__safe_add() -%}\n\n{% set fields = [] %}\n\n{%- for field in varargs -%}\n\n {% do fields.append(\"coalesce(\" ~ field ~ \", 0)\") %}\n\n{%- endfor -%}\n\n{{ fields|join(' +\\n ') }}\n\n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.nullcheck": {"unique_id": "macro.dbt_utils.nullcheck", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/sql/nullcheck.sql", "original_file_path": "macros/sql/nullcheck.sql", "name": "nullcheck", "macro_sql": "{% macro nullcheck(cols) %}\n {{ return(adapter.dispatch('nullcheck', packages = dbt_utils._get_utils_namespaces())(cols)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__nullcheck": {"unique_id": "macro.dbt_utils.default__nullcheck", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/sql/nullcheck.sql", "original_file_path": "macros/sql/nullcheck.sql", "name": "default__nullcheck", "macro_sql": "{% macro default__nullcheck(cols) %}\n{%- for col in cols %}\n\n {% if col.is_string() -%}\n\n nullif({{col.name}},'') as {{col.name}}\n\n {%- else -%}\n\n {{col.name}}\n\n {%- endif -%}\n\n{%- if not loop.last -%} , {%- endif -%}\n\n{%- endfor -%}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.get_tables_by_pattern_sql": {"unique_id": "macro.dbt_utils.get_tables_by_pattern_sql", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/sql/get_tables_by_pattern_sql.sql", "original_file_path": "macros/sql/get_tables_by_pattern_sql.sql", "name": "get_tables_by_pattern_sql", "macro_sql": "{% macro get_tables_by_pattern_sql(schema_pattern, table_pattern, exclude='', database=target.database) %}\n {{ return(adapter.dispatch('get_tables_by_pattern_sql', packages = dbt_utils._get_utils_namespaces())\n (schema_pattern, table_pattern, exclude, database)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__get_tables_by_pattern_sql": {"unique_id": "macro.dbt_utils.default__get_tables_by_pattern_sql", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/sql/get_tables_by_pattern_sql.sql", "original_file_path": "macros/sql/get_tables_by_pattern_sql.sql", "name": "default__get_tables_by_pattern_sql", "macro_sql": "{% macro default__get_tables_by_pattern_sql(schema_pattern, table_pattern, exclude='', database=target.database) %}\n\n select distinct\n table_schema as \"table_schema\",\n table_name as \"table_name\",\n case table_type\n when 'BASE TABLE' then 'table'\n when 'EXTERNAL TABLE' then 'external'\n when 'MATERIALIZED VIEW' then 'materializedview'\n else lower(table_type)\n end as \"table_type\"\n from {{ database }}.information_schema.tables\n where table_schema ilike '{{ schema_pattern }}'\n and table_name ilike '{{ table_pattern }}'\n and table_name not ilike '{{ exclude }}'\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.bigquery__get_tables_by_pattern_sql": {"unique_id": "macro.dbt_utils.bigquery__get_tables_by_pattern_sql", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/sql/get_tables_by_pattern_sql.sql", "original_file_path": "macros/sql/get_tables_by_pattern_sql.sql", "name": "bigquery__get_tables_by_pattern_sql", "macro_sql": "{% macro bigquery__get_tables_by_pattern_sql(schema_pattern, table_pattern, exclude='', database=target.database) %}\n\n {% if '%' in schema_pattern %}\n {% set schemata=dbt_utils._bigquery__get_matching_schemata(schema_pattern, database) %}\n {% else %}\n {% set schemata=[schema_pattern] %}\n {% endif %}\n\n {% set sql %}\n {% for schema in schemata %}\n select distinct\n table_schema,\n table_name,\n case table_type\n when 'BASE TABLE' then 'table'\n else lower(table_type)\n end as table_type\n\n from {{ adapter.quote(database) }}.{{ schema }}.INFORMATION_SCHEMA.TABLES\n where lower(table_name) like lower ('{{ table_pattern }}')\n and lower(table_name) not like lower ('{{ exclude }}')\n\n {% if not loop.last %} union all {% endif %}\n\n {% endfor %}\n {% endset %}\n\n {{ return(sql) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils._bigquery__get_matching_schemata": {"unique_id": "macro.dbt_utils._bigquery__get_matching_schemata", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/sql/get_tables_by_pattern_sql.sql", "original_file_path": "macros/sql/get_tables_by_pattern_sql.sql", "name": "_bigquery__get_matching_schemata", "macro_sql": "{% macro _bigquery__get_matching_schemata(schema_pattern, database) %}\n {% if execute %}\n\n {% set sql %}\n select schema_name from {{ adapter.quote(database) }}.INFORMATION_SCHEMA.SCHEMATA\n where lower(schema_name) like lower('{{ schema_pattern }}')\n {% endset %}\n\n {% set results=run_query(sql) %}\n\n {% set schemata=results.columns['schema_name'].values() %}\n\n {{ return(schemata) }}\n\n {% else %}\n\n {{ return([]) }}\n\n {% endif %}\n\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.get_column_values": {"unique_id": "macro.dbt_utils.get_column_values", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/sql/get_column_values.sql", "original_file_path": "macros/sql/get_column_values.sql", "name": "get_column_values", "macro_sql": "{% macro get_column_values(table, column, max_records=none, default=none) -%}\n {{ return(adapter.dispatch('get_column_values', packages = dbt_utils._get_utils_namespaces())(table, column, max_records, default)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__get_column_values": {"unique_id": "macro.dbt_utils.default__get_column_values", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/sql/get_column_values.sql", "original_file_path": "macros/sql/get_column_values.sql", "name": "default__get_column_values", "macro_sql": "{% macro default__get_column_values(table, column, max_records=none, default=none) -%}\n\n{#-- Prevent querying of db in parsing mode. This works because this macro does not create any new refs. #}\n {%- if not execute -%}\n {{ return('') }}\n {% endif %}\n{#-- #}\n\n {%- set target_relation = adapter.get_relation(database=table.database,\n schema=table.schema,\n identifier=table.identifier) -%}\n\n {%- call statement('get_column_values', fetch_result=true) %}\n\n {%- if not target_relation and default is none -%}\n\n {{ exceptions.raise_compiler_error(\"In get_column_values(): relation \" ~ table ~ \" does not exist and no default value was provided.\") }}\n\n {%- elif not target_relation and default is not none -%}\n\n {{ log(\"Relation \" ~ table ~ \" does not exist. Returning the default value: \" ~ default) }}\n\n {{ return(default) }}\n\n {%- else -%}\n\n select\n {{ column }} as value\n\n from {{ target_relation }}\n group by 1\n order by count(*) desc\n\n {% if max_records is not none %}\n limit {{ max_records }}\n {% endif %}\n\n {% endif %}\n\n {%- endcall -%}\n\n {%- set value_list = load_result('get_column_values') -%}\n\n {%- if value_list and value_list['data'] -%}\n {%- set values = value_list['data'] | map(attribute=0) | list %}\n {{ return(values) }}\n {%- else -%}\n {{ return(default) }}\n {%- endif -%}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.pivot": {"unique_id": "macro.dbt_utils.pivot", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/sql/pivot.sql", "original_file_path": "macros/sql/pivot.sql", "name": "pivot", "macro_sql": "{% macro pivot(column,\n values,\n alias=True,\n agg='sum',\n cmp='=',\n prefix='',\n suffix='',\n then_value=1,\n else_value=0,\n quote_identifiers=True,\n distinct=False) %}\n {{ return(adapter.dispatch('pivot', packages = dbt_utils._get_utils_namespaces())(column, values, alias, agg, cmp, prefix, suffix, then_value, else_value, quote_identifiers, distinct)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__pivot": {"unique_id": "macro.dbt_utils.default__pivot", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/sql/pivot.sql", "original_file_path": "macros/sql/pivot.sql", "name": "default__pivot", "macro_sql": "{% macro default__pivot(column,\n values,\n alias=True,\n agg='sum',\n cmp='=',\n prefix='',\n suffix='',\n then_value=1,\n else_value=0,\n quote_identifiers=True,\n distinct=False) %}\n {% for v in values %}\n {{ agg }}(\n {% if distinct %} distinct {% endif %}\n case\n when {{ column }} {{ cmp }} '{{ v }}'\n then {{ then_value }}\n else {{ else_value }}\n end\n )\n {% if alias %}\n {% if quote_identifiers %}\n as {{ adapter.quote(prefix ~ v ~ suffix) }}\n {% else %}\n as {{prefix ~ v ~ suffix }}\n {% endif %}\n {% endif %}\n {% if not loop.last %},{% endif %}\n {% endfor %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.get_query_results_as_dict": {"unique_id": "macro.dbt_utils.get_query_results_as_dict", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/sql/get_query_results_as_dict.sql", "original_file_path": "macros/sql/get_query_results_as_dict.sql", "name": "get_query_results_as_dict", "macro_sql": "{% macro get_query_results_as_dict(query) %}\n {{ return(adapter.dispatch('get_query_results_as_dict', packages = dbt_utils._get_utils_namespaces())(query)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__get_query_results_as_dict": {"unique_id": "macro.dbt_utils.default__get_query_results_as_dict", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/sql/get_query_results_as_dict.sql", "original_file_path": "macros/sql/get_query_results_as_dict.sql", "name": "default__get_query_results_as_dict", "macro_sql": "{% macro default__get_query_results_as_dict(query) %}\n\n{# This macro returns a dictionary of the form {column_name: (tuple_of_results)} #}\n\n {%- call statement('get_query_results', fetch_result=True,auto_begin=false) -%}\n\n {{ query }}\n\n {%- endcall -%}\n\n {% set sql_results={} %}\n\n {%- if execute -%}\n {% set sql_results_table = load_result('get_query_results').table.columns %}\n {% for column_name, column in sql_results_table.items() %}\n {% do sql_results.update({column_name: column.values()}) %}\n {% endfor %}\n {%- endif -%}\n\n {{ return(sql_results) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.degrees_to_radians": {"unique_id": "macro.dbt_utils.degrees_to_radians", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/sql/haversine_distance.sql", "original_file_path": "macros/sql/haversine_distance.sql", "name": "degrees_to_radians", "macro_sql": "{% macro degrees_to_radians(degrees) -%}\n acos(-1) * {{degrees}} / 180\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.haversine_distance": {"unique_id": "macro.dbt_utils.haversine_distance", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/sql/haversine_distance.sql", "original_file_path": "macros/sql/haversine_distance.sql", "name": "haversine_distance", "macro_sql": "{% macro haversine_distance(lat1, lon1, lat2, lon2, unit='mi') -%}\n {{ return(adapter.dispatch('haversine_distance', packages = dbt_utils._get_utils_namespaces())(lat1,lon1,lat2,lon2,unit)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__haversine_distance": {"unique_id": "macro.dbt_utils.default__haversine_distance", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/sql/haversine_distance.sql", "original_file_path": "macros/sql/haversine_distance.sql", "name": "default__haversine_distance", "macro_sql": "{% macro default__haversine_distance(lat1, lon1, lat2, lon2, unit='mi') -%}\n{%- if unit == 'mi' %}\n {% set conversion_rate = 1 %}\n{% elif unit == 'km' %}\n {% set conversion_rate = 1.60934 %}\n{% else %}\n {{ exceptions.raise_compiler_error(\"unit input must be one of 'mi' or 'km'. Got \" ~ unit) }}\n{% endif %}\n\n 2 * 3961 * asin(sqrt(pow((sin(radians(({{ lat2 }} - {{ lat1 }}) / 2))), 2) +\n cos(radians({{lat1}})) * cos(radians({{lat2}})) *\n pow((sin(radians(({{ lon2 }} - {{ lon1 }}) / 2))), 2))) * {{ conversion_rate }}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.bigquery__haversine_distance": {"unique_id": "macro.dbt_utils.bigquery__haversine_distance", "package_name": "dbt_utils", "root_path": "/dbt_artifacts/dbt_modules/dbt_utils", "path": "macros/sql/haversine_distance.sql", "original_file_path": "macros/sql/haversine_distance.sql", "name": "bigquery__haversine_distance", "macro_sql": "{% macro bigquery__haversine_distance(lat1, lon1, lat2, lon2, unit='mi') -%}\n{% set radians_lat1 = dbt_utils.degrees_to_radians(lat1) %}\n{% set radians_lat2 = dbt_utils.degrees_to_radians(lat2) %}\n{% set radians_lon1 = dbt_utils.degrees_to_radians(lon1) %}\n{% set radians_lon2 = dbt_utils.degrees_to_radians(lon2) %}\n{%- if unit == 'mi' %}\n {% set conversion_rate = 1 %}\n{% elif unit == 'km' %}\n {% set conversion_rate = 1.60934 %}\n{% else %}\n {{ exceptions.raise_compiler_error(\"unit input must be one of 'mi' or 'km'. Got \" ~ unit) }}\n{% endif %}\n 2 * 3961 * asin(sqrt(pow(sin(({{ radians_lat2 }} - {{ radians_lat1 }}) / 2), 2) +\n cos({{ radians_lat1 }}) * cos({{ radians_lat2 }}) *\n pow(sin(({{ radians_lon2 }} - {{ radians_lon1 }}) / 2), 2))) * {{ conversion_rate }}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}}, "docs": {"dbt.__overview__": {"unique_id": "dbt.__overview__", "package_name": "dbt", "root_path": "t/versions/0.19.1/lib/python3.8/site-packages/dbt/include/global_project", "path": "overview.md", "original_file_path": "docs/overview.md", "name": "__overview__", "block_contents": "### Welcome!\n\nWelcome to the auto-generated documentation for your dbt project!\n\n### Navigation\n\nYou can use the `Project` and `Database` navigation tabs on the left side of the window to explore the models\nin your project.\n\n#### Project Tab\nThe `Project` tab mirrors the directory structure of your dbt project. In this tab, you can see all of the\nmodels defined in your dbt project, as well as models imported from dbt packages.\n\n#### Database Tab\nThe `Database` tab also exposes your models, but in a format that looks more like a database explorer. This view\nshows relations (tables and views) grouped into database schemas. Note that ephemeral models are _not_ shown\nin this interface, as they do not exist in the database.\n\n### Graph Exploration\nYou can click the blue icon on the bottom-right corner of the page to view the lineage graph of your models.\n\nOn model pages, you'll see the immediate parents and children of the model you're exploring. By clicking the `Expand`\nbutton at the top-right of this lineage pane, you'll be able to see all of the models that are used to build,\nor are built from, the model you're exploring.\n\nOnce expanded, you'll be able to use the `--models` and `--exclude` model selection syntax to filter the\nmodels in the graph. For more information on model selection, check out the [dbt docs](https://docs.getdbt.com/docs/model-selection-syntax).\n\nNote that you can also right-click on models to interactively filter and explore the graph.\n\n---\n\n### More information\n\n- [What is dbt](https://docs.getdbt.com/docs/overview)?\n- Read the [dbt viewpoint](https://docs.getdbt.com/docs/viewpoint)\n- [Installation](https://docs.getdbt.com/docs/installation)\n- Join the [chat](https://community.getdbt.com/) on Slack for live questions and support."}}, "exposures": {}, "selectors": {}, "disabled": [], "parent_map": {"model.dbt_artifacts.fct_dbt__latest_full_model_executions": ["model.dbt_artifacts.fct_dbt__model_executions", "model.dbt_artifacts.fct_dbt__run_results"], "model.dbt_artifacts.fct_dbt__exposures_updates": ["model.dbt_artifacts.dim_dbt__exposures", "model.dbt_artifacts.fct_dbt__model_executions"], "model.dbt_artifacts.fct_dbt__critical_path": ["model.dbt_artifacts.fct_dbt__latest_full_model_executions", "model.dbt_artifacts.stg_dbt__models"], "model.dbt_artifacts.stg_dbt__models": ["model.dbt_artifacts.stg_dbt__artifacts"], "model.dbt_artifacts.stg_dbt__run_results_env_keys": ["model.dbt_artifacts.stg_dbt__artifacts"], "model.dbt_artifacts.stg_dbt__exposures": ["model.dbt_artifacts.stg_dbt__artifacts"], "model.dbt_artifacts.stg_dbt__test_executions": ["model.dbt_artifacts.stg_dbt__artifacts"], "model.dbt_artifacts.stg_dbt__sources": ["model.dbt_artifacts.stg_dbt__artifacts"], "model.dbt_artifacts.stg_dbt__artifacts": ["source.dbt_artifacts.dbt_artifacts.artifacts"], "model.dbt_artifacts.stg_dbt__model_executions": ["model.dbt_artifacts.stg_dbt__artifacts"], "model.dbt_artifacts.stg_dbt__run_results": ["model.dbt_artifacts.stg_dbt__artifacts"], "model.dbt_artifacts.int_dbt__model_executions": ["model.dbt_artifacts.stg_dbt__model_executions"], "model.dbt_artifacts.fct_dbt__test_executions": ["model.dbt_artifacts.stg_dbt__test_executions"], "model.dbt_artifacts.fct_dbt__model_executions": ["model.dbt_artifacts.dim_dbt__models", "model.dbt_artifacts.int_dbt__model_executions"], "model.dbt_artifacts.dim_dbt__sources": ["model.dbt_artifacts.stg_dbt__sources"], "model.dbt_artifacts.dim_dbt__exposures": ["model.dbt_artifacts.stg_dbt__exposures"], "model.dbt_artifacts.dim_dbt__models": ["model.dbt_artifacts.stg_dbt__models"], "model.dbt_artifacts.fct_dbt__run_results": ["model.dbt_artifacts.stg_dbt__run_results", "model.dbt_artifacts.stg_dbt__run_results_env_keys"], "test.dbt_artifacts.unique_fct_dbt__critical_path_node_id": ["model.dbt_artifacts.fct_dbt__critical_path"], "test.dbt_artifacts.not_null_fct_dbt__critical_path_node_id": ["model.dbt_artifacts.fct_dbt__critical_path"], "test.dbt_artifacts.unique_fct_dbt__latest_full_model_executions_node_id": ["model.dbt_artifacts.fct_dbt__latest_full_model_executions"], "test.dbt_artifacts.not_null_fct_dbt__latest_full_model_executions_node_id": ["model.dbt_artifacts.fct_dbt__latest_full_model_executions"], "test.dbt_artifacts.unique_fct_dbt__model_executions_model_execution_id": ["model.dbt_artifacts.fct_dbt__model_executions"], "test.dbt_artifacts.not_null_fct_dbt__model_executions_model_execution_id": ["model.dbt_artifacts.fct_dbt__model_executions"], "test.dbt_artifacts.unique_fct_dbt__run_results_command_invocation_id": ["model.dbt_artifacts.fct_dbt__run_results"], "test.dbt_artifacts.not_null_fct_dbt__run_results_command_invocation_id": ["model.dbt_artifacts.fct_dbt__run_results"], "test.dbt_artifacts.not_null_dim_dbt__exposures_manifest_model_id": ["model.dbt_artifacts.dim_dbt__exposures"], "test.dbt_artifacts.unique_dim_dbt__exposures_manifest_model_id_output_feeds": ["model.dbt_artifacts.dim_dbt__exposures"], "test.dbt_artifacts.unique_dim_dbt__models_manifest_model_id": ["model.dbt_artifacts.dim_dbt__models"], "test.dbt_artifacts.not_null_dim_dbt__models_manifest_model_id": ["model.dbt_artifacts.dim_dbt__models"], "test.dbt_artifacts.unique_dim_dbt__sources_manifest_source_id": ["model.dbt_artifacts.dim_dbt__sources"], "test.dbt_artifacts.not_null_dim_dbt__sources_manifest_source_id": ["model.dbt_artifacts.dim_dbt__sources"], "source.dbt_artifacts.dbt_artifacts.artifacts": []}, "child_map": {"model.dbt_artifacts.fct_dbt__latest_full_model_executions": ["model.dbt_artifacts.fct_dbt__critical_path", "test.dbt_artifacts.not_null_fct_dbt__latest_full_model_executions_node_id", "test.dbt_artifacts.unique_fct_dbt__latest_full_model_executions_node_id"], "model.dbt_artifacts.fct_dbt__exposures_updates": [], "model.dbt_artifacts.fct_dbt__critical_path": ["test.dbt_artifacts.not_null_fct_dbt__critical_path_node_id", "test.dbt_artifacts.unique_fct_dbt__critical_path_node_id"], "model.dbt_artifacts.stg_dbt__models": ["model.dbt_artifacts.dim_dbt__models", "model.dbt_artifacts.fct_dbt__critical_path"], "model.dbt_artifacts.stg_dbt__run_results_env_keys": ["model.dbt_artifacts.fct_dbt__run_results"], "model.dbt_artifacts.stg_dbt__exposures": ["model.dbt_artifacts.dim_dbt__exposures"], "model.dbt_artifacts.stg_dbt__test_executions": ["model.dbt_artifacts.fct_dbt__test_executions"], "model.dbt_artifacts.stg_dbt__sources": ["model.dbt_artifacts.dim_dbt__sources"], "model.dbt_artifacts.stg_dbt__artifacts": ["model.dbt_artifacts.stg_dbt__exposures", "model.dbt_artifacts.stg_dbt__model_executions", "model.dbt_artifacts.stg_dbt__models", "model.dbt_artifacts.stg_dbt__run_results", "model.dbt_artifacts.stg_dbt__run_results_env_keys", "model.dbt_artifacts.stg_dbt__sources", "model.dbt_artifacts.stg_dbt__test_executions"], "model.dbt_artifacts.stg_dbt__model_executions": ["model.dbt_artifacts.int_dbt__model_executions"], "model.dbt_artifacts.stg_dbt__run_results": ["model.dbt_artifacts.fct_dbt__run_results"], "model.dbt_artifacts.int_dbt__model_executions": ["model.dbt_artifacts.fct_dbt__model_executions"], "model.dbt_artifacts.fct_dbt__test_executions": [], "model.dbt_artifacts.fct_dbt__model_executions": ["model.dbt_artifacts.fct_dbt__exposures_updates", "model.dbt_artifacts.fct_dbt__latest_full_model_executions", "test.dbt_artifacts.not_null_fct_dbt__model_executions_model_execution_id", "test.dbt_artifacts.unique_fct_dbt__model_executions_model_execution_id"], "model.dbt_artifacts.dim_dbt__sources": ["test.dbt_artifacts.not_null_dim_dbt__sources_manifest_source_id", "test.dbt_artifacts.unique_dim_dbt__sources_manifest_source_id"], "model.dbt_artifacts.dim_dbt__exposures": ["model.dbt_artifacts.fct_dbt__exposures_updates", "test.dbt_artifacts.not_null_dim_dbt__exposures_manifest_model_id", "test.dbt_artifacts.unique_dim_dbt__exposures_manifest_model_id_output_feeds"], "model.dbt_artifacts.dim_dbt__models": ["model.dbt_artifacts.fct_dbt__model_executions", "test.dbt_artifacts.not_null_dim_dbt__models_manifest_model_id", "test.dbt_artifacts.unique_dim_dbt__models_manifest_model_id"], "model.dbt_artifacts.fct_dbt__run_results": ["model.dbt_artifacts.fct_dbt__latest_full_model_executions", "test.dbt_artifacts.not_null_fct_dbt__run_results_command_invocation_id", "test.dbt_artifacts.unique_fct_dbt__run_results_command_invocation_id"], "test.dbt_artifacts.unique_fct_dbt__critical_path_node_id": [], "test.dbt_artifacts.not_null_fct_dbt__critical_path_node_id": [], "test.dbt_artifacts.unique_fct_dbt__latest_full_model_executions_node_id": [], "test.dbt_artifacts.not_null_fct_dbt__latest_full_model_executions_node_id": [], "test.dbt_artifacts.unique_fct_dbt__model_executions_model_execution_id": [], "test.dbt_artifacts.not_null_fct_dbt__model_executions_model_execution_id": [], "test.dbt_artifacts.unique_fct_dbt__run_results_command_invocation_id": [], "test.dbt_artifacts.not_null_fct_dbt__run_results_command_invocation_id": [], "test.dbt_artifacts.not_null_dim_dbt__exposures_manifest_model_id": [], "test.dbt_artifacts.unique_dim_dbt__exposures_manifest_model_id_output_feeds": [], "test.dbt_artifacts.unique_dim_dbt__models_manifest_model_id": [], "test.dbt_artifacts.not_null_dim_dbt__models_manifest_model_id": [], "test.dbt_artifacts.unique_dim_dbt__sources_manifest_source_id": [], "test.dbt_artifacts.not_null_dim_dbt__sources_manifest_source_id": [], "source.dbt_artifacts.dbt_artifacts.artifacts": ["model.dbt_artifacts.stg_dbt__artifacts"]}} \ No newline at end of file diff --git a/docs/run_results.json b/docs/run_results.json index 7ba58a62..bc73fb45 100644 --- a/docs/run_results.json +++ b/docs/run_results.json @@ -1 +1 @@ -{"metadata": {"dbt_schema_version": "https://schemas.getdbt.com/dbt/run-results/v1.json", "dbt_version": "0.19.0", "generated_at": "2021-03-12T10:59:04.706129Z", "invocation_id": "2607e74e-72d8-4769-80b5-b6c0da4137a1", "env": {}}, "results": [{"status": "success", "timing": [{"name": "compile", "started_at": "2021-03-12T10:58:23.756323Z", "completed_at": "2021-03-12T10:58:23.777226Z"}, {"name": "execute", "started_at": "2021-03-12T10:58:23.777539Z", "completed_at": "2021-03-12T10:58:23.777576Z"}], "thread_id": "Thread-1", "execution_time": 0.022091150283813477, "message": null, "adapter_response": {}, "unique_id": "model.dbt_artifacts.stg_dbt__artifacts"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-03-12T10:58:23.780021Z", "completed_at": "2021-03-12T10:58:23.816497Z"}, {"name": "execute", "started_at": "2021-03-12T10:58:23.816755Z", "completed_at": "2021-03-12T10:58:23.816766Z"}], "thread_id": "Thread-3", "execution_time": 0.03794980049133301, "message": null, "adapter_response": {}, "unique_id": "model.dbt_artifacts.stg_dbt__model_executions"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-03-12T10:58:23.780763Z", "completed_at": "2021-03-12T10:58:23.822901Z"}, {"name": "execute", "started_at": "2021-03-12T10:58:23.823179Z", "completed_at": "2021-03-12T10:58:23.823185Z"}], "thread_id": "Thread-4", "execution_time": 0.04381084442138672, "message": null, "adapter_response": {}, "unique_id": "model.dbt_artifacts.stg_dbt__models"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-03-12T10:58:23.791060Z", "completed_at": "2021-03-12T10:58:23.823966Z"}, {"name": "execute", "started_at": "2021-03-12T10:58:23.824201Z", "completed_at": "2021-03-12T10:58:23.824207Z"}], "thread_id": "Thread-2", "execution_time": 0.044368743896484375, "message": null, "adapter_response": {}, "unique_id": "model.dbt_artifacts.stg_dbt__run_results"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-03-12T10:58:23.791192Z", "completed_at": "2021-03-12T10:58:23.827103Z"}, {"name": "execute", "started_at": "2021-03-12T10:58:23.828080Z", "completed_at": "2021-03-12T10:58:23.828088Z"}], "thread_id": "Thread-1", "execution_time": 0.04866504669189453, "message": null, "adapter_response": {}, "unique_id": "model.dbt_artifacts.stg_dbt__run_results_env_keys"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-03-12T10:58:23.817548Z", "completed_at": "2021-03-12T10:58:23.828528Z"}, {"name": "execute", "started_at": "2021-03-12T10:58:23.829333Z", "completed_at": "2021-03-12T10:58:23.829339Z"}], "thread_id": "Thread-3", "execution_time": 0.01783299446105957, "message": null, "adapter_response": {}, "unique_id": "model.dbt_artifacts.stg_dbt__sources"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-03-12T10:58:23.829240Z", "completed_at": "2021-03-12T10:58:23.852126Z"}, {"name": "execute", "started_at": "2021-03-12T10:58:23.864058Z", "completed_at": "2021-03-12T10:58:23.864066Z"}], "thread_id": "Thread-4", "execution_time": 0.036514997482299805, "message": null, "adapter_response": {}, "unique_id": "model.dbt_artifacts.dim_dbt__models"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-03-12T10:58:23.829527Z", "completed_at": "2021-03-12T10:58:23.852304Z"}, {"name": "execute", "started_at": "2021-03-12T10:58:23.864347Z", "completed_at": "2021-03-12T10:58:23.864352Z"}], "thread_id": "Thread-2", "execution_time": 0.03628396987915039, "message": null, "adapter_response": {}, "unique_id": "model.dbt_artifacts.int_dbt__model_executions"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-03-12T10:58:23.864534Z", "completed_at": "2021-03-12T10:58:23.902939Z"}, {"name": "execute", "started_at": "2021-03-12T10:58:23.903449Z", "completed_at": "2021-03-12T10:58:23.903459Z"}], "thread_id": "Thread-3", "execution_time": 0.05170917510986328, "message": null, "adapter_response": {}, "unique_id": "model.dbt_artifacts.dim_dbt__sources"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-03-12T10:58:23.877330Z", "completed_at": "2021-03-12T10:58:23.903200Z"}, {"name": "execute", "started_at": "2021-03-12T10:58:23.903857Z", "completed_at": "2021-03-12T10:58:23.903863Z"}], "thread_id": "Thread-4", "execution_time": 0.027515888214111328, "message": null, "adapter_response": {}, "unique_id": "model.dbt_artifacts.fct_dbt__model_executions"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-03-12T10:58:23.888779Z", "completed_at": "2021-03-12T10:58:23.903655Z"}, {"name": "execute", "started_at": "2021-03-12T10:58:23.904324Z", "completed_at": "2021-03-12T10:58:23.904332Z"}], "thread_id": "Thread-2", "execution_time": 0.0164949893951416, "message": null, "adapter_response": {}, "unique_id": "test.dbt_artifacts.not_null_dim_dbt__models_manifest_model_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-03-12T10:58:23.906411Z", "completed_at": "2021-03-12T10:58:23.927936Z"}, {"name": "execute", "started_at": "2021-03-12T10:58:23.928168Z", "completed_at": "2021-03-12T10:58:23.928176Z"}], "thread_id": "Thread-4", "execution_time": 0.022649765014648438, "message": null, "adapter_response": {}, "unique_id": "test.dbt_artifacts.not_null_dim_dbt__sources_manifest_source_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-03-12T10:58:23.906026Z", "completed_at": "2021-03-12T10:58:23.928963Z"}, {"name": "execute", "started_at": "2021-03-12T10:58:23.929449Z", "completed_at": "2021-03-12T10:58:23.929456Z"}], "thread_id": "Thread-3", "execution_time": 0.030693769454956055, "message": null, "adapter_response": {}, "unique_id": "test.dbt_artifacts.unique_dim_dbt__models_manifest_model_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-03-12T10:58:23.913071Z", "completed_at": "2021-03-12T10:58:23.929626Z"}, {"name": "execute", "started_at": "2021-03-12T10:58:23.936590Z", "completed_at": "2021-03-12T10:58:23.936597Z"}], "thread_id": "Thread-2", "execution_time": 0.031517982482910156, "message": null, "adapter_response": {}, "unique_id": "test.dbt_artifacts.unique_dim_dbt__sources_manifest_source_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-03-12T10:58:23.929248Z", "completed_at": "2021-03-12T10:58:23.937864Z"}, {"name": "execute", "started_at": "2021-03-12T10:58:23.938440Z", "completed_at": "2021-03-12T10:58:23.938446Z"}], "thread_id": "Thread-4", "execution_time": 0.010273933410644531, "message": null, "adapter_response": {}, "unique_id": "test.dbt_artifacts.not_null_fct_dbt__model_executions_model_execution_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-03-12T10:58:23.938725Z", "completed_at": "2021-03-12T10:58:23.946276Z"}, {"name": "execute", "started_at": "2021-03-12T10:58:23.946481Z", "completed_at": "2021-03-12T10:58:23.946489Z"}], "thread_id": "Thread-3", "execution_time": 0.008734941482543945, "message": null, "adapter_response": {}, "unique_id": "test.dbt_artifacts.unique_fct_dbt__model_executions_model_execution_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-03-12T10:58:23.851936Z", "completed_at": "2021-03-12T10:59:04.231619Z"}, {"name": "execute", "started_at": "2021-03-12T10:59:04.231912Z", "completed_at": "2021-03-12T10:59:04.231926Z"}], "thread_id": "Thread-1", "execution_time": 40.7716748714447, "message": null, "adapter_response": {}, "unique_id": "model.dbt_artifacts.fct_dbt__run_results"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-03-12T10:59:04.624108Z", "completed_at": "2021-03-12T10:59:04.658166Z"}, {"name": "execute", "started_at": "2021-03-12T10:59:04.658436Z", "completed_at": "2021-03-12T10:59:04.658447Z"}], "thread_id": "Thread-2", "execution_time": 0.03504300117492676, "message": null, "adapter_response": {}, "unique_id": "model.dbt_artifacts.fct_dbt__latest_full_model_executions"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-03-12T10:59:04.631862Z", "completed_at": "2021-03-12T10:59:04.659274Z"}, {"name": "execute", "started_at": "2021-03-12T10:59:04.659534Z", "completed_at": "2021-03-12T10:59:04.659541Z"}], "thread_id": "Thread-4", "execution_time": 0.02831268310546875, "message": null, "adapter_response": {}, "unique_id": "test.dbt_artifacts.not_null_fct_dbt__run_results_command_invocation_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-03-12T10:59:04.642690Z", "completed_at": "2021-03-12T10:59:04.660184Z"}, {"name": "execute", "started_at": "2021-03-12T10:59:04.660446Z", "completed_at": "2021-03-12T10:59:04.660453Z"}], "thread_id": "Thread-3", "execution_time": 0.01838994026184082, "message": null, "adapter_response": {}, "unique_id": "test.dbt_artifacts.unique_fct_dbt__run_results_command_invocation_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-03-12T10:59:04.663373Z", "completed_at": "2021-03-12T10:59:04.687337Z"}, {"name": "execute", "started_at": "2021-03-12T10:59:04.687548Z", "completed_at": "2021-03-12T10:59:04.687556Z"}], "thread_id": "Thread-1", "execution_time": 0.026417970657348633, "message": null, "adapter_response": {}, "unique_id": "model.dbt_artifacts.fct_dbt__critical_path"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-03-12T10:59:04.663478Z", "completed_at": "2021-03-12T10:59:04.688190Z"}, {"name": "execute", "started_at": "2021-03-12T10:59:04.688738Z", "completed_at": "2021-03-12T10:59:04.688744Z"}], "thread_id": "Thread-2", "execution_time": 0.027764081954956055, "message": null, "adapter_response": {}, "unique_id": "test.dbt_artifacts.not_null_fct_dbt__latest_full_model_executions_node_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-03-12T10:59:04.663574Z", "completed_at": "2021-03-12T10:59:04.688383Z"}, {"name": "execute", "started_at": "2021-03-12T10:59:04.688999Z", "completed_at": "2021-03-12T10:59:04.689004Z"}], "thread_id": "Thread-4", "execution_time": 0.02787303924560547, "message": null, "adapter_response": {}, "unique_id": "test.dbt_artifacts.unique_fct_dbt__latest_full_model_executions_node_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-03-12T10:59:04.690015Z", "completed_at": "2021-03-12T10:59:04.703573Z"}, {"name": "execute", "started_at": "2021-03-12T10:59:04.703773Z", "completed_at": "2021-03-12T10:59:04.703779Z"}], "thread_id": "Thread-3", "execution_time": 0.014860868453979492, "message": null, "adapter_response": {}, "unique_id": "test.dbt_artifacts.not_null_fct_dbt__critical_path_node_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-03-12T10:59:04.690183Z", "completed_at": "2021-03-12T10:59:04.704362Z"}, {"name": "execute", "started_at": "2021-03-12T10:59:04.704560Z", "completed_at": "2021-03-12T10:59:04.704566Z"}], "thread_id": "Thread-1", "execution_time": 0.015215158462524414, "message": null, "adapter_response": {}, "unique_id": "test.dbt_artifacts.unique_fct_dbt__critical_path_node_id"}], "elapsed_time": 42.006187915802, "args": {"log_format": "default", "write_json": true, "profiles_dir": "/Users/niallwoodward/.dbt", "profile": "tails_analytics_profile", "use_cache": true, "compile": true, "version_check": true, "which": "generate", "rpc_method": "docs.generate"}} \ No newline at end of file +{"metadata": {"dbt_schema_version": "https://schemas.getdbt.com/dbt/run-results/v1.json", "dbt_version": "0.19.1", "generated_at": "2021-07-07T10:07:28.705122Z", "invocation_id": "21776fd0-5851-493f-ae7d-c0beb4e6da36", "env": {}}, "results": [{"status": "success", "timing": [{"name": "compile", "started_at": "2021-07-07T10:07:26.260344Z", "completed_at": "2021-07-07T10:07:26.263657Z"}, {"name": "execute", "started_at": "2021-07-07T10:07:26.263814Z", "completed_at": "2021-07-07T10:07:26.263833Z"}], "thread_id": "Thread-1", "execution_time": 0.004129171371459961, "adapter_response": {}, "message": null, "unique_id": "model.dbt_artifacts.stg_dbt__artifacts"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-07-07T10:07:26.266801Z", "completed_at": "2021-07-07T10:07:26.296892Z"}, {"name": "execute", "started_at": "2021-07-07T10:07:26.298242Z", "completed_at": "2021-07-07T10:07:26.298254Z"}], "thread_id": "Thread-3", "execution_time": 0.034127235412597656, "adapter_response": {}, "message": null, "unique_id": "model.dbt_artifacts.stg_dbt__model_executions"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-07-07T10:07:26.268091Z", "completed_at": "2021-07-07T10:07:26.297579Z"}, {"name": "execute", "started_at": "2021-07-07T10:07:26.298564Z", "completed_at": "2021-07-07T10:07:26.298571Z"}], "thread_id": "Thread-4", "execution_time": 0.03363990783691406, "adapter_response": {}, "message": null, "unique_id": "model.dbt_artifacts.stg_dbt__models"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-07-07T10:07:26.268215Z", "completed_at": "2021-07-07T10:07:26.297716Z"}, {"name": "execute", "started_at": "2021-07-07T10:07:26.298837Z", "completed_at": "2021-07-07T10:07:26.298844Z"}], "thread_id": "Thread-5", "execution_time": 0.03378582000732422, "adapter_response": {}, "message": null, "unique_id": "model.dbt_artifacts.stg_dbt__run_results"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-07-07T10:07:26.272555Z", "completed_at": "2021-07-07T10:07:26.298053Z"}, {"name": "execute", "started_at": "2021-07-07T10:07:26.299102Z", "completed_at": "2021-07-07T10:07:26.299109Z"}], "thread_id": "Thread-6", "execution_time": 0.03377819061279297, "adapter_response": {}, "message": null, "unique_id": "model.dbt_artifacts.stg_dbt__run_results_env_keys"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-07-07T10:07:26.272687Z", "completed_at": "2021-07-07T10:07:26.298423Z"}, {"name": "execute", "started_at": "2021-07-07T10:07:26.299567Z", "completed_at": "2021-07-07T10:07:26.299574Z"}], "thread_id": "Thread-7", "execution_time": 0.034104108810424805, "adapter_response": {}, "message": null, "unique_id": "model.dbt_artifacts.stg_dbt__exposures"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-07-07T10:07:26.272816Z", "completed_at": "2021-07-07T10:07:26.298656Z"}, {"name": "execute", "started_at": "2021-07-07T10:07:26.300021Z", "completed_at": "2021-07-07T10:07:26.300028Z"}], "thread_id": "Thread-8", "execution_time": 0.034277915954589844, "adapter_response": {}, "message": null, "unique_id": "model.dbt_artifacts.stg_dbt__sources"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-07-07T10:07:26.272933Z", "completed_at": "2021-07-07T10:07:26.298950Z"}, {"name": "execute", "started_at": "2021-07-07T10:07:26.300458Z", "completed_at": "2021-07-07T10:07:26.300465Z"}], "thread_id": "Thread-2", "execution_time": 0.03450798988342285, "adapter_response": {}, "message": null, "unique_id": "model.dbt_artifacts.stg_dbt__test_executions"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-07-07T10:07:26.304065Z", "completed_at": "2021-07-07T10:07:26.322149Z"}, {"name": "execute", "started_at": "2021-07-07T10:07:26.332443Z", "completed_at": "2021-07-07T10:07:26.332453Z"}], "thread_id": "Thread-1", "execution_time": 0.030803918838500977, "adapter_response": {}, "message": null, "unique_id": "model.dbt_artifacts.int_dbt__model_executions"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-07-07T10:07:26.304837Z", "completed_at": "2021-07-07T10:07:26.332299Z"}, {"name": "execute", "started_at": "2021-07-07T10:07:26.333171Z", "completed_at": "2021-07-07T10:07:26.333177Z"}], "thread_id": "Thread-3", "execution_time": 0.031090974807739258, "adapter_response": {}, "message": null, "unique_id": "model.dbt_artifacts.dim_dbt__models"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-07-07T10:07:26.311861Z", "completed_at": "2021-07-07T10:07:26.332842Z"}, {"name": "execute", "started_at": "2021-07-07T10:07:26.333682Z", "completed_at": "2021-07-07T10:07:26.333689Z"}], "thread_id": "Thread-6", "execution_time": 0.031077861785888672, "adapter_response": {}, "message": null, "unique_id": "model.dbt_artifacts.dim_dbt__exposures"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-07-07T10:07:26.315813Z", "completed_at": "2021-07-07T10:07:26.332948Z"}, {"name": "execute", "started_at": "2021-07-07T10:07:26.333818Z", "completed_at": "2021-07-07T10:07:26.333825Z"}], "thread_id": "Thread-7", "execution_time": 0.030943870544433594, "adapter_response": {}, "message": null, "unique_id": "model.dbt_artifacts.dim_dbt__sources"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-07-07T10:07:26.316051Z", "completed_at": "2021-07-07T10:07:26.333565Z"}, {"name": "execute", "started_at": "2021-07-07T10:07:26.335406Z", "completed_at": "2021-07-07T10:07:26.335413Z"}], "thread_id": "Thread-8", "execution_time": 0.025332927703857422, "adapter_response": {}, "message": null, "unique_id": "model.dbt_artifacts.fct_dbt__test_executions"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-07-07T10:07:26.339629Z", "completed_at": "2021-07-07T10:07:26.388245Z"}, {"name": "execute", "started_at": "2021-07-07T10:07:26.389267Z", "completed_at": "2021-07-07T10:07:26.389279Z"}], "thread_id": "Thread-2", "execution_time": 0.05217885971069336, "adapter_response": {}, "message": null, "unique_id": "model.dbt_artifacts.fct_dbt__model_executions"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-07-07T10:07:26.339939Z", "completed_at": "2021-07-07T10:07:26.388576Z"}, {"name": "execute", "started_at": "2021-07-07T10:07:26.389561Z", "completed_at": "2021-07-07T10:07:26.389568Z"}], "thread_id": "Thread-5", "execution_time": 0.052336931228637695, "adapter_response": {}, "message": null, "unique_id": "test.dbt_artifacts.not_null_dim_dbt__models_manifest_model_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-07-07T10:07:26.340038Z", "completed_at": "2021-07-07T10:07:26.388811Z"}, {"name": "execute", "started_at": "2021-07-07T10:07:26.389811Z", "completed_at": "2021-07-07T10:07:26.389818Z"}], "thread_id": "Thread-1", "execution_time": 0.052533864974975586, "adapter_response": {}, "message": null, "unique_id": "test.dbt_artifacts.unique_dim_dbt__models_manifest_model_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-07-07T10:07:26.340136Z", "completed_at": "2021-07-07T10:07:26.389079Z"}, {"name": "execute", "started_at": "2021-07-07T10:07:26.390051Z", "completed_at": "2021-07-07T10:07:26.390058Z"}], "thread_id": "Thread-3", "execution_time": 0.052722930908203125, "adapter_response": {}, "message": null, "unique_id": "test.dbt_artifacts.not_null_dim_dbt__exposures_manifest_model_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-07-07T10:07:26.340229Z", "completed_at": "2021-07-07T10:07:26.389415Z"}, {"name": "execute", "started_at": "2021-07-07T10:07:26.390521Z", "completed_at": "2021-07-07T10:07:26.390529Z"}], "thread_id": "Thread-6", "execution_time": 0.053169965744018555, "adapter_response": {}, "message": null, "unique_id": "test.dbt_artifacts.unique_dim_dbt__exposures_manifest_model_id_output_feeds"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-07-07T10:07:26.340319Z", "completed_at": "2021-07-07T10:07:26.389705Z"}, {"name": "execute", "started_at": "2021-07-07T10:07:26.390993Z", "completed_at": "2021-07-07T10:07:26.391000Z"}], "thread_id": "Thread-8", "execution_time": 0.05342507362365723, "adapter_response": {}, "message": null, "unique_id": "test.dbt_artifacts.not_null_dim_dbt__sources_manifest_source_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-07-07T10:07:26.345327Z", "completed_at": "2021-07-07T10:07:26.389920Z"}, {"name": "execute", "started_at": "2021-07-07T10:07:26.391403Z", "completed_at": "2021-07-07T10:07:26.391410Z"}], "thread_id": "Thread-7", "execution_time": 0.053552865982055664, "adapter_response": {}, "message": null, "unique_id": "test.dbt_artifacts.unique_dim_dbt__sources_manifest_source_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-07-07T10:07:26.394551Z", "completed_at": "2021-07-07T10:07:26.404968Z"}, {"name": "execute", "started_at": "2021-07-07T10:07:26.405343Z", "completed_at": "2021-07-07T10:07:26.405354Z"}], "thread_id": "Thread-2", "execution_time": 0.012462139129638672, "adapter_response": {}, "message": null, "unique_id": "model.dbt_artifacts.fct_dbt__exposures_updates"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-07-07T10:07:26.394784Z", "completed_at": "2021-07-07T10:07:26.405132Z"}, {"name": "execute", "started_at": "2021-07-07T10:07:26.405467Z", "completed_at": "2021-07-07T10:07:26.405474Z"}], "thread_id": "Thread-1", "execution_time": 0.012050151824951172, "adapter_response": {}, "message": null, "unique_id": "test.dbt_artifacts.unique_fct_dbt__model_executions_model_execution_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-07-07T10:07:26.394666Z", "completed_at": "2021-07-07T10:07:26.405233Z"}, {"name": "execute", "started_at": "2021-07-07T10:07:26.405601Z", "completed_at": "2021-07-07T10:07:26.405609Z"}], "thread_id": "Thread-5", "execution_time": 0.012629032135009766, "adapter_response": {}, "message": null, "unique_id": "test.dbt_artifacts.not_null_fct_dbt__model_executions_model_execution_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-07-07T10:07:26.311728Z", "completed_at": "2021-07-07T10:07:27.857016Z"}, {"name": "execute", "started_at": "2021-07-07T10:07:27.857165Z", "completed_at": "2021-07-07T10:07:27.857179Z"}], "thread_id": "Thread-4", "execution_time": 2.3064451217651367, "adapter_response": {}, "message": null, "unique_id": "model.dbt_artifacts.fct_dbt__run_results"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-07-07T10:07:28.662905Z", "completed_at": "2021-07-07T10:07:28.676293Z"}, {"name": "execute", "started_at": "2021-07-07T10:07:28.676605Z", "completed_at": "2021-07-07T10:07:28.676617Z"}], "thread_id": "Thread-3", "execution_time": 0.03512072563171387, "adapter_response": {}, "message": null, "unique_id": "model.dbt_artifacts.fct_dbt__latest_full_model_executions"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-07-07T10:07:28.663149Z", "completed_at": "2021-07-07T10:07:28.676444Z"}, {"name": "execute", "started_at": "2021-07-07T10:07:28.676813Z", "completed_at": "2021-07-07T10:07:28.676821Z"}], "thread_id": "Thread-6", "execution_time": 0.03474783897399902, "adapter_response": {}, "message": null, "unique_id": "test.dbt_artifacts.not_null_fct_dbt__run_results_command_invocation_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-07-07T10:07:28.663387Z", "completed_at": "2021-07-07T10:07:28.676924Z"}, {"name": "execute", "started_at": "2021-07-07T10:07:28.677732Z", "completed_at": "2021-07-07T10:07:28.677741Z"}], "thread_id": "Thread-8", "execution_time": 0.016424894332885742, "adapter_response": {}, "message": null, "unique_id": "test.dbt_artifacts.unique_fct_dbt__run_results_command_invocation_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-07-07T10:07:28.680193Z", "completed_at": "2021-07-07T10:07:28.690891Z"}, {"name": "execute", "started_at": "2021-07-07T10:07:28.691054Z", "completed_at": "2021-07-07T10:07:28.691064Z"}], "thread_id": "Thread-1", "execution_time": 0.01178884506225586, "adapter_response": {}, "message": null, "unique_id": "test.dbt_artifacts.not_null_fct_dbt__latest_full_model_executions_node_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-07-07T10:07:28.680071Z", "completed_at": "2021-07-07T10:07:28.691493Z"}, {"name": "execute", "started_at": "2021-07-07T10:07:28.691617Z", "completed_at": "2021-07-07T10:07:28.691623Z"}], "thread_id": "Thread-2", "execution_time": 0.012761116027832031, "adapter_response": {}, "message": null, "unique_id": "model.dbt_artifacts.fct_dbt__critical_path"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-07-07T10:07:28.680311Z", "completed_at": "2021-07-07T10:07:28.692029Z"}, {"name": "execute", "started_at": "2021-07-07T10:07:28.692171Z", "completed_at": "2021-07-07T10:07:28.692179Z"}], "thread_id": "Thread-5", "execution_time": 0.012612104415893555, "adapter_response": {}, "message": null, "unique_id": "test.dbt_artifacts.unique_fct_dbt__latest_full_model_executions_node_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-07-07T10:07:28.693733Z", "completed_at": "2021-07-07T10:07:28.702173Z"}, {"name": "execute", "started_at": "2021-07-07T10:07:28.702437Z", "completed_at": "2021-07-07T10:07:28.702446Z"}], "thread_id": "Thread-7", "execution_time": 0.00963592529296875, "adapter_response": {}, "message": null, "unique_id": "test.dbt_artifacts.not_null_fct_dbt__critical_path_node_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-07-07T10:07:28.693840Z", "completed_at": "2021-07-07T10:07:28.702307Z"}, {"name": "execute", "started_at": "2021-07-07T10:07:28.702588Z", "completed_at": "2021-07-07T10:07:28.702595Z"}], "thread_id": "Thread-3", "execution_time": 0.00964975357055664, "adapter_response": {}, "message": null, "unique_id": "test.dbt_artifacts.unique_fct_dbt__critical_path_node_id"}], "elapsed_time": 4.362806081771851, "args": {"log_format": "default", "write_json": true, "profiles_dir": "/Users/niall.woodward/.dbt", "use_cache": true, "compile": true, "version_check": true, "which": "generate", "rpc_method": "docs.generate"}} \ No newline at end of file diff --git a/models/fct_dbt__critical_path.sql b/models/fct_dbt__critical_path.sql index edf7fa21..8cd0ba60 100644 --- a/models/fct_dbt__critical_path.sql +++ b/models/fct_dbt__critical_path.sql @@ -16,7 +16,8 @@ latest_id as ( -- Find the latest full, incremental execution select - any_value(command_invocation_id) as command_invocation_id + any_value(command_invocation_id) as command_invocation_id, + any_value(dbt_cloud_run_id) as dbt_cloud_run_id from latest_executions ), @@ -29,7 +30,9 @@ latest_models as ( models.depends_on_nodes, models.model_materialization from latest_id - left join models on latest_id.command_invocation_id = models.command_invocation_id + left join models on + latest_id.command_invocation_id = models.command_invocation_id + or latest_id.dbt_cloud_run_id = models.dbt_cloud_run_id ), diff --git a/models/fct_dbt__latest_full_model_executions.sql b/models/fct_dbt__latest_full_model_executions.sql index 178aab5c..0f127eb1 100644 --- a/models/fct_dbt__latest_full_model_executions.sql +++ b/models/fct_dbt__latest_full_model_executions.sql @@ -27,7 +27,9 @@ joined as ( select model_executions.* from latest_full - left join model_executions on model_executions.command_invocation_id = latest_full.command_invocation_id + left join model_executions on + model_executions.command_invocation_id = latest_full.command_invocation_id + or model_executions.dbt_cloud_run_id = latest_full.dbt_cloud_run_id ), @@ -36,6 +38,7 @@ fields as ( select artifact_generated_at, command_invocation_id, + dbt_cloud_run_id, compile_started_at, query_completed_at, total_node_runtime, diff --git a/models/incremental/dim_dbt__exposures.sql b/models/incremental/dim_dbt__exposures.sql index f7cbc084..8920b2a8 100644 --- a/models/incremental/dim_dbt__exposures.sql +++ b/models/incremental/dim_dbt__exposures.sql @@ -1,8 +1,8 @@ -{{ +{{ config( - materialized='incremental', + materialized='incremental', unique_key='manifest_model_id' - ) + ) }} with dbt_models as ( @@ -25,9 +25,10 @@ dbt_models_incremental as ( fields as ( - select + select t.manifest_model_id, t.command_invocation_id, + t.dbt_cloud_run_id, t.artifact_generated_at, t.node_id, t.name, @@ -36,8 +37,8 @@ fields as ( t.maturity, f.value::string as output_feeds, t.package_name - from dbt_models_incremental t, - lateral flatten(input => depends_on_nodes) f + from dbt_models_incremental as t, + lateral flatten(input => depends_on_nodes) as f ) diff --git a/models/incremental/dim_dbt__models.sql b/models/incremental/dim_dbt__models.sql index 5d77d096..27b384ed 100644 --- a/models/incremental/dim_dbt__models.sql +++ b/models/incremental/dim_dbt__models.sql @@ -23,6 +23,7 @@ fields as ( select manifest_model_id, command_invocation_id, + dbt_cloud_run_id, artifact_generated_at, node_id, model_database, diff --git a/models/incremental/dim_dbt__sources.sql b/models/incremental/dim_dbt__sources.sql index edc0309b..84a14df8 100644 --- a/models/incremental/dim_dbt__sources.sql +++ b/models/incremental/dim_dbt__sources.sql @@ -23,6 +23,7 @@ fields as ( select manifest_source_id, command_invocation_id, + dbt_cloud_run_id, artifact_generated_at, node_id, name, diff --git a/models/incremental/fct_dbt__model_executions.sql b/models/incremental/fct_dbt__model_executions.sql index 6edeb8f5..c4ae7095 100644 --- a/models/incremental/fct_dbt__model_executions.sql +++ b/models/incremental/fct_dbt__model_executions.sql @@ -34,10 +34,12 @@ model_executions_with_materialization as ( models.model_schema, models.name from model_executions_incremental - left join models on ( - model_executions_incremental.command_invocation_id = models.command_invocation_id + left join models on + ( + model_executions_incremental.command_invocation_id = models.command_invocation_id + or model_executions_incremental.dbt_cloud_run_id = models.dbt_cloud_run_id + ) and model_executions_incremental.node_id = models.node_id - ) ), @@ -46,6 +48,7 @@ fields as ( select model_execution_id, command_invocation_id, + dbt_cloud_run_id, artifact_generated_at, was_full_refresh, node_id, diff --git a/models/incremental/fct_dbt__run_results.sql b/models/incremental/fct_dbt__run_results.sql index 799e4912..ef4ccf9d 100644 --- a/models/incremental/fct_dbt__run_results.sql +++ b/models/incremental/fct_dbt__run_results.sql @@ -26,6 +26,7 @@ fields as ( select artifact_generated_at, command_invocation_id, + dbt_cloud_run_id, dbt_version, elapsed_time, execution_command, diff --git a/models/incremental/fct_dbt__test_executions.sql b/models/incremental/fct_dbt__test_executions.sql index 3afee16b..6a5487a5 100644 --- a/models/incremental/fct_dbt__test_executions.sql +++ b/models/incremental/fct_dbt__test_executions.sql @@ -24,6 +24,7 @@ fields as ( select model_execution_id, command_invocation_id, + dbt_cloud_run_id, artifact_generated_at, was_full_refresh, node_id, diff --git a/models/incremental/int_dbt__model_executions.sql b/models/incremental/int_dbt__model_executions.sql index 7d9f8be8..4609011c 100644 --- a/models/incremental/int_dbt__model_executions.sql +++ b/models/incremental/int_dbt__model_executions.sql @@ -24,6 +24,7 @@ fields as ( select model_execution_id, command_invocation_id, + dbt_cloud_run_id, artifact_generated_at, was_full_refresh, node_id, diff --git a/models/staging/stg_dbt__artifacts.sql b/models/staging/stg_dbt__artifacts.sql index f79937ec..8c91c629 100644 --- a/models/staging/stg_dbt__artifacts.sql +++ b/models/staging/stg_dbt__artifacts.sql @@ -9,6 +9,7 @@ fields as ( select data:metadata:invocation_id::string as command_invocation_id, + data:metadata:env:DBT_CLOUD_RUN_ID::int as dbt_cloud_run_id, generated_at, path, artifact_type, @@ -17,7 +18,7 @@ fields as ( ), -duduped as ( +deduped as ( select *, @@ -34,11 +35,12 @@ artifacts as ( select command_invocation_id, + dbt_cloud_run_id, generated_at, path, artifact_type, data - from duduped + from deduped ) diff --git a/models/staging/stg_dbt__exposures.sql b/models/staging/stg_dbt__exposures.sql index 05af4c2c..64f22100 100644 --- a/models/staging/stg_dbt__exposures.sql +++ b/models/staging/stg_dbt__exposures.sql @@ -17,6 +17,7 @@ flatten as ( select command_invocation_id, + dbt_cloud_run_id, generated_at as artifact_generated_at, node.key as node_id, node.value:name::string as name, @@ -36,6 +37,7 @@ surrogate_key as ( select {{ dbt_utils.surrogate_key(['command_invocation_id', 'node_id']) }} as manifest_model_id, command_invocation_id, + dbt_cloud_run_id, artifact_generated_at, node_id, name, diff --git a/models/staging/stg_dbt__model_executions.sql b/models/staging/stg_dbt__model_executions.sql index a1fcd796..cca02ccb 100644 --- a/models/staging/stg_dbt__model_executions.sql +++ b/models/staging/stg_dbt__model_executions.sql @@ -24,7 +24,8 @@ dbt_run as ( fields as ( select - data:metadata:invocation_id::string as command_invocation_id, + command_invocation_id, + dbt_cloud_run_id, generated_at as artifact_generated_at, coalesce(data:args:full_refresh, 'false')::boolean as was_full_refresh, result.value:unique_id::string as node_id, @@ -36,11 +37,11 @@ fields as ( -- The second item in the timing array is `execute`. result.value:timing[1]:completed_at::timestamp_ntz as query_completed_at, - + -- Confusingly, this does not match the delta of the above two timestamps. -- should we calculate it instead? coalesce(result.value:execution_time::float, 0) as total_node_runtime, - + result.value:adapter_response:rows_affected::int as rows_affected from dbt_run, lateral flatten(input => data:results) as result @@ -52,6 +53,7 @@ surrogate_key as ( select {{ dbt_utils.surrogate_key(['command_invocation_id', 'node_id']) }} as model_execution_id, command_invocation_id, + dbt_cloud_run_id, artifact_generated_at, was_full_refresh, node_id, diff --git a/models/staging/stg_dbt__models.sql b/models/staging/stg_dbt__models.sql index ba92a872..227af6b6 100644 --- a/models/staging/stg_dbt__models.sql +++ b/models/staging/stg_dbt__models.sql @@ -17,6 +17,7 @@ flatten as ( select command_invocation_id, + dbt_cloud_run_id, generated_at as artifact_generated_at, node.key as node_id, node.value:database::string as model_database, @@ -38,6 +39,7 @@ surrogate_key as ( select {{ dbt_utils.surrogate_key(['command_invocation_id', 'node_id']) }} as manifest_model_id, command_invocation_id, + dbt_cloud_run_id, artifact_generated_at, node_id, model_database, diff --git a/models/staging/stg_dbt__run_results.sql b/models/staging/stg_dbt__run_results.sql index 291860b6..c510864c 100644 --- a/models/staging/stg_dbt__run_results.sql +++ b/models/staging/stg_dbt__run_results.sql @@ -25,7 +25,8 @@ fields as ( select generated_at as artifact_generated_at, - data:metadata:invocation_id::string as command_invocation_id, + command_invocation_id, + dbt_cloud_run_id, data:metadata:dbt_version::string as dbt_version, data:metadata:env as env, data:elapsed_time::float as elapsed_time, diff --git a/models/staging/stg_dbt__sources.sql b/models/staging/stg_dbt__sources.sql index 34a53f10..8632ce1e 100644 --- a/models/staging/stg_dbt__sources.sql +++ b/models/staging/stg_dbt__sources.sql @@ -17,6 +17,7 @@ flatten as ( select command_invocation_id, + dbt_cloud_run_id, generated_at as artifact_generated_at, node.key as node_id, node.value:name::string as name, @@ -36,6 +37,7 @@ surrogate_key as ( select {{ dbt_utils.surrogate_key(['command_invocation_id', 'node_id']) }} as manifest_source_id, command_invocation_id, + dbt_cloud_run_id, artifact_generated_at, node_id, name, diff --git a/models/staging/stg_dbt__test_executions.sql b/models/staging/stg_dbt__test_executions.sql index 1332f7e8..3917b091 100644 --- a/models/staging/stg_dbt__test_executions.sql +++ b/models/staging/stg_dbt__test_executions.sql @@ -24,7 +24,8 @@ dbt_run as ( fields as ( select - data:metadata:invocation_id::string as command_invocation_id, + command_invocation_id, + dbt_cloud_run_id, generated_at as artifact_generated_at, coalesce(data:args:full_refresh, 'false')::boolean as was_full_refresh, result.value:unique_id::string as node_id, @@ -37,11 +38,11 @@ fields as ( -- The second item in the timing array is `execute`. result.value:timing[1]:completed_at::timestamp_ntz as query_completed_at, - + -- Confusingly, this does not match the delta of the above two timestamps. -- should we calculate it instead? coalesce(result.value:execution_time::float, 0) as total_node_runtime, - + result.value:adapter_response:rows_affected::int as rows_affected from dbt_run, lateral flatten(input => data:results) as result @@ -53,6 +54,7 @@ surrogate_key as ( select {{ dbt_utils.surrogate_key(['command_invocation_id', 'node_id']) }} as model_execution_id, command_invocation_id, + dbt_cloud_run_id, artifact_generated_at, was_full_refresh, node_id,