diff --git a/docs/catalog.json b/docs/catalog.json
new file mode 100644
index 0000000..7d8acdd
--- /dev/null
+++ b/docs/catalog.json
@@ -0,0 +1 @@
+{"metadata": {"dbt_schema_version": "https://schemas.getdbt.com/dbt/catalog/v1.json", "dbt_version": "1.7.11", "generated_at": "2024-12-07T05:38:50.821697Z", "invocation_id": "bd20d4ff-d6c5-4850-b106-ab1d2c6241c2", "env": {}}, "nodes": {"model.dbt_testing_example.body_mass_indexes": {"metadata": {"type": "BASE TABLE", "schema": "dbt_testing_example", "name": "body_mass_indexes", "database": "neondb", "comment": null, "owner": "portovep"}, "columns": {"created_date": {"type": "date", "index": 1, "name": "created_date", "comment": null}, "user_id": {"type": "integer", "index": 2, "name": "user_id", "comment": null}, "weight": {"type": "double precision", "index": 3, "name": "weight", "comment": null}, "height": {"type": "double precision", "index": 4, "name": "height", "comment": null}, "bmi": {"type": "numeric", "index": 5, "name": "bmi", "comment": null}, "processed_at": {"type": "timestamp with time zone", "index": 6, "name": "processed_at", "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_testing_example.body_mass_indexes"}, "model.dbt_testing_example.int_weight_measurements_with_latest_height": {"metadata": {"type": "BASE TABLE", "schema": "dbt_testing_example", "name": "int_weight_measurements_with_latest_height", "database": "neondb", "comment": null, "owner": "portovep"}, "columns": {"created_date": {"type": "date", "index": 1, "name": "created_date", "comment": null}, "user_id": {"type": "integer", "index": 2, "name": "user_id", "comment": null}, "weight": {"type": "double precision", "index": 3, "name": "weight", "comment": null}, "height": {"type": "double precision", "index": 4, "name": "height", "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_testing_example.int_weight_measurements_with_latest_height"}, "seed.dbt_testing_example.raw_height": {"metadata": {"type": "BASE TABLE", "schema": "dbt_testing_example", "name": "raw_height", "database": "neondb", "comment": null, "owner": "portovep"}, "columns": {"date": {"type": "text", "index": 1, "name": "date", "comment": null}, "user_id": {"type": "integer", "index": 2, "name": "user_id", "comment": null}, "height": {"type": "double precision", "index": 3, "name": "height", "comment": null}, "height_unit": {"type": "text", "index": 4, "name": "height_unit", "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": "seed.dbt_testing_example.raw_height"}, "seed.dbt_testing_example.raw_weight": {"metadata": {"type": "BASE TABLE", "schema": "dbt_testing_example", "name": "raw_weight", "database": "neondb", "comment": null, "owner": "portovep"}, "columns": {"date": {"type": "text", "index": 1, "name": "date", "comment": null}, "user_id": {"type": "integer", "index": 2, "name": "user_id", "comment": null}, "weight": {"type": "double precision", "index": 3, "name": "weight", "comment": null}, "measurement_unit": {"type": "text", "index": 4, "name": "measurement_unit", "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": "seed.dbt_testing_example.raw_weight"}, "model.dbt_testing_example.stg_gym_app__height": {"metadata": {"type": "BASE TABLE", "schema": "dbt_testing_example", "name": "stg_gym_app__height", "database": "neondb", "comment": null, "owner": "portovep"}, "columns": {"created_date": {"type": "date", "index": 1, "name": "created_date", "comment": null}, "user_id": {"type": "integer", "index": 2, "name": "user_id", "comment": null}, "height": {"type": "double precision", "index": 3, "name": "height", "comment": null}, "measurement_unit": {"type": "text", "index": 4, "name": "measurement_unit", "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_testing_example.stg_gym_app__height"}, "model.dbt_testing_example.stg_gym_app__weight": {"metadata": {"type": "BASE TABLE", "schema": "dbt_testing_example", "name": "stg_gym_app__weight", "database": "neondb", "comment": null, "owner": "portovep"}, "columns": {"created_date": {"type": "date", "index": 1, "name": "created_date", "comment": null}, "weight": {"type": "double precision", "index": 2, "name": "weight", "comment": null}, "user_id": {"type": "integer", "index": 3, "name": "user_id", "comment": null}, "measurement_unit": {"type": "text", "index": 4, "name": "measurement_unit", "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_testing_example.stg_gym_app__weight"}, "model.elementary.alerts_anomaly_detection": {"metadata": {"type": "VIEW", "schema": "dbt_testing_example_elementary", "name": "alerts_anomaly_detection", "database": "neondb", "comment": null, "owner": "portovep"}, "columns": {"alert_id": {"type": "text", "index": 1, "name": "alert_id", "comment": null}, "data_issue_id": {"type": "character varying(4096)", "index": 2, "name": "data_issue_id", "comment": null}, "test_execution_id": {"type": "text", "index": 3, "name": "test_execution_id", "comment": null}, "test_unique_id": {"type": "text", "index": 4, "name": "test_unique_id", "comment": null}, "model_unique_id": {"type": "text", "index": 5, "name": "model_unique_id", "comment": null}, "detected_at": {"type": "timestamp without time zone", "index": 6, "name": "detected_at", "comment": null}, "database_name": {"type": "character varying(4096)", "index": 7, "name": "database_name", "comment": null}, "schema_name": {"type": "character varying(4096)", "index": 8, "name": "schema_name", "comment": null}, "table_name": {"type": "character varying(4096)", "index": 9, "name": "table_name", "comment": null}, "column_name": {"type": "character varying(4096)", "index": 10, "name": "column_name", "comment": null}, "alert_type": {"type": "character varying(4096)", "index": 11, "name": "alert_type", "comment": null}, "sub_type": {"type": "character varying(4096)", "index": 12, "name": "sub_type", "comment": null}, "alert_description": {"type": "text", "index": 13, "name": "alert_description", "comment": null}, "owners": {"type": "character varying(4096)", "index": 14, "name": "owners", "comment": null}, "tags": {"type": "character varying(4096)", "index": 15, "name": "tags", "comment": null}, "alert_results_query": {"type": "text", "index": 16, "name": "alert_results_query", "comment": null}, "other": {"type": "character varying(4096)", "index": 17, "name": "other", "comment": null}, "test_name": {"type": "text", "index": 18, "name": "test_name", "comment": null}, "test_short_name": {"type": "character varying(4096)", "index": 19, "name": "test_short_name", "comment": null}, "test_params": {"type": "text", "index": 20, "name": "test_params", "comment": null}, "severity": {"type": "character varying(4096)", "index": 21, "name": "severity", "comment": null}, "status": {"type": "character varying(4096)", "index": 22, "name": "status", "comment": null}, "result_rows": {"type": "text", "index": 23, "name": "result_rows", "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.elementary.alerts_anomaly_detection"}, "model.elementary.alerts_dbt_models": {"metadata": {"type": "VIEW", "schema": "dbt_testing_example_elementary", "name": "alerts_dbt_models", "database": "neondb", "comment": null, "owner": "portovep"}, "columns": {"alert_id": {"type": "text", "index": 1, "name": "alert_id", "comment": null}, "unique_id": {"type": "text", "index": 2, "name": "unique_id", "comment": null}, "detected_at": {"type": "timestamp without time zone", "index": 3, "name": "detected_at", "comment": null}, "database_name": {"type": "character varying(4096)", "index": 4, "name": "database_name", "comment": null}, "materialization": {"type": "character varying(4096)", "index": 5, "name": "materialization", "comment": null}, "path": {"type": "character varying(4096)", "index": 6, "name": "path", "comment": null}, "original_path": {"type": "text", "index": 7, "name": "original_path", "comment": null}, "schema_name": {"type": "character varying(4096)", "index": 8, "name": "schema_name", "comment": null}, "message": {"type": "text", "index": 9, "name": "message", "comment": null}, "owners": {"type": "character varying(4096)", "index": 10, "name": "owners", "comment": null}, "tags": {"type": "text", "index": 11, "name": "tags", "comment": null}, "alias": {"type": "character varying(4096)", "index": 12, "name": "alias", "comment": null}, "status": {"type": "character varying(4096)", "index": 13, "name": "status", "comment": null}, "full_refresh": {"type": "boolean", "index": 14, "name": "full_refresh", "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.elementary.alerts_dbt_models"}, "model.elementary.alerts_dbt_source_freshness": {"metadata": {"type": "VIEW", "schema": "dbt_testing_example_elementary", "name": "alerts_dbt_source_freshness", "database": "neondb", "comment": null, "owner": "portovep"}, "columns": {"alert_id": {"type": "character varying(4096)", "index": 1, "name": "alert_id", "comment": null}, "max_loaded_at": {"type": "character varying(4096)", "index": 2, "name": "max_loaded_at", "comment": null}, "snapshotted_at": {"type": "character varying(4096)", "index": 3, "name": "snapshotted_at", "comment": null}, "detected_at": {"type": "timestamp without time zone", "index": 4, "name": "detected_at", "comment": null}, "max_loaded_at_time_ago_in_s": {"type": "double precision", "index": 5, "name": "max_loaded_at_time_ago_in_s", "comment": null}, "status": {"type": "character varying(4096)", "index": 6, "name": "status", "comment": null}, "error": {"type": "character varying(4096)", "index": 7, "name": "error", "comment": null}, "warn_after": {"type": "character varying(4096)", "index": 8, "name": "warn_after", "comment": null}, "error_after": {"type": "character varying(4096)", "index": 9, "name": "error_after", "comment": null}, "filter": {"type": "text", "index": 10, "name": "filter", "comment": null}, "unique_id": {"type": "character varying(4096)", "index": 11, "name": "unique_id", "comment": null}, "database_name": {"type": "character varying(4096)", "index": 12, "name": "database_name", "comment": null}, "schema_name": {"type": "character varying(4096)", "index": 13, "name": "schema_name", "comment": null}, "source_name": {"type": "character varying(4096)", "index": 14, "name": "source_name", "comment": null}, "identifier": {"type": "character varying(4096)", "index": 15, "name": "identifier", "comment": null}, "tags": {"type": "text", "index": 16, "name": "tags", "comment": null}, "meta": {"type": "text", "index": 17, "name": "meta", "comment": null}, "owner": {"type": "character varying(4096)", "index": 18, "name": "owner", "comment": null}, "package_name": {"type": "character varying(4096)", "index": 19, "name": "package_name", "comment": null}, "path": {"type": "character varying(4096)", "index": 20, "name": "path", "comment": null}, "freshness_error_after": {"type": "character varying(4096)", "index": 21, "name": "freshness_error_after", "comment": null}, "freshness_warn_after": {"type": "character varying(4096)", "index": 22, "name": "freshness_warn_after", "comment": null}, "freshness_filter": {"type": "text", "index": 23, "name": "freshness_filter", "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.elementary.alerts_dbt_source_freshness"}, "model.elementary.alerts_dbt_tests": {"metadata": {"type": "VIEW", "schema": "dbt_testing_example_elementary", "name": "alerts_dbt_tests", "database": "neondb", "comment": null, "owner": "portovep"}, "columns": {"alert_id": {"type": "text", "index": 1, "name": "alert_id", "comment": null}, "data_issue_id": {"type": "character varying(4096)", "index": 2, "name": "data_issue_id", "comment": null}, "test_execution_id": {"type": "text", "index": 3, "name": "test_execution_id", "comment": null}, "test_unique_id": {"type": "text", "index": 4, "name": "test_unique_id", "comment": null}, "model_unique_id": {"type": "text", "index": 5, "name": "model_unique_id", "comment": null}, "detected_at": {"type": "timestamp without time zone", "index": 6, "name": "detected_at", "comment": null}, "database_name": {"type": "character varying(4096)", "index": 7, "name": "database_name", "comment": null}, "schema_name": {"type": "character varying(4096)", "index": 8, "name": "schema_name", "comment": null}, "table_name": {"type": "character varying(4096)", "index": 9, "name": "table_name", "comment": null}, "column_name": {"type": "character varying(4096)", "index": 10, "name": "column_name", "comment": null}, "alert_type": {"type": "character varying(4096)", "index": 11, "name": "alert_type", "comment": null}, "sub_type": {"type": "character varying(4096)", "index": 12, "name": "sub_type", "comment": null}, "alert_description": {"type": "text", "index": 13, "name": "alert_description", "comment": null}, "owners": {"type": "character varying(4096)", "index": 14, "name": "owners", "comment": null}, "tags": {"type": "character varying(4096)", "index": 15, "name": "tags", "comment": null}, "alert_results_query": {"type": "text", "index": 16, "name": "alert_results_query", "comment": null}, "other": {"type": "character varying(4096)", "index": 17, "name": "other", "comment": null}, "test_name": {"type": "text", "index": 18, "name": "test_name", "comment": null}, "test_short_name": {"type": "character varying(4096)", "index": 19, "name": "test_short_name", "comment": null}, "test_params": {"type": "text", "index": 20, "name": "test_params", "comment": null}, "severity": {"type": "character varying(4096)", "index": 21, "name": "severity", "comment": null}, "status": {"type": "character varying(4096)", "index": 22, "name": "status", "comment": null}, "result_rows": {"type": "text", "index": 23, "name": "result_rows", "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.elementary.alerts_dbt_tests"}, "model.elementary.alerts_schema_changes": {"metadata": {"type": "VIEW", "schema": "dbt_testing_example_elementary", "name": "alerts_schema_changes", "database": "neondb", "comment": null, "owner": "portovep"}, "columns": {"alert_id": {"type": "text", "index": 1, "name": "alert_id", "comment": null}, "data_issue_id": {"type": "character varying(4096)", "index": 2, "name": "data_issue_id", "comment": null}, "test_execution_id": {"type": "text", "index": 3, "name": "test_execution_id", "comment": null}, "test_unique_id": {"type": "text", "index": 4, "name": "test_unique_id", "comment": null}, "model_unique_id": {"type": "text", "index": 5, "name": "model_unique_id", "comment": null}, "detected_at": {"type": "timestamp without time zone", "index": 6, "name": "detected_at", "comment": null}, "database_name": {"type": "character varying(4096)", "index": 7, "name": "database_name", "comment": null}, "schema_name": {"type": "character varying(4096)", "index": 8, "name": "schema_name", "comment": null}, "table_name": {"type": "character varying(4096)", "index": 9, "name": "table_name", "comment": null}, "column_name": {"type": "character varying(4096)", "index": 10, "name": "column_name", "comment": null}, "alert_type": {"type": "character varying(4096)", "index": 11, "name": "alert_type", "comment": null}, "sub_type": {"type": "character varying(4096)", "index": 12, "name": "sub_type", "comment": null}, "alert_description": {"type": "text", "index": 13, "name": "alert_description", "comment": null}, "owners": {"type": "character varying(4096)", "index": 14, "name": "owners", "comment": null}, "tags": {"type": "character varying(4096)", "index": 15, "name": "tags", "comment": null}, "alert_results_query": {"type": "text", "index": 16, "name": "alert_results_query", "comment": null}, "other": {"type": "character varying(4096)", "index": 17, "name": "other", "comment": null}, "test_name": {"type": "text", "index": 18, "name": "test_name", "comment": null}, "test_short_name": {"type": "character varying(4096)", "index": 19, "name": "test_short_name", "comment": null}, "test_params": {"type": "text", "index": 20, "name": "test_params", "comment": null}, "severity": {"type": "character varying(4096)", "index": 21, "name": "severity", "comment": null}, "status": {"type": "character varying(4096)", "index": 22, "name": "status", "comment": null}, "result_rows": {"type": "text", "index": 23, "name": "result_rows", "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.elementary.alerts_schema_changes"}, "model.elementary.anomaly_threshold_sensitivity": {"metadata": {"type": "VIEW", "schema": "dbt_testing_example_elementary", "name": "anomaly_threshold_sensitivity", "database": "neondb", "comment": null, "owner": "portovep"}, "columns": {"full_table_name": {"type": "character varying(4096)", "index": 1, "name": "full_table_name", "comment": null}, "column_name": {"type": "character varying(4096)", "index": 2, "name": "column_name", "comment": null}, "metric_name": {"type": "character varying(4096)", "index": 3, "name": "metric_name", "comment": null}, "latest_metric_value": {"type": "double precision", "index": 4, "name": "latest_metric_value", "comment": null}, "metric_avg": {"type": "double precision", "index": 5, "name": "metric_avg", "comment": null}, "metric_stddev": {"type": "double precision", "index": 6, "name": "metric_stddev", "comment": null}, "anomaly_score": {"type": "double precision", "index": 7, "name": "anomaly_score", "comment": null}, "is_anomaly_1_5": {"type": "boolean", "index": 8, "name": "is_anomaly_1_5", "comment": null}, "is_anomaly_2": {"type": "boolean", "index": 9, "name": "is_anomaly_2", "comment": null}, "is_anomaly_2_5": {"type": "boolean", "index": 10, "name": "is_anomaly_2_5", "comment": null}, "is_anomaly_3": {"type": "boolean", "index": 11, "name": "is_anomaly_3", "comment": null}, "is_anomaly_3_5": {"type": "boolean", "index": 12, "name": "is_anomaly_3_5", "comment": null}, "is_anomaly_4": {"type": "boolean", "index": 13, "name": "is_anomaly_4", "comment": null}, "is_anomaly_4_5": {"type": "boolean", "index": 14, "name": "is_anomaly_4_5", "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.elementary.anomaly_threshold_sensitivity"}, "model.elementary.data_monitoring_metrics": {"metadata": {"type": "BASE TABLE", "schema": "dbt_testing_example_elementary", "name": "data_monitoring_metrics", "database": "neondb", "comment": null, "owner": "portovep"}, "columns": {"id": {"type": "character varying(4096)", "index": 1, "name": "id", "comment": null}, "full_table_name": {"type": "character varying(4096)", "index": 2, "name": "full_table_name", "comment": null}, "column_name": {"type": "character varying(4096)", "index": 3, "name": "column_name", "comment": null}, "metric_name": {"type": "character varying(4096)", "index": 4, "name": "metric_name", "comment": null}, "metric_value": {"type": "double precision", "index": 5, "name": "metric_value", "comment": null}, "source_value": {"type": "character varying(4096)", "index": 6, "name": "source_value", "comment": null}, "bucket_start": {"type": "timestamp without time zone", "index": 7, "name": "bucket_start", "comment": null}, "bucket_end": {"type": "timestamp without time zone", "index": 8, "name": "bucket_end", "comment": null}, "bucket_duration_hours": {"type": "integer", "index": 9, "name": "bucket_duration_hours", "comment": null}, "updated_at": {"type": "timestamp without time zone", "index": 10, "name": "updated_at", "comment": null}, "dimension": {"type": "character varying(4096)", "index": 11, "name": "dimension", "comment": null}, "dimension_value": {"type": "character varying(4096)", "index": 12, "name": "dimension_value", "comment": null}, "metric_properties": {"type": "character varying(4096)", "index": 13, "name": "metric_properties", "comment": null}, "created_at": {"type": "timestamp without time zone", "index": 14, "name": "created_at", "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.elementary.data_monitoring_metrics"}, "model.elementary.dbt_artifacts_hashes": {"metadata": {"type": "VIEW", "schema": "dbt_testing_example_elementary", "name": "dbt_artifacts_hashes", "database": "neondb", "comment": null, "owner": "portovep"}, "columns": {"artifacts_model": {"type": "text", "index": 1, "name": "artifacts_model", "comment": null}, "metadata_hash": {"type": "character varying(4096)", "index": 2, "name": "metadata_hash", "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.elementary.dbt_artifacts_hashes"}, "model.elementary.dbt_columns": {"metadata": {"type": "BASE TABLE", "schema": "dbt_testing_example_elementary", "name": "dbt_columns", "database": "neondb", "comment": null, "owner": "portovep"}, "columns": {"unique_id": {"type": "character varying(4096)", "index": 1, "name": "unique_id", "comment": null}, "parent_unique_id": {"type": "character varying(4096)", "index": 2, "name": "parent_unique_id", "comment": null}, "name": {"type": "character varying(4096)", "index": 3, "name": "name", "comment": null}, "data_type": {"type": "character varying(4096)", "index": 4, "name": "data_type", "comment": null}, "tags": {"type": "text", "index": 5, "name": "tags", "comment": null}, "meta": {"type": "text", "index": 6, "name": "meta", "comment": null}, "database_name": {"type": "character varying(4096)", "index": 7, "name": "database_name", "comment": null}, "schema_name": {"type": "character varying(4096)", "index": 8, "name": "schema_name", "comment": null}, "table_name": {"type": "character varying(4096)", "index": 9, "name": "table_name", "comment": null}, "description": {"type": "text", "index": 10, "name": "description", "comment": null}, "resource_type": {"type": "character varying(4096)", "index": 11, "name": "resource_type", "comment": null}, "generated_at": {"type": "character varying(4096)", "index": 12, "name": "generated_at", "comment": null}, "metadata_hash": {"type": "character varying(4096)", "index": 13, "name": "metadata_hash", "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.elementary.dbt_columns"}, "model.elementary.dbt_exposures": {"metadata": {"type": "BASE TABLE", "schema": "dbt_testing_example_elementary", "name": "dbt_exposures", "database": "neondb", "comment": null, "owner": "portovep"}, "columns": {"unique_id": {"type": "character varying(4096)", "index": 1, "name": "unique_id", "comment": null}, "name": {"type": "character varying(4096)", "index": 2, "name": "name", "comment": null}, "maturity": {"type": "character varying(4096)", "index": 3, "name": "maturity", "comment": null}, "type": {"type": "character varying(4096)", "index": 4, "name": "type", "comment": null}, "owner_email": {"type": "character varying(4096)", "index": 5, "name": "owner_email", "comment": null}, "owner_name": {"type": "character varying(4096)", "index": 6, "name": "owner_name", "comment": null}, "url": {"type": "text", "index": 7, "name": "url", "comment": null}, "depends_on_macros": {"type": "text", "index": 8, "name": "depends_on_macros", "comment": null}, "depends_on_nodes": {"type": "text", "index": 9, "name": "depends_on_nodes", "comment": null}, "description": {"type": "text", "index": 10, "name": "description", "comment": null}, "tags": {"type": "text", "index": 11, "name": "tags", "comment": null}, "meta": {"type": "text", "index": 12, "name": "meta", "comment": null}, "package_name": {"type": "character varying(4096)", "index": 13, "name": "package_name", "comment": null}, "original_path": {"type": "text", "index": 14, "name": "original_path", "comment": null}, "path": {"type": "character varying(4096)", "index": 15, "name": "path", "comment": null}, "generated_at": {"type": "character varying(4096)", "index": 16, "name": "generated_at", "comment": null}, "metadata_hash": {"type": "character varying(4096)", "index": 17, "name": "metadata_hash", "comment": null}, "label": {"type": "character varying(4096)", "index": 18, "name": "label", "comment": null}, "raw_queries": {"type": "text", "index": 19, "name": "raw_queries", "comment": null}, "depends_on_columns": {"type": "text", "index": 20, "name": "depends_on_columns", "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.elementary.dbt_exposures"}, "model.elementary.dbt_invocations": {"metadata": {"type": "BASE TABLE", "schema": "dbt_testing_example_elementary", "name": "dbt_invocations", "database": "neondb", "comment": null, "owner": "portovep"}, "columns": {"invocation_id": {"type": "text", "index": 1, "name": "invocation_id", "comment": null}, "job_id": {"type": "text", "index": 2, "name": "job_id", "comment": null}, "job_name": {"type": "text", "index": 3, "name": "job_name", "comment": null}, "job_run_id": {"type": "text", "index": 4, "name": "job_run_id", "comment": null}, "run_started_at": {"type": "character varying(4096)", "index": 5, "name": "run_started_at", "comment": null}, "run_completed_at": {"type": "character varying(4096)", "index": 6, "name": "run_completed_at", "comment": null}, "generated_at": {"type": "character varying(4096)", "index": 7, "name": "generated_at", "comment": null}, "created_at": {"type": "timestamp without time zone", "index": 8, "name": "created_at", "comment": null}, "command": {"type": "character varying(4096)", "index": 9, "name": "command", "comment": null}, "dbt_version": {"type": "character varying(4096)", "index": 10, "name": "dbt_version", "comment": null}, "elementary_version": {"type": "character varying(4096)", "index": 11, "name": "elementary_version", "comment": null}, "full_refresh": {"type": "boolean", "index": 12, "name": "full_refresh", "comment": null}, "invocation_vars": {"type": "text", "index": 13, "name": "invocation_vars", "comment": null}, "vars": {"type": "text", "index": 14, "name": "vars", "comment": null}, "target_name": {"type": "character varying(4096)", "index": 15, "name": "target_name", "comment": null}, "target_database": {"type": "character varying(4096)", "index": 16, "name": "target_database", "comment": null}, "target_schema": {"type": "character varying(4096)", "index": 17, "name": "target_schema", "comment": null}, "target_profile_name": {"type": "character varying(4096)", "index": 18, "name": "target_profile_name", "comment": null}, "threads": {"type": "integer", "index": 19, "name": "threads", "comment": null}, "selected": {"type": "text", "index": 20, "name": "selected", "comment": null}, "yaml_selector": {"type": "text", "index": 21, "name": "yaml_selector", "comment": null}, "project_id": {"type": "character varying(4096)", "index": 22, "name": "project_id", "comment": null}, "project_name": {"type": "character varying(4096)", "index": 23, "name": "project_name", "comment": null}, "env": {"type": "character varying(4096)", "index": 24, "name": "env", "comment": null}, "env_id": {"type": "character varying(4096)", "index": 25, "name": "env_id", "comment": null}, "cause_category": {"type": "character varying(4096)", "index": 26, "name": "cause_category", "comment": null}, "cause": {"type": "text", "index": 27, "name": "cause", "comment": null}, "pull_request_id": {"type": "character varying(4096)", "index": 28, "name": "pull_request_id", "comment": null}, "git_sha": {"type": "character varying(4096)", "index": 29, "name": "git_sha", "comment": null}, "orchestrator": {"type": "character varying(4096)", "index": 30, "name": "orchestrator", "comment": null}, "dbt_user": {"type": "character varying(4096)", "index": 31, "name": "dbt_user", "comment": null}, "job_url": {"type": "character varying(4096)", "index": 32, "name": "job_url", "comment": null}, "job_run_url": {"type": "character varying(4096)", "index": 33, "name": "job_run_url", "comment": null}, "account_id": {"type": "character varying(4096)", "index": 34, "name": "account_id", "comment": null}, "target_adapter_specific_fields": {"type": "text", "index": 35, "name": "target_adapter_specific_fields", "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.elementary.dbt_invocations"}, "model.elementary.dbt_metrics": {"metadata": {"type": "BASE TABLE", "schema": "dbt_testing_example_elementary", "name": "dbt_metrics", "database": "neondb", "comment": null, "owner": "portovep"}, "columns": {"unique_id": {"type": "character varying(4096)", "index": 1, "name": "unique_id", "comment": null}, "name": {"type": "character varying(4096)", "index": 2, "name": "name", "comment": null}, "label": {"type": "character varying(4096)", "index": 3, "name": "label", "comment": null}, "model": {"type": "character varying(4096)", "index": 4, "name": "model", "comment": null}, "type": {"type": "character varying(4096)", "index": 5, "name": "type", "comment": null}, "sql": {"type": "text", "index": 6, "name": "sql", "comment": null}, "timestamp": {"type": "character varying(4096)", "index": 7, "name": "timestamp", "comment": null}, "filters": {"type": "text", "index": 8, "name": "filters", "comment": null}, "time_grains": {"type": "text", "index": 9, "name": "time_grains", "comment": null}, "dimensions": {"type": "text", "index": 10, "name": "dimensions", "comment": null}, "depends_on_macros": {"type": "text", "index": 11, "name": "depends_on_macros", "comment": null}, "depends_on_nodes": {"type": "text", "index": 12, "name": "depends_on_nodes", "comment": null}, "description": {"type": "text", "index": 13, "name": "description", "comment": null}, "tags": {"type": "text", "index": 14, "name": "tags", "comment": null}, "meta": {"type": "text", "index": 15, "name": "meta", "comment": null}, "package_name": {"type": "character varying(4096)", "index": 16, "name": "package_name", "comment": null}, "original_path": {"type": "text", "index": 17, "name": "original_path", "comment": null}, "path": {"type": "character varying(4096)", "index": 18, "name": "path", "comment": null}, "generated_at": {"type": "character varying(4096)", "index": 19, "name": "generated_at", "comment": null}, "metadata_hash": {"type": "character varying(4096)", "index": 20, "name": "metadata_hash", "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.elementary.dbt_metrics"}, "model.elementary.dbt_models": {"metadata": {"type": "BASE TABLE", "schema": "dbt_testing_example_elementary", "name": "dbt_models", "database": "neondb", "comment": null, "owner": "portovep"}, "columns": {"unique_id": {"type": "character varying(4096)", "index": 1, "name": "unique_id", "comment": null}, "alias": {"type": "character varying(4096)", "index": 2, "name": "alias", "comment": null}, "checksum": {"type": "character varying(4096)", "index": 3, "name": "checksum", "comment": null}, "materialization": {"type": "character varying(4096)", "index": 4, "name": "materialization", "comment": null}, "tags": {"type": "text", "index": 5, "name": "tags", "comment": null}, "meta": {"type": "text", "index": 6, "name": "meta", "comment": null}, "owner": {"type": "character varying(4096)", "index": 7, "name": "owner", "comment": null}, "database_name": {"type": "character varying(4096)", "index": 8, "name": "database_name", "comment": null}, "schema_name": {"type": "character varying(4096)", "index": 9, "name": "schema_name", "comment": null}, "depends_on_macros": {"type": "text", "index": 10, "name": "depends_on_macros", "comment": null}, "depends_on_nodes": {"type": "text", "index": 11, "name": "depends_on_nodes", "comment": null}, "description": {"type": "text", "index": 12, "name": "description", "comment": null}, "name": {"type": "character varying(4096)", "index": 13, "name": "name", "comment": null}, "package_name": {"type": "character varying(4096)", "index": 14, "name": "package_name", "comment": null}, "original_path": {"type": "text", "index": 15, "name": "original_path", "comment": null}, "path": {"type": "character varying(4096)", "index": 16, "name": "path", "comment": null}, "patch_path": {"type": "character varying(4096)", "index": 17, "name": "patch_path", "comment": null}, "generated_at": {"type": "character varying(4096)", "index": 18, "name": "generated_at", "comment": null}, "metadata_hash": {"type": "character varying(4096)", "index": 19, "name": "metadata_hash", "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.elementary.dbt_models"}, "model.elementary.dbt_run_results": {"metadata": {"type": "BASE TABLE", "schema": "dbt_testing_example_elementary", "name": "dbt_run_results", "database": "neondb", "comment": null, "owner": "portovep"}, "columns": {"model_execution_id": {"type": "text", "index": 1, "name": "model_execution_id", "comment": null}, "unique_id": {"type": "text", "index": 2, "name": "unique_id", "comment": null}, "invocation_id": {"type": "character varying(4096)", "index": 3, "name": "invocation_id", "comment": null}, "generated_at": {"type": "character varying(4096)", "index": 4, "name": "generated_at", "comment": null}, "created_at": {"type": "timestamp without time zone", "index": 5, "name": "created_at", "comment": null}, "name": {"type": "text", "index": 6, "name": "name", "comment": null}, "message": {"type": "text", "index": 7, "name": "message", "comment": null}, "status": {"type": "character varying(4096)", "index": 8, "name": "status", "comment": null}, "resource_type": {"type": "character varying(4096)", "index": 9, "name": "resource_type", "comment": null}, "execution_time": {"type": "double precision", "index": 10, "name": "execution_time", "comment": null}, "execute_started_at": {"type": "character varying(4096)", "index": 11, "name": "execute_started_at", "comment": null}, "execute_completed_at": {"type": "character varying(4096)", "index": 12, "name": "execute_completed_at", "comment": null}, "compile_started_at": {"type": "character varying(4096)", "index": 13, "name": "compile_started_at", "comment": null}, "compile_completed_at": {"type": "character varying(4096)", "index": 14, "name": "compile_completed_at", "comment": null}, "rows_affected": {"type": "bigint", "index": 15, "name": "rows_affected", "comment": null}, "full_refresh": {"type": "boolean", "index": 16, "name": "full_refresh", "comment": null}, "compiled_code": {"type": "text", "index": 17, "name": "compiled_code", "comment": null}, "failures": {"type": "bigint", "index": 18, "name": "failures", "comment": null}, "query_id": {"type": "character varying(4096)", "index": 19, "name": "query_id", "comment": null}, "thread_id": {"type": "character varying(4096)", "index": 20, "name": "thread_id", "comment": null}, "materialization": {"type": "character varying(4096)", "index": 21, "name": "materialization", "comment": null}, "adapter_response": {"type": "character varying(4096)", "index": 22, "name": "adapter_response", "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.elementary.dbt_run_results"}, "model.elementary.dbt_seeds": {"metadata": {"type": "BASE TABLE", "schema": "dbt_testing_example_elementary", "name": "dbt_seeds", "database": "neondb", "comment": null, "owner": "portovep"}, "columns": {"unique_id": {"type": "character varying(4096)", "index": 1, "name": "unique_id", "comment": null}, "alias": {"type": "character varying(4096)", "index": 2, "name": "alias", "comment": null}, "checksum": {"type": "character varying(4096)", "index": 3, "name": "checksum", "comment": null}, "tags": {"type": "text", "index": 4, "name": "tags", "comment": null}, "meta": {"type": "text", "index": 5, "name": "meta", "comment": null}, "owner": {"type": "character varying(4096)", "index": 6, "name": "owner", "comment": null}, "database_name": {"type": "character varying(4096)", "index": 7, "name": "database_name", "comment": null}, "schema_name": {"type": "character varying(4096)", "index": 8, "name": "schema_name", "comment": null}, "description": {"type": "text", "index": 9, "name": "description", "comment": null}, "name": {"type": "character varying(4096)", "index": 10, "name": "name", "comment": null}, "package_name": {"type": "character varying(4096)", "index": 11, "name": "package_name", "comment": null}, "original_path": {"type": "text", "index": 12, "name": "original_path", "comment": null}, "path": {"type": "character varying(4096)", "index": 13, "name": "path", "comment": null}, "generated_at": {"type": "character varying(4096)", "index": 14, "name": "generated_at", "comment": null}, "metadata_hash": {"type": "character varying(4096)", "index": 15, "name": "metadata_hash", "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.elementary.dbt_seeds"}, "model.elementary.dbt_snapshots": {"metadata": {"type": "BASE TABLE", "schema": "dbt_testing_example_elementary", "name": "dbt_snapshots", "database": "neondb", "comment": null, "owner": "portovep"}, "columns": {"unique_id": {"type": "character varying(4096)", "index": 1, "name": "unique_id", "comment": null}, "alias": {"type": "character varying(4096)", "index": 2, "name": "alias", "comment": null}, "checksum": {"type": "character varying(4096)", "index": 3, "name": "checksum", "comment": null}, "materialization": {"type": "character varying(4096)", "index": 4, "name": "materialization", "comment": null}, "tags": {"type": "text", "index": 5, "name": "tags", "comment": null}, "meta": {"type": "text", "index": 6, "name": "meta", "comment": null}, "owner": {"type": "character varying(4096)", "index": 7, "name": "owner", "comment": null}, "database_name": {"type": "character varying(4096)", "index": 8, "name": "database_name", "comment": null}, "schema_name": {"type": "character varying(4096)", "index": 9, "name": "schema_name", "comment": null}, "depends_on_macros": {"type": "text", "index": 10, "name": "depends_on_macros", "comment": null}, "depends_on_nodes": {"type": "text", "index": 11, "name": "depends_on_nodes", "comment": null}, "description": {"type": "text", "index": 12, "name": "description", "comment": null}, "name": {"type": "character varying(4096)", "index": 13, "name": "name", "comment": null}, "package_name": {"type": "character varying(4096)", "index": 14, "name": "package_name", "comment": null}, "original_path": {"type": "text", "index": 15, "name": "original_path", "comment": null}, "path": {"type": "character varying(4096)", "index": 16, "name": "path", "comment": null}, "patch_path": {"type": "character varying(4096)", "index": 17, "name": "patch_path", "comment": null}, "generated_at": {"type": "character varying(4096)", "index": 18, "name": "generated_at", "comment": null}, "metadata_hash": {"type": "character varying(4096)", "index": 19, "name": "metadata_hash", "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.elementary.dbt_snapshots"}, "model.elementary.dbt_source_freshness_results": {"metadata": {"type": "BASE TABLE", "schema": "dbt_testing_example_elementary", "name": "dbt_source_freshness_results", "database": "neondb", "comment": null, "owner": "portovep"}, "columns": {"source_freshness_execution_id": {"type": "character varying(4096)", "index": 1, "name": "source_freshness_execution_id", "comment": null}, "unique_id": {"type": "character varying(4096)", "index": 2, "name": "unique_id", "comment": null}, "max_loaded_at": {"type": "character varying(4096)", "index": 3, "name": "max_loaded_at", "comment": null}, "snapshotted_at": {"type": "character varying(4096)", "index": 4, "name": "snapshotted_at", "comment": null}, "generated_at": {"type": "character varying(4096)", "index": 5, "name": "generated_at", "comment": null}, "created_at": {"type": "timestamp without time zone", "index": 6, "name": "created_at", "comment": null}, "max_loaded_at_time_ago_in_s": {"type": "double precision", "index": 7, "name": "max_loaded_at_time_ago_in_s", "comment": null}, "status": {"type": "character varying(4096)", "index": 8, "name": "status", "comment": null}, "error": {"type": "character varying(4096)", "index": 9, "name": "error", "comment": null}, "compile_started_at": {"type": "character varying(4096)", "index": 10, "name": "compile_started_at", "comment": null}, "compile_completed_at": {"type": "character varying(4096)", "index": 11, "name": "compile_completed_at", "comment": null}, "execute_started_at": {"type": "character varying(4096)", "index": 12, "name": "execute_started_at", "comment": null}, "execute_completed_at": {"type": "character varying(4096)", "index": 13, "name": "execute_completed_at", "comment": null}, "invocation_id": {"type": "character varying(4096)", "index": 14, "name": "invocation_id", "comment": null}, "warn_after": {"type": "character varying(4096)", "index": 15, "name": "warn_after", "comment": null}, "error_after": {"type": "character varying(4096)", "index": 16, "name": "error_after", "comment": null}, "filter": {"type": "text", "index": 17, "name": "filter", "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.elementary.dbt_source_freshness_results"}, "model.elementary.dbt_sources": {"metadata": {"type": "BASE TABLE", "schema": "dbt_testing_example_elementary", "name": "dbt_sources", "database": "neondb", "comment": null, "owner": "portovep"}, "columns": {"unique_id": {"type": "character varying(4096)", "index": 1, "name": "unique_id", "comment": null}, "database_name": {"type": "character varying(4096)", "index": 2, "name": "database_name", "comment": null}, "schema_name": {"type": "character varying(4096)", "index": 3, "name": "schema_name", "comment": null}, "source_name": {"type": "character varying(4096)", "index": 4, "name": "source_name", "comment": null}, "name": {"type": "character varying(4096)", "index": 5, "name": "name", "comment": null}, "identifier": {"type": "character varying(4096)", "index": 6, "name": "identifier", "comment": null}, "loaded_at_field": {"type": "character varying(4096)", "index": 7, "name": "loaded_at_field", "comment": null}, "freshness_warn_after": {"type": "character varying(4096)", "index": 8, "name": "freshness_warn_after", "comment": null}, "freshness_error_after": {"type": "character varying(4096)", "index": 9, "name": "freshness_error_after", "comment": null}, "freshness_filter": {"type": "text", "index": 10, "name": "freshness_filter", "comment": null}, "freshness_description": {"type": "text", "index": 11, "name": "freshness_description", "comment": null}, "relation_name": {"type": "character varying(4096)", "index": 12, "name": "relation_name", "comment": null}, "tags": {"type": "text", "index": 13, "name": "tags", "comment": null}, "meta": {"type": "text", "index": 14, "name": "meta", "comment": null}, "owner": {"type": "character varying(4096)", "index": 15, "name": "owner", "comment": null}, "package_name": {"type": "character varying(4096)", "index": 16, "name": "package_name", "comment": null}, "original_path": {"type": "text", "index": 17, "name": "original_path", "comment": null}, "path": {"type": "character varying(4096)", "index": 18, "name": "path", "comment": null}, "source_description": {"type": "text", "index": 19, "name": "source_description", "comment": null}, "description": {"type": "text", "index": 20, "name": "description", "comment": null}, "generated_at": {"type": "character varying(4096)", "index": 21, "name": "generated_at", "comment": null}, "metadata_hash": {"type": "character varying(4096)", "index": 22, "name": "metadata_hash", "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.elementary.dbt_sources"}, "model.elementary.dbt_tests": {"metadata": {"type": "BASE TABLE", "schema": "dbt_testing_example_elementary", "name": "dbt_tests", "database": "neondb", "comment": null, "owner": "portovep"}, "columns": {"unique_id": {"type": "character varying(4096)", "index": 1, "name": "unique_id", "comment": null}, "database_name": {"type": "character varying(4096)", "index": 2, "name": "database_name", "comment": null}, "schema_name": {"type": "character varying(4096)", "index": 3, "name": "schema_name", "comment": null}, "name": {"type": "character varying(4096)", "index": 4, "name": "name", "comment": null}, "short_name": {"type": "character varying(4096)", "index": 5, "name": "short_name", "comment": null}, "alias": {"type": "character varying(4096)", "index": 6, "name": "alias", "comment": null}, "test_column_name": {"type": "character varying(4096)", "index": 7, "name": "test_column_name", "comment": null}, "severity": {"type": "character varying(4096)", "index": 8, "name": "severity", "comment": null}, "warn_if": {"type": "character varying(4096)", "index": 9, "name": "warn_if", "comment": null}, "error_if": {"type": "character varying(4096)", "index": 10, "name": "error_if", "comment": null}, "test_params": {"type": "text", "index": 11, "name": "test_params", "comment": null}, "test_namespace": {"type": "character varying(4096)", "index": 12, "name": "test_namespace", "comment": null}, "tags": {"type": "text", "index": 13, "name": "tags", "comment": null}, "model_tags": {"type": "text", "index": 14, "name": "model_tags", "comment": null}, "model_owners": {"type": "text", "index": 15, "name": "model_owners", "comment": null}, "meta": {"type": "text", "index": 16, "name": "meta", "comment": null}, "depends_on_macros": {"type": "text", "index": 17, "name": "depends_on_macros", "comment": null}, "depends_on_nodes": {"type": "text", "index": 18, "name": "depends_on_nodes", "comment": null}, "parent_model_unique_id": {"type": "character varying(4096)", "index": 19, "name": "parent_model_unique_id", "comment": null}, "description": {"type": "text", "index": 20, "name": "description", "comment": null}, "package_name": {"type": "character varying(4096)", "index": 21, "name": "package_name", "comment": null}, "type": {"type": "character varying(4096)", "index": 22, "name": "type", "comment": null}, "original_path": {"type": "text", "index": 23, "name": "original_path", "comment": null}, "path": {"type": "character varying(4096)", "index": 24, "name": "path", "comment": null}, "generated_at": {"type": "character varying(4096)", "index": 25, "name": "generated_at", "comment": null}, "metadata_hash": {"type": "character varying(4096)", "index": 26, "name": "metadata_hash", "comment": null}, "quality_dimension": {"type": "character varying(4096)", "index": 27, "name": "quality_dimension", "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.elementary.dbt_tests"}, "model.elementary.elementary_test_results": {"metadata": {"type": "BASE TABLE", "schema": "dbt_testing_example_elementary", "name": "elementary_test_results", "database": "neondb", "comment": null, "owner": "portovep"}, "columns": {"id": {"type": "text", "index": 1, "name": "id", "comment": null}, "data_issue_id": {"type": "character varying(4096)", "index": 2, "name": "data_issue_id", "comment": null}, "test_execution_id": {"type": "text", "index": 3, "name": "test_execution_id", "comment": null}, "test_unique_id": {"type": "text", "index": 4, "name": "test_unique_id", "comment": null}, "model_unique_id": {"type": "text", "index": 5, "name": "model_unique_id", "comment": null}, "invocation_id": {"type": "character varying(4096)", "index": 6, "name": "invocation_id", "comment": null}, "detected_at": {"type": "timestamp without time zone", "index": 7, "name": "detected_at", "comment": null}, "created_at": {"type": "timestamp without time zone", "index": 8, "name": "created_at", "comment": null}, "database_name": {"type": "character varying(4096)", "index": 9, "name": "database_name", "comment": null}, "schema_name": {"type": "character varying(4096)", "index": 10, "name": "schema_name", "comment": null}, "table_name": {"type": "character varying(4096)", "index": 11, "name": "table_name", "comment": null}, "column_name": {"type": "character varying(4096)", "index": 12, "name": "column_name", "comment": null}, "test_type": {"type": "character varying(4096)", "index": 13, "name": "test_type", "comment": null}, "test_sub_type": {"type": "character varying(4096)", "index": 14, "name": "test_sub_type", "comment": null}, "test_results_description": {"type": "text", "index": 15, "name": "test_results_description", "comment": null}, "owners": {"type": "character varying(4096)", "index": 16, "name": "owners", "comment": null}, "tags": {"type": "character varying(4096)", "index": 17, "name": "tags", "comment": null}, "test_results_query": {"type": "text", "index": 18, "name": "test_results_query", "comment": null}, "other": {"type": "character varying(4096)", "index": 19, "name": "other", "comment": null}, "test_name": {"type": "text", "index": 20, "name": "test_name", "comment": null}, "test_params": {"type": "text", "index": 21, "name": "test_params", "comment": null}, "severity": {"type": "character varying(4096)", "index": 22, "name": "severity", "comment": null}, "status": {"type": "character varying(4096)", "index": 23, "name": "status", "comment": null}, "failures": {"type": "bigint", "index": 24, "name": "failures", "comment": null}, "test_short_name": {"type": "character varying(4096)", "index": 25, "name": "test_short_name", "comment": null}, "test_alias": {"type": "character varying(4096)", "index": 26, "name": "test_alias", "comment": null}, "result_rows": {"type": "text", "index": 27, "name": "result_rows", "comment": null}, "failed_row_count": {"type": "bigint", "index": 28, "name": "failed_row_count", "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.elementary.elementary_test_results"}, "model.elementary.enriched_columns": {"metadata": {"type": "VIEW", "schema": "dbt_testing_example_elementary", "name": "enriched_columns", "database": "neondb", "comment": null, "owner": "portovep"}, "columns": {"database_name": {"type": "text", "index": 1, "name": "database_name", "comment": null}, "schema_name": {"type": "text", "index": 2, "name": "schema_name", "comment": null}, "table_name": {"type": "text", "index": 3, "name": "table_name", "comment": null}, "name": {"type": "text", "index": 4, "name": "name", "comment": null}, "data_type": {"type": "information_schema.character_data", "index": 5, "name": "data_type", "comment": null}, "description": {"type": "text", "index": 6, "name": "description", "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.elementary.enriched_columns"}, "model.elementary.information_schema_columns": {"metadata": {"type": "VIEW", "schema": "dbt_testing_example_elementary", "name": "information_schema_columns", "database": "neondb", "comment": null, "owner": "portovep"}, "columns": {"full_table_name": {"type": "text", "index": 1, "name": "full_table_name", "comment": null}, "database_name": {"type": "text", "index": 2, "name": "database_name", "comment": null}, "schema_name": {"type": "text", "index": 3, "name": "schema_name", "comment": null}, "table_name": {"type": "text", "index": 4, "name": "table_name", "comment": null}, "column_name": {"type": "text", "index": 5, "name": "column_name", "comment": null}, "data_type": {"type": "information_schema.character_data", "index": 6, "name": "data_type", "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.elementary.information_schema_columns"}, "model.elementary.job_run_results": {"metadata": {"type": "VIEW", "schema": "dbt_testing_example_elementary", "name": "job_run_results", "database": "neondb", "comment": null, "owner": "portovep"}, "columns": {"name": {"type": "text", "index": 1, "name": "name", "comment": null}, "id": {"type": "text", "index": 2, "name": "id", "comment": null}, "run_id": {"type": "text", "index": 3, "name": "run_id", "comment": null}, "run_started_at": {"type": "timestamp without time zone", "index": 4, "name": "run_started_at", "comment": null}, "run_completed_at": {"type": "timestamp without time zone", "index": 5, "name": "run_completed_at", "comment": null}, "run_execution_time": {"type": "double precision", "index": 6, "name": "run_execution_time", "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.elementary.job_run_results"}, "model.elementary.metadata": {"metadata": {"type": "BASE TABLE", "schema": "dbt_testing_example_elementary", "name": "metadata", "database": "neondb", "comment": null, "owner": "portovep"}, "columns": {"dbt_pkg_version": {"type": "text", "index": 1, "name": "dbt_pkg_version", "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.elementary.metadata"}, "model.elementary.metrics_anomaly_score": {"metadata": {"type": "VIEW", "schema": "dbt_testing_example_elementary", "name": "metrics_anomaly_score", "database": "neondb", "comment": null, "owner": "portovep"}, "columns": {"id": {"type": "character varying(4096)", "index": 1, "name": "id", "comment": null}, "full_table_name": {"type": "character varying(4096)", "index": 2, "name": "full_table_name", "comment": null}, "column_name": {"type": "character varying(4096)", "index": 3, "name": "column_name", "comment": null}, "dimension": {"type": "character varying(4096)", "index": 4, "name": "dimension", "comment": null}, "dimension_value": {"type": "character varying(4096)", "index": 5, "name": "dimension_value", "comment": null}, "metric_name": {"type": "character varying(4096)", "index": 6, "name": "metric_name", "comment": null}, "anomaly_score": {"type": "double precision", "index": 7, "name": "anomaly_score", "comment": null}, "latest_metric_value": {"type": "double precision", "index": 8, "name": "latest_metric_value", "comment": null}, "bucket_start": {"type": "timestamp without time zone", "index": 9, "name": "bucket_start", "comment": null}, "bucket_end": {"type": "timestamp without time zone", "index": 10, "name": "bucket_end", "comment": null}, "training_avg": {"type": "double precision", "index": 11, "name": "training_avg", "comment": null}, "training_stddev": {"type": "double precision", "index": 12, "name": "training_stddev", "comment": null}, "training_start": {"type": "timestamp without time zone", "index": 13, "name": "training_start", "comment": null}, "training_end": {"type": "timestamp without time zone", "index": 14, "name": "training_end", "comment": null}, "training_set_size": {"type": "bigint", "index": 15, "name": "training_set_size", "comment": null}, "updated_at": {"type": "timestamp without time zone", "index": 16, "name": "updated_at", "comment": null}, "is_anomaly": {"type": "boolean", "index": 17, "name": "is_anomaly", "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.elementary.metrics_anomaly_score"}, "model.elementary.model_run_results": {"metadata": {"type": "VIEW", "schema": "dbt_testing_example_elementary", "name": "model_run_results", "database": "neondb", "comment": null, "owner": "portovep"}, "columns": {"model_execution_id": {"type": "text", "index": 1, "name": "model_execution_id", "comment": null}, "unique_id": {"type": "text", "index": 2, "name": "unique_id", "comment": null}, "invocation_id": {"type": "character varying(4096)", "index": 3, "name": "invocation_id", "comment": null}, "query_id": {"type": "character varying(4096)", "index": 4, "name": "query_id", "comment": null}, "name": {"type": "text", "index": 5, "name": "name", "comment": null}, "generated_at": {"type": "character varying(4096)", "index": 6, "name": "generated_at", "comment": null}, "status": {"type": "character varying(4096)", "index": 7, "name": "status", "comment": null}, "full_refresh": {"type": "boolean", "index": 8, "name": "full_refresh", "comment": null}, "message": {"type": "text", "index": 9, "name": "message", "comment": null}, "execution_time": {"type": "double precision", "index": 10, "name": "execution_time", "comment": null}, "execute_started_at": {"type": "character varying(4096)", "index": 11, "name": "execute_started_at", "comment": null}, "execute_completed_at": {"type": "character varying(4096)", "index": 12, "name": "execute_completed_at", "comment": null}, "compile_started_at": {"type": "character varying(4096)", "index": 13, "name": "compile_started_at", "comment": null}, "compile_completed_at": {"type": "character varying(4096)", "index": 14, "name": "compile_completed_at", "comment": null}, "compiled_code": {"type": "text", "index": 15, "name": "compiled_code", "comment": null}, "adapter_response": {"type": "character varying(4096)", "index": 16, "name": "adapter_response", "comment": null}, "thread_id": {"type": "character varying(4096)", "index": 17, "name": "thread_id", "comment": null}, "database_name": {"type": "character varying(4096)", "index": 18, "name": "database_name", "comment": null}, "schema_name": {"type": "character varying(4096)", "index": 19, "name": "schema_name", "comment": null}, "materialization": {"type": "character varying(4096)", "index": 20, "name": "materialization", "comment": null}, "tags": {"type": "text", "index": 21, "name": "tags", "comment": null}, "package_name": {"type": "character varying(4096)", "index": 22, "name": "package_name", "comment": null}, "path": {"type": "character varying(4096)", "index": 23, "name": "path", "comment": null}, "original_path": {"type": "text", "index": 24, "name": "original_path", "comment": null}, "owner": {"type": "character varying(4096)", "index": 25, "name": "owner", "comment": null}, "alias": {"type": "character varying(4096)", "index": 26, "name": "alias", "comment": null}, "model_invocation_reverse_index": {"type": "bigint", "index": 27, "name": "model_invocation_reverse_index", "comment": null}, "is_the_first_invocation_of_the_day": {"type": "boolean", "index": 28, "name": "is_the_first_invocation_of_the_day", "comment": null}, "is_the_last_invocation_of_the_day": {"type": "boolean", "index": 29, "name": "is_the_last_invocation_of_the_day", "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.elementary.model_run_results"}, "model.elementary.monitors_runs": {"metadata": {"type": "VIEW", "schema": "dbt_testing_example_elementary", "name": "monitors_runs", "database": "neondb", "comment": null, "owner": "portovep"}, "columns": {"full_table_name": {"type": "character varying(4096)", "index": 1, "name": "full_table_name", "comment": null}, "column_name": {"type": "character varying(4096)", "index": 2, "name": "column_name", "comment": null}, "metric_name": {"type": "character varying(4096)", "index": 3, "name": "metric_name", "comment": null}, "metric_properties": {"type": "character varying(4096)", "index": 4, "name": "metric_properties", "comment": null}, "last_bucket_end": {"type": "timestamp without time zone", "index": 5, "name": "last_bucket_end", "comment": null}, "first_bucket_end": {"type": "timestamp without time zone", "index": 6, "name": "first_bucket_end", "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.elementary.monitors_runs"}, "model.elementary.schema_columns_snapshot": {"metadata": {"type": "BASE TABLE", "schema": "dbt_testing_example_elementary", "name": "schema_columns_snapshot", "database": "neondb", "comment": null, "owner": "portovep"}, "columns": {"column_state_id": {"type": "character varying(4096)", "index": 1, "name": "column_state_id", "comment": null}, "full_column_name": {"type": "character varying(4096)", "index": 2, "name": "full_column_name", "comment": null}, "full_table_name": {"type": "character varying(4096)", "index": 3, "name": "full_table_name", "comment": null}, "column_name": {"type": "character varying(4096)", "index": 4, "name": "column_name", "comment": null}, "data_type": {"type": "character varying(4096)", "index": 5, "name": "data_type", "comment": null}, "is_new": {"type": "boolean", "index": 6, "name": "is_new", "comment": null}, "detected_at": {"type": "timestamp without time zone", "index": 7, "name": "detected_at", "comment": null}, "created_at": {"type": "timestamp without time zone", "index": 8, "name": "created_at", "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.elementary.schema_columns_snapshot"}, "model.elementary.snapshot_run_results": {"metadata": {"type": "VIEW", "schema": "dbt_testing_example_elementary", "name": "snapshot_run_results", "database": "neondb", "comment": null, "owner": "portovep"}, "columns": {"model_execution_id": {"type": "text", "index": 1, "name": "model_execution_id", "comment": null}, "unique_id": {"type": "text", "index": 2, "name": "unique_id", "comment": null}, "invocation_id": {"type": "character varying(4096)", "index": 3, "name": "invocation_id", "comment": null}, "query_id": {"type": "character varying(4096)", "index": 4, "name": "query_id", "comment": null}, "name": {"type": "text", "index": 5, "name": "name", "comment": null}, "generated_at": {"type": "character varying(4096)", "index": 6, "name": "generated_at", "comment": null}, "status": {"type": "character varying(4096)", "index": 7, "name": "status", "comment": null}, "full_refresh": {"type": "boolean", "index": 8, "name": "full_refresh", "comment": null}, "message": {"type": "text", "index": 9, "name": "message", "comment": null}, "execution_time": {"type": "double precision", "index": 10, "name": "execution_time", "comment": null}, "execute_started_at": {"type": "character varying(4096)", "index": 11, "name": "execute_started_at", "comment": null}, "execute_completed_at": {"type": "character varying(4096)", "index": 12, "name": "execute_completed_at", "comment": null}, "compile_started_at": {"type": "character varying(4096)", "index": 13, "name": "compile_started_at", "comment": null}, "compile_completed_at": {"type": "character varying(4096)", "index": 14, "name": "compile_completed_at", "comment": null}, "compiled_code": {"type": "text", "index": 15, "name": "compiled_code", "comment": null}, "adapter_response": {"type": "character varying(4096)", "index": 16, "name": "adapter_response", "comment": null}, "thread_id": {"type": "character varying(4096)", "index": 17, "name": "thread_id", "comment": null}, "database_name": {"type": "character varying(4096)", "index": 18, "name": "database_name", "comment": null}, "schema_name": {"type": "character varying(4096)", "index": 19, "name": "schema_name", "comment": null}, "materialization": {"type": "character varying(4096)", "index": 20, "name": "materialization", "comment": null}, "tags": {"type": "text", "index": 21, "name": "tags", "comment": null}, "package_name": {"type": "character varying(4096)", "index": 22, "name": "package_name", "comment": null}, "path": {"type": "character varying(4096)", "index": 23, "name": "path", "comment": null}, "original_path": {"type": "text", "index": 24, "name": "original_path", "comment": null}, "owner": {"type": "character varying(4096)", "index": 25, "name": "owner", "comment": null}, "alias": {"type": "character varying(4096)", "index": 26, "name": "alias", "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.elementary.snapshot_run_results"}, "model.elementary.test_result_rows": {"metadata": {"type": "BASE TABLE", "schema": "dbt_testing_example_elementary", "name": "test_result_rows", "database": "neondb", "comment": null, "owner": "portovep"}, "columns": {"elementary_test_results_id": {"type": "text", "index": 1, "name": "elementary_test_results_id", "comment": null}, "result_row": {"type": "text", "index": 2, "name": "result_row", "comment": null}, "detected_at": {"type": "timestamp without time zone", "index": 3, "name": "detected_at", "comment": null}, "created_at": {"type": "timestamp without time zone", "index": 4, "name": "created_at", "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.elementary.test_result_rows"}}, "sources": {"source.dbt_testing_example.gym_app.raw_height": {"metadata": {"type": "BASE TABLE", "schema": "dbt_testing_example", "name": "raw_height", "database": "neondb", "comment": null, "owner": "portovep"}, "columns": {"date": {"type": "text", "index": 1, "name": "date", "comment": null}, "user_id": {"type": "integer", "index": 2, "name": "user_id", "comment": null}, "height": {"type": "double precision", "index": 3, "name": "height", "comment": null}, "height_unit": {"type": "text", "index": 4, "name": "height_unit", "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": "source.dbt_testing_example.gym_app.raw_height"}, "source.dbt_testing_example.gym_app.raw_weight": {"metadata": {"type": "BASE TABLE", "schema": "dbt_testing_example", "name": "raw_weight", "database": "neondb", "comment": null, "owner": "portovep"}, "columns": {"date": {"type": "text", "index": 1, "name": "date", "comment": null}, "user_id": {"type": "integer", "index": 2, "name": "user_id", "comment": null}, "weight": {"type": "double precision", "index": 3, "name": "weight", "comment": null}, "measurement_unit": {"type": "text", "index": 4, "name": "measurement_unit", "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": "source.dbt_testing_example.gym_app.raw_weight"}}, "errors": null}
\ No newline at end of file
diff --git a/docs/compiled/dbt_testing_example/models/intermediate/int_weight_measurements_with_latest_height.sql b/docs/compiled/dbt_testing_example/models/intermediate/int_weight_measurements_with_latest_height.sql
new file mode 100644
index 0000000..812a95c
--- /dev/null
+++ b/docs/compiled/dbt_testing_example/models/intermediate/int_weight_measurements_with_latest_height.sql
@@ -0,0 +1,30 @@
+with
+
+height as (
+
+ select * from "neondb"."dbt_testing_example"."stg_gym_app__height"
+
+),
+
+weight as (
+
+ select * from "neondb"."dbt_testing_example"."stg_gym_app__weight"
+
+),
+
+enrich_with_lasted_height_recorded_before_the_weight_measurement as (
+
+ select
+ weight.created_date,
+ user_id,
+ weight,
+ (select height
+ from height
+ where height.created_date < weight.created_date and
+ height.user_id = weight.user_id
+ order by height.created_date DESC
+ limit 1) as height
+ from weight
+)
+
+select * from enrich_with_lasted_height_recorded_before_the_weight_measurement
\ No newline at end of file
diff --git a/docs/compiled/dbt_testing_example/models/marts/_body_mass_indexes__models.yml/elementary_freshness_anomalies_9a86bd6e410f746dbd11fda53a1b4dbb.sql b/docs/compiled/dbt_testing_example/models/marts/_body_mass_indexes__models.yml/elementary_freshness_anomalies_9a86bd6e410f746dbd11fda53a1b4dbb.sql
new file mode 100644
index 0000000..170772f
--- /dev/null
+++ b/docs/compiled/dbt_testing_example/models/marts/_body_mass_indexes__models.yml/elementary_freshness_anomalies_9a86bd6e410f746dbd11fda53a1b4dbb.sql
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+ with nothing as (select 1 as num)
+ select * from nothing where num = 2
+
+
+
+
+
diff --git a/docs/compiled/dbt_testing_example/models/marts/_body_mass_indexes__models.yml/elementary_schema_changes_body_mass_indexes_.sql b/docs/compiled/dbt_testing_example/models/marts/_body_mass_indexes__models.yml/elementary_schema_changes_body_mass_indexes_.sql
new file mode 100644
index 0000000..252145f
--- /dev/null
+++ b/docs/compiled/dbt_testing_example/models/marts/_body_mass_indexes__models.yml/elementary_schema_changes_body_mass_indexes_.sql
@@ -0,0 +1,11 @@
+
+
+
+
+
+ with nothing as (select 1 as num)
+ select * from nothing where num = 2
+
+
+
+
diff --git a/docs/compiled/dbt_testing_example/models/marts/_body_mass_indexes__models.yml/elementary_volume_anomalies_body_mass_indexes_.sql b/docs/compiled/dbt_testing_example/models/marts/_body_mass_indexes__models.yml/elementary_volume_anomalies_body_mass_indexes_.sql
new file mode 100644
index 0000000..dc3c05c
--- /dev/null
+++ b/docs/compiled/dbt_testing_example/models/marts/_body_mass_indexes__models.yml/elementary_volume_anomalies_body_mass_indexes_.sql
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+ with nothing as (select 1 as num)
+ select * from nothing where num = 2
+
+
+
+
+
diff --git a/docs/compiled/dbt_testing_example/models/marts/_body_mass_indexes__models.yml/relationships_body_mass_indexe_2ce2c0087b52cfa92fbe92bbf3d083f4.sql b/docs/compiled/dbt_testing_example/models/marts/_body_mass_indexes__models.yml/relationships_body_mass_indexe_2ce2c0087b52cfa92fbe92bbf3d083f4.sql
new file mode 100644
index 0000000..5990022
--- /dev/null
+++ b/docs/compiled/dbt_testing_example/models/marts/_body_mass_indexes__models.yml/relationships_body_mass_indexe_2ce2c0087b52cfa92fbe92bbf3d083f4.sql
@@ -0,0 +1,25 @@
+
+
+
+
+with child as (
+ select user_id as from_field
+ from "neondb"."dbt_testing_example"."body_mass_indexes"
+ where user_id is not null
+),
+
+parent as (
+ select user_id as to_field
+ from "neondb"."dbt_testing_example"."raw_height"
+)
+
+select
+ from_field
+
+from child
+left join parent
+ on child.from_field = parent.to_field
+
+where parent.to_field is null
+
+
diff --git a/docs/compiled/dbt_testing_example/models/marts/_body_mass_indexes__models.yml/relationships_body_mass_indexe_49d5aa6bb90fb311de636b464ab53ae0.sql b/docs/compiled/dbt_testing_example/models/marts/_body_mass_indexes__models.yml/relationships_body_mass_indexe_49d5aa6bb90fb311de636b464ab53ae0.sql
new file mode 100644
index 0000000..87dce4c
--- /dev/null
+++ b/docs/compiled/dbt_testing_example/models/marts/_body_mass_indexes__models.yml/relationships_body_mass_indexe_49d5aa6bb90fb311de636b464ab53ae0.sql
@@ -0,0 +1,25 @@
+
+
+
+
+with child as (
+ select user_id as from_field
+ from "neondb"."dbt_testing_example"."body_mass_indexes"
+ where user_id is not null
+),
+
+parent as (
+ select user_id as to_field
+ from "neondb"."dbt_testing_example"."raw_weight"
+)
+
+select
+ from_field
+
+from child
+left join parent
+ on child.from_field = parent.to_field
+
+where parent.to_field is null
+
+
diff --git a/docs/compiled/dbt_testing_example/models/marts/body_mass_indexes.sql b/docs/compiled/dbt_testing_example/models/marts/body_mass_indexes.sql
new file mode 100644
index 0000000..2a372f3
--- /dev/null
+++ b/docs/compiled/dbt_testing_example/models/marts/body_mass_indexes.sql
@@ -0,0 +1,21 @@
+with
+
+weights_with_latest_height as (
+
+ select * from "neondb"."dbt_testing_example"."int_weight_measurements_with_latest_height"
+
+),
+
+body_mass_indexes as (
+
+ select
+ created_date,
+ user_id,
+ weight,
+ height,
+ round((weight::numeric / (height::numeric / 100) ^ 2)::numeric, 1) as bmi,
+ current_timestamp as processed_at
+ from weights_with_latest_height
+)
+
+select * from body_mass_indexes
\ No newline at end of file
diff --git a/docs/compiled/dbt_testing_example/models/staging/gym_app/_gym_app__raw_height_schema.yml/dbt_expectations_source_expect_89d58c60a30ca33e201a445d2f77dbfa.sql b/docs/compiled/dbt_testing_example/models/staging/gym_app/_gym_app__raw_height_schema.yml/dbt_expectations_source_expect_89d58c60a30ca33e201a445d2f77dbfa.sql
new file mode 100644
index 0000000..c738959
--- /dev/null
+++ b/docs/compiled/dbt_testing_example/models/staging/gym_app/_gym_app__raw_height_schema.yml/dbt_expectations_source_expect_89d58c60a30ca33e201a445d2f77dbfa.sql
@@ -0,0 +1,38 @@
+with relation_columns as (
+
+
+ select
+ cast('DATE' as TEXT) as relation_column,
+ cast('TEXT' as TEXT) as relation_column_type
+ union all
+
+ select
+ cast('USER_ID' as TEXT) as relation_column,
+ cast('INTEGER' as TEXT) as relation_column_type
+ union all
+
+ select
+ cast('HEIGHT' as TEXT) as relation_column,
+ cast('DOUBLE PRECISION' as TEXT) as relation_column_type
+ union all
+
+ select
+ cast('HEIGHT_UNIT' as TEXT) as relation_column,
+ cast('TEXT' as TEXT) as relation_column_type
+
+
+ ),
+ test_data as (
+
+ select
+ *
+ from
+ relation_columns
+ where
+ relation_column = 'HEIGHT'
+ and
+ relation_column_type not in ('DOUBLE PRECISION')
+
+ )
+ select *
+ from test_data
\ No newline at end of file
diff --git a/docs/compiled/dbt_testing_example/models/staging/gym_app/_gym_app__raw_height_schema.yml/dbt_expectations_source_expect_d058c5e89bb36317bea26ae649047e21.sql b/docs/compiled/dbt_testing_example/models/staging/gym_app/_gym_app__raw_height_schema.yml/dbt_expectations_source_expect_d058c5e89bb36317bea26ae649047e21.sql
new file mode 100644
index 0000000..8e65022
--- /dev/null
+++ b/docs/compiled/dbt_testing_example/models/staging/gym_app/_gym_app__raw_height_schema.yml/dbt_expectations_source_expect_d058c5e89bb36317bea26ae649047e21.sql
@@ -0,0 +1,38 @@
+with relation_columns as (
+
+
+ select
+ cast('DATE' as TEXT) as relation_column,
+ cast('TEXT' as TEXT) as relation_column_type
+ union all
+
+ select
+ cast('USER_ID' as TEXT) as relation_column,
+ cast('INTEGER' as TEXT) as relation_column_type
+ union all
+
+ select
+ cast('HEIGHT' as TEXT) as relation_column,
+ cast('DOUBLE PRECISION' as TEXT) as relation_column_type
+ union all
+
+ select
+ cast('HEIGHT_UNIT' as TEXT) as relation_column,
+ cast('TEXT' as TEXT) as relation_column_type
+
+
+ ),
+ test_data as (
+
+ select
+ *
+ from
+ relation_columns
+ where
+ relation_column = 'USER_ID'
+ and
+ relation_column_type not in ('INTEGER')
+
+ )
+ select *
+ from test_data
\ No newline at end of file
diff --git a/docs/compiled/dbt_testing_example/models/staging/gym_app/_gym_app__raw_height_schema.yml/dbt_expectations_source_expect_d25b7d4c2c9fca23113cd8cbcfb14445.sql b/docs/compiled/dbt_testing_example/models/staging/gym_app/_gym_app__raw_height_schema.yml/dbt_expectations_source_expect_d25b7d4c2c9fca23113cd8cbcfb14445.sql
new file mode 100644
index 0000000..30d0687
--- /dev/null
+++ b/docs/compiled/dbt_testing_example/models/staging/gym_app/_gym_app__raw_height_schema.yml/dbt_expectations_source_expect_d25b7d4c2c9fca23113cd8cbcfb14445.sql
@@ -0,0 +1,38 @@
+with relation_columns as (
+
+
+ select
+ cast('DATE' as TEXT) as relation_column,
+ cast('TEXT' as TEXT) as relation_column_type
+ union all
+
+ select
+ cast('USER_ID' as TEXT) as relation_column,
+ cast('INTEGER' as TEXT) as relation_column_type
+ union all
+
+ select
+ cast('HEIGHT' as TEXT) as relation_column,
+ cast('DOUBLE PRECISION' as TEXT) as relation_column_type
+ union all
+
+ select
+ cast('HEIGHT_UNIT' as TEXT) as relation_column,
+ cast('TEXT' as TEXT) as relation_column_type
+
+
+ ),
+ test_data as (
+
+ select
+ *
+ from
+ relation_columns
+ where
+ relation_column = 'HEIGHT_UNIT'
+ and
+ relation_column_type not in ('TEXT')
+
+ )
+ select *
+ from test_data
\ No newline at end of file
diff --git a/docs/compiled/dbt_testing_example/models/staging/gym_app/_gym_app__raw_height_schema.yml/dbt_utils_source_accepted_rang_f11d86b3627432fa821d885e1ad1b432.sql b/docs/compiled/dbt_testing_example/models/staging/gym_app/_gym_app__raw_height_schema.yml/dbt_utils_source_accepted_rang_f11d86b3627432fa821d885e1ad1b432.sql
new file mode 100644
index 0000000..a285a2f
--- /dev/null
+++ b/docs/compiled/dbt_testing_example/models/staging/gym_app/_gym_app__raw_height_schema.yml/dbt_utils_source_accepted_rang_f11d86b3627432fa821d885e1ad1b432.sql
@@ -0,0 +1,20 @@
+
+
+with meet_condition as(
+ select *
+ from "neondb"."dbt_testing_example"."raw_height"
+),
+
+validation_errors as (
+ select *
+ from meet_condition
+ where
+ -- never true, defaults to an empty result set. Exists to ensure any combo of the `or` clauses below succeeds
+ 1 = 2
+ -- records with a value >= min_value are permitted. The `not` flips this to find records that don't meet the rule.
+ or not height > 0
+)
+
+select *
+from validation_errors
+
diff --git a/docs/compiled/dbt_testing_example/models/staging/gym_app/_gym_app__raw_height_schema.yml/source_accepted_values_gym_app_3616a0039aa603ccf6fea0c6e492ff79.sql b/docs/compiled/dbt_testing_example/models/staging/gym_app/_gym_app__raw_height_schema.yml/source_accepted_values_gym_app_3616a0039aa603ccf6fea0c6e492ff79.sql
new file mode 100644
index 0000000..6ddae1c
--- /dev/null
+++ b/docs/compiled/dbt_testing_example/models/staging/gym_app/_gym_app__raw_height_schema.yml/source_accepted_values_gym_app_3616a0039aa603ccf6fea0c6e492ff79.sql
@@ -0,0 +1,22 @@
+
+
+
+
+with all_values as (
+
+ select
+ height_unit as value_field,
+ count(*) as n_records
+
+ from "neondb"."dbt_testing_example"."raw_height"
+ group by height_unit
+
+)
+
+select *
+from all_values
+where value_field not in (
+ 'cm','inches'
+)
+
+
diff --git a/docs/compiled/dbt_testing_example/models/staging/gym_app/_gym_app__raw_height_schema.yml/source_not_null_gym_app_raw_height_height.sql b/docs/compiled/dbt_testing_example/models/staging/gym_app/_gym_app__raw_height_schema.yml/source_not_null_gym_app_raw_height_height.sql
new file mode 100644
index 0000000..91b713d
--- /dev/null
+++ b/docs/compiled/dbt_testing_example/models/staging/gym_app/_gym_app__raw_height_schema.yml/source_not_null_gym_app_raw_height_height.sql
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+select height
+from "neondb"."dbt_testing_example"."raw_height"
+where height is null
+
+
diff --git a/docs/compiled/dbt_testing_example/models/staging/gym_app/_gym_app__raw_height_schema.yml/source_not_null_gym_app_raw_height_user_id.sql b/docs/compiled/dbt_testing_example/models/staging/gym_app/_gym_app__raw_height_schema.yml/source_not_null_gym_app_raw_height_user_id.sql
new file mode 100644
index 0000000..4fc13a1
--- /dev/null
+++ b/docs/compiled/dbt_testing_example/models/staging/gym_app/_gym_app__raw_height_schema.yml/source_not_null_gym_app_raw_height_user_id.sql
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+select user_id
+from "neondb"."dbt_testing_example"."raw_height"
+where user_id is null
+
+
diff --git a/docs/compiled/dbt_testing_example/models/staging/gym_app/_gym_app__raw_weight_schema.yml/dbt_expectations_source_expect_b59b3be08112542eac611e15e1c084e5.sql b/docs/compiled/dbt_testing_example/models/staging/gym_app/_gym_app__raw_weight_schema.yml/dbt_expectations_source_expect_b59b3be08112542eac611e15e1c084e5.sql
new file mode 100644
index 0000000..4deeaf5
--- /dev/null
+++ b/docs/compiled/dbt_testing_example/models/staging/gym_app/_gym_app__raw_weight_schema.yml/dbt_expectations_source_expect_b59b3be08112542eac611e15e1c084e5.sql
@@ -0,0 +1,38 @@
+with relation_columns as (
+
+
+ select
+ cast('DATE' as TEXT) as relation_column,
+ cast('TEXT' as TEXT) as relation_column_type
+ union all
+
+ select
+ cast('USER_ID' as TEXT) as relation_column,
+ cast('INTEGER' as TEXT) as relation_column_type
+ union all
+
+ select
+ cast('WEIGHT' as TEXT) as relation_column,
+ cast('DOUBLE PRECISION' as TEXT) as relation_column_type
+ union all
+
+ select
+ cast('MEASUREMENT_UNIT' as TEXT) as relation_column,
+ cast('TEXT' as TEXT) as relation_column_type
+
+
+ ),
+ test_data as (
+
+ select
+ *
+ from
+ relation_columns
+ where
+ relation_column = 'USER_ID'
+ and
+ relation_column_type not in ('INTEGER')
+
+ )
+ select *
+ from test_data
\ No newline at end of file
diff --git a/docs/compiled/dbt_testing_example/models/staging/gym_app/_gym_app__raw_weight_schema.yml/dbt_expectations_source_expect_c30c42d8522b41e4f8a1a6e266d8e221.sql b/docs/compiled/dbt_testing_example/models/staging/gym_app/_gym_app__raw_weight_schema.yml/dbt_expectations_source_expect_c30c42d8522b41e4f8a1a6e266d8e221.sql
new file mode 100644
index 0000000..86707c4
--- /dev/null
+++ b/docs/compiled/dbt_testing_example/models/staging/gym_app/_gym_app__raw_weight_schema.yml/dbt_expectations_source_expect_c30c42d8522b41e4f8a1a6e266d8e221.sql
@@ -0,0 +1,38 @@
+with relation_columns as (
+
+
+ select
+ cast('DATE' as TEXT) as relation_column,
+ cast('TEXT' as TEXT) as relation_column_type
+ union all
+
+ select
+ cast('USER_ID' as TEXT) as relation_column,
+ cast('INTEGER' as TEXT) as relation_column_type
+ union all
+
+ select
+ cast('WEIGHT' as TEXT) as relation_column,
+ cast('DOUBLE PRECISION' as TEXT) as relation_column_type
+ union all
+
+ select
+ cast('MEASUREMENT_UNIT' as TEXT) as relation_column,
+ cast('TEXT' as TEXT) as relation_column_type
+
+
+ ),
+ test_data as (
+
+ select
+ *
+ from
+ relation_columns
+ where
+ relation_column = 'MEASUREMENT_UNIT'
+ and
+ relation_column_type not in ('TEXT')
+
+ )
+ select *
+ from test_data
\ No newline at end of file
diff --git a/docs/compiled/dbt_testing_example/models/staging/gym_app/_gym_app__raw_weight_schema.yml/dbt_expectations_source_expect_ddae5a39468609ab9f63dbccf2db995c.sql b/docs/compiled/dbt_testing_example/models/staging/gym_app/_gym_app__raw_weight_schema.yml/dbt_expectations_source_expect_ddae5a39468609ab9f63dbccf2db995c.sql
new file mode 100644
index 0000000..aff5327
--- /dev/null
+++ b/docs/compiled/dbt_testing_example/models/staging/gym_app/_gym_app__raw_weight_schema.yml/dbt_expectations_source_expect_ddae5a39468609ab9f63dbccf2db995c.sql
@@ -0,0 +1,38 @@
+with relation_columns as (
+
+
+ select
+ cast('DATE' as TEXT) as relation_column,
+ cast('TEXT' as TEXT) as relation_column_type
+ union all
+
+ select
+ cast('USER_ID' as TEXT) as relation_column,
+ cast('INTEGER' as TEXT) as relation_column_type
+ union all
+
+ select
+ cast('WEIGHT' as TEXT) as relation_column,
+ cast('DOUBLE PRECISION' as TEXT) as relation_column_type
+ union all
+
+ select
+ cast('MEASUREMENT_UNIT' as TEXT) as relation_column,
+ cast('TEXT' as TEXT) as relation_column_type
+
+
+ ),
+ test_data as (
+
+ select
+ *
+ from
+ relation_columns
+ where
+ relation_column = 'WEIGHT'
+ and
+ relation_column_type not in ('DOUBLE PRECISION')
+
+ )
+ select *
+ from test_data
\ No newline at end of file
diff --git a/docs/compiled/dbt_testing_example/models/staging/gym_app/_gym_app__raw_weight_schema.yml/dbt_utils_source_accepted_rang_8c3cff7ac664119087ba60052df6c918.sql b/docs/compiled/dbt_testing_example/models/staging/gym_app/_gym_app__raw_weight_schema.yml/dbt_utils_source_accepted_rang_8c3cff7ac664119087ba60052df6c918.sql
new file mode 100644
index 0000000..3b42b7e
--- /dev/null
+++ b/docs/compiled/dbt_testing_example/models/staging/gym_app/_gym_app__raw_weight_schema.yml/dbt_utils_source_accepted_rang_8c3cff7ac664119087ba60052df6c918.sql
@@ -0,0 +1,20 @@
+
+
+with meet_condition as(
+ select *
+ from "neondb"."dbt_testing_example"."raw_weight"
+),
+
+validation_errors as (
+ select *
+ from meet_condition
+ where
+ -- never true, defaults to an empty result set. Exists to ensure any combo of the `or` clauses below succeeds
+ 1 = 2
+ -- records with a value >= min_value are permitted. The `not` flips this to find records that don't meet the rule.
+ or not weight > 0
+)
+
+select *
+from validation_errors
+
diff --git a/docs/compiled/dbt_testing_example/models/staging/gym_app/_gym_app__raw_weight_schema.yml/source_accepted_values_gym_app_c4d9451d981a8445339c3a0120cf5a76.sql b/docs/compiled/dbt_testing_example/models/staging/gym_app/_gym_app__raw_weight_schema.yml/source_accepted_values_gym_app_c4d9451d981a8445339c3a0120cf5a76.sql
new file mode 100644
index 0000000..87cd7ff
--- /dev/null
+++ b/docs/compiled/dbt_testing_example/models/staging/gym_app/_gym_app__raw_weight_schema.yml/source_accepted_values_gym_app_c4d9451d981a8445339c3a0120cf5a76.sql
@@ -0,0 +1,22 @@
+
+
+
+
+with all_values as (
+
+ select
+ measurement_unit as value_field,
+ count(*) as n_records
+
+ from "neondb"."dbt_testing_example"."raw_weight"
+ group by measurement_unit
+
+)
+
+select *
+from all_values
+where value_field not in (
+ 'kg','pounds'
+)
+
+
diff --git a/docs/compiled/dbt_testing_example/models/staging/gym_app/_gym_app__raw_weight_schema.yml/source_not_null_gym_app_raw_weight_user_id.sql b/docs/compiled/dbt_testing_example/models/staging/gym_app/_gym_app__raw_weight_schema.yml/source_not_null_gym_app_raw_weight_user_id.sql
new file mode 100644
index 0000000..b74045a
--- /dev/null
+++ b/docs/compiled/dbt_testing_example/models/staging/gym_app/_gym_app__raw_weight_schema.yml/source_not_null_gym_app_raw_weight_user_id.sql
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+select user_id
+from "neondb"."dbt_testing_example"."raw_weight"
+where user_id is null
+
+
diff --git a/docs/compiled/dbt_testing_example/models/staging/gym_app/_gym_app__raw_weight_schema.yml/source_not_null_gym_app_raw_weight_weight.sql b/docs/compiled/dbt_testing_example/models/staging/gym_app/_gym_app__raw_weight_schema.yml/source_not_null_gym_app_raw_weight_weight.sql
new file mode 100644
index 0000000..26542aa
--- /dev/null
+++ b/docs/compiled/dbt_testing_example/models/staging/gym_app/_gym_app__raw_weight_schema.yml/source_not_null_gym_app_raw_weight_weight.sql
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+select weight
+from "neondb"."dbt_testing_example"."raw_weight"
+where weight is null
+
+
diff --git a/docs/compiled/dbt_testing_example/models/staging/gym_app/stg_gym_app__height.sql b/docs/compiled/dbt_testing_example/models/staging/gym_app/stg_gym_app__height.sql
new file mode 100644
index 0000000..3880d1c
--- /dev/null
+++ b/docs/compiled/dbt_testing_example/models/staging/gym_app/stg_gym_app__height.sql
@@ -0,0 +1,20 @@
+with
+
+source as (
+
+ select * from "neondb"."dbt_testing_example"."raw_height"
+
+),
+
+renamed as (
+
+ select
+ TO_DATE(date, 'DD/MM/YYYY') as created_date,
+ user_id,
+ height,
+ height_unit as measurement_unit
+ from source
+
+)
+
+select * from renamed
\ No newline at end of file
diff --git a/docs/compiled/dbt_testing_example/models/staging/gym_app/stg_gym_app__weight.sql b/docs/compiled/dbt_testing_example/models/staging/gym_app/stg_gym_app__weight.sql
new file mode 100644
index 0000000..5e032e0
--- /dev/null
+++ b/docs/compiled/dbt_testing_example/models/staging/gym_app/stg_gym_app__weight.sql
@@ -0,0 +1,20 @@
+with
+
+source as (
+
+ select * from "neondb"."dbt_testing_example"."raw_weight"
+
+),
+
+renamed as (
+
+ select
+ TO_DATE(date, 'DD/MM/YYYY') as created_date,
+ weight,
+ user_id,
+ measurement_unit
+ from source
+
+)
+
+select * from renamed
\ No newline at end of file
diff --git a/docs/compiled/dbt_testing_example/tests/component/body_mass_indexes_component_test.sql b/docs/compiled/dbt_testing_example/tests/component/body_mass_indexes_component_test.sql
new file mode 100644
index 0000000..8bc9df6
--- /dev/null
+++ b/docs/compiled/dbt_testing_example/tests/component/body_mass_indexes_component_test.sql
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+ select * from (select 1) as t where 1 = 0
+
+
diff --git a/docs/compiled/dbt_testing_example/tests/unit/intermediate/int_weight_measurements_with_latest_height_unit_test.sql b/docs/compiled/dbt_testing_example/tests/unit/intermediate/int_weight_measurements_with_latest_height_unit_test.sql
new file mode 100644
index 0000000..8a3edf3
--- /dev/null
+++ b/docs/compiled/dbt_testing_example/tests/unit/intermediate/int_weight_measurements_with_latest_height_unit_test.sql
@@ -0,0 +1,26 @@
+
+
+
+
+
+
+
+
+
+ select * from (select 1) as t where 1 = 0
+
+
+
+
+UNION ALL
+
+
+
+
+
+
+
+
+ select * from (select 1) as t where 1 = 0
+
+
diff --git a/docs/compiled/dbt_testing_example/tests/unit/marts/body_mass_indexes_unit_test.sql b/docs/compiled/dbt_testing_example/tests/unit/marts/body_mass_indexes_unit_test.sql
new file mode 100644
index 0000000..8bc9df6
--- /dev/null
+++ b/docs/compiled/dbt_testing_example/tests/unit/marts/body_mass_indexes_unit_test.sql
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+ select * from (select 1) as t where 1 = 0
+
+
diff --git a/docs/compiled/dbt_testing_example/tests/unit/staging/gym_app/stg_gym_app__height_unit_test.sql b/docs/compiled/dbt_testing_example/tests/unit/staging/gym_app/stg_gym_app__height_unit_test.sql
new file mode 100644
index 0000000..8a3edf3
--- /dev/null
+++ b/docs/compiled/dbt_testing_example/tests/unit/staging/gym_app/stg_gym_app__height_unit_test.sql
@@ -0,0 +1,26 @@
+
+
+
+
+
+
+
+
+
+ select * from (select 1) as t where 1 = 0
+
+
+
+
+UNION ALL
+
+
+
+
+
+
+
+
+ select * from (select 1) as t where 1 = 0
+
+
diff --git a/docs/compiled/dbt_testing_example/tests/unit/staging/gym_app/stg_gym_app__weight_unit_test.sql b/docs/compiled/dbt_testing_example/tests/unit/staging/gym_app/stg_gym_app__weight_unit_test.sql
new file mode 100644
index 0000000..8bc9df6
--- /dev/null
+++ b/docs/compiled/dbt_testing_example/tests/unit/staging/gym_app/stg_gym_app__weight_unit_test.sql
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+ select * from (select 1) as t where 1 = 0
+
+
diff --git a/docs/compiled/elementary/dbt_project.yml/hooks/elementary-on-run-end-0.sql b/docs/compiled/elementary/dbt_project.yml/hooks/elementary-on-run-end-0.sql
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/docs/compiled/elementary/dbt_project.yml/hooks/elementary-on-run-end-0.sql
@@ -0,0 +1 @@
+
diff --git a/docs/compiled/elementary/dbt_project.yml/hooks/elementary-on-run-start-0.sql b/docs/compiled/elementary/dbt_project.yml/hooks/elementary-on-run-start-0.sql
new file mode 100644
index 0000000..2cf0c71
--- /dev/null
+++ b/docs/compiled/elementary/dbt_project.yml/hooks/elementary-on-run-start-0.sql
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
diff --git a/docs/compiled/elementary/models/edr/alerts/alerts_anomaly_detection.sql b/docs/compiled/elementary/models/edr/alerts/alerts_anomaly_detection.sql
new file mode 100644
index 0000000..812981e
--- /dev/null
+++ b/docs/compiled/elementary/models/edr/alerts/alerts_anomaly_detection.sql
@@ -0,0 +1,35 @@
+
+
+with elementary_test_results as (
+ select * from "neondb"."dbt_testing_example_elementary"."elementary_test_results"
+),
+
+alerts_anomaly_detection as (
+ select id as alert_id,
+ data_issue_id,
+ test_execution_id,
+ test_unique_id,
+ model_unique_id,
+ detected_at,
+ database_name,
+ schema_name,
+ table_name,
+ column_name,
+ test_type as alert_type,
+ test_sub_type as sub_type,
+ test_results_description as alert_description,
+ owners,
+ tags,
+ test_results_query as alert_results_query,
+ other,
+ test_name,
+ test_short_name,
+ test_params,
+ severity,
+ status,
+ result_rows
+ from elementary_test_results
+ where True and lower(status) != 'pass'and lower(status) != 'skipped'and test_type = 'anomaly_detection'
+)
+
+select * from alerts_anomaly_detection
\ No newline at end of file
diff --git a/docs/compiled/elementary/models/edr/alerts/alerts_dbt_models.sql b/docs/compiled/elementary/models/edr/alerts/alerts_dbt_models.sql
new file mode 100644
index 0000000..37b03ae
--- /dev/null
+++ b/docs/compiled/elementary/models/edr/alerts/alerts_dbt_models.sql
@@ -0,0 +1,74 @@
+
+
+with error_models as (
+
+ select model_execution_id,
+ unique_id,
+ invocation_id,
+ name,
+ generated_at,
+ status,
+ full_refresh,
+ message,
+ execution_time,
+ execute_started_at,
+ execute_completed_at,
+ compile_started_at,
+ compile_completed_at,
+ compiled_code,
+ database_name,
+ schema_name,
+ materialization,
+ tags,
+ package_name,
+ path,
+ original_path,
+ owner,
+ alias
+ from "neondb"."dbt_testing_example_elementary"."model_run_results"
+
+ union all
+
+ select model_execution_id,
+ unique_id,
+ invocation_id,
+ name,
+ generated_at,
+ status,
+ full_refresh,
+ message,
+ execution_time,
+ execute_started_at,
+ execute_completed_at,
+ compile_started_at,
+ compile_completed_at,
+ compiled_code,
+ database_name,
+ schema_name,
+ materialization,
+ tags,
+ package_name,
+ path,
+ original_path,
+ owner,
+ alias
+ from "neondb"."dbt_testing_example_elementary"."snapshot_run_results"
+)
+
+
+select model_execution_id as alert_id,
+ unique_id,
+ cast(generated_at as timestamp) as detected_at,
+ database_name,
+ materialization,
+ path,
+ original_path,
+ schema_name,
+ message,
+ owner as owners,
+ tags,
+ alias,
+ status,
+ full_refresh
+from error_models
+where True and lower(status) != 'success'and lower(status) != 'skipped'
\ No newline at end of file
diff --git a/docs/compiled/elementary/models/edr/alerts/alerts_dbt_source_freshness.sql b/docs/compiled/elementary/models/edr/alerts/alerts_dbt_source_freshness.sql
new file mode 100644
index 0000000..433c362
--- /dev/null
+++ b/docs/compiled/elementary/models/edr/alerts/alerts_dbt_source_freshness.sql
@@ -0,0 +1,41 @@
+
+
+with results as (
+ select * from "neondb"."dbt_testing_example_elementary"."dbt_source_freshness_results"
+),
+
+sources as (
+ select * from "neondb"."dbt_testing_example_elementary"."dbt_sources"
+)
+
+select
+ results.source_freshness_execution_id as alert_id,
+ results.max_loaded_at,
+ results.snapshotted_at,
+ cast(results.generated_at as timestamp) as detected_at,
+ results.max_loaded_at_time_ago_in_s,
+ results.status,
+ results.error,
+ results.warn_after,
+ results.error_after,
+ results.filter,
+ sources.unique_id,
+ sources.database_name,
+ sources.schema_name,
+ sources.source_name,
+ sources.identifier,
+ sources.tags,
+ sources.meta,
+ sources.owner,
+ sources.package_name,
+ sources.path,
+ -- These columns below are deprecated. We add them since this view
+ -- was used to be loaded into an incremental model with those columns, their names were later changed
+ -- and Databricks doesn't respect `on_schema_change = 'append_new_columns'` properly, as described here -
+ -- https://docs.databricks.com/en/delta/update-schema.html#automatic-schema-evolution-for-delta-lake-merge
+ results.error_after as freshness_error_after,
+ results.warn_after as freshness_warn_after,
+ results.filter as freshness_filter
+from results
+join sources on results.unique_id = sources.unique_id
+where True and lower(status) != 'pass'
\ No newline at end of file
diff --git a/docs/compiled/elementary/models/edr/alerts/alerts_dbt_tests.sql b/docs/compiled/elementary/models/edr/alerts/alerts_dbt_tests.sql
new file mode 100644
index 0000000..c033747
--- /dev/null
+++ b/docs/compiled/elementary/models/edr/alerts/alerts_dbt_tests.sql
@@ -0,0 +1,35 @@
+
+
+with elementary_test_results as (
+ select * from "neondb"."dbt_testing_example_elementary"."elementary_test_results"
+),
+
+alerts_dbt_tests as (
+ select id as alert_id,
+ data_issue_id,
+ test_execution_id,
+ test_unique_id,
+ model_unique_id,
+ detected_at,
+ database_name,
+ schema_name,
+ table_name,
+ column_name,
+ test_type as alert_type,
+ test_sub_type as sub_type,
+ test_results_description as alert_description,
+ owners,
+ tags,
+ test_results_query as alert_results_query,
+ other,
+ test_name,
+ test_short_name,
+ test_params,
+ severity,
+ status,
+ result_rows
+ from elementary_test_results
+ where True and lower(status) != 'pass' and lower(status) != 'skipped' and test_type = 'dbt_test'
+)
+
+select * from alerts_dbt_tests
\ No newline at end of file
diff --git a/docs/compiled/elementary/models/edr/alerts/alerts_schema_changes.sql b/docs/compiled/elementary/models/edr/alerts/alerts_schema_changes.sql
new file mode 100644
index 0000000..3deeca9
--- /dev/null
+++ b/docs/compiled/elementary/models/edr/alerts/alerts_schema_changes.sql
@@ -0,0 +1,36 @@
+
+
+
+with elementary_test_results as (
+ select * from "neondb"."dbt_testing_example_elementary"."elementary_test_results"
+),
+
+alerts_schema_changes as (
+ select id as alert_id,
+ data_issue_id,
+ test_execution_id,
+ test_unique_id,
+ model_unique_id,
+ detected_at,
+ database_name,
+ schema_name,
+ table_name,
+ column_name,
+ test_type as alert_type,
+ test_sub_type as sub_type,
+ test_results_description as alert_description,
+ owners,
+ tags,
+ test_results_query as alert_results_query,
+ other,
+ test_name,
+ test_short_name,
+ test_params,
+ severity,
+ status,
+ result_rows
+ from elementary_test_results
+ where True and lower(status) != 'pass'and lower(status) != 'skipped'and test_type = 'schema_change'
+)
+
+select * from alerts_schema_changes
\ No newline at end of file
diff --git a/docs/compiled/elementary/models/edr/data_monitoring/anomaly_detection/anomaly_threshold_sensitivity.sql b/docs/compiled/elementary/models/edr/data_monitoring/anomaly_detection/anomaly_threshold_sensitivity.sql
new file mode 100644
index 0000000..c0a642b
--- /dev/null
+++ b/docs/compiled/elementary/models/edr/data_monitoring/anomaly_detection/anomaly_threshold_sensitivity.sql
@@ -0,0 +1,31 @@
+
+
+with metrics_anomaly_score as (
+
+ select * from "neondb"."dbt_testing_example_elementary"."metrics_anomaly_score"
+
+),
+
+score_sensitivity as (
+
+ select
+ full_table_name,
+ column_name,
+ metric_name,
+ latest_metric_value,
+ training_avg as metric_avg,
+ training_stddev as metric_stddev,
+ anomaly_score,
+ case when abs(anomaly_score) >= 1.5 then true else false end as "is_anomaly_1_5",
+ case when abs(anomaly_score) >= 2 then true else false end as "is_anomaly_2",
+ case when abs(anomaly_score) >= 2.5 then true else false end as "is_anomaly_2_5",
+ case when abs(anomaly_score) >= 3 then true else false end as "is_anomaly_3",
+ case when abs(anomaly_score) >= 3.5 then true else false end as "is_anomaly_3_5",
+ case when abs(anomaly_score) >= 4 then true else false end as "is_anomaly_4",
+ case when abs(anomaly_score) >= 4.5 then true else false end as "is_anomaly_4_5"
+ from metrics_anomaly_score
+ where abs(anomaly_score) >= 1.5
+
+)
+
+select * from score_sensitivity
\ No newline at end of file
diff --git a/docs/compiled/elementary/models/edr/data_monitoring/anomaly_detection/metrics_anomaly_score.sql b/docs/compiled/elementary/models/edr/data_monitoring/anomaly_detection/metrics_anomaly_score.sql
new file mode 100644
index 0000000..cd9168c
--- /dev/null
+++ b/docs/compiled/elementary/models/edr/data_monitoring/anomaly_detection/metrics_anomaly_score.sql
@@ -0,0 +1,97 @@
+
+
+with data_monitoring_metrics as (
+
+ select * from "neondb"."dbt_testing_example_elementary"."data_monitoring_metrics"
+
+),
+
+time_window_aggregation as (
+
+ select
+ id,
+ full_table_name,
+ column_name,
+ dimension,
+ dimension_value,
+ metric_name,
+ metric_value,
+ source_value,
+ bucket_start,
+ bucket_end,
+ bucket_duration_hours,
+ updated_at,
+ avg(metric_value) over (partition by metric_name, full_table_name, column_name order by bucket_start asc rows between unbounded preceding and current row) as training_avg,
+ stddev(metric_value) over (partition by metric_name, full_table_name, column_name order by bucket_start asc rows between unbounded preceding and current row) as training_stddev,
+ count(metric_value) over (partition by metric_name, full_table_name, column_name order by bucket_start asc rows between unbounded preceding and current row) as training_set_size,
+ last_value(bucket_end) over (partition by metric_name, full_table_name, column_name order by bucket_start asc rows between unbounded preceding and current row) training_end,
+ first_value(bucket_end) over (partition by metric_name, full_table_name, column_name order by bucket_start asc rows between unbounded preceding and current row) as training_start
+ from data_monitoring_metrics
+ group by 1,2,3,4,5,6,7,8,9,10,11,12
+),
+
+metrics_anomaly_score as (
+
+ select
+ id,
+ full_table_name,
+ column_name,
+ dimension,
+ dimension_value,
+ metric_name,
+ case
+ when training_stddev is null then null
+ when training_stddev = 0 then 0
+ else (metric_value - training_avg) / (training_stddev)
+ end as anomaly_score,
+ metric_value as latest_metric_value,
+ bucket_start,
+ bucket_end,
+ training_avg,
+ training_stddev,
+ training_start,
+ training_end,
+ training_set_size,
+ max(updated_at) as updated_at
+ from time_window_aggregation
+ where
+ metric_value is not null
+ and training_avg is not null
+ and bucket_end >=
+ cast(date_trunc('day',
+ current_timestamp::timestamp
+) as timestamp) + cast(-7 as integer) * INTERVAL '1 day'
+
+ group by 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
+ order by bucket_end desc
+
+
+),
+
+final as (
+
+ select
+ id,
+ full_table_name,
+ column_name,
+ dimension,
+ dimension_value,
+ metric_name,
+ anomaly_score,
+ latest_metric_value,
+ bucket_start,
+ bucket_end,
+ training_avg,
+ training_stddev,
+ training_start,
+ training_end,
+ training_set_size,
+ updated_at,
+ case
+ when abs(anomaly_score) > 3 then true
+ else false end
+ as is_anomaly
+ from metrics_anomaly_score
+)
+
+select * from final
\ No newline at end of file
diff --git a/docs/compiled/elementary/models/edr/data_monitoring/data_monitoring/data_monitoring_metrics.sql b/docs/compiled/elementary/models/edr/data_monitoring/data_monitoring/data_monitoring_metrics.sql
new file mode 100644
index 0000000..5e10d79
--- /dev/null
+++ b/docs/compiled/elementary/models/edr/data_monitoring/data_monitoring/data_monitoring_metrics.sql
@@ -0,0 +1,64 @@
+
+
+
+
+
+
+
+ select * from (
+ select
+
+
+ cast('dummy_string' as varchar(4096)) as id
+
+,
+
+ cast('dummy_string' as varchar(4096)) as full_table_name
+
+,
+
+ cast('dummy_string' as varchar(4096)) as column_name
+
+,
+
+ cast('dummy_string' as varchar(4096)) as metric_name
+
+,
+
+ cast(123456789.99 as float) as metric_value
+
+,
+
+ cast('dummy_string' as varchar(4096)) as source_value
+
+,
+ cast('2091-02-17' as timestamp) as bucket_start
+
+,
+ cast('2091-02-17' as timestamp) as bucket_end
+
+,
+
+ cast(123456789 as integer) as bucket_duration_hours
+
+,
+ cast('2091-02-17' as timestamp) as updated_at
+
+,
+
+ cast('dummy_string' as varchar(4096)) as dimension
+
+,
+
+ cast('dummy_string' as varchar(4096)) as dimension_value
+
+,
+
+ cast('dummy_string' as varchar(4096)) as metric_properties
+
+,
+ cast('2091-02-17' as timestamp) as created_at
+
+
+ ) as empty_table
+ where 1 = 0
diff --git a/docs/compiled/elementary/models/edr/data_monitoring/schema_changes/schema_columns_snapshot.sql b/docs/compiled/elementary/models/edr/data_monitoring/schema_changes/schema_columns_snapshot.sql
new file mode 100644
index 0000000..3120439
--- /dev/null
+++ b/docs/compiled/elementary/models/edr/data_monitoring/schema_changes/schema_columns_snapshot.sql
@@ -0,0 +1,38 @@
+
+
+
+ select * from (
+ select
+
+
+ cast('dummy_string' as varchar(4096)) as column_state_id
+
+,
+
+ cast('dummy_string' as varchar(4096)) as full_column_name
+
+,
+
+ cast('dummy_string' as varchar(4096)) as full_table_name
+
+,
+
+ cast('dummy_string' as varchar(4096)) as column_name
+
+,
+
+ cast('dummy_string' as varchar(4096)) as data_type
+
+,
+
+ cast (True as boolean) as is_new
+
+,
+ cast('2091-02-17' as timestamp) as detected_at
+
+,
+ cast('2091-02-17' as timestamp) as created_at
+
+
+ ) as empty_table
+ where 1 = 0
diff --git a/docs/compiled/elementary/models/edr/dbt_artifacts/dbt_artifacts_hashes.sql b/docs/compiled/elementary/models/edr/dbt_artifacts/dbt_artifacts_hashes.sql
new file mode 100644
index 0000000..889bfd9
--- /dev/null
+++ b/docs/compiled/elementary/models/edr/dbt_artifacts/dbt_artifacts_hashes.sql
@@ -0,0 +1,54 @@
+
+
+
+
+
+select
+ 'dbt_models' as artifacts_model,
+ metadata_hash
+from "neondb"."dbt_testing_example_elementary"."dbt_models"
+ union all
+
+select
+ 'dbt_tests' as artifacts_model,
+ metadata_hash
+from "neondb"."dbt_testing_example_elementary"."dbt_tests"
+ union all
+
+select
+ 'dbt_sources' as artifacts_model,
+ metadata_hash
+from "neondb"."dbt_testing_example_elementary"."dbt_sources"
+ union all
+
+select
+ 'dbt_snapshots' as artifacts_model,
+ metadata_hash
+from "neondb"."dbt_testing_example_elementary"."dbt_snapshots"
+ union all
+
+select
+ 'dbt_metrics' as artifacts_model,
+ metadata_hash
+from "neondb"."dbt_testing_example_elementary"."dbt_metrics"
+ union all
+
+select
+ 'dbt_exposures' as artifacts_model,
+ metadata_hash
+from "neondb"."dbt_testing_example_elementary"."dbt_exposures"
+ union all
+
+select
+ 'dbt_seeds' as artifacts_model,
+ metadata_hash
+from "neondb"."dbt_testing_example_elementary"."dbt_seeds"
+ union all
+
+select
+ 'dbt_columns' as artifacts_model,
+ metadata_hash
+from "neondb"."dbt_testing_example_elementary"."dbt_columns"
+
+
+order by metadata_hash
\ No newline at end of file
diff --git a/docs/compiled/elementary/models/edr/dbt_artifacts/dbt_columns.sql b/docs/compiled/elementary/models/edr/dbt_artifacts/dbt_columns.sql
new file mode 100644
index 0000000..9d89308
--- /dev/null
+++ b/docs/compiled/elementary/models/edr/dbt_artifacts/dbt_columns.sql
@@ -0,0 +1,59 @@
+
+
+select * from (
+ select
+
+
+ cast('dummy_string' as varchar(4096)) as unique_id
+
+,
+
+ cast('dummy_string' as varchar(4096)) as parent_unique_id
+
+,
+
+ cast('dummy_string' as varchar(4096)) as name
+
+,
+
+ cast('dummy_string' as varchar(4096)) as data_type
+
+,
+
+ cast('this_is_just_a_long_dummy_string' as text) as tags
+
+,
+
+ cast('this_is_just_a_long_dummy_string' as text) as meta
+
+,
+
+ cast('dummy_string' as varchar(4096)) as database_name
+
+,
+
+ cast('dummy_string' as varchar(4096)) as schema_name
+
+,
+
+ cast('dummy_string' as varchar(4096)) as table_name
+
+,
+
+ cast('this_is_just_a_long_dummy_string' as text) as description
+
+,
+
+ cast('dummy_string' as varchar(4096)) as resource_type
+
+,
+
+ cast('dummy_string' as varchar(4096)) as generated_at
+
+,
+
+ cast('dummy_string' as varchar(4096)) as metadata_hash
+
+
+ ) as empty_table
+ where 1 = 0
\ No newline at end of file
diff --git a/docs/compiled/elementary/models/edr/dbt_artifacts/dbt_exposures.sql b/docs/compiled/elementary/models/edr/dbt_artifacts/dbt_exposures.sql
new file mode 100644
index 0000000..6e77256
--- /dev/null
+++ b/docs/compiled/elementary/models/edr/dbt_artifacts/dbt_exposures.sql
@@ -0,0 +1,87 @@
+
+
+select * from (
+ select
+
+
+ cast('dummy_string' as varchar(4096)) as unique_id
+
+,
+
+ cast('dummy_string' as varchar(4096)) as name
+
+,
+
+ cast('dummy_string' as varchar(4096)) as maturity
+
+,
+
+ cast('dummy_string' as varchar(4096)) as type
+
+,
+
+ cast('dummy_string' as varchar(4096)) as owner_email
+
+,
+
+ cast('dummy_string' as varchar(4096)) as owner_name
+
+,
+
+ cast('this_is_just_a_long_dummy_string' as text) as url
+
+,
+
+ cast('this_is_just_a_long_dummy_string' as text) as depends_on_macros
+
+,
+
+ cast('this_is_just_a_long_dummy_string' as text) as depends_on_nodes
+
+,
+
+ cast('this_is_just_a_long_dummy_string' as text) as depends_on_columns
+
+,
+
+ cast('this_is_just_a_long_dummy_string' as text) as description
+
+,
+
+ cast('this_is_just_a_long_dummy_string' as text) as tags
+
+,
+
+ cast('this_is_just_a_long_dummy_string' as text) as meta
+
+,
+
+ cast('dummy_string' as varchar(4096)) as package_name
+
+,
+
+ cast('this_is_just_a_long_dummy_string' as text) as original_path
+
+,
+
+ cast('dummy_string' as varchar(4096)) as path
+
+,
+
+ cast('dummy_string' as varchar(4096)) as generated_at
+
+,
+
+ cast('dummy_string' as varchar(4096)) as metadata_hash
+
+,
+
+ cast('dummy_string' as varchar(4096)) as label
+
+,
+
+ cast('this_is_just_a_long_dummy_string' as text) as raw_queries
+
+
+ ) as empty_table
+ where 1 = 0
\ No newline at end of file
diff --git a/docs/compiled/elementary/models/edr/dbt_artifacts/dbt_invocations.sql b/docs/compiled/elementary/models/edr/dbt_artifacts/dbt_invocations.sql
new file mode 100644
index 0000000..a9d0e4a
--- /dev/null
+++ b/docs/compiled/elementary/models/edr/dbt_artifacts/dbt_invocations.sql
@@ -0,0 +1,146 @@
+
+
+select * from (
+ select
+
+
+ cast('this_is_just_a_long_dummy_string' as text) as invocation_id
+
+,
+
+ cast('this_is_just_a_long_dummy_string' as text) as job_id
+
+,
+
+ cast('this_is_just_a_long_dummy_string' as text) as job_name
+
+,
+
+ cast('this_is_just_a_long_dummy_string' as text) as job_run_id
+
+,
+
+ cast('dummy_string' as varchar(4096)) as run_started_at
+
+,
+
+ cast('dummy_string' as varchar(4096)) as run_completed_at
+
+,
+
+ cast('dummy_string' as varchar(4096)) as generated_at
+
+,
+ cast('2091-02-17' as timestamp) as created_at
+
+,
+
+ cast('dummy_string' as varchar(4096)) as command
+
+,
+
+ cast('dummy_string' as varchar(4096)) as dbt_version
+
+,
+
+ cast('dummy_string' as varchar(4096)) as elementary_version
+
+,
+
+ cast (True as boolean) as full_refresh
+
+,
+
+ cast('this_is_just_a_long_dummy_string' as text) as invocation_vars
+
+,
+
+ cast('this_is_just_a_long_dummy_string' as text) as vars
+
+,
+
+ cast('dummy_string' as varchar(4096)) as target_name
+
+,
+
+ cast('dummy_string' as varchar(4096)) as target_database
+
+,
+
+ cast('dummy_string' as varchar(4096)) as target_schema
+
+,
+
+ cast('dummy_string' as varchar(4096)) as target_profile_name
+
+,
+
+ cast(123456789 as integer) as threads
+
+,
+
+ cast('this_is_just_a_long_dummy_string' as text) as selected
+
+,
+
+ cast('this_is_just_a_long_dummy_string' as text) as yaml_selector
+
+,
+
+ cast('dummy_string' as varchar(4096)) as project_id
+
+,
+
+ cast('dummy_string' as varchar(4096)) as project_name
+
+,
+
+ cast('dummy_string' as varchar(4096)) as env
+
+,
+
+ cast('dummy_string' as varchar(4096)) as env_id
+
+,
+
+ cast('dummy_string' as varchar(4096)) as cause_category
+
+,
+
+ cast('this_is_just_a_long_dummy_string' as text) as cause
+
+,
+
+ cast('dummy_string' as varchar(4096)) as pull_request_id
+
+,
+
+ cast('dummy_string' as varchar(4096)) as git_sha
+
+,
+
+ cast('dummy_string' as varchar(4096)) as orchestrator
+
+,
+
+ cast('dummy_string' as varchar(4096)) as dbt_user
+
+,
+
+ cast('dummy_string' as varchar(4096)) as job_url
+
+,
+
+ cast('dummy_string' as varchar(4096)) as job_run_url
+
+,
+
+ cast('dummy_string' as varchar(4096)) as account_id
+
+,
+
+ cast('this_is_just_a_long_dummy_string' as text) as target_adapter_specific_fields
+
+
+ ) as empty_table
+ where 1 = 0
\ No newline at end of file
diff --git a/docs/compiled/elementary/models/edr/dbt_artifacts/dbt_metrics.sql b/docs/compiled/elementary/models/edr/dbt_artifacts/dbt_metrics.sql
new file mode 100644
index 0000000..02114cf
--- /dev/null
+++ b/docs/compiled/elementary/models/edr/dbt_artifacts/dbt_metrics.sql
@@ -0,0 +1,87 @@
+
+
+select * from (
+ select
+
+
+ cast('dummy_string' as varchar(4096)) as unique_id
+
+,
+
+ cast('dummy_string' as varchar(4096)) as name
+
+,
+
+ cast('dummy_string' as varchar(4096)) as label
+
+,
+
+ cast('dummy_string' as varchar(4096)) as model
+
+,
+
+ cast('dummy_string' as varchar(4096)) as type
+
+,
+
+ cast('this_is_just_a_long_dummy_string' as text) as sql
+
+,
+
+ cast('dummy_string' as varchar(4096)) as timestamp
+
+,
+
+ cast('this_is_just_a_long_dummy_string' as text) as filters
+
+,
+
+ cast('this_is_just_a_long_dummy_string' as text) as time_grains
+
+,
+
+ cast('this_is_just_a_long_dummy_string' as text) as dimensions
+
+,
+
+ cast('this_is_just_a_long_dummy_string' as text) as depends_on_macros
+
+,
+
+ cast('this_is_just_a_long_dummy_string' as text) as depends_on_nodes
+
+,
+
+ cast('this_is_just_a_long_dummy_string' as text) as description
+
+,
+
+ cast('this_is_just_a_long_dummy_string' as text) as tags
+
+,
+
+ cast('this_is_just_a_long_dummy_string' as text) as meta
+
+,
+
+ cast('dummy_string' as varchar(4096)) as package_name
+
+,
+
+ cast('this_is_just_a_long_dummy_string' as text) as original_path
+
+,
+
+ cast('dummy_string' as varchar(4096)) as path
+
+,
+
+ cast('dummy_string' as varchar(4096)) as generated_at
+
+,
+
+ cast('dummy_string' as varchar(4096)) as metadata_hash
+
+
+ ) as empty_table
+ where 1 = 0
\ No newline at end of file
diff --git a/docs/compiled/elementary/models/edr/dbt_artifacts/dbt_models.sql b/docs/compiled/elementary/models/edr/dbt_artifacts/dbt_models.sql
new file mode 100644
index 0000000..ae5a441
--- /dev/null
+++ b/docs/compiled/elementary/models/edr/dbt_artifacts/dbt_models.sql
@@ -0,0 +1,83 @@
+
+
+select * from (
+ select
+
+
+ cast('dummy_string' as varchar(4096)) as unique_id
+
+,
+
+ cast('dummy_string' as varchar(4096)) as alias
+
+,
+
+ cast('dummy_string' as varchar(4096)) as checksum
+
+,
+
+ cast('dummy_string' as varchar(4096)) as materialization
+
+,
+
+ cast('this_is_just_a_long_dummy_string' as text) as tags
+
+,
+
+ cast('this_is_just_a_long_dummy_string' as text) as meta
+
+,
+
+ cast('dummy_string' as varchar(4096)) as owner
+
+,
+
+ cast('dummy_string' as varchar(4096)) as database_name
+
+,
+
+ cast('dummy_string' as varchar(4096)) as schema_name
+
+,
+
+ cast('this_is_just_a_long_dummy_string' as text) as depends_on_macros
+
+,
+
+ cast('this_is_just_a_long_dummy_string' as text) as depends_on_nodes
+
+,
+
+ cast('this_is_just_a_long_dummy_string' as text) as description
+
+,
+
+ cast('dummy_string' as varchar(4096)) as name
+
+,
+
+ cast('dummy_string' as varchar(4096)) as package_name
+
+,
+
+ cast('this_is_just_a_long_dummy_string' as text) as original_path
+
+,
+
+ cast('dummy_string' as varchar(4096)) as path
+
+,
+
+ cast('dummy_string' as varchar(4096)) as patch_path
+
+,
+
+ cast('dummy_string' as varchar(4096)) as generated_at
+
+,
+
+ cast('dummy_string' as varchar(4096)) as metadata_hash
+
+
+ ) as empty_table
+ where 1 = 0
\ No newline at end of file
diff --git a/docs/compiled/elementary/models/edr/dbt_artifacts/dbt_run_results.sql b/docs/compiled/elementary/models/edr/dbt_artifacts/dbt_run_results.sql
new file mode 100644
index 0000000..a425bcb
--- /dev/null
+++ b/docs/compiled/elementary/models/edr/dbt_artifacts/dbt_run_results.sql
@@ -0,0 +1,94 @@
+
+
+select * from (
+ select
+
+
+ cast('this_is_just_a_long_dummy_string' as text) as model_execution_id
+
+,
+
+ cast('this_is_just_a_long_dummy_string' as text) as unique_id
+
+,
+
+ cast('dummy_string' as varchar(4096)) as invocation_id
+
+,
+
+ cast('dummy_string' as varchar(4096)) as generated_at
+
+,
+ cast('2091-02-17' as timestamp) as created_at
+
+,
+
+ cast('this_is_just_a_long_dummy_string' as text) as name
+
+,
+
+ cast('this_is_just_a_long_dummy_string' as text) as message
+
+,
+
+ cast('dummy_string' as varchar(4096)) as status
+
+,
+
+ cast('dummy_string' as varchar(4096)) as resource_type
+
+,
+
+ cast(123456789.99 as float) as execution_time
+
+,
+
+ cast('dummy_string' as varchar(4096)) as execute_started_at
+
+,
+
+ cast('dummy_string' as varchar(4096)) as execute_completed_at
+
+,
+
+ cast('dummy_string' as varchar(4096)) as compile_started_at
+
+,
+
+ cast('dummy_string' as varchar(4096)) as compile_completed_at
+
+,
+
+ cast(31474836478 as bigint) as rows_affected
+
+,
+
+ cast (True as boolean) as full_refresh
+
+,
+
+ cast('this_is_just_a_long_dummy_string' as text) as compiled_code
+
+,
+
+ cast(31474836478 as bigint) as failures
+
+,
+
+ cast('dummy_string' as varchar(4096)) as query_id
+
+,
+
+ cast('dummy_string' as varchar(4096)) as thread_id
+
+,
+
+ cast('dummy_string' as varchar(4096)) as materialization
+
+,
+
+ cast('dummy_string' as varchar(4096)) as adapter_response
+
+
+ ) as empty_table
+ where 1 = 0
\ No newline at end of file
diff --git a/docs/compiled/elementary/models/edr/dbt_artifacts/dbt_seeds.sql b/docs/compiled/elementary/models/edr/dbt_artifacts/dbt_seeds.sql
new file mode 100644
index 0000000..ff1b9e6
--- /dev/null
+++ b/docs/compiled/elementary/models/edr/dbt_artifacts/dbt_seeds.sql
@@ -0,0 +1,67 @@
+
+
+select * from (
+ select
+
+
+ cast('dummy_string' as varchar(4096)) as unique_id
+
+,
+
+ cast('dummy_string' as varchar(4096)) as alias
+
+,
+
+ cast('dummy_string' as varchar(4096)) as checksum
+
+,
+
+ cast('this_is_just_a_long_dummy_string' as text) as tags
+
+,
+
+ cast('this_is_just_a_long_dummy_string' as text) as meta
+
+,
+
+ cast('dummy_string' as varchar(4096)) as owner
+
+,
+
+ cast('dummy_string' as varchar(4096)) as database_name
+
+,
+
+ cast('dummy_string' as varchar(4096)) as schema_name
+
+,
+
+ cast('this_is_just_a_long_dummy_string' as text) as description
+
+,
+
+ cast('dummy_string' as varchar(4096)) as name
+
+,
+
+ cast('dummy_string' as varchar(4096)) as package_name
+
+,
+
+ cast('this_is_just_a_long_dummy_string' as text) as original_path
+
+,
+
+ cast('dummy_string' as varchar(4096)) as path
+
+,
+
+ cast('dummy_string' as varchar(4096)) as generated_at
+
+,
+
+ cast('dummy_string' as varchar(4096)) as metadata_hash
+
+
+ ) as empty_table
+ where 1 = 0
\ No newline at end of file
diff --git a/docs/compiled/elementary/models/edr/dbt_artifacts/dbt_snapshots.sql b/docs/compiled/elementary/models/edr/dbt_artifacts/dbt_snapshots.sql
new file mode 100644
index 0000000..ae5a441
--- /dev/null
+++ b/docs/compiled/elementary/models/edr/dbt_artifacts/dbt_snapshots.sql
@@ -0,0 +1,83 @@
+
+
+select * from (
+ select
+
+
+ cast('dummy_string' as varchar(4096)) as unique_id
+
+,
+
+ cast('dummy_string' as varchar(4096)) as alias
+
+,
+
+ cast('dummy_string' as varchar(4096)) as checksum
+
+,
+
+ cast('dummy_string' as varchar(4096)) as materialization
+
+,
+
+ cast('this_is_just_a_long_dummy_string' as text) as tags
+
+,
+
+ cast('this_is_just_a_long_dummy_string' as text) as meta
+
+,
+
+ cast('dummy_string' as varchar(4096)) as owner
+
+,
+
+ cast('dummy_string' as varchar(4096)) as database_name
+
+,
+
+ cast('dummy_string' as varchar(4096)) as schema_name
+
+,
+
+ cast('this_is_just_a_long_dummy_string' as text) as depends_on_macros
+
+,
+
+ cast('this_is_just_a_long_dummy_string' as text) as depends_on_nodes
+
+,
+
+ cast('this_is_just_a_long_dummy_string' as text) as description
+
+,
+
+ cast('dummy_string' as varchar(4096)) as name
+
+,
+
+ cast('dummy_string' as varchar(4096)) as package_name
+
+,
+
+ cast('this_is_just_a_long_dummy_string' as text) as original_path
+
+,
+
+ cast('dummy_string' as varchar(4096)) as path
+
+,
+
+ cast('dummy_string' as varchar(4096)) as patch_path
+
+,
+
+ cast('dummy_string' as varchar(4096)) as generated_at
+
+,
+
+ cast('dummy_string' as varchar(4096)) as metadata_hash
+
+
+ ) as empty_table
+ where 1 = 0
\ No newline at end of file
diff --git a/docs/compiled/elementary/models/edr/dbt_artifacts/dbt_sources.sql b/docs/compiled/elementary/models/edr/dbt_artifacts/dbt_sources.sql
new file mode 100644
index 0000000..0d4c039
--- /dev/null
+++ b/docs/compiled/elementary/models/edr/dbt_artifacts/dbt_sources.sql
@@ -0,0 +1,95 @@
+
+
+select * from (
+ select
+
+
+ cast('dummy_string' as varchar(4096)) as unique_id
+
+,
+
+ cast('dummy_string' as varchar(4096)) as database_name
+
+,
+
+ cast('dummy_string' as varchar(4096)) as schema_name
+
+,
+
+ cast('dummy_string' as varchar(4096)) as source_name
+
+,
+
+ cast('dummy_string' as varchar(4096)) as name
+
+,
+
+ cast('dummy_string' as varchar(4096)) as identifier
+
+,
+
+ cast('dummy_string' as varchar(4096)) as loaded_at_field
+
+,
+
+ cast('dummy_string' as varchar(4096)) as freshness_warn_after
+
+,
+
+ cast('dummy_string' as varchar(4096)) as freshness_error_after
+
+,
+
+ cast('this_is_just_a_long_dummy_string' as text) as freshness_filter
+
+,
+
+ cast('this_is_just_a_long_dummy_string' as text) as freshness_description
+
+,
+
+ cast('dummy_string' as varchar(4096)) as relation_name
+
+,
+
+ cast('this_is_just_a_long_dummy_string' as text) as tags
+
+,
+
+ cast('this_is_just_a_long_dummy_string' as text) as meta
+
+,
+
+ cast('dummy_string' as varchar(4096)) as owner
+
+,
+
+ cast('dummy_string' as varchar(4096)) as package_name
+
+,
+
+ cast('this_is_just_a_long_dummy_string' as text) as original_path
+
+,
+
+ cast('dummy_string' as varchar(4096)) as path
+
+,
+
+ cast('this_is_just_a_long_dummy_string' as text) as source_description
+
+,
+
+ cast('this_is_just_a_long_dummy_string' as text) as description
+
+,
+
+ cast('dummy_string' as varchar(4096)) as generated_at
+
+,
+
+ cast('dummy_string' as varchar(4096)) as metadata_hash
+
+
+ ) as empty_table
+ where 1 = 0
\ No newline at end of file
diff --git a/docs/compiled/elementary/models/edr/dbt_artifacts/dbt_tests.sql b/docs/compiled/elementary/models/edr/dbt_artifacts/dbt_tests.sql
new file mode 100644
index 0000000..4b4b277
--- /dev/null
+++ b/docs/compiled/elementary/models/edr/dbt_artifacts/dbt_tests.sql
@@ -0,0 +1,115 @@
+
+
+select * from (
+ select
+
+
+ cast('dummy_string' as varchar(4096)) as unique_id
+
+,
+
+ cast('dummy_string' as varchar(4096)) as database_name
+
+,
+
+ cast('dummy_string' as varchar(4096)) as schema_name
+
+,
+
+ cast('dummy_string' as varchar(4096)) as name
+
+,
+
+ cast('dummy_string' as varchar(4096)) as short_name
+
+,
+
+ cast('dummy_string' as varchar(4096)) as alias
+
+,
+
+ cast('dummy_string' as varchar(4096)) as test_column_name
+
+,
+
+ cast('dummy_string' as varchar(4096)) as severity
+
+,
+
+ cast('dummy_string' as varchar(4096)) as warn_if
+
+,
+
+ cast('dummy_string' as varchar(4096)) as error_if
+
+,
+
+ cast('this_is_just_a_long_dummy_string' as text) as test_params
+
+,
+
+ cast('dummy_string' as varchar(4096)) as test_namespace
+
+,
+
+ cast('this_is_just_a_long_dummy_string' as text) as tags
+
+,
+
+ cast('this_is_just_a_long_dummy_string' as text) as model_tags
+
+,
+
+ cast('this_is_just_a_long_dummy_string' as text) as model_owners
+
+,
+
+ cast('this_is_just_a_long_dummy_string' as text) as meta
+
+,
+
+ cast('this_is_just_a_long_dummy_string' as text) as depends_on_macros
+
+,
+
+ cast('this_is_just_a_long_dummy_string' as text) as depends_on_nodes
+
+,
+
+ cast('dummy_string' as varchar(4096)) as parent_model_unique_id
+
+,
+
+ cast('this_is_just_a_long_dummy_string' as text) as description
+
+,
+
+ cast('dummy_string' as varchar(4096)) as package_name
+
+,
+
+ cast('dummy_string' as varchar(4096)) as type
+
+,
+
+ cast('this_is_just_a_long_dummy_string' as text) as original_path
+
+,
+
+ cast('dummy_string' as varchar(4096)) as path
+
+,
+
+ cast('dummy_string' as varchar(4096)) as generated_at
+
+,
+
+ cast('dummy_string' as varchar(4096)) as metadata_hash
+
+,
+
+ cast('dummy_string' as varchar(4096)) as quality_dimension
+
+
+ ) as empty_table
+ where 1 = 0
\ No newline at end of file
diff --git a/docs/compiled/elementary/models/edr/dbt_artifacts/enriched_columns.sql b/docs/compiled/elementary/models/edr/dbt_artifacts/enriched_columns.sql
new file mode 100644
index 0000000..016ba87
--- /dev/null
+++ b/docs/compiled/elementary/models/edr/dbt_artifacts/enriched_columns.sql
@@ -0,0 +1,32 @@
+
+
+
+with information_schema_columns as (
+ select
+ lower(database_name) as database_name,
+ lower(schema_name) as schema_name,
+ lower(table_name) as table_name,
+ lower(column_name) as name,
+ data_type
+ from "neondb"."dbt_testing_example_elementary"."information_schema_columns"
+),
+
+dbt_columns as (
+ select
+ lower(database_name) as database_name,
+ lower(schema_name) as schema_name,
+ lower(table_name) as table_name,
+ lower(name) as name,
+ description
+ from "neondb"."dbt_testing_example_elementary"."dbt_columns"
+)
+
+select
+ database_name,
+ schema_name,
+ table_name,
+ name,
+ data_type,
+ description
+from information_schema_columns
+left join dbt_columns using (database_name, schema_name, table_name, name)
\ No newline at end of file
diff --git a/docs/compiled/elementary/models/edr/dbt_artifacts/information_schema_columns.sql b/docs/compiled/elementary/models/edr/dbt_artifacts/information_schema_columns.sql
new file mode 100644
index 0000000..dca98cf
--- /dev/null
+++ b/docs/compiled/elementary/models/edr/dbt_artifacts/information_schema_columns.sql
@@ -0,0 +1,86 @@
+
+
+
+
+
+
+
+ with dbt_models_data as (
+ select
+ database_name,
+ schema_name,
+ alias as table_name
+ from "neondb"."dbt_testing_example_elementary"."dbt_models"
+ ),
+
+ dbt_snapshots_data as (
+ select
+ database_name,
+ schema_name,
+ alias as table_name
+ from "neondb"."dbt_testing_example_elementary"."dbt_snapshots"
+ ),
+
+ dbt_sources_data as (
+ select
+ database_name,
+ schema_name,
+ name as table_name
+ from "neondb"."dbt_testing_example_elementary"."dbt_sources"
+ ),
+
+ dbt_seeds_data as (
+ select
+ database_name,
+ schema_name,
+ name as table_name
+ from "neondb"."dbt_testing_example_elementary"."dbt_seeds"
+ ),
+
+ tables_information as (
+ select * from dbt_models_data
+ union all
+ select * from dbt_sources_data
+ union all
+ select * from dbt_snapshots_data
+ union all
+ select * from dbt_seeds_data
+ ),
+
+ columns_information as (
+
+
+
+
+ (
+ select
+ upper(table_catalog || '.' || table_schema || '.' || table_name) as full_table_name,
+ upper(table_catalog) as database_name,
+ upper(table_schema) as schema_name,
+ upper(table_name) as table_name,
+ upper(column_name) as column_name,
+ data_type
+ from information_schema.columns
+ where upper(table_schema) = upper('dbt_testing_example')
+
+)
+
+
+
+
+
+ ),
+
+ information_schema_columns as (
+ select col_info.*
+ from tables_information tbl_info
+ join columns_information col_info
+ on (lower(tbl_info.database_name) = lower(col_info.database_name) and
+ lower(tbl_info.schema_name) = lower(col_info.schema_name) and
+ lower(tbl_info.table_name) = lower(col_info.table_name)
+ )
+ )
+
+ select *
+ from information_schema_columns
+
diff --git a/docs/compiled/elementary/models/edr/run_results/dbt_source_freshness_results.sql b/docs/compiled/elementary/models/edr/run_results/dbt_source_freshness_results.sql
new file mode 100644
index 0000000..2a38970
--- /dev/null
+++ b/docs/compiled/elementary/models/edr/run_results/dbt_source_freshness_results.sql
@@ -0,0 +1,75 @@
+
+
+
+ select * from (
+ select
+
+
+ cast('dummy_string' as varchar(4096)) as source_freshness_execution_id
+
+,
+
+ cast('dummy_string' as varchar(4096)) as unique_id
+
+,
+
+ cast('dummy_string' as varchar(4096)) as max_loaded_at
+
+,
+
+ cast('dummy_string' as varchar(4096)) as snapshotted_at
+
+,
+
+ cast('dummy_string' as varchar(4096)) as generated_at
+
+,
+ cast('2091-02-17' as timestamp) as created_at
+
+,
+
+ cast(123456789.99 as float) as max_loaded_at_time_ago_in_s
+
+,
+
+ cast('dummy_string' as varchar(4096)) as status
+
+,
+
+ cast('dummy_string' as varchar(4096)) as error
+
+,
+
+ cast('dummy_string' as varchar(4096)) as compile_started_at
+
+,
+
+ cast('dummy_string' as varchar(4096)) as compile_completed_at
+
+,
+
+ cast('dummy_string' as varchar(4096)) as execute_started_at
+
+,
+
+ cast('dummy_string' as varchar(4096)) as execute_completed_at
+
+,
+
+ cast('dummy_string' as varchar(4096)) as invocation_id
+
+,
+
+ cast('dummy_string' as varchar(4096)) as warn_after
+
+,
+
+ cast('dummy_string' as varchar(4096)) as error_after
+
+,
+
+ cast('this_is_just_a_long_dummy_string' as text) as filter
+
+
+ ) as empty_table
+ where 1 = 0
diff --git a/docs/compiled/elementary/models/edr/run_results/elementary_test_results.sql b/docs/compiled/elementary/models/edr/run_results/elementary_test_results.sql
new file mode 100644
index 0000000..bfdf8c7
--- /dev/null
+++ b/docs/compiled/elementary/models/edr/run_results/elementary_test_results.sql
@@ -0,0 +1,118 @@
+
+
+
+ select * from (
+ select
+
+
+ cast('this_is_just_a_long_dummy_string' as text) as id
+
+,
+
+ cast('dummy_string' as varchar(4096)) as data_issue_id
+
+,
+
+ cast('this_is_just_a_long_dummy_string' as text) as test_execution_id
+
+,
+
+ cast('this_is_just_a_long_dummy_string' as text) as test_unique_id
+
+,
+
+ cast('this_is_just_a_long_dummy_string' as text) as model_unique_id
+
+,
+
+ cast('dummy_string' as varchar(4096)) as invocation_id
+
+,
+ cast('2091-02-17' as timestamp) as detected_at
+
+,
+ cast('2091-02-17' as timestamp) as created_at
+
+,
+
+ cast('dummy_string' as varchar(4096)) as database_name
+
+,
+
+ cast('dummy_string' as varchar(4096)) as schema_name
+
+,
+
+ cast('dummy_string' as varchar(4096)) as table_name
+
+,
+
+ cast('dummy_string' as varchar(4096)) as column_name
+
+,
+
+ cast('dummy_string' as varchar(4096)) as test_type
+
+,
+
+ cast('dummy_string' as varchar(4096)) as test_sub_type
+
+,
+
+ cast('this_is_just_a_long_dummy_string' as text) as test_results_description
+
+,
+
+ cast('dummy_string' as varchar(4096)) as owners
+
+,
+
+ cast('dummy_string' as varchar(4096)) as tags
+
+,
+
+ cast('this_is_just_a_long_dummy_string' as text) as test_results_query
+
+,
+
+ cast('dummy_string' as varchar(4096)) as other
+
+,
+
+ cast('this_is_just_a_long_dummy_string' as text) as test_name
+
+,
+
+ cast('this_is_just_a_long_dummy_string' as text) as test_params
+
+,
+
+ cast('dummy_string' as varchar(4096)) as severity
+
+,
+
+ cast('dummy_string' as varchar(4096)) as status
+
+,
+
+ cast(31474836478 as bigint) as failures
+
+,
+
+ cast('dummy_string' as varchar(4096)) as test_short_name
+
+,
+
+ cast('dummy_string' as varchar(4096)) as test_alias
+
+,
+
+ cast('this_is_just_a_long_dummy_string' as text) as result_rows
+
+,
+
+ cast(31474836478 as bigint) as failed_row_count
+
+
+ ) as empty_table
+ where 1 = 0
diff --git a/docs/compiled/elementary/models/edr/run_results/job_run_results.sql b/docs/compiled/elementary/models/edr/run_results/job_run_results.sql
new file mode 100644
index 0000000..4f2c0f0
--- /dev/null
+++ b/docs/compiled/elementary/models/edr/run_results/job_run_results.sql
@@ -0,0 +1,57 @@
+
+
+
+
+
+
+with jobs as (
+ select
+ job_name,
+ job_id,
+ job_run_id,
+
+min(cast(run_started_at as timestamp))
+ as job_run_started_at,
+
+max(cast(run_completed_at as timestamp))
+ as job_run_completed_at,
+
+
+ (
+ (
+ (
+ ((
+max(cast(run_completed_at as timestamp))
+)::date - (
+min(cast(run_started_at as timestamp))
+)::date)
+ * 24 + date_part('hour', (
+max(cast(run_completed_at as timestamp))
+)::timestamp) - date_part('hour', (
+min(cast(run_started_at as timestamp))
+)::timestamp))
+ * 60 + date_part('minute', (
+max(cast(run_completed_at as timestamp))
+)::timestamp) - date_part('minute', (
+min(cast(run_started_at as timestamp))
+)::timestamp))
+ * 60 + floor(date_part('second', (
+max(cast(run_completed_at as timestamp))
+)::timestamp)) - floor(date_part('second', (
+min(cast(run_started_at as timestamp))
+)::timestamp)))
+
+ as job_run_execution_time
+ from "neondb"."dbt_testing_example_elementary"."dbt_invocations"
+ where job_id is not null
+ group by job_name, job_id, job_run_id
+)
+
+select
+ job_name as name,
+ job_id as id,
+ job_run_id as run_id,
+ job_run_started_at as run_started_at,
+ job_run_completed_at as run_completed_at,
+ job_run_execution_time as run_execution_time
+from jobs
\ No newline at end of file
diff --git a/docs/compiled/elementary/models/edr/run_results/model_run_results.sql b/docs/compiled/elementary/models/edr/run_results/model_run_results.sql
new file mode 100644
index 0000000..976c4cb
--- /dev/null
+++ b/docs/compiled/elementary/models/edr/run_results/model_run_results.sql
@@ -0,0 +1,53 @@
+
+
+with dbt_run_results as (
+ select * from "neondb"."dbt_testing_example_elementary"."dbt_run_results"
+),
+
+dbt_models as (
+ select * from "neondb"."dbt_testing_example_elementary"."dbt_models"
+)
+
+SELECT
+ run_results.model_execution_id,
+ run_results.unique_id,
+ run_results.invocation_id,
+ run_results.query_id,
+ run_results.name,
+ run_results.generated_at,
+ run_results.status,
+ run_results.full_refresh,
+ run_results.message,
+ run_results.execution_time,
+ run_results.execute_started_at,
+ run_results.execute_completed_at,
+ run_results.compile_started_at,
+ run_results.compile_completed_at,
+ run_results.compiled_code,
+ run_results.adapter_response,
+ run_results.thread_id,
+ models.database_name,
+ models.schema_name,
+ coalesce(run_results.materialization, models.materialization) as materialization,
+ models.tags,
+ models.package_name,
+ models.path,
+ models.original_path,
+ models.owner,
+ models.alias,
+ ROW_NUMBER() OVER (PARTITION BY run_results.unique_id ORDER BY run_results.generated_at DESC) AS model_invocation_reverse_index,
+ CASE WHEN FIRST_VALUE(invocation_id) OVER (PARTITION BY
+ date_trunc('day', cast(run_results.generated_at as timestamp))
+ ORDER BY run_results.generated_at ASC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) = invocation_id
+ THEN TRUE
+ ELSE FALSE
+ END AS is_the_first_invocation_of_the_day,
+ CASE WHEN LAST_VALUE(invocation_id) OVER (PARTITION BY
+ date_trunc('day', cast(run_results.generated_at as timestamp))
+ ORDER BY run_results.generated_at ASC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) = invocation_id
+ THEN TRUE
+ ELSE FALSE
+ END AS is_the_last_invocation_of_the_day
+
+FROM dbt_run_results run_results
+JOIN dbt_models models ON run_results.unique_id = models.unique_id
\ No newline at end of file
diff --git a/docs/compiled/elementary/models/edr/run_results/snapshot_run_results.sql b/docs/compiled/elementary/models/edr/run_results/snapshot_run_results.sql
new file mode 100644
index 0000000..6fb8310
--- /dev/null
+++ b/docs/compiled/elementary/models/edr/run_results/snapshot_run_results.sql
@@ -0,0 +1,39 @@
+
+
+with dbt_run_results as (
+ select * from "neondb"."dbt_testing_example_elementary"."dbt_run_results"
+),
+
+dbt_snapshots as (
+ select * from "neondb"."dbt_testing_example_elementary"."dbt_snapshots"
+)
+
+SELECT
+ run_results.model_execution_id,
+ run_results.unique_id,
+ run_results.invocation_id,
+ run_results.query_id,
+ run_results.name,
+ run_results.generated_at,
+ run_results.status,
+ run_results.full_refresh,
+ run_results.message,
+ run_results.execution_time,
+ run_results.execute_started_at,
+ run_results.execute_completed_at,
+ run_results.compile_started_at,
+ run_results.compile_completed_at,
+ run_results.compiled_code,
+ run_results.adapter_response,
+ run_results.thread_id,
+ snapshots.database_name,
+ snapshots.schema_name,
+ coalesce(run_results.materialization, snapshots.materialization) as materialization,
+ snapshots.tags,
+ snapshots.package_name,
+ snapshots.path,
+ snapshots.original_path,
+ snapshots.owner,
+ snapshots.alias
+FROM dbt_run_results run_results
+JOIN dbt_snapshots snapshots ON run_results.unique_id = snapshots.unique_id
\ No newline at end of file
diff --git a/docs/compiled/elementary/models/edr/run_results/test_result_rows.sql b/docs/compiled/elementary/models/edr/run_results/test_result_rows.sql
new file mode 100644
index 0000000..1b34ccb
--- /dev/null
+++ b/docs/compiled/elementary/models/edr/run_results/test_result_rows.sql
@@ -0,0 +1,22 @@
+
+
+-- depends_on: "neondb"."dbt_testing_example_elementary"."elementary_test_results"
+select * from (
+ select
+
+
+ cast('this_is_just_a_long_dummy_string' as text) as elementary_test_results_id
+
+,
+
+ cast('this_is_just_a_long_dummy_string' as text) as result_row
+
+,
+ cast('2091-02-17' as timestamp) as detected_at
+
+,
+ cast('2091-02-17' as timestamp) as created_at
+
+
+ ) as empty_table
+ where 1 = 0
\ No newline at end of file
diff --git a/docs/compiled/elementary/models/edr/system/metadata.sql b/docs/compiled/elementary/models/edr/system/metadata.sql
new file mode 100644
index 0000000..b79ea5a
--- /dev/null
+++ b/docs/compiled/elementary/models/edr/system/metadata.sql
@@ -0,0 +1,4 @@
+
+
+SELECT
+ '0.14.1' as dbt_pkg_version
\ No newline at end of file
diff --git a/docs/compiled/elementary/models/edr/system/monitors_runs.sql b/docs/compiled/elementary/models/edr/system/monitors_runs.sql
new file mode 100644
index 0000000..ff0573b
--- /dev/null
+++ b/docs/compiled/elementary/models/edr/system/monitors_runs.sql
@@ -0,0 +1,22 @@
+
+
+with data_monitoring_metrics as (
+
+ select * from "neondb"."dbt_testing_example_elementary"."data_monitoring_metrics"
+
+),
+
+max_bucket_end as (
+
+ select full_table_name,
+ column_name,
+ metric_name,
+ metric_properties,
+ max(bucket_end) as last_bucket_end,
+ min(bucket_end) as first_bucket_end
+ from data_monitoring_metrics
+ group by 1,2,3,4
+
+)
+
+select * from max_bucket_end
\ No newline at end of file
diff --git a/docs/graph.gpickle b/docs/graph.gpickle
new file mode 100644
index 0000000..2a8b6a6
Binary files /dev/null and b/docs/graph.gpickle differ
diff --git a/docs/graph_summary.json b/docs/graph_summary.json
new file mode 100644
index 0000000..32c7c89
--- /dev/null
+++ b/docs/graph_summary.json
@@ -0,0 +1 @@
+{"_invocation_id": "bd20d4ff-d6c5-4850-b106-ab1d2c6241c2", "linked": {"0": {"name": "source.dbt_testing_example.gym_app.raw_height", "type": "source", "succ": [4, 45, 50, 51, 52, 53, 54, 55, 56]}, "1": {"name": "source.dbt_testing_example.gym_app.raw_weight", "type": "source", "succ": [5, 46, 57, 58, 59, 60, 61, 62, 63]}, "2": {"name": "model.dbt_testing_example.body_mass_indexes", "type": "model", "succ": [6, 7, 45, 46, 47, 48, 49]}, "3": {"name": "model.dbt_testing_example.int_weight_measurements_with_latest_height", "type": "model", "succ": [2, 10]}, "4": {"name": "model.dbt_testing_example.stg_gym_app__height", "type": "model", "succ": [3, 8]}, "5": {"name": "model.dbt_testing_example.stg_gym_app__weight", "type": "model", "succ": [3, 9]}, "6": {"name": "test.dbt_testing_example.body_mass_indexes_component_test", "type": "test"}, "7": {"name": "test.dbt_testing_example.body_mass_indexes_unit_test", "type": "test"}, "8": {"name": "test.dbt_testing_example.stg_gym_app__height_unit_test", "type": "test"}, "9": {"name": "test.dbt_testing_example.stg_gym_app__weight_unit_test", "type": "test"}, "10": {"name": "test.dbt_testing_example.int_weight_measurements_with_latest_height_unit_test", "type": "test"}, "11": {"name": "seed.dbt_testing_example.raw_weight", "type": "seed"}, "12": {"name": "seed.dbt_testing_example.raw_height", "type": "seed"}, "13": {"name": "model.elementary.metadata", "type": "model"}, "14": {"name": "model.elementary.monitors_runs", "type": "model"}, "15": {"name": "model.elementary.data_monitoring_metrics", "type": "model", "succ": [14, 18]}, "16": {"name": "model.elementary.schema_columns_snapshot", "type": "model"}, "17": {"name": "model.elementary.anomaly_threshold_sensitivity", "type": "model"}, "18": {"name": "model.elementary.metrics_anomaly_score", "type": "model", "succ": [17]}, "19": {"name": "model.elementary.elementary_test_results", "type": "model", "succ": [20, 38, 39, 40]}, "20": {"name": "model.elementary.test_result_rows", "type": "model"}, "21": {"name": "model.elementary.job_run_results", "type": "model"}, "22": {"name": "model.elementary.dbt_invocations", "type": "model", "succ": [21]}, "23": {"name": "model.elementary.snapshot_run_results", "type": "model", "succ": [42]}, "24": {"name": "model.elementary.dbt_run_results", "type": "model", "succ": [23, 26]}, "25": {"name": "model.elementary.dbt_snapshots", "type": "model", "succ": [23, 35, 30]}, "26": {"name": "model.elementary.model_run_results", "type": "model", "succ": [42]}, "27": {"name": "model.elementary.dbt_models", "type": "model", "succ": [26, 35, 30]}, "28": {"name": "model.elementary.dbt_source_freshness_results", "type": "model", "succ": [41]}, "29": {"name": "model.elementary.enriched_columns", "type": "model"}, "30": {"name": "model.elementary.information_schema_columns", "type": "model", "succ": [29]}, "31": {"name": "model.elementary.dbt_columns", "type": "model", "succ": [29, 35]}, "32": {"name": "model.elementary.dbt_metrics", "type": "model", "succ": [35]}, "33": {"name": "model.elementary.dbt_sources", "type": "model", "succ": [35, 30, 41]}, "34": {"name": "model.elementary.dbt_tests", "type": "model", "succ": [35]}, "35": {"name": "model.elementary.dbt_artifacts_hashes", "type": "model"}, "36": {"name": "model.elementary.dbt_exposures", "type": "model", "succ": [35]}, "37": {"name": "model.elementary.dbt_seeds", "type": "model", "succ": [35, 30]}, "38": {"name": "model.elementary.alerts_anomaly_detection", "type": "model"}, "39": {"name": "model.elementary.alerts_dbt_tests", "type": "model"}, "40": {"name": "model.elementary.alerts_schema_changes", "type": "model"}, "41": {"name": "model.elementary.alerts_dbt_source_freshness", "type": "model"}, "42": {"name": "model.elementary.alerts_dbt_models", "type": "model"}, "43": {"name": "operation.elementary.elementary-on-run-start-0", "type": "operation"}, "44": {"name": "operation.elementary.elementary-on-run-end-0", "type": "operation"}, "45": {"name": "test.dbt_testing_example.relationships_body_mass_indexes_user_id__user_id__source_gym_app_raw_height_.d338d193c2", "type": "test"}, "46": {"name": "test.dbt_testing_example.relationships_body_mass_indexes_user_id__user_id__source_gym_app_raw_weight_.1ef253afa0", "type": "test"}, "47": {"name": "test.dbt_testing_example.elementary_schema_changes_body_mass_indexes_.5e7b3caf3a", "type": "test"}, "48": {"name": "test.dbt_testing_example.elementary_volume_anomalies_body_mass_indexes_.c1d889d103", "type": "test"}, "49": {"name": "test.dbt_testing_example.elementary_freshness_anomalies_body_mass_indexes_hour__2__processed_at.e39d6b3299", "type": "test"}, "50": {"name": "test.dbt_testing_example.dbt_expectations_source_expect_column_values_to_be_of_type_gym_app_raw_height_height_unit__text.c82161c012", "type": "test"}, "51": {"name": "test.dbt_testing_example.source_accepted_values_gym_app_raw_height_height_unit__cm__inches.f4af351a08", "type": "test"}, "52": {"name": "test.dbt_testing_example.source_not_null_gym_app_raw_height_user_id.4fb45a730a", "type": "test"}, "53": {"name": "test.dbt_testing_example.dbt_expectations_source_expect_column_values_to_be_of_type_gym_app_raw_height_user_id__integer.14569ac5f0", "type": "test"}, "54": {"name": "test.dbt_testing_example.source_not_null_gym_app_raw_height_height.e7ed26fbfe", "type": "test"}, "55": {"name": "test.dbt_testing_example.dbt_expectations_source_expect_column_values_to_be_of_type_gym_app_raw_height_height__double_precision.1f5b371f9e", "type": "test"}, "56": {"name": "test.dbt_testing_example.dbt_utils_source_accepted_range_gym_app_raw_height_height__False__0.0dd5e14a3d", "type": "test"}, "57": {"name": "test.dbt_testing_example.dbt_expectations_source_expect_column_values_to_be_of_type_gym_app_raw_weight_measurement_unit__text.7271116707", "type": "test"}, "58": {"name": "test.dbt_testing_example.source_accepted_values_gym_app_raw_weight_measurement_unit__kg__pounds.0e8337c1da", "type": "test"}, "59": {"name": "test.dbt_testing_example.source_not_null_gym_app_raw_weight_user_id.e854c4fcc8", "type": "test"}, "60": {"name": "test.dbt_testing_example.dbt_expectations_source_expect_column_values_to_be_of_type_gym_app_raw_weight_user_id__integer.feda35ce32", "type": "test"}, "61": {"name": "test.dbt_testing_example.source_not_null_gym_app_raw_weight_weight.3cc3503e9d", "type": "test"}, "62": {"name": "test.dbt_testing_example.dbt_expectations_source_expect_column_values_to_be_of_type_gym_app_raw_weight_weight__double_precision.0c34285381", "type": "test"}, "63": {"name": "test.dbt_testing_example.dbt_utils_source_accepted_range_gym_app_raw_weight_weight__False__0.2147fe640d", "type": "test"}}}
\ No newline at end of file
diff --git a/docs/index.html b/docs/index.html
new file mode 100644
index 0000000..ca1e6f8
--- /dev/null
+++ b/docs/index.html
@@ -0,0 +1,102 @@
+
+
+
+
+
+
+ dbt Docs
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/docs/manifest.json b/docs/manifest.json
new file mode 100644
index 0000000..7f3380c
--- /dev/null
+++ b/docs/manifest.json
@@ -0,0 +1 @@
+{"metadata": {"dbt_schema_version": "https://schemas.getdbt.com/dbt/manifest/v11.json", "dbt_version": "1.7.11", "generated_at": "2024-12-07T05:38:39.832683Z", "invocation_id": "bd20d4ff-d6c5-4850-b106-ab1d2c6241c2", "env": {}, "project_name": "dbt_testing_example", "project_id": "f591358997332d0a4cb0125a64f9ab4f", "user_id": "d5bbc0a5-4f9a-48c4-b8a8-f722bcb2a4cb", "send_anonymous_usage_stats": true, "adapter_type": "postgres"}, "nodes": {"model.dbt_testing_example.body_mass_indexes": {"database": "neondb", "schema": "dbt_testing_example", "name": "body_mass_indexes", "resource_type": "model", "package_name": "dbt_testing_example", "path": "marts/body_mass_indexes.sql", "original_file_path": "models/marts/body_mass_indexes.sql", "unique_id": "model.dbt_testing_example.body_mass_indexes", "fqn": ["dbt_testing_example", "marts", "body_mass_indexes"], "alias": "body_mass_indexes", "checksum": {"name": "sha256", "checksum": "e2d73b5bd015a77017fa3f20cc6c711248b8181e513a42259a8759ceb0119bf7"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": [], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected"}, "tags": [], "description": "", "columns": {"user_id": {"name": "user_id", "description": "", "meta": {}, "data_type": "int", "constraints": [{"type": "not_null", "name": null, "expression": null, "warn_unenforced": true, "warn_unsupported": true}, {"type": "check", "name": null, "expression": "user_id > 0", "warn_unenforced": true, "warn_unsupported": true}], "quote": null, "tags": ["data-quality"]}, "created_date": {"name": "created_date", "description": "", "meta": {}, "data_type": "date", "constraints": [], "quote": null, "tags": []}, "weight": {"name": "weight", "description": "", "meta": {}, "data_type": "float", "constraints": [], "quote": null, "tags": []}, "height": {"name": "height", "description": "", "meta": {}, "data_type": "float", "constraints": [], "quote": null, "tags": []}, "bmi": {"name": "bmi", "description": "", "meta": {}, "data_type": "decimal", "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "dbt_testing_example://models/marts/_body_mass_indexes__models.yml", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "table"}, "created_at": 1733549924.4109578, "relation_name": "\"neondb\".\"dbt_testing_example\".\"body_mass_indexes\"", "raw_code": "with\n\nweights_with_latest_height as (\n\n select * from {{ dbt_unit_testing.ref('int_weight_measurements_with_latest_height') }}\n\n),\n\nbody_mass_indexes as (\n\n select\n created_date,\n user_id,\n weight,\n height,\n round((weight::numeric / (height::numeric / 100) ^ 2)::numeric, 1) as bmi,\n current_timestamp as processed_at\n from weights_with_latest_height\n)\n\nselect * from body_mass_indexes", "language": "sql", "refs": [{"name": "int_weight_measurements_with_latest_height", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt_unit_testing.ref"], "nodes": ["model.dbt_testing_example.int_weight_measurements_with_latest_height"]}, "compiled_path": "docs/compiled/dbt_testing_example/models/marts/body_mass_indexes.sql", "compiled": true, "compiled_code": "with\n\nweights_with_latest_height as (\n\n select * from \"neondb\".\"dbt_testing_example\".\"int_weight_measurements_with_latest_height\"\n\n),\n\nbody_mass_indexes as (\n\n select\n created_date,\n user_id,\n weight,\n height,\n round((weight::numeric / (height::numeric / 100) ^ 2)::numeric, 1) as bmi,\n current_timestamp as processed_at\n from weights_with_latest_height\n)\n\nselect * from body_mass_indexes", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.dbt_testing_example.stg_gym_app__height": {"database": "neondb", "schema": "dbt_testing_example", "name": "stg_gym_app__height", "resource_type": "model", "package_name": "dbt_testing_example", "path": "staging/gym_app/stg_gym_app__height.sql", "original_file_path": "models/staging/gym_app/stg_gym_app__height.sql", "unique_id": "model.dbt_testing_example.stg_gym_app__height", "fqn": ["dbt_testing_example", "staging", "gym_app", "stg_gym_app__height"], "alias": "stg_gym_app__height", "checksum": {"name": "sha256", "checksum": "3a6428c6cc92ffbb2bffba5acfa3661defee102c9a5963632aeea1f04d0a691f"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": [], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"materialized": "table"}, "created_at": 1733549923.109779, "relation_name": "\"neondb\".\"dbt_testing_example\".\"stg_gym_app__height\"", "raw_code": "with\n\nsource as (\n\n select * from {{ dbt_unit_testing.source('gym_app', 'raw_height') }}\n\n),\n\nrenamed as (\n\n select\n TO_DATE(date, 'DD/MM/YYYY') as created_date,\n user_id,\n height,\n height_unit as measurement_unit\n from source\n\n)\n\nselect * from renamed", "language": "sql", "refs": [], "sources": [["gym_app", "raw_height"]], "metrics": [], "depends_on": {"macros": ["macro.dbt_unit_testing.source"], "nodes": ["source.dbt_testing_example.gym_app.raw_height"]}, "compiled_path": "docs/compiled/dbt_testing_example/models/staging/gym_app/stg_gym_app__height.sql", "compiled": true, "compiled_code": "with\n\nsource as (\n\n select * from \"neondb\".\"dbt_testing_example\".\"raw_height\"\n\n),\n\nrenamed as (\n\n select\n TO_DATE(date, 'DD/MM/YYYY') as created_date,\n user_id,\n height,\n height_unit as measurement_unit\n from source\n\n)\n\nselect * from renamed", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.dbt_testing_example.stg_gym_app__weight": {"database": "neondb", "schema": "dbt_testing_example", "name": "stg_gym_app__weight", "resource_type": "model", "package_name": "dbt_testing_example", "path": "staging/gym_app/stg_gym_app__weight.sql", "original_file_path": "models/staging/gym_app/stg_gym_app__weight.sql", "unique_id": "model.dbt_testing_example.stg_gym_app__weight", "fqn": ["dbt_testing_example", "staging", "gym_app", "stg_gym_app__weight"], "alias": "stg_gym_app__weight", "checksum": {"name": "sha256", "checksum": "083bac826d334cef67bf772a4f5ff14edff86e998034453aef04f5f5b76b0c47"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": [], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"materialized": "table"}, "created_at": 1733549923.1175268, "relation_name": "\"neondb\".\"dbt_testing_example\".\"stg_gym_app__weight\"", "raw_code": "with\n\nsource as (\n\n select * from {{ dbt_unit_testing.source('gym_app', 'raw_weight') }}\n\n),\n\nrenamed as (\n\n select\n TO_DATE(date, 'DD/MM/YYYY') as created_date,\n weight,\n user_id,\n measurement_unit\n from source\n\n)\n\nselect * from renamed", "language": "sql", "refs": [], "sources": [["gym_app", "raw_weight"]], "metrics": [], "depends_on": {"macros": ["macro.dbt_unit_testing.source"], "nodes": ["source.dbt_testing_example.gym_app.raw_weight"]}, "compiled_path": "docs/compiled/dbt_testing_example/models/staging/gym_app/stg_gym_app__weight.sql", "compiled": true, "compiled_code": "with\n\nsource as (\n\n select * from \"neondb\".\"dbt_testing_example\".\"raw_weight\"\n\n),\n\nrenamed as (\n\n select\n TO_DATE(date, 'DD/MM/YYYY') as created_date,\n weight,\n user_id,\n measurement_unit\n from source\n\n)\n\nselect * from renamed", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.dbt_testing_example.int_weight_measurements_with_latest_height": {"database": "neondb", "schema": "dbt_testing_example", "name": "int_weight_measurements_with_latest_height", "resource_type": "model", "package_name": "dbt_testing_example", "path": "intermediate/int_weight_measurements_with_latest_height.sql", "original_file_path": "models/intermediate/int_weight_measurements_with_latest_height.sql", "unique_id": "model.dbt_testing_example.int_weight_measurements_with_latest_height", "fqn": ["dbt_testing_example", "intermediate", "int_weight_measurements_with_latest_height"], "alias": "int_weight_measurements_with_latest_height", "checksum": {"name": "sha256", "checksum": "1d25482769baeadf5bf9c81aa06d0a2ae7d53a17b2b34ee192983e4a69f27326"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": [], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"materialized": "table"}, "created_at": 1733549923.1235461, "relation_name": "\"neondb\".\"dbt_testing_example\".\"int_weight_measurements_with_latest_height\"", "raw_code": "with\n\nheight as (\n\n select * from {{ dbt_unit_testing.ref('stg_gym_app__height') }}\n\n),\n\nweight as (\n\n select * from {{ dbt_unit_testing.ref('stg_gym_app__weight') }}\n\n),\n\nenrich_with_lasted_height_recorded_before_the_weight_measurement as (\n\n select\n weight.created_date,\n user_id,\n weight,\n (select height\n from height\n where height.created_date < weight.created_date and\n height.user_id = weight.user_id\n order by height.created_date DESC\n limit 1) as height\n from weight\n)\n\nselect * from enrich_with_lasted_height_recorded_before_the_weight_measurement", "language": "sql", "refs": [{"name": "stg_gym_app__height", "package": null, "version": null}, {"name": "stg_gym_app__weight", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt_unit_testing.ref"], "nodes": ["model.dbt_testing_example.stg_gym_app__height", "model.dbt_testing_example.stg_gym_app__weight"]}, "compiled_path": "docs/compiled/dbt_testing_example/models/intermediate/int_weight_measurements_with_latest_height.sql", "compiled": true, "compiled_code": "with\n\nheight as (\n\n select * from \"neondb\".\"dbt_testing_example\".\"stg_gym_app__height\"\n\n),\n\nweight as (\n\n select * from \"neondb\".\"dbt_testing_example\".\"stg_gym_app__weight\"\n\n),\n\nenrich_with_lasted_height_recorded_before_the_weight_measurement as (\n\n select\n weight.created_date,\n user_id,\n weight,\n (select height\n from height\n where height.created_date < weight.created_date and\n height.user_id = weight.user_id\n order by height.created_date DESC\n limit 1) as height\n from weight\n)\n\nselect * from enrich_with_lasted_height_recorded_before_the_weight_measurement", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "test.dbt_testing_example.body_mass_indexes_component_test": {"database": "neondb", "schema": "dbt_testing_example_dbt_test__audit", "name": "body_mass_indexes_component_test", "resource_type": "test", "package_name": "dbt_testing_example", "path": "component/body_mass_indexes_component_test.sql", "original_file_path": "tests/component/body_mass_indexes_component_test.sql", "unique_id": "test.dbt_testing_example.body_mass_indexes_component_test", "fqn": ["dbt_testing_example", "component", "body_mass_indexes_component_test"], "alias": "body_mass_indexes_component_test", "checksum": {"name": "sha256", "checksum": "024619612a37ea2cf25078dee9b55d406968ce6c9bc1a3f22202a265e132c368"}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": ["unit-test", "component-test"], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": ["unit-test", "component-test"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"tags": ["unit-test", "component-test"]}, "created_at": 1733549923.2575245, "relation_name": null, "raw_code": "{{ config(tags=['unit-test', 'component-test']) }}\n\n{% call dbt_unit_testing.test ('body_mass_indexes',\n 'it should calculate the body mass index for users with weight and height measurements') %}\n \n {% call dbt_unit_testing.mock_source('gym_app', 'raw_weight', {\"input_format\": \"csv\"}) %}\n\n date,user_id,weight,measurement_unit\n '01/07/2009',1,80,'kg'\n '01/07/2009',2,70,'kg'\n \n {% endcall %}\n\n {% call dbt_unit_testing.mock_source('gym_app', 'raw_height', {\"input_format\": \"csv\"}) %}\n\n date,user_id,height,height_unit\n '01/05/2009',1,180,'cm'\n '01/05/2009',2,165,'cm'\n \n {% endcall %}\n\n {% call dbt_unit_testing.expect() %}\n select\n to_date('2009/07/01', 'YYYY-MM-DD') as created_date,\n 1 as user_id,\n 24.7 as bmi\n \n UNION ALL\n\n select\n to_date('2009/07/01', 'YYYY-MM-DD') as created_date,\n 2 as user_id,\n 25.7 as bmi\n {% endcall %}\n\n{% endcall %}", "language": "sql", "refs": [{"name": "body_mass_indexes", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt_unit_testing.test"], "nodes": ["model.dbt_testing_example.body_mass_indexes"]}, "compiled_path": "docs/compiled/dbt_testing_example/tests/component/body_mass_indexes_component_test.sql", "compiled": true, "compiled_code": "\n\n\n \n \n\n\n \n \n select * from (select 1) as t where 1 = 0\n \n \n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}}, "test.dbt_testing_example.body_mass_indexes_unit_test": {"database": "neondb", "schema": "dbt_testing_example_dbt_test__audit", "name": "body_mass_indexes_unit_test", "resource_type": "test", "package_name": "dbt_testing_example", "path": "unit/marts/body_mass_indexes_unit_test.sql", "original_file_path": "tests/unit/marts/body_mass_indexes_unit_test.sql", "unique_id": "test.dbt_testing_example.body_mass_indexes_unit_test", "fqn": ["dbt_testing_example", "unit", "marts", "body_mass_indexes_unit_test"], "alias": "body_mass_indexes_unit_test", "checksum": {"name": "sha256", "checksum": "496737d7f5b10b67459da2905e69e9291d758840ac9b06ff443ebb8833168e01"}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": ["unit-test", "unit-tests"], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": ["unit-test", "unit-tests"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"tags": ["unit-test", "unit-tests"]}, "created_at": 1733549923.2722309, "relation_name": null, "raw_code": "{{ config(tags=['unit-test', 'unit-tests']) }}\n\n{% call dbt_unit_testing.test ('body_mass_indexes',\n 'it should calculate the body mass index for each weight with height record') %}\n \n {% call dbt_unit_testing.mock_ref ('int_weight_measurements_with_latest_height') %}\n select\n to_date('2022-09-01', 'YYYY-MM-DD') as created_date,\n 1 as user_id,\n 84.50 as weight,\n 190 as height\n {% endcall %}\n\n {% call dbt_unit_testing.expect() %}\n select\n to_date('2022/09/01', 'YYYY-MM-DD') as created_date,\n 1 as user_id,\n 23.4 as bmi\n {% endcall %}\n\n{% endcall %}", "language": "sql", "refs": [{"name": "body_mass_indexes", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt_unit_testing.test"], "nodes": ["model.dbt_testing_example.body_mass_indexes"]}, "compiled_path": "docs/compiled/dbt_testing_example/tests/unit/marts/body_mass_indexes_unit_test.sql", "compiled": true, "compiled_code": "\n\n\n \n \n\n\n \n \n select * from (select 1) as t where 1 = 0\n \n \n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}}, "test.dbt_testing_example.stg_gym_app__height_unit_test": {"database": "neondb", "schema": "dbt_testing_example_dbt_test__audit", "name": "stg_gym_app__height_unit_test", "resource_type": "test", "package_name": "dbt_testing_example", "path": "unit/staging/gym_app/stg_gym_app__height_unit_test.sql", "original_file_path": "tests/unit/staging/gym_app/stg_gym_app__height_unit_test.sql", "unique_id": "test.dbt_testing_example.stg_gym_app__height_unit_test", "fqn": ["dbt_testing_example", "unit", "staging", "gym_app", "stg_gym_app__height_unit_test"], "alias": "stg_gym_app__height_unit_test", "checksum": {"name": "sha256", "checksum": "5f570d38ba6801e61bb866359eeb6da5f87a584582fb4f05fc9d411fb218620e"}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": ["unit-test", "unit-tests"], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": ["unit-test", "unit-tests"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"tags": ["unit-test", "unit-tests"]}, "created_at": 1733549923.279295, "relation_name": null, "raw_code": "{{ config(tags=['unit-test', 'unit-tests']) }}\n\n{% call dbt_unit_testing.test('stg_gym_app__height',\n 'it should cast string date to date type') %}\n \n {% call dbt_unit_testing.mock_source('gym_app', 'raw_height', {\"input_format\": \"csv\"}) %}\n\n date,user_id,height,height_unit\n '01/07/2009',1,180,'cm'\n \n {% endcall %}\n\n {% call dbt_unit_testing.expect() %}\n \n select\n to_date('2009-07-01', 'YYYY-MM-DD') as created_date\n {% endcall %}\n\n{% endcall %}\n\nUNION ALL\n\n{% call dbt_unit_testing.test('stg_gym_app__height',\n 'it should clean column names') %}\n \n {% call dbt_unit_testing.mock_source('gym_app', 'raw_height', {\"input_format\": \"csv\"}) %}\n\n date,user_id,height,height_unit\n '01/07/2009',1,180,'cm'\n \n {% endcall %}\n\n {% call dbt_unit_testing.expect() %}\n \n select\n to_date('2009-07-01', 'YYYY-MM-DD') as created_date,\n 1 as user_id,\n 180 as height,\n 'cm' as measurement_unit\n \n {% endcall %}\n\n{% endcall %}", "language": "sql", "refs": [{"name": "stg_gym_app__height", "package": null, "version": null}, {"name": "stg_gym_app__height", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt_unit_testing.test"], "nodes": ["model.dbt_testing_example.stg_gym_app__height"]}, "compiled_path": "docs/compiled/dbt_testing_example/tests/unit/staging/gym_app/stg_gym_app__height_unit_test.sql", "compiled": true, "compiled_code": "\n\n\n \n \n\n\n \n \n select * from (select 1) as t where 1 = 0\n \n \n\n\nUNION ALL\n\n\n \n \n\n\n \n \n select * from (select 1) as t where 1 = 0\n \n \n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}}, "test.dbt_testing_example.stg_gym_app__weight_unit_test": {"database": "neondb", "schema": "dbt_testing_example_dbt_test__audit", "name": "stg_gym_app__weight_unit_test", "resource_type": "test", "package_name": "dbt_testing_example", "path": "unit/staging/gym_app/stg_gym_app__weight_unit_test.sql", "original_file_path": "tests/unit/staging/gym_app/stg_gym_app__weight_unit_test.sql", "unique_id": "test.dbt_testing_example.stg_gym_app__weight_unit_test", "fqn": ["dbt_testing_example", "unit", "staging", "gym_app", "stg_gym_app__weight_unit_test"], "alias": "stg_gym_app__weight_unit_test", "checksum": {"name": "sha256", "checksum": "84478099b65619cc65e9d2f0792d89c2abaabc88bccb33e8ccb3b8037ae7116b"}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": ["unit-test", "unit-tests"], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": ["unit-test", "unit-tests"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"tags": ["unit-test", "unit-tests"]}, "created_at": 1733549923.2877312, "relation_name": null, "raw_code": "{{ config(tags=['unit-test', 'unit-tests']) }}\n\n{% call dbt_unit_testing.test('stg_gym_app__weight',\n 'it should cast string date to date type') %}\n \n {% call dbt_unit_testing.mock_source('gym_app', 'raw_weight', {\"input_format\": \"csv\"}) %}\n\n date,user_id,weight,measurement_unit\n '01/07/2009',1,82.50,'kg'\n \n {% endcall %}\n\n {% call dbt_unit_testing.expect() %}\n \n select\n to_date('2009-07-01', 'YYYY-MM-DD') as created_date,\n 82.50 as weight,\n 1 as user_id,\n 'kg' as measurement_unit\n \n {% endcall %}\n\n{% endcall %}", "language": "sql", "refs": [{"name": "stg_gym_app__weight", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt_unit_testing.test"], "nodes": ["model.dbt_testing_example.stg_gym_app__weight"]}, "compiled_path": "docs/compiled/dbt_testing_example/tests/unit/staging/gym_app/stg_gym_app__weight_unit_test.sql", "compiled": true, "compiled_code": "\n\n\n \n \n\n\n \n \n select * from (select 1) as t where 1 = 0\n \n \n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}}, "test.dbt_testing_example.int_weight_measurements_with_latest_height_unit_test": {"database": "neondb", "schema": "dbt_testing_example_dbt_test__audit", "name": "int_weight_measurements_with_latest_height_unit_test", "resource_type": "test", "package_name": "dbt_testing_example", "path": "unit/intermediate/int_weight_measurements_with_latest_height_unit_test.sql", "original_file_path": "tests/unit/intermediate/int_weight_measurements_with_latest_height_unit_test.sql", "unique_id": "test.dbt_testing_example.int_weight_measurements_with_latest_height_unit_test", "fqn": ["dbt_testing_example", "unit", "intermediate", "int_weight_measurements_with_latest_height_unit_test"], "alias": "int_weight_measurements_with_latest_height_unit_test", "checksum": {"name": "sha256", "checksum": "403288a797949d488ae4d8871fabfbbe0c33ab44c9872840ba8394235ab0e247"}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": ["unit-test", "unit-tests"], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": ["unit-test", "unit-tests"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"tags": ["unit-test", "unit-tests"]}, "created_at": 1733549923.29422, "relation_name": null, "raw_code": "{{ config(tags=['unit-test', 'unit-tests']) }}\n\n{% call dbt_unit_testing.test ('int_weight_measurements_with_latest_height',\n 'it should enrich weight measurement with latest height measurement') %}\n \n {% call dbt_unit_testing.mock_ref ('stg_gym_app__weight') %}\n select\n to_date('2022-09-01', 'YYYY-MM-DD') as created_date,\n 1 as user_id,\n 82.50 as weight\n {% endcall %}\n\n {% call dbt_unit_testing.mock_ref ('stg_gym_app__height') %}\n select\n to_date('2021-07-01', 'YYYY-MM-DD') as created_date,\n 1 as user_id,\n 182 as height\n UNION ALL\n select\n to_date('2022-08-01', 'YYYY-MM-DD') as created_date,\n 1 as user_id,\n 183 as height\n {% endcall %}\n\n {% call dbt_unit_testing.expect() %}\n select\n to_date('2022/09/01', 'YYYY-MM-DD') as created_date,\n 1 as user_id,\n 82.50 as weight,\n 183 as height\n {% endcall %}\n\n{% endcall %}\n\nUNION ALL\n\n{% call dbt_unit_testing.test ('int_weight_measurements_with_latest_height',\n 'it should enrich weight with null height when height measurement for an user does not exist') %}\n \n {% call dbt_unit_testing.mock_ref('stg_gym_app__weight') %}\n select\n to_date('2022-09-01', 'YYYY-MM-DD') as created_date,\n 1 as user_id,\n 82.50 as weight\n {% endcall %}\n\n {% call dbt_unit_testing.mock_ref('stg_gym_app__height') %}\n select\n to_date('2021-07-01', 'YYYY-MM-DD') as created_date,\n 2 as user_id,\n 182 as height\n {% endcall %}\n\n {% call dbt_unit_testing.expect() %}\n select\n to_date('2022/09/01', 'YYYY-MM-DD') as created_date,\n 1 as user_id,\n 82.50 as weight,\n null::integer as height\n {% endcall %}\n\n{% endcall %}", "language": "sql", "refs": [{"name": "int_weight_measurements_with_latest_height", "package": null, "version": null}, {"name": "int_weight_measurements_with_latest_height", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt_unit_testing.test"], "nodes": ["model.dbt_testing_example.int_weight_measurements_with_latest_height"]}, "compiled_path": "docs/compiled/dbt_testing_example/tests/unit/intermediate/int_weight_measurements_with_latest_height_unit_test.sql", "compiled": true, "compiled_code": "\n\n\n \n \n\n\n \n \n select * from (select 1) as t where 1 = 0\n \n \n\n\nUNION ALL\n\n\n \n \n\n\n \n \n select * from (select 1) as t where 1 = 0\n \n \n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}}, "seed.dbt_testing_example.raw_weight": {"database": "neondb", "schema": "dbt_testing_example", "name": "raw_weight", "resource_type": "seed", "package_name": "dbt_testing_example", "path": "gym_app/raw_weight.csv", "original_file_path": "seeds/gym_app/raw_weight.csv", "unique_id": "seed.dbt_testing_example.raw_weight", "fqn": ["dbt_testing_example", "gym_app", "raw_weight"], "alias": "raw_weight", "checksum": {"name": "sha256", "checksum": "1254fe93801e1a3580c0f1538f838592185a197de655ea41e00f667ccb354556"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": [], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1733549923.3966315, "relation_name": "\"neondb\".\"dbt_testing_example\".\"raw_weight\"", "raw_code": "", "root_path": "/__w/dbt-testing-examples/dbt-testing-examples", "depends_on": {"macros": []}}, "seed.dbt_testing_example.raw_height": {"database": "neondb", "schema": "dbt_testing_example", "name": "raw_height", "resource_type": "seed", "package_name": "dbt_testing_example", "path": "gym_app/raw_height.csv", "original_file_path": "seeds/gym_app/raw_height.csv", "unique_id": "seed.dbt_testing_example.raw_height", "fqn": ["dbt_testing_example", "gym_app", "raw_height"], "alias": "raw_height", "checksum": {"name": "sha256", "checksum": "111d4a9f752c009741776af0d0ced80ff89bd92f92ef1314ece9035b6b7a684b"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": [], "meta": {}, "group": null, "materialized": "seed", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "delimiter": ",", "quote_columns": null}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1733549923.3988206, "relation_name": "\"neondb\".\"dbt_testing_example\".\"raw_height\"", "raw_code": "", "root_path": "/__w/dbt-testing-examples/dbt-testing-examples", "depends_on": {"macros": []}}, "model.elementary.metadata": {"database": "neondb", "schema": "dbt_testing_example_elementary", "name": "metadata", "resource_type": "model", "package_name": "elementary", "path": "edr/system/metadata.sql", "original_file_path": "models/edr/system/metadata.sql", "unique_id": "model.elementary.metadata", "fqn": ["elementary", "edr", "system", "metadata"], "alias": "metadata", "checksum": {"name": "sha256", "checksum": "7d06c726499b330d51c340d2dc2774ac95f958fd6824c09711b3881b39b76a84"}, "config": {"enabled": true, "alias": null, "schema": "elementary", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"materialized": "table", "schema": "elementary"}, "created_at": 1733549923.5439773, "relation_name": "\"neondb\".\"dbt_testing_example_elementary\".\"metadata\"", "raw_code": "{{ config(materialized='table') }}\n\nSELECT\n '{{ elementary.get_elementary_package_version() }}' as dbt_pkg_version", "language": "sql", "refs": [], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.elementary.get_elementary_package_version"], "nodes": []}, "compiled_path": "docs/compiled/elementary/models/edr/system/metadata.sql", "compiled": true, "compiled_code": "\n\nSELECT\n '0.14.1' as dbt_pkg_version", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.elementary.monitors_runs": {"database": "neondb", "schema": "dbt_testing_example_elementary", "name": "monitors_runs", "resource_type": "model", "package_name": "elementary", "path": "edr/system/monitors_runs.sql", "original_file_path": "models/edr/system/monitors_runs.sql", "unique_id": "model.elementary.monitors_runs", "fqn": ["elementary", "edr", "system", "monitors_runs"], "alias": "monitors_runs", "checksum": {"name": "sha256", "checksum": "3720e206635d4f2f95c193835727b0d533ec1a5fa56e5dec79331418d07e934f"}, "config": {"enabled": true, "alias": null, "schema": "elementary", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": [], "description": "This is a view on `data_monitoring_metrics` that is used to determine when a specific anomaly detection test was last executed. Each anomaly detection test queries this view to decide on a start time for collecting metrics.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "elementary://models/elementary_tests.yml", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "view", "bind": false, "schema": "elementary"}, "created_at": 1733549924.6669245, "relation_name": "\"neondb\".\"dbt_testing_example_elementary\".\"monitors_runs\"", "raw_code": "{{\n config(\n materialized = 'view',\n bind=False\n )\n}}\n\nwith data_monitoring_metrics as (\n\n select * from {{ ref('data_monitoring_metrics') }}\n\n),\n\nmax_bucket_end as (\n\n select full_table_name,\n column_name,\n metric_name,\n metric_properties,\n max(bucket_end) as last_bucket_end,\n min(bucket_end) as first_bucket_end\n from data_monitoring_metrics\n group by 1,2,3,4\n\n)\n\nselect * from max_bucket_end", "language": "sql", "refs": [{"name": "data_monitoring_metrics", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt_testing_example.ref"], "nodes": ["model.elementary.data_monitoring_metrics"]}, "compiled_path": "docs/compiled/elementary/models/edr/system/monitors_runs.sql", "compiled": true, "compiled_code": "\n\nwith data_monitoring_metrics as (\n\n select * from \"neondb\".\"dbt_testing_example_elementary\".\"data_monitoring_metrics\"\n\n),\n\nmax_bucket_end as (\n\n select full_table_name,\n column_name,\n metric_name,\n metric_properties,\n max(bucket_end) as last_bucket_end,\n min(bucket_end) as first_bucket_end\n from data_monitoring_metrics\n group by 1,2,3,4\n\n)\n\nselect * from max_bucket_end", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.elementary.schema_columns_snapshot": {"database": "neondb", "schema": "dbt_testing_example_elementary", "name": "schema_columns_snapshot", "resource_type": "model", "package_name": "elementary", "path": "edr/data_monitoring/schema_changes/schema_columns_snapshot.sql", "original_file_path": "models/edr/data_monitoring/schema_changes/schema_columns_snapshot.sql", "unique_id": "model.elementary.schema_columns_snapshot", "fqn": ["elementary", "edr", "data_monitoring", "schema_changes", "schema_columns_snapshot"], "alias": "schema_columns_snapshot", "checksum": {"name": "sha256", "checksum": "91a98d3190bef02e47f763520b5443197e120ceb132a86b1d90608ca30c33374"}, "config": {"enabled": true, "alias": null, "schema": "elementary", "database": null, "tags": [], "meta": {"timestamp_column": "created_at", "prev_timestamp_column": "detected_at"}, "group": null, "materialized": "incremental", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": false, "unique_key": "column_state_id", "on_schema_change": "append_new_columns", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "table_type": null}, "tags": [], "description": "Stores the schema details for tables that are monitored with elementary schema changes test. In order to compare current schema to previous state, we must store the previous state. The data is from a view that queries the data warehouse information schema. This is an incremental table.", "columns": {}, "meta": {"timestamp_column": "created_at", "prev_timestamp_column": "detected_at"}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "elementary://models/elementary_tests.yml", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "incremental", "unique_key": "column_state_id", "on_schema_change": "append_new_columns", "full_refresh": false, "meta": {"timestamp_column": "created_at", "prev_timestamp_column": "detected_at"}, "table_type": null, "incremental_strategy": null, "schema": "elementary"}, "created_at": 1733549924.6673026, "relation_name": "\"neondb\".\"dbt_testing_example_elementary\".\"schema_columns_snapshot\"", "raw_code": "{{\n config(\n materialized='incremental',\n unique_key = 'column_state_id',\n on_schema_change = 'append_new_columns',\n full_refresh=elementary.get_config_var('elementary_full_refresh'),\n meta={\n \"timestamp_column\": \"created_at\",\n \"prev_timestamp_column\": \"detected_at\",\n },\n table_type=elementary.get_default_table_type(),\n incremental_strategy=elementary.get_default_incremental_strategy()\n )\n}}\n\n{{ elementary.empty_schema_columns_snapshot() }}", "language": "sql", "refs": [], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.elementary.get_config_var", "macro.elementary.get_default_table_type", "macro.elementary.get_default_incremental_strategy", "macro.elementary.empty_schema_columns_snapshot"], "nodes": []}, "compiled_path": "docs/compiled/elementary/models/edr/data_monitoring/schema_changes/schema_columns_snapshot.sql", "compiled": true, "compiled_code": "\n\n\n select * from (\n select\n \n \n cast('dummy_string' as varchar(4096)) as column_state_id\n\n,\n \n cast('dummy_string' as varchar(4096)) as full_column_name\n\n,\n \n cast('dummy_string' as varchar(4096)) as full_table_name\n\n,\n \n cast('dummy_string' as varchar(4096)) as column_name\n\n,\n \n cast('dummy_string' as varchar(4096)) as data_type\n\n,\n \n cast (True as boolean) as is_new\n\n,\n cast('2091-02-17' as timestamp) as detected_at\n\n,\n cast('2091-02-17' as timestamp) as created_at\n\n\n ) as empty_table\n where 1 = 0\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.elementary.anomaly_threshold_sensitivity": {"database": "neondb", "schema": "dbt_testing_example_elementary", "name": "anomaly_threshold_sensitivity", "resource_type": "model", "package_name": "elementary", "path": "edr/data_monitoring/anomaly_detection/anomaly_threshold_sensitivity.sql", "original_file_path": "models/edr/data_monitoring/anomaly_detection/anomaly_threshold_sensitivity.sql", "unique_id": "model.elementary.anomaly_threshold_sensitivity", "fqn": ["elementary", "edr", "data_monitoring", "anomaly_detection", "anomaly_threshold_sensitivity"], "alias": "anomaly_threshold_sensitivity", "checksum": {"name": "sha256", "checksum": "b0e4310abc62902b98a6ad6fd465713d5aeb5e884b52594e8a1b2ff6429b1b2d"}, "config": {"enabled": true, "alias": null, "schema": "elementary", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": [], "description": "This is a view on `metrics_anomaly_score` that calculates if values of metrics from latest runs would have been considered anomalies in different anomaly scores. This can help you decide if there is a need to adjust the `anomaly_score_threshold`.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "elementary://models/elementary_tests.yml", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "view", "bind": false, "schema": "elementary"}, "created_at": 1733549924.6665416, "relation_name": "\"neondb\".\"dbt_testing_example_elementary\".\"anomaly_threshold_sensitivity\"", "raw_code": "{{\n config(\n materialized = 'view',\n bind=False\n )\n}}\n\nwith metrics_anomaly_score as (\n\n select * from {{ ref('metrics_anomaly_score') }}\n\n),\n\nscore_sensitivity as (\n\n select\n full_table_name,\n column_name,\n metric_name,\n latest_metric_value,\n training_avg as metric_avg,\n training_stddev as metric_stddev,\n anomaly_score,\n case when abs(anomaly_score) >= 1.5 then true else false end as {{ elementary.edr_quote_column('is_anomaly_1_5') }},\n case when abs(anomaly_score) >= 2 then true else false end as {{ elementary.edr_quote_column('is_anomaly_2') }},\n case when abs(anomaly_score) >= 2.5 then true else false end as {{ elementary.edr_quote_column('is_anomaly_2_5') }},\n case when abs(anomaly_score) >= 3 then true else false end as {{ elementary.edr_quote_column('is_anomaly_3') }},\n case when abs(anomaly_score) >= 3.5 then true else false end as {{ elementary.edr_quote_column('is_anomaly_3_5') }},\n case when abs(anomaly_score) >= 4 then true else false end as {{ elementary.edr_quote_column('is_anomaly_4') }},\n case when abs(anomaly_score) >= 4.5 then true else false end as {{ elementary.edr_quote_column('is_anomaly_4_5') }}\n from metrics_anomaly_score\n where abs(anomaly_score) >= 1.5\n\n)\n\nselect * from score_sensitivity", "language": "sql", "refs": [{"name": "metrics_anomaly_score", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt_testing_example.ref", "macro.elementary.edr_quote_column"], "nodes": ["model.elementary.metrics_anomaly_score"]}, "compiled_path": "docs/compiled/elementary/models/edr/data_monitoring/anomaly_detection/anomaly_threshold_sensitivity.sql", "compiled": true, "compiled_code": "\n\nwith metrics_anomaly_score as (\n\n select * from \"neondb\".\"dbt_testing_example_elementary\".\"metrics_anomaly_score\"\n\n),\n\nscore_sensitivity as (\n\n select\n full_table_name,\n column_name,\n metric_name,\n latest_metric_value,\n training_avg as metric_avg,\n training_stddev as metric_stddev,\n anomaly_score,\n case when abs(anomaly_score) >= 1.5 then true else false end as \"is_anomaly_1_5\",\n case when abs(anomaly_score) >= 2 then true else false end as \"is_anomaly_2\",\n case when abs(anomaly_score) >= 2.5 then true else false end as \"is_anomaly_2_5\",\n case when abs(anomaly_score) >= 3 then true else false end as \"is_anomaly_3\",\n case when abs(anomaly_score) >= 3.5 then true else false end as \"is_anomaly_3_5\",\n case when abs(anomaly_score) >= 4 then true else false end as \"is_anomaly_4\",\n case when abs(anomaly_score) >= 4.5 then true else false end as \"is_anomaly_4_5\"\n from metrics_anomaly_score\n where abs(anomaly_score) >= 1.5\n\n)\n\nselect * from score_sensitivity", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.elementary.metrics_anomaly_score": {"database": "neondb", "schema": "dbt_testing_example_elementary", "name": "metrics_anomaly_score", "resource_type": "model", "package_name": "elementary", "path": "edr/data_monitoring/anomaly_detection/metrics_anomaly_score.sql", "original_file_path": "models/edr/data_monitoring/anomaly_detection/metrics_anomaly_score.sql", "unique_id": "model.elementary.metrics_anomaly_score", "fqn": ["elementary", "edr", "data_monitoring", "anomaly_detection", "metrics_anomaly_score"], "alias": "metrics_anomaly_score", "checksum": {"name": "sha256", "checksum": "3c24ecb37454bb7fc0cd30ea889676be6759d558716df6e99b8306eee4feab4f"}, "config": {"enabled": true, "alias": null, "schema": "elementary", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": [], "description": "This is a view on `data_monitoring_metrics` that runs the same query the anomaly detection tests run to calculate anomaly scores. The purpose of this view is to provide visibility to the results of anomaly detection tests.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "elementary://models/elementary_tests.yml", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "view", "bind": false, "schema": "elementary"}, "created_at": 1733549924.6661527, "relation_name": "\"neondb\".\"dbt_testing_example_elementary\".\"metrics_anomaly_score\"", "raw_code": "{{\n config(\n materialized = 'view',\n bind=False\n )\n}}\n\nwith data_monitoring_metrics as (\n\n select * from {{ ref('data_monitoring_metrics') }}\n\n),\n\ntime_window_aggregation as (\n\n select\n id,\n full_table_name,\n column_name,\n dimension,\n dimension_value,\n metric_name,\n metric_value,\n source_value,\n bucket_start,\n bucket_end,\n bucket_duration_hours,\n updated_at,\n avg(metric_value) over (partition by metric_name, full_table_name, column_name order by bucket_start asc rows between unbounded preceding and current row) as training_avg,\n stddev(metric_value) over (partition by metric_name, full_table_name, column_name order by bucket_start asc rows between unbounded preceding and current row) as training_stddev,\n count(metric_value) over (partition by metric_name, full_table_name, column_name order by bucket_start asc rows between unbounded preceding and current row) as training_set_size,\n last_value(bucket_end) over (partition by metric_name, full_table_name, column_name order by bucket_start asc rows between unbounded preceding and current row) training_end,\n first_value(bucket_end) over (partition by metric_name, full_table_name, column_name order by bucket_start asc rows between unbounded preceding and current row) as training_start\n from data_monitoring_metrics\n {{ dbt_utils.group_by(12) }}\n),\n\nmetrics_anomaly_score as (\n\n select\n id,\n full_table_name,\n column_name,\n dimension,\n dimension_value,\n metric_name,\n case\n when training_stddev is null then null\n when training_stddev = 0 then 0\n else (metric_value - training_avg) / (training_stddev)\n end as anomaly_score,\n metric_value as latest_metric_value,\n bucket_start,\n bucket_end,\n training_avg,\n training_stddev,\n training_start,\n training_end,\n training_set_size,\n max(updated_at) as updated_at\n from time_window_aggregation\n where\n metric_value is not null\n and training_avg is not null\n and bucket_end >= {{ elementary.edr_timeadd('day', '-7', elementary.edr_date_trunc('day', elementary.edr_current_timestamp())) }}\n {{ dbt_utils.group_by(15) }}\n order by bucket_end desc\n\n\n),\n\nfinal as (\n\n select\n id,\n full_table_name,\n column_name,\n dimension,\n dimension_value,\n metric_name,\n anomaly_score,\n latest_metric_value,\n bucket_start,\n bucket_end,\n training_avg,\n training_stddev,\n training_start,\n training_end,\n training_set_size,\n updated_at,\n case\n when abs(anomaly_score) > {{ elementary.get_config_var('anomaly_sensitivity') }} then true\n else false end\n as is_anomaly\n from metrics_anomaly_score\n)\n\nselect * from final", "language": "sql", "refs": [{"name": "data_monitoring_metrics", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt_testing_example.ref", "macro.dbt_utils.group_by", "macro.elementary.edr_current_timestamp", "macro.elementary.edr_date_trunc", "macro.elementary.edr_timeadd", "macro.elementary.get_config_var"], "nodes": ["model.elementary.data_monitoring_metrics"]}, "compiled_path": "docs/compiled/elementary/models/edr/data_monitoring/anomaly_detection/metrics_anomaly_score.sql", "compiled": true, "compiled_code": "\n\nwith data_monitoring_metrics as (\n\n select * from \"neondb\".\"dbt_testing_example_elementary\".\"data_monitoring_metrics\"\n\n),\n\ntime_window_aggregation as (\n\n select\n id,\n full_table_name,\n column_name,\n dimension,\n dimension_value,\n metric_name,\n metric_value,\n source_value,\n bucket_start,\n bucket_end,\n bucket_duration_hours,\n updated_at,\n avg(metric_value) over (partition by metric_name, full_table_name, column_name order by bucket_start asc rows between unbounded preceding and current row) as training_avg,\n stddev(metric_value) over (partition by metric_name, full_table_name, column_name order by bucket_start asc rows between unbounded preceding and current row) as training_stddev,\n count(metric_value) over (partition by metric_name, full_table_name, column_name order by bucket_start asc rows between unbounded preceding and current row) as training_set_size,\n last_value(bucket_end) over (partition by metric_name, full_table_name, column_name order by bucket_start asc rows between unbounded preceding and current row) training_end,\n first_value(bucket_end) over (partition by metric_name, full_table_name, column_name order by bucket_start asc rows between unbounded preceding and current row) as training_start\n from data_monitoring_metrics\n group by 1,2,3,4,5,6,7,8,9,10,11,12\n),\n\nmetrics_anomaly_score as (\n\n select\n id,\n full_table_name,\n column_name,\n dimension,\n dimension_value,\n metric_name,\n case\n when training_stddev is null then null\n when training_stddev = 0 then 0\n else (metric_value - training_avg) / (training_stddev)\n end as anomaly_score,\n metric_value as latest_metric_value,\n bucket_start,\n bucket_end,\n training_avg,\n training_stddev,\n training_start,\n training_end,\n training_set_size,\n max(updated_at) as updated_at\n from time_window_aggregation\n where\n metric_value is not null\n and training_avg is not null\n and bucket_end >= \n cast(date_trunc('day', \n current_timestamp::timestamp\n) as timestamp) + cast(-7 as integer) * INTERVAL '1 day'\n\n group by 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15\n order by bucket_end desc\n\n\n),\n\nfinal as (\n\n select\n id,\n full_table_name,\n column_name,\n dimension,\n dimension_value,\n metric_name,\n anomaly_score,\n latest_metric_value,\n bucket_start,\n bucket_end,\n training_avg,\n training_stddev,\n training_start,\n training_end,\n training_set_size,\n updated_at,\n case\n when abs(anomaly_score) > 3 then true\n else false end\n as is_anomaly\n from metrics_anomaly_score\n)\n\nselect * from final", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.elementary.data_monitoring_metrics": {"database": "neondb", "schema": "dbt_testing_example_elementary", "name": "data_monitoring_metrics", "resource_type": "model", "package_name": "elementary", "path": "edr/data_monitoring/data_monitoring/data_monitoring_metrics.sql", "original_file_path": "models/edr/data_monitoring/data_monitoring/data_monitoring_metrics.sql", "unique_id": "model.elementary.data_monitoring_metrics", "fqn": ["elementary", "edr", "data_monitoring", "data_monitoring", "data_monitoring_metrics"], "alias": "data_monitoring_metrics", "checksum": {"name": "sha256", "checksum": "0c19743330c3a4220c42f142eaf58cb571aef26ab24ea27070f3eeb9e3cc925c"}, "config": {"enabled": true, "alias": null, "schema": "elementary", "database": null, "tags": [], "meta": {"timestamp_column": "created_at", "prev_timestamp_column": "updated_at"}, "group": null, "materialized": "incremental", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": false, "unique_key": "id", "on_schema_change": "append_new_columns", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "table_type": null}, "tags": [], "description": "Elementary anomaly detection tests monitor metrics such as volume, freshness and data quality metrics. This incremental table is used to store the metrics over time. On each anomaly detection test, the test queries this table for historical metrics, and compares to the latest values. The table is updated with new metrics on the on-run-end named handle_test_results that is executed at the end of dbt test invocations.\n", "columns": {}, "meta": {"timestamp_column": "created_at", "prev_timestamp_column": "updated_at"}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "elementary://models/elementary_tests.yml", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "incremental", "unique_key": "id", "on_schema_change": "append_new_columns", "full_refresh": false, "meta": {"timestamp_column": "created_at", "prev_timestamp_column": "updated_at"}, "table_type": null, "incremental_strategy": null, "schema": "elementary"}, "created_at": 1733549924.6657526, "relation_name": "\"neondb\".\"dbt_testing_example_elementary\".\"data_monitoring_metrics\"", "raw_code": "{{\n config(\n materialized='incremental',\n unique_key='id',\n on_schema_change='append_new_columns',\n full_refresh=elementary.get_config_var('elementary_full_refresh'),\n meta={\n \"timestamp_column\": \"created_at\",\n \"prev_timestamp_column\": \"updated_at\",\n },\n table_type=elementary.get_default_table_type(),\n incremental_strategy=elementary.get_default_incremental_strategy(),\n )\n}}\n\n{{ elementary.empty_data_monitoring_metrics() }}", "language": "sql", "refs": [], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.elementary.get_config_var", "macro.elementary.get_default_table_type", "macro.elementary.get_default_incremental_strategy", "macro.elementary.empty_data_monitoring_metrics"], "nodes": []}, "compiled_path": "docs/compiled/elementary/models/edr/data_monitoring/data_monitoring/data_monitoring_metrics.sql", "compiled": true, "compiled_code": "\n\n\n \n \n \n \n select * from (\n select\n \n \n cast('dummy_string' as varchar(4096)) as id\n\n,\n \n cast('dummy_string' as varchar(4096)) as full_table_name\n\n,\n \n cast('dummy_string' as varchar(4096)) as column_name\n\n,\n \n cast('dummy_string' as varchar(4096)) as metric_name\n\n,\n \n cast(123456789.99 as float) as metric_value\n\n,\n \n cast('dummy_string' as varchar(4096)) as source_value\n\n,\n cast('2091-02-17' as timestamp) as bucket_start\n\n,\n cast('2091-02-17' as timestamp) as bucket_end\n\n,\n \n cast(123456789 as integer) as bucket_duration_hours\n\n,\n cast('2091-02-17' as timestamp) as updated_at\n\n,\n \n cast('dummy_string' as varchar(4096)) as dimension\n\n,\n \n cast('dummy_string' as varchar(4096)) as dimension_value\n\n,\n \n cast('dummy_string' as varchar(4096)) as metric_properties\n\n,\n cast('2091-02-17' as timestamp) as created_at\n\n\n ) as empty_table\n where 1 = 0\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.elementary.elementary_test_results": {"database": "neondb", "schema": "dbt_testing_example_elementary", "name": "elementary_test_results", "resource_type": "model", "package_name": "elementary", "path": "edr/run_results/elementary_test_results.sql", "original_file_path": "models/edr/run_results/elementary_test_results.sql", "unique_id": "model.elementary.elementary_test_results", "fqn": ["elementary", "edr", "run_results", "elementary_test_results"], "alias": "elementary_test_results", "checksum": {"name": "sha256", "checksum": "df74ce864e711c45b8f20af4d3246257f95ef0735e17d83dce220bdd80bde93a"}, "config": {"enabled": true, "alias": null, "schema": "elementary", "database": null, "tags": [], "meta": {"timestamp_column": "created_at", "prev_timestamp_column": "detected_at"}, "group": null, "materialized": "incremental", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": false, "unique_key": "id", "on_schema_change": "append_new_columns", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "table_type": null}, "tags": [], "description": "Run results of all dbt tests, with fields and metadata needed to produce the Elementary report UI. Each row is the result of a single test, including native dbt tests, packages tests and elementary tests. New data is loaded to this model on an on-run-end hook named `elementary.handle_tests_results`.\n", "columns": {}, "meta": {"timestamp_column": "created_at", "prev_timestamp_column": "detected_at"}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "elementary://models/run_results.yml", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "incremental", "unique_key": "id", "on_schema_change": "append_new_columns", "full_refresh": false, "meta": {"timestamp_column": "created_at", "prev_timestamp_column": "detected_at"}, "table_type": null, "incremental_strategy": null, "schema": "elementary"}, "created_at": 1733549924.6425421, "relation_name": "\"neondb\".\"dbt_testing_example_elementary\".\"elementary_test_results\"", "raw_code": "{{\n config(\n materialized = 'incremental',\n unique_key = 'id',\n on_schema_change = 'append_new_columns',\n full_refresh=elementary.get_config_var('elementary_full_refresh'),\n meta={\n \"timestamp_column\": \"created_at\",\n \"prev_timestamp_column\": \"detected_at\",\n },\n table_type=elementary.get_default_table_type(),\n incremental_strategy=elementary.get_default_incremental_strategy()\n )\n}}\n\n{{ elementary.empty_elementary_test_results() }}", "language": "sql", "refs": [], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.elementary.get_config_var", "macro.elementary.get_default_table_type", "macro.elementary.get_default_incremental_strategy", "macro.elementary.empty_elementary_test_results"], "nodes": []}, "compiled_path": "docs/compiled/elementary/models/edr/run_results/elementary_test_results.sql", "compiled": true, "compiled_code": "\n\n\n select * from (\n select\n \n \n cast('this_is_just_a_long_dummy_string' as text) as id\n\n,\n \n cast('dummy_string' as varchar(4096)) as data_issue_id\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as test_execution_id\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as test_unique_id\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as model_unique_id\n\n,\n \n cast('dummy_string' as varchar(4096)) as invocation_id\n\n,\n cast('2091-02-17' as timestamp) as detected_at\n\n,\n cast('2091-02-17' as timestamp) as created_at\n\n,\n \n cast('dummy_string' as varchar(4096)) as database_name\n\n,\n \n cast('dummy_string' as varchar(4096)) as schema_name\n\n,\n \n cast('dummy_string' as varchar(4096)) as table_name\n\n,\n \n cast('dummy_string' as varchar(4096)) as column_name\n\n,\n \n cast('dummy_string' as varchar(4096)) as test_type\n\n,\n \n cast('dummy_string' as varchar(4096)) as test_sub_type\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as test_results_description\n\n,\n \n cast('dummy_string' as varchar(4096)) as owners\n\n,\n \n cast('dummy_string' as varchar(4096)) as tags\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as test_results_query\n\n,\n \n cast('dummy_string' as varchar(4096)) as other\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as test_name\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as test_params\n\n,\n \n cast('dummy_string' as varchar(4096)) as severity\n\n,\n \n cast('dummy_string' as varchar(4096)) as status\n\n,\n \n cast(31474836478 as bigint) as failures\n\n,\n \n cast('dummy_string' as varchar(4096)) as test_short_name\n\n,\n \n cast('dummy_string' as varchar(4096)) as test_alias\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as result_rows\n\n,\n \n cast(31474836478 as bigint) as failed_row_count\n\n\n ) as empty_table\n where 1 = 0\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.elementary.test_result_rows": {"database": "neondb", "schema": "dbt_testing_example_elementary", "name": "test_result_rows", "resource_type": "model", "package_name": "elementary", "path": "edr/run_results/test_result_rows.sql", "original_file_path": "models/edr/run_results/test_result_rows.sql", "unique_id": "model.elementary.test_result_rows", "fqn": ["elementary", "edr", "run_results", "test_result_rows"], "alias": "test_result_rows", "checksum": {"name": "sha256", "checksum": "60f29c6ec225f876c714075d2ffd1b81198268ee2eb2e5138b4c3a8b94604de4"}, "config": {"enabled": true, "alias": null, "schema": "elementary", "database": null, "tags": [], "meta": {"timestamp_column": "created_at", "prev_timestamp_column": "detected_at"}, "group": null, "materialized": "incremental", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ elementary.backfill_result_rows() }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": false, "unique_key": "elementary_test_results_id", "on_schema_change": "append_new_columns", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "table_type": null}, "tags": [], "description": "", "columns": {}, "meta": {"timestamp_column": "created_at", "prev_timestamp_column": "detected_at"}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"materialized": "incremental", "unique_key": "elementary_test_results_id", "on_schema_change": "append_new_columns", "full_refresh": false, "meta": {"timestamp_column": "created_at", "prev_timestamp_column": "detected_at"}, "table_type": null, "incremental_strategy": null, "post-hook": ["{{ elementary.backfill_result_rows() }}"], "schema": "elementary"}, "created_at": 1733549923.7011864, "relation_name": "\"neondb\".\"dbt_testing_example_elementary\".\"test_result_rows\"", "raw_code": "{{\n config(\n materialized = 'incremental',\n unique_key = 'elementary_test_results_id',\n on_schema_change = 'append_new_columns',\n full_refresh=elementary.get_config_var('elementary_full_refresh'),\n post_hook='{{ elementary.backfill_result_rows() }}',\n meta={\n \"timestamp_column\": \"created_at\",\n \"prev_timestamp_column\": \"detected_at\",\n },\n table_type=elementary.get_default_table_type(),\n incremental_strategy=elementary.get_default_incremental_strategy()\n )\n}}\n\n-- depends_on: {{ ref('elementary_test_results') }}\n{{ elementary.empty_table([\n ('elementary_test_results_id', 'long_string'),\n ('result_row', 'long_string'),\n ('detected_at','timestamp'),\n ('created_at','timestamp'),\n]) }}", "language": "sql", "refs": [{"name": "elementary_test_results", "package": null, "version": null}, {"name": "elementary_test_results", "package": null, "version": null}, {"name": "elementary_test_results", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.elementary.get_config_var", "macro.elementary.get_default_table_type", "macro.elementary.get_default_incremental_strategy", "macro.dbt_testing_example.ref", "macro.elementary.empty_table", "macro.elementary.backfill_result_rows"], "nodes": ["model.elementary.elementary_test_results"]}, "compiled_path": "docs/compiled/elementary/models/edr/run_results/test_result_rows.sql", "compiled": true, "compiled_code": "\n\n-- depends_on: \"neondb\".\"dbt_testing_example_elementary\".\"elementary_test_results\"\nselect * from (\n select\n \n \n cast('this_is_just_a_long_dummy_string' as text) as elementary_test_results_id\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as result_row\n\n,\n cast('2091-02-17' as timestamp) as detected_at\n\n,\n cast('2091-02-17' as timestamp) as created_at\n\n\n ) as empty_table\n where 1 = 0", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.elementary.job_run_results": {"database": "neondb", "schema": "dbt_testing_example_elementary", "name": "job_run_results", "resource_type": "model", "package_name": "elementary", "path": "edr/run_results/job_run_results.sql", "original_file_path": "models/edr/run_results/job_run_results.sql", "unique_id": "model.elementary.job_run_results", "fqn": ["elementary", "edr", "run_results", "job_run_results"], "alias": "job_run_results", "checksum": {"name": "sha256", "checksum": "70fa0f75184f074237575d1146a8caf3048d0d0300a5da5013b7a88f137bc810"}, "config": {"enabled": true, "alias": null, "schema": "elementary", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": [], "description": "Run results of dbt invocations, enriched with jobs metadata. Each row is the result of a single job. This is a view on `dbt_invocations`.", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "elementary://models/run_results.yml", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "view", "bind": false, "schema": "elementary"}, "created_at": 1733549924.6437528, "relation_name": "\"neondb\".\"dbt_testing_example_elementary\".\"job_run_results\"", "raw_code": "{{\n config(\n materialized = 'view',\n bind=False\n )\n}}\n\n{% set job_run_started_at %}\nmin({{ elementary.edr_cast_as_timestamp(\"run_started_at\") }})\n{% endset %}\n\n{% set job_run_completed_at %}\nmax({{ elementary.edr_cast_as_timestamp(\"run_completed_at\") }})\n{% endset %}\n\nwith jobs as (\n select\n job_name,\n job_id,\n job_run_id,\n {{ job_run_started_at }} as job_run_started_at,\n {{ job_run_completed_at }} as job_run_completed_at,\n {{ elementary.timediff(\"second\", job_run_started_at, job_run_completed_at) }} as job_run_execution_time\n from {{ ref('dbt_invocations') }}\n where job_id is not null\n group by job_name, job_id, job_run_id\n)\n\nselect\n job_name as name,\n job_id as id,\n job_run_id as run_id,\n job_run_started_at as run_started_at,\n job_run_completed_at as run_completed_at,\n job_run_execution_time as run_execution_time\nfrom jobs", "language": "sql", "refs": [{"name": "dbt_invocations", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.elementary.edr_cast_as_timestamp", "macro.elementary.timediff", "macro.dbt_testing_example.ref"], "nodes": ["model.elementary.dbt_invocations"]}, "compiled_path": "docs/compiled/elementary/models/edr/run_results/job_run_results.sql", "compiled": true, "compiled_code": "\n\n\n\n\n\nwith jobs as (\n select\n job_name,\n job_id,\n job_run_id,\n \nmin(cast(run_started_at as timestamp))\n as job_run_started_at,\n \nmax(cast(run_completed_at as timestamp))\n as job_run_completed_at,\n \n \n (\n (\n (\n ((\nmax(cast(run_completed_at as timestamp))\n)::date - (\nmin(cast(run_started_at as timestamp))\n)::date)\n * 24 + date_part('hour', (\nmax(cast(run_completed_at as timestamp))\n)::timestamp) - date_part('hour', (\nmin(cast(run_started_at as timestamp))\n)::timestamp))\n * 60 + date_part('minute', (\nmax(cast(run_completed_at as timestamp))\n)::timestamp) - date_part('minute', (\nmin(cast(run_started_at as timestamp))\n)::timestamp))\n * 60 + floor(date_part('second', (\nmax(cast(run_completed_at as timestamp))\n)::timestamp)) - floor(date_part('second', (\nmin(cast(run_started_at as timestamp))\n)::timestamp)))\n \n as job_run_execution_time\n from \"neondb\".\"dbt_testing_example_elementary\".\"dbt_invocations\"\n where job_id is not null\n group by job_name, job_id, job_run_id\n)\n\nselect\n job_name as name,\n job_id as id,\n job_run_id as run_id,\n job_run_started_at as run_started_at,\n job_run_completed_at as run_completed_at,\n job_run_execution_time as run_execution_time\nfrom jobs", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.elementary.snapshot_run_results": {"database": "neondb", "schema": "dbt_testing_example_elementary", "name": "snapshot_run_results", "resource_type": "model", "package_name": "elementary", "path": "edr/run_results/snapshot_run_results.sql", "original_file_path": "models/edr/run_results/snapshot_run_results.sql", "unique_id": "model.elementary.snapshot_run_results", "fqn": ["elementary", "edr", "run_results", "snapshot_run_results"], "alias": "snapshot_run_results", "checksum": {"name": "sha256", "checksum": "1b4464b5d2043628e6ca2f1b435220ef0d577a48eecfc07b5ea5657e69c55b02"}, "config": {"enabled": true, "alias": null, "schema": "elementary", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": [], "description": "Run results of dbt snapshots, enriched with snapshots metadata. Each row is the result of a single snapshot. This is a view that joins data from `dbt_run_results` and `dbt_snapshots`.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "elementary://models/run_results.yml", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "view", "bind": false, "schema": "elementary"}, "created_at": 1733549924.643356, "relation_name": "\"neondb\".\"dbt_testing_example_elementary\".\"snapshot_run_results\"", "raw_code": "{{\n config(\n materialized = 'view',\n bind=False\n )\n}}\n\nwith dbt_run_results as (\n select * from {{ ref('dbt_run_results') }}\n),\n\ndbt_snapshots as (\n select * from {{ ref('dbt_snapshots') }}\n)\n\nSELECT\n run_results.model_execution_id,\n run_results.unique_id,\n run_results.invocation_id,\n run_results.query_id,\n run_results.name,\n run_results.generated_at,\n run_results.status,\n run_results.full_refresh,\n run_results.message,\n run_results.execution_time,\n run_results.execute_started_at,\n run_results.execute_completed_at,\n run_results.compile_started_at,\n run_results.compile_completed_at,\n run_results.compiled_code,\n run_results.adapter_response,\n run_results.thread_id,\n snapshots.database_name,\n snapshots.schema_name,\n coalesce(run_results.materialization, snapshots.materialization) as materialization,\n snapshots.tags,\n snapshots.package_name,\n snapshots.path,\n snapshots.original_path,\n snapshots.owner,\n snapshots.alias\nFROM dbt_run_results run_results\nJOIN dbt_snapshots snapshots ON run_results.unique_id = snapshots.unique_id", "language": "sql", "refs": [{"name": "dbt_run_results", "package": null, "version": null}, {"name": "dbt_snapshots", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt_testing_example.ref"], "nodes": ["model.elementary.dbt_run_results", "model.elementary.dbt_snapshots"]}, "compiled_path": "docs/compiled/elementary/models/edr/run_results/snapshot_run_results.sql", "compiled": true, "compiled_code": "\n\nwith dbt_run_results as (\n select * from \"neondb\".\"dbt_testing_example_elementary\".\"dbt_run_results\"\n),\n\ndbt_snapshots as (\n select * from \"neondb\".\"dbt_testing_example_elementary\".\"dbt_snapshots\"\n)\n\nSELECT\n run_results.model_execution_id,\n run_results.unique_id,\n run_results.invocation_id,\n run_results.query_id,\n run_results.name,\n run_results.generated_at,\n run_results.status,\n run_results.full_refresh,\n run_results.message,\n run_results.execution_time,\n run_results.execute_started_at,\n run_results.execute_completed_at,\n run_results.compile_started_at,\n run_results.compile_completed_at,\n run_results.compiled_code,\n run_results.adapter_response,\n run_results.thread_id,\n snapshots.database_name,\n snapshots.schema_name,\n coalesce(run_results.materialization, snapshots.materialization) as materialization,\n snapshots.tags,\n snapshots.package_name,\n snapshots.path,\n snapshots.original_path,\n snapshots.owner,\n snapshots.alias\nFROM dbt_run_results run_results\nJOIN dbt_snapshots snapshots ON run_results.unique_id = snapshots.unique_id", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.elementary.model_run_results": {"database": "neondb", "schema": "dbt_testing_example_elementary", "name": "model_run_results", "resource_type": "model", "package_name": "elementary", "path": "edr/run_results/model_run_results.sql", "original_file_path": "models/edr/run_results/model_run_results.sql", "unique_id": "model.elementary.model_run_results", "fqn": ["elementary", "edr", "run_results", "model_run_results"], "alias": "model_run_results", "checksum": {"name": "sha256", "checksum": "99fba47e42516fbdc31e2546f687e3f780f21eaa5ac303e1ed22d23262ac5ec9"}, "config": {"enabled": true, "alias": null, "schema": "elementary", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": [], "description": "Run results of dbt models, enriched with models metadata. Each row is the result of a single model. This is a view that joins data from `dbt_run_results` and `dbt_models`.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "elementary://models/run_results.yml", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "view", "bind": false, "schema": "elementary"}, "created_at": 1733549924.6429572, "relation_name": "\"neondb\".\"dbt_testing_example_elementary\".\"model_run_results\"", "raw_code": "{{\n config(\n materialized = 'view',\n bind=False\n )\n}}\n\nwith dbt_run_results as (\n select * from {{ ref('dbt_run_results') }}\n),\n\ndbt_models as (\n select * from {{ ref('dbt_models') }}\n)\n\nSELECT\n run_results.model_execution_id,\n run_results.unique_id,\n run_results.invocation_id,\n run_results.query_id,\n run_results.name,\n run_results.generated_at,\n run_results.status,\n run_results.full_refresh,\n run_results.message,\n run_results.execution_time,\n run_results.execute_started_at,\n run_results.execute_completed_at,\n run_results.compile_started_at,\n run_results.compile_completed_at,\n run_results.compiled_code,\n run_results.adapter_response,\n run_results.thread_id,\n models.database_name,\n models.schema_name,\n coalesce(run_results.materialization, models.materialization) as materialization,\n models.tags,\n models.package_name,\n models.path,\n models.original_path,\n models.owner,\n models.alias,\n ROW_NUMBER() OVER (PARTITION BY run_results.unique_id ORDER BY run_results.generated_at DESC) AS model_invocation_reverse_index,\n CASE WHEN FIRST_VALUE(invocation_id) OVER (PARTITION BY {{ elementary.edr_time_trunc('day', 'run_results.generated_at') }} ORDER BY run_results.generated_at ASC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) = invocation_id\n THEN TRUE\n ELSE FALSE \n END AS is_the_first_invocation_of_the_day,\n CASE WHEN LAST_VALUE(invocation_id) OVER (PARTITION BY {{ elementary.edr_time_trunc('day', 'run_results.generated_at') }} ORDER BY run_results.generated_at ASC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) = invocation_id\n THEN TRUE\n ELSE FALSE \n END AS is_the_last_invocation_of_the_day\n \nFROM dbt_run_results run_results\nJOIN dbt_models models ON run_results.unique_id = models.unique_id", "language": "sql", "refs": [{"name": "dbt_run_results", "package": null, "version": null}, {"name": "dbt_models", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt_testing_example.ref", "macro.elementary.edr_time_trunc"], "nodes": ["model.elementary.dbt_run_results", "model.elementary.dbt_models"]}, "compiled_path": "docs/compiled/elementary/models/edr/run_results/model_run_results.sql", "compiled": true, "compiled_code": "\n\nwith dbt_run_results as (\n select * from \"neondb\".\"dbt_testing_example_elementary\".\"dbt_run_results\"\n),\n\ndbt_models as (\n select * from \"neondb\".\"dbt_testing_example_elementary\".\"dbt_models\"\n)\n\nSELECT\n run_results.model_execution_id,\n run_results.unique_id,\n run_results.invocation_id,\n run_results.query_id,\n run_results.name,\n run_results.generated_at,\n run_results.status,\n run_results.full_refresh,\n run_results.message,\n run_results.execution_time,\n run_results.execute_started_at,\n run_results.execute_completed_at,\n run_results.compile_started_at,\n run_results.compile_completed_at,\n run_results.compiled_code,\n run_results.adapter_response,\n run_results.thread_id,\n models.database_name,\n models.schema_name,\n coalesce(run_results.materialization, models.materialization) as materialization,\n models.tags,\n models.package_name,\n models.path,\n models.original_path,\n models.owner,\n models.alias,\n ROW_NUMBER() OVER (PARTITION BY run_results.unique_id ORDER BY run_results.generated_at DESC) AS model_invocation_reverse_index,\n CASE WHEN FIRST_VALUE(invocation_id) OVER (PARTITION BY \n date_trunc('day', cast(run_results.generated_at as timestamp))\n ORDER BY run_results.generated_at ASC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) = invocation_id\n THEN TRUE\n ELSE FALSE \n END AS is_the_first_invocation_of_the_day,\n CASE WHEN LAST_VALUE(invocation_id) OVER (PARTITION BY \n date_trunc('day', cast(run_results.generated_at as timestamp))\n ORDER BY run_results.generated_at ASC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) = invocation_id\n THEN TRUE\n ELSE FALSE \n END AS is_the_last_invocation_of_the_day\n \nFROM dbt_run_results run_results\nJOIN dbt_models models ON run_results.unique_id = models.unique_id", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.elementary.dbt_source_freshness_results": {"database": "neondb", "schema": "dbt_testing_example_elementary", "name": "dbt_source_freshness_results", "resource_type": "model", "package_name": "elementary", "path": "edr/run_results/dbt_source_freshness_results.sql", "original_file_path": "models/edr/run_results/dbt_source_freshness_results.sql", "unique_id": "model.elementary.dbt_source_freshness_results", "fqn": ["elementary", "edr", "run_results", "dbt_source_freshness_results"], "alias": "dbt_source_freshness_results", "checksum": {"name": "sha256", "checksum": "fb063c8eb524356395464854c25d33038742ce2e0c3d4b3936ce8919a0ee27d6"}, "config": {"enabled": true, "alias": null, "schema": "elementary", "database": null, "tags": [], "meta": {"timestamp_column": "created_at", "prev_timestamp_column": "generated_at"}, "group": null, "materialized": "incremental", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": false, "unique_key": "source_freshness_execution_id", "on_schema_change": "append_new_columns", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "table_type": null}, "tags": [], "description": "", "columns": {}, "meta": {"timestamp_column": "created_at", "prev_timestamp_column": "generated_at"}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"materialized": "incremental", "unique_key": "source_freshness_execution_id", "on_schema_change": "append_new_columns", "full_refresh": false, "meta": {"timestamp_column": "created_at", "prev_timestamp_column": "generated_at"}, "table_type": null, "incremental_strategy": null, "schema": "elementary"}, "created_at": 1733549923.7686028, "relation_name": "\"neondb\".\"dbt_testing_example_elementary\".\"dbt_source_freshness_results\"", "raw_code": "{{\n config(\n materialized = 'incremental',\n unique_key = 'source_freshness_execution_id',\n on_schema_change = 'append_new_columns',\n full_refresh=elementary.get_config_var('elementary_full_refresh'),\n meta={\n \"timestamp_column\": \"created_at\",\n \"prev_timestamp_column\": \"generated_at\",\n },\n table_type=elementary.get_default_table_type(),\n incremental_strategy=elementary.get_default_incremental_strategy()\n )\n}}\n\n{{ elementary.empty_dbt_source_freshness_results() }}", "language": "sql", "refs": [], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.elementary.get_config_var", "macro.elementary.get_default_table_type", "macro.elementary.get_default_incremental_strategy", "macro.elementary.empty_dbt_source_freshness_results"], "nodes": []}, "compiled_path": "docs/compiled/elementary/models/edr/run_results/dbt_source_freshness_results.sql", "compiled": true, "compiled_code": "\n\n\n select * from (\n select\n \n \n cast('dummy_string' as varchar(4096)) as source_freshness_execution_id\n\n,\n \n cast('dummy_string' as varchar(4096)) as unique_id\n\n,\n \n cast('dummy_string' as varchar(4096)) as max_loaded_at\n\n,\n \n cast('dummy_string' as varchar(4096)) as snapshotted_at\n\n,\n \n cast('dummy_string' as varchar(4096)) as generated_at\n\n,\n cast('2091-02-17' as timestamp) as created_at\n\n,\n \n cast(123456789.99 as float) as max_loaded_at_time_ago_in_s\n\n,\n \n cast('dummy_string' as varchar(4096)) as status\n\n,\n \n cast('dummy_string' as varchar(4096)) as error\n\n,\n \n cast('dummy_string' as varchar(4096)) as compile_started_at\n\n,\n \n cast('dummy_string' as varchar(4096)) as compile_completed_at\n\n,\n \n cast('dummy_string' as varchar(4096)) as execute_started_at\n\n,\n \n cast('dummy_string' as varchar(4096)) as execute_completed_at\n\n,\n \n cast('dummy_string' as varchar(4096)) as invocation_id\n\n,\n \n cast('dummy_string' as varchar(4096)) as warn_after\n\n,\n \n cast('dummy_string' as varchar(4096)) as error_after\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as filter\n\n\n ) as empty_table\n where 1 = 0\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.elementary.dbt_snapshots": {"database": "neondb", "schema": "dbt_testing_example_elementary", "name": "dbt_snapshots", "resource_type": "model", "package_name": "elementary", "path": "edr/dbt_artifacts/dbt_snapshots.sql", "original_file_path": "models/edr/dbt_artifacts/dbt_snapshots.sql", "unique_id": "model.elementary.dbt_snapshots", "fqn": ["elementary", "edr", "dbt_artifacts", "dbt_snapshots"], "alias": "dbt_snapshots", "checksum": {"name": "sha256", "checksum": "84129810bfd9a5181f3d1552ba85143966cd16d64b9fc9169c1b089eab0c6ac2"}, "config": {"enabled": true, "alias": null, "schema": "elementary", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "incremental", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ elementary.upload_dbt_snapshots() }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": false, "unique_key": "unique_id", "on_schema_change": "sync_all_columns", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "transient": false, "table_type": null}, "tags": [], "description": "Metadata about snapshots in the project, including configuration and properties from the dbt graph. Each row contains information about a single snapshot. Data is loaded every time this model is executed. It is recommended to execute the model every time a change is merged to the project.\n", "columns": {"unique_id": {"name": "unique_id", "description": "", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "alias": {"name": "alias", "description": "", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "checksum": {"name": "checksum", "description": "", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "materialization": {"name": "materialization", "description": "", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "tags": {"name": "tags", "description": "", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "meta": {"name": "meta", "description": "", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "owner": {"name": "owner", "description": "", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "database_name": {"name": "database_name", "description": "", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "schema_name": {"name": "schema_name", "description": "", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "depends_on_macros": {"name": "depends_on_macros", "description": "", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "depends_on_nodes": {"name": "depends_on_nodes", "description": "", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "description": {"name": "description", "description": "", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "name": {"name": "name", "description": "", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "package_name": {"name": "package_name", "description": "", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "original_path": {"name": "original_path", "description": "", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "path": {"name": "path", "description": "", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "generated_at": {"name": "generated_at", "description": "", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "elementary://models/dbt_artifacts.yml", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "incremental", "transient": false, "unique_key": "unique_id", "on_schema_change": "sync_all_columns", "full_refresh": false, "table_type": null, "incremental_strategy": null, "post-hook": ["{{ elementary.upload_dbt_snapshots() }}"], "schema": "elementary"}, "created_at": 1733549924.659682, "relation_name": "\"neondb\".\"dbt_testing_example_elementary\".\"dbt_snapshots\"", "raw_code": "{{\n config(\n materialized='incremental',\n transient=False,\n post_hook='{{ elementary.upload_dbt_snapshots() }}',\n unique_key='unique_id',\n on_schema_change='sync_all_columns',\n full_refresh=elementary.get_config_var('elementary_full_refresh'),\n table_type=elementary.get_default_table_type(),\n incremental_strategy=elementary.get_default_incremental_strategy()\n )\n}}\n\n{{ elementary.get_dbt_models_empty_table_query() }}", "language": "sql", "refs": [], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.elementary.get_config_var", "macro.elementary.get_default_table_type", "macro.elementary.get_default_incremental_strategy", "macro.elementary.get_dbt_models_empty_table_query", "macro.elementary.upload_dbt_snapshots"], "nodes": []}, "compiled_path": "docs/compiled/elementary/models/edr/dbt_artifacts/dbt_snapshots.sql", "compiled": true, "compiled_code": "\n\nselect * from (\n select\n \n \n cast('dummy_string' as varchar(4096)) as unique_id\n\n,\n \n cast('dummy_string' as varchar(4096)) as alias\n\n,\n \n cast('dummy_string' as varchar(4096)) as checksum\n\n,\n \n cast('dummy_string' as varchar(4096)) as materialization\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as tags\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as meta\n\n,\n \n cast('dummy_string' as varchar(4096)) as owner\n\n,\n \n cast('dummy_string' as varchar(4096)) as database_name\n\n,\n \n cast('dummy_string' as varchar(4096)) as schema_name\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as depends_on_macros\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as depends_on_nodes\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as description\n\n,\n \n cast('dummy_string' as varchar(4096)) as name\n\n,\n \n cast('dummy_string' as varchar(4096)) as package_name\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as original_path\n\n,\n \n cast('dummy_string' as varchar(4096)) as path\n\n,\n \n cast('dummy_string' as varchar(4096)) as patch_path\n\n,\n \n cast('dummy_string' as varchar(4096)) as generated_at\n\n,\n \n cast('dummy_string' as varchar(4096)) as metadata_hash\n\n\n ) as empty_table\n where 1 = 0", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.elementary.enriched_columns": {"database": "neondb", "schema": "dbt_testing_example_elementary", "name": "enriched_columns", "resource_type": "model", "package_name": "elementary", "path": "edr/dbt_artifacts/enriched_columns.sql", "original_file_path": "models/edr/dbt_artifacts/enriched_columns.sql", "unique_id": "model.elementary.enriched_columns", "fqn": ["elementary", "edr", "dbt_artifacts", "enriched_columns"], "alias": "enriched_columns", "checksum": {"name": "sha256", "checksum": "de13843dd09be742938fe58c752b0b44350377ea6202d8ecec71096ceb0b9a8b"}, "config": {"enabled": true, "alias": null, "schema": "elementary", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"materialized": "view", "bind": false, "schema": "elementary"}, "created_at": 1733549923.8168056, "relation_name": "\"neondb\".\"dbt_testing_example_elementary\".\"enriched_columns\"", "raw_code": "{{\n config(\n materialized = 'view',\n bind=False\n )\n}}\n\n\nwith information_schema_columns as (\n select\n lower(database_name) as database_name,\n lower(schema_name) as schema_name,\n lower(table_name) as table_name,\n lower(column_name) as name,\n data_type\n from {{ ref(\"information_schema_columns\") }}\n),\n\ndbt_columns as (\n select\n lower(database_name) as database_name,\n lower(schema_name) as schema_name,\n lower(table_name) as table_name,\n lower(name) as name,\n description\n from {{ ref(\"dbt_columns\") }}\n)\n\nselect\n database_name,\n schema_name,\n table_name,\n name,\n data_type,\n description\nfrom information_schema_columns\nleft join dbt_columns using (database_name, schema_name, table_name, name)", "language": "sql", "refs": [{"name": "information_schema_columns", "package": null, "version": null}, {"name": "dbt_columns", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt_testing_example.ref"], "nodes": ["model.elementary.information_schema_columns", "model.elementary.dbt_columns"]}, "compiled_path": "docs/compiled/elementary/models/edr/dbt_artifacts/enriched_columns.sql", "compiled": true, "compiled_code": "\n\n\nwith information_schema_columns as (\n select\n lower(database_name) as database_name,\n lower(schema_name) as schema_name,\n lower(table_name) as table_name,\n lower(column_name) as name,\n data_type\n from \"neondb\".\"dbt_testing_example_elementary\".\"information_schema_columns\"\n),\n\ndbt_columns as (\n select\n lower(database_name) as database_name,\n lower(schema_name) as schema_name,\n lower(table_name) as table_name,\n lower(name) as name,\n description\n from \"neondb\".\"dbt_testing_example_elementary\".\"dbt_columns\"\n)\n\nselect\n database_name,\n schema_name,\n table_name,\n name,\n data_type,\n description\nfrom information_schema_columns\nleft join dbt_columns using (database_name, schema_name, table_name, name)", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.elementary.dbt_metrics": {"database": "neondb", "schema": "dbt_testing_example_elementary", "name": "dbt_metrics", "resource_type": "model", "package_name": "elementary", "path": "edr/dbt_artifacts/dbt_metrics.sql", "original_file_path": "models/edr/dbt_artifacts/dbt_metrics.sql", "unique_id": "model.elementary.dbt_metrics", "fqn": ["elementary", "edr", "dbt_artifacts", "dbt_metrics"], "alias": "dbt_metrics", "checksum": {"name": "sha256", "checksum": "86136f6682874137b3f9277098edf419c918548c440e1cd03c29f930d13d6dca"}, "config": {"enabled": true, "alias": null, "schema": "elementary", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "incremental", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ elementary.upload_dbt_metrics() }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": false, "unique_key": "unique_id", "on_schema_change": "sync_all_columns", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "transient": false, "table_type": null}, "tags": [], "description": "Metadata about metrics in the project, including configuration and properties from the dbt graph. Each row contains information about a single metric. Data is loaded every time this model is executed. It is recommended to execute the model every time a change is merged to the project.\n", "columns": {"unique_id": {"name": "unique_id", "description": "", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "name": {"name": "name", "description": "", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "label": {"name": "label", "description": "", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "model": {"name": "model", "description": "", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "type": {"name": "type", "description": "", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "sql": {"name": "sql", "description": "", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "timestamp": {"name": "timestamp", "description": "", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "filters": {"name": "filters", "description": "", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "time_grains": {"name": "time_grains", "description": "", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "dimensions": {"name": "dimensions", "description": "", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "depends_on_macros": {"name": "depends_on_macros", "description": "", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "depends_on_nodes": {"name": "depends_on_nodes", "description": "", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "description": {"name": "description", "description": "", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "tags": {"name": "tags", "description": "", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "meta": {"name": "meta", "description": "", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "package_name": {"name": "package_name", "description": "", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "original_path": {"name": "original_path", "description": "", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "path": {"name": "path", "description": "", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "generated_at": {"name": "generated_at", "description": "", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "elementary://models/dbt_artifacts.yml", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "incremental", "transient": false, "unique_key": "unique_id", "on_schema_change": "sync_all_columns", "full_refresh": false, "table_type": null, "incremental_strategy": null, "post-hook": ["{{ elementary.upload_dbt_metrics() }}"], "schema": "elementary"}, "created_at": 1733549924.6629753, "relation_name": "\"neondb\".\"dbt_testing_example_elementary\".\"dbt_metrics\"", "raw_code": "{{\n config(\n materialized='incremental',\n transient=False,\n post_hook='{{ elementary.upload_dbt_metrics() }}',\n unique_key='unique_id',\n on_schema_change='sync_all_columns',\n full_refresh=elementary.get_config_var('elementary_full_refresh'),\n table_type=elementary.get_default_table_type(),\n incremental_strategy=elementary.get_default_incremental_strategy()\n )\n}}\n\n{{ elementary.get_dbt_metrics_empty_table_query() }}", "language": "sql", "refs": [], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.elementary.get_config_var", "macro.elementary.get_default_table_type", "macro.elementary.get_default_incremental_strategy", "macro.elementary.get_dbt_metrics_empty_table_query", "macro.elementary.upload_dbt_metrics"], "nodes": []}, "compiled_path": "docs/compiled/elementary/models/edr/dbt_artifacts/dbt_metrics.sql", "compiled": true, "compiled_code": "\n\nselect * from (\n select\n \n \n cast('dummy_string' as varchar(4096)) as unique_id\n\n,\n \n cast('dummy_string' as varchar(4096)) as name\n\n,\n \n cast('dummy_string' as varchar(4096)) as label\n\n,\n \n cast('dummy_string' as varchar(4096)) as model\n\n,\n \n cast('dummy_string' as varchar(4096)) as type\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as sql\n\n,\n \n cast('dummy_string' as varchar(4096)) as timestamp\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as filters\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as time_grains\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as dimensions\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as depends_on_macros\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as depends_on_nodes\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as description\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as tags\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as meta\n\n,\n \n cast('dummy_string' as varchar(4096)) as package_name\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as original_path\n\n,\n \n cast('dummy_string' as varchar(4096)) as path\n\n,\n \n cast('dummy_string' as varchar(4096)) as generated_at\n\n,\n \n cast('dummy_string' as varchar(4096)) as metadata_hash\n\n\n ) as empty_table\n where 1 = 0", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.elementary.dbt_sources": {"database": "neondb", "schema": "dbt_testing_example_elementary", "name": "dbt_sources", "resource_type": "model", "package_name": "elementary", "path": "edr/dbt_artifacts/dbt_sources.sql", "original_file_path": "models/edr/dbt_artifacts/dbt_sources.sql", "unique_id": "model.elementary.dbt_sources", "fqn": ["elementary", "edr", "dbt_artifacts", "dbt_sources"], "alias": "dbt_sources", "checksum": {"name": "sha256", "checksum": "1abd5241398ed596cf8fcf85b84a45835ae0a3e67069f00d7b519757b009cbb3"}, "config": {"enabled": true, "alias": null, "schema": "elementary", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "incremental", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ elementary.upload_dbt_sources() }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": false, "unique_key": "unique_id", "on_schema_change": "sync_all_columns", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "transient": false, "table_type": null}, "tags": [], "description": "Metadata about sources in the project, including configuration and properties from the dbt graph. Each row contains information about a single source. Data is loaded every time this model is executed. It is recommended to execute the model every time a change is merged to the project.\n", "columns": {"unique_id": {"name": "unique_id", "description": "", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "database_name": {"name": "database_name", "description": "", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "schema_name": {"name": "schema_name", "description": "", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "source_name": {"name": "source_name", "description": "", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "name": {"name": "name", "description": "", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "identifier": {"name": "identifier", "description": "", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "loaded_at_field": {"name": "loaded_at_field", "description": "", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "freshness_warn_after": {"name": "freshness_warn_after", "description": "", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "freshness_error_after": {"name": "freshness_error_after", "description": "", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "freshness_filter": {"name": "freshness_filter", "description": "", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "relation_name": {"name": "relation_name", "description": "", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "tags": {"name": "tags", "description": "", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "meta": {"name": "meta", "description": "", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "owner": {"name": "owner", "description": "", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "package_name": {"name": "package_name", "description": "", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "original_path": {"name": "original_path", "description": "", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "path": {"name": "path", "description": "", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "source_description": {"name": "source_description", "description": "", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "description": {"name": "description", "description": "", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "generated_at": {"name": "generated_at", "description": "", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "elementary://models/dbt_artifacts.yml", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "incremental", "transient": false, "unique_key": "unique_id", "on_schema_change": "sync_all_columns", "full_refresh": false, "table_type": null, "incremental_strategy": null, "post-hook": ["{{ elementary.upload_dbt_sources() }}"], "schema": "elementary"}, "created_at": 1733549924.6585305, "relation_name": "\"neondb\".\"dbt_testing_example_elementary\".\"dbt_sources\"", "raw_code": "{{\n config(\n materialized='incremental',\n transient=False,\n post_hook='{{ elementary.upload_dbt_sources() }}',\n unique_key='unique_id',\n on_schema_change='sync_all_columns',\n full_refresh=elementary.get_config_var('elementary_full_refresh'),\n table_type=elementary.get_default_table_type(),\n incremental_strategy=elementary.get_default_incremental_strategy()\n )\n}}\n\n{{ elementary.get_dbt_sources_empty_table_query() }}", "language": "sql", "refs": [], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.elementary.get_config_var", "macro.elementary.get_default_table_type", "macro.elementary.get_default_incremental_strategy", "macro.elementary.get_dbt_sources_empty_table_query", "macro.elementary.upload_dbt_sources"], "nodes": []}, "compiled_path": "docs/compiled/elementary/models/edr/dbt_artifacts/dbt_sources.sql", "compiled": true, "compiled_code": "\n\nselect * from (\n select\n \n \n cast('dummy_string' as varchar(4096)) as unique_id\n\n,\n \n cast('dummy_string' as varchar(4096)) as database_name\n\n,\n \n cast('dummy_string' as varchar(4096)) as schema_name\n\n,\n \n cast('dummy_string' as varchar(4096)) as source_name\n\n,\n \n cast('dummy_string' as varchar(4096)) as name\n\n,\n \n cast('dummy_string' as varchar(4096)) as identifier\n\n,\n \n cast('dummy_string' as varchar(4096)) as loaded_at_field\n\n,\n \n cast('dummy_string' as varchar(4096)) as freshness_warn_after\n\n,\n \n cast('dummy_string' as varchar(4096)) as freshness_error_after\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as freshness_filter\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as freshness_description\n\n,\n \n cast('dummy_string' as varchar(4096)) as relation_name\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as tags\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as meta\n\n,\n \n cast('dummy_string' as varchar(4096)) as owner\n\n,\n \n cast('dummy_string' as varchar(4096)) as package_name\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as original_path\n\n,\n \n cast('dummy_string' as varchar(4096)) as path\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as source_description\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as description\n\n,\n \n cast('dummy_string' as varchar(4096)) as generated_at\n\n,\n \n cast('dummy_string' as varchar(4096)) as metadata_hash\n\n\n ) as empty_table\n where 1 = 0", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.elementary.dbt_tests": {"database": "neondb", "schema": "dbt_testing_example_elementary", "name": "dbt_tests", "resource_type": "model", "package_name": "elementary", "path": "edr/dbt_artifacts/dbt_tests.sql", "original_file_path": "models/edr/dbt_artifacts/dbt_tests.sql", "unique_id": "model.elementary.dbt_tests", "fqn": ["elementary", "edr", "dbt_artifacts", "dbt_tests"], "alias": "dbt_tests", "checksum": {"name": "sha256", "checksum": "e3e387b5d7f7df8bdfdc358f4458dd69b8311803d989c7a0a571314bb1f1dfc2"}, "config": {"enabled": true, "alias": null, "schema": "elementary", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "incremental", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ elementary.upload_dbt_tests() }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": false, "unique_key": "unique_id", "on_schema_change": "sync_all_columns", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "transient": false, "table_type": null}, "tags": [], "description": "Metadata about tests in the project, including configuration and properties from the dbt graph. Each row contains information about a single test. Data is loaded every time this model is executed. It is recommended to execute the model every time a change is merged to the project.\n", "columns": {"unique_id": {"name": "unique_id", "description": "The unique id of the test.", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "database_name": {"name": "database_name", "description": "The tested model database name.", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "schema_name": {"name": "schema_name", "description": "The tested model schema name.", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "name": {"name": "name", "description": "The test name.", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "short_name": {"name": "short_name", "description": "", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "alias": {"name": "alias", "description": "", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "test_column_name": {"name": "test_column_name", "description": "The name of the tested column.", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "severity": {"name": "severity", "description": "", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "warn_if": {"name": "warn_if", "description": "", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "error_if": {"name": "error_if", "description": "", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "test_params": {"name": "test_params", "description": "", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "test_namespace": {"name": "test_namespace", "description": "", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "tags": {"name": "tags", "description": "", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "model_tags": {"name": "model_tags", "description": "", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "model_owners": {"name": "model_owners", "description": "", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "meta": {"name": "meta", "description": "", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "depends_on_macros": {"name": "depends_on_macros", "description": "", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "depends_on_nodes": {"name": "depends_on_nodes", "description": "", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "parent_model_unique_id": {"name": "parent_model_unique_id", "description": "", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "description": {"name": "description", "description": "", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "package_name": {"name": "package_name", "description": "", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "type": {"name": "type", "description": "", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "original_path": {"name": "original_path", "description": "", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "path": {"name": "path", "description": "", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "generated_at": {"name": "generated_at", "description": "", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "elementary://models/dbt_artifacts.yml", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "incremental", "transient": false, "unique_key": "unique_id", "on_schema_change": "sync_all_columns", "full_refresh": false, "table_type": null, "incremental_strategy": null, "post-hook": ["{{ elementary.upload_dbt_tests() }}"], "schema": "elementary"}, "created_at": 1733549924.6551, "relation_name": "\"neondb\".\"dbt_testing_example_elementary\".\"dbt_tests\"", "raw_code": "{{\n config(\n materialized='incremental',\n transient=False,\n post_hook='{{ elementary.upload_dbt_tests() }}',\n unique_key='unique_id',\n on_schema_change='sync_all_columns',\n full_refresh=elementary.get_config_var('elementary_full_refresh'),\n table_type=elementary.get_default_table_type(),\n incremental_strategy=elementary.get_default_incremental_strategy()\n )\n}}\n\n{{ elementary.get_dbt_tests_empty_table_query() }}", "language": "sql", "refs": [], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.elementary.get_config_var", "macro.elementary.get_default_table_type", "macro.elementary.get_default_incremental_strategy", "macro.elementary.get_dbt_tests_empty_table_query", "macro.elementary.upload_dbt_tests"], "nodes": []}, "compiled_path": "docs/compiled/elementary/models/edr/dbt_artifacts/dbt_tests.sql", "compiled": true, "compiled_code": "\n\nselect * from (\n select\n \n \n cast('dummy_string' as varchar(4096)) as unique_id\n\n,\n \n cast('dummy_string' as varchar(4096)) as database_name\n\n,\n \n cast('dummy_string' as varchar(4096)) as schema_name\n\n,\n \n cast('dummy_string' as varchar(4096)) as name\n\n,\n \n cast('dummy_string' as varchar(4096)) as short_name\n\n,\n \n cast('dummy_string' as varchar(4096)) as alias\n\n,\n \n cast('dummy_string' as varchar(4096)) as test_column_name\n\n,\n \n cast('dummy_string' as varchar(4096)) as severity\n\n,\n \n cast('dummy_string' as varchar(4096)) as warn_if\n\n,\n \n cast('dummy_string' as varchar(4096)) as error_if\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as test_params\n\n,\n \n cast('dummy_string' as varchar(4096)) as test_namespace\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as tags\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as model_tags\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as model_owners\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as meta\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as depends_on_macros\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as depends_on_nodes\n\n,\n \n cast('dummy_string' as varchar(4096)) as parent_model_unique_id\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as description\n\n,\n \n cast('dummy_string' as varchar(4096)) as package_name\n\n,\n \n cast('dummy_string' as varchar(4096)) as type\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as original_path\n\n,\n \n cast('dummy_string' as varchar(4096)) as path\n\n,\n \n cast('dummy_string' as varchar(4096)) as generated_at\n\n,\n \n cast('dummy_string' as varchar(4096)) as metadata_hash\n\n,\n \n cast('dummy_string' as varchar(4096)) as quality_dimension\n\n\n ) as empty_table\n where 1 = 0", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.elementary.dbt_artifacts_hashes": {"database": "neondb", "schema": "dbt_testing_example_elementary", "name": "dbt_artifacts_hashes", "resource_type": "model", "package_name": "elementary", "path": "edr/dbt_artifacts/dbt_artifacts_hashes.sql", "original_file_path": "models/edr/dbt_artifacts/dbt_artifacts_hashes.sql", "unique_id": "model.elementary.dbt_artifacts_hashes", "fqn": ["elementary", "edr", "dbt_artifacts", "dbt_artifacts_hashes"], "alias": "dbt_artifacts_hashes", "checksum": {"name": "sha256", "checksum": "830e8b8053c5f914ccc03c0fde90786590b17ce0c736a1b91d1d48c57f22a8ed"}, "config": {"enabled": true, "alias": null, "schema": "elementary", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"materialized": "view", "bind": false, "schema": "elementary"}, "created_at": 1733549923.9657598, "relation_name": "\"neondb\".\"dbt_testing_example_elementary\".\"dbt_artifacts_hashes\"", "raw_code": "{{\n config(\n materialized = 'view',\n bind=False\n )\n}}\n\n{% set artifact_models = [\n \"dbt_models\",\n \"dbt_tests\",\n \"dbt_sources\",\n \"dbt_snapshots\",\n \"dbt_metrics\",\n \"dbt_exposures\",\n \"dbt_seeds\",\n \"dbt_columns\",\n] %}\n\n{% for artifact_model in artifact_models %}\nselect\n '{{ artifact_model }}' as artifacts_model,\n metadata_hash\nfrom {{ ref(artifact_model) }}\n{% if not loop.last %} union all {% endif %}\n{% endfor %}\norder by metadata_hash", "language": "sql", "refs": [{"name": "dbt_models", "package": null, "version": null}, {"name": "dbt_tests", "package": null, "version": null}, {"name": "dbt_sources", "package": null, "version": null}, {"name": "dbt_snapshots", "package": null, "version": null}, {"name": "dbt_metrics", "package": null, "version": null}, {"name": "dbt_exposures", "package": null, "version": null}, {"name": "dbt_seeds", "package": null, "version": null}, {"name": "dbt_columns", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt_testing_example.ref"], "nodes": ["model.elementary.dbt_models", "model.elementary.dbt_tests", "model.elementary.dbt_sources", "model.elementary.dbt_snapshots", "model.elementary.dbt_metrics", "model.elementary.dbt_exposures", "model.elementary.dbt_seeds", "model.elementary.dbt_columns"]}, "compiled_path": "docs/compiled/elementary/models/edr/dbt_artifacts/dbt_artifacts_hashes.sql", "compiled": true, "compiled_code": "\n\n\n\n\nselect\n 'dbt_models' as artifacts_model,\n metadata_hash\nfrom \"neondb\".\"dbt_testing_example_elementary\".\"dbt_models\"\n union all \n\nselect\n 'dbt_tests' as artifacts_model,\n metadata_hash\nfrom \"neondb\".\"dbt_testing_example_elementary\".\"dbt_tests\"\n union all \n\nselect\n 'dbt_sources' as artifacts_model,\n metadata_hash\nfrom \"neondb\".\"dbt_testing_example_elementary\".\"dbt_sources\"\n union all \n\nselect\n 'dbt_snapshots' as artifacts_model,\n metadata_hash\nfrom \"neondb\".\"dbt_testing_example_elementary\".\"dbt_snapshots\"\n union all \n\nselect\n 'dbt_metrics' as artifacts_model,\n metadata_hash\nfrom \"neondb\".\"dbt_testing_example_elementary\".\"dbt_metrics\"\n union all \n\nselect\n 'dbt_exposures' as artifacts_model,\n metadata_hash\nfrom \"neondb\".\"dbt_testing_example_elementary\".\"dbt_exposures\"\n union all \n\nselect\n 'dbt_seeds' as artifacts_model,\n metadata_hash\nfrom \"neondb\".\"dbt_testing_example_elementary\".\"dbt_seeds\"\n union all \n\nselect\n 'dbt_columns' as artifacts_model,\n metadata_hash\nfrom \"neondb\".\"dbt_testing_example_elementary\".\"dbt_columns\"\n\n\norder by metadata_hash", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.elementary.dbt_models": {"database": "neondb", "schema": "dbt_testing_example_elementary", "name": "dbt_models", "resource_type": "model", "package_name": "elementary", "path": "edr/dbt_artifacts/dbt_models.sql", "original_file_path": "models/edr/dbt_artifacts/dbt_models.sql", "unique_id": "model.elementary.dbt_models", "fqn": ["elementary", "edr", "dbt_artifacts", "dbt_models"], "alias": "dbt_models", "checksum": {"name": "sha256", "checksum": "3b137ff6fc5007c98c2cce8c57010d5a8386ed4f9d217b08506e9106ab9168fd"}, "config": {"enabled": true, "alias": null, "schema": "elementary", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "incremental", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ elementary.upload_dbt_models() }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": false, "unique_key": "unique_id", "on_schema_change": "sync_all_columns", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "transient": false, "table_type": null}, "tags": [], "description": "Metadata about models in the project, including configuration and properties from the dbt graph. Each row contains information about a single model. Data is loaded every time this model is executed. It is recommended to execute the model every time a change is merged to the project.\n", "columns": {"unique_id": {"name": "unique_id", "description": "The unique id of the model.", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "alias": {"name": "alias", "description": "", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "checksum": {"name": "checksum", "description": "Model file checksum.", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "materialization": {"name": "materialization", "description": "The model materialization config.", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "tags": {"name": "tags", "description": "Model tags property.", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "meta": {"name": "meta", "description": "The content of 'meta' property key.", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "owner": {"name": "owner", "description": "Model owner property (configured under 'meta' key).", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "database_name": {"name": "database_name", "description": "The model database name.", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "schema_name": {"name": "schema_name", "description": "The model schema name.", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "depends_on_macros": {"name": "depends_on_macros", "description": "The macros the model directly depends on.", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "depends_on_nodes": {"name": "depends_on_nodes", "description": "The nodes the model directly depends on.", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "description": {"name": "description", "description": "Model description.", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "name": {"name": "name", "description": "Model name.", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "package_name": {"name": "package_name", "description": "Package name of the model.", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "original_path": {"name": "original_path", "description": "Full path of the model file.", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "path": {"name": "path", "description": "Short path of the model file.", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "generated_at": {"name": "generated_at", "description": "Update time of the table.", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "elementary://models/dbt_artifacts.yml", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "incremental", "transient": false, "unique_key": "unique_id", "on_schema_change": "sync_all_columns", "full_refresh": false, "table_type": null, "incremental_strategy": null, "post-hook": ["{{ elementary.upload_dbt_models() }}"], "schema": "elementary"}, "created_at": 1733549924.650675, "relation_name": "\"neondb\".\"dbt_testing_example_elementary\".\"dbt_models\"", "raw_code": "{{\n config(\n materialized='incremental',\n transient=False,\n post_hook='{{ elementary.upload_dbt_models() }}',\n unique_key='unique_id',\n on_schema_change='sync_all_columns',\n full_refresh=elementary.get_config_var('elementary_full_refresh'),\n table_type=elementary.get_default_table_type(),\n incremental_strategy=elementary.get_default_incremental_strategy()\n )\n}}\n\n{{ elementary.get_dbt_models_empty_table_query() }}", "language": "sql", "refs": [], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.elementary.get_config_var", "macro.elementary.get_default_table_type", "macro.elementary.get_default_incremental_strategy", "macro.elementary.get_dbt_models_empty_table_query", "macro.elementary.upload_dbt_models"], "nodes": []}, "compiled_path": "docs/compiled/elementary/models/edr/dbt_artifacts/dbt_models.sql", "compiled": true, "compiled_code": "\n\nselect * from (\n select\n \n \n cast('dummy_string' as varchar(4096)) as unique_id\n\n,\n \n cast('dummy_string' as varchar(4096)) as alias\n\n,\n \n cast('dummy_string' as varchar(4096)) as checksum\n\n,\n \n cast('dummy_string' as varchar(4096)) as materialization\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as tags\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as meta\n\n,\n \n cast('dummy_string' as varchar(4096)) as owner\n\n,\n \n cast('dummy_string' as varchar(4096)) as database_name\n\n,\n \n cast('dummy_string' as varchar(4096)) as schema_name\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as depends_on_macros\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as depends_on_nodes\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as description\n\n,\n \n cast('dummy_string' as varchar(4096)) as name\n\n,\n \n cast('dummy_string' as varchar(4096)) as package_name\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as original_path\n\n,\n \n cast('dummy_string' as varchar(4096)) as path\n\n,\n \n cast('dummy_string' as varchar(4096)) as patch_path\n\n,\n \n cast('dummy_string' as varchar(4096)) as generated_at\n\n,\n \n cast('dummy_string' as varchar(4096)) as metadata_hash\n\n\n ) as empty_table\n where 1 = 0", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.elementary.dbt_exposures": {"database": "neondb", "schema": "dbt_testing_example_elementary", "name": "dbt_exposures", "resource_type": "model", "package_name": "elementary", "path": "edr/dbt_artifacts/dbt_exposures.sql", "original_file_path": "models/edr/dbt_artifacts/dbt_exposures.sql", "unique_id": "model.elementary.dbt_exposures", "fqn": ["elementary", "edr", "dbt_artifacts", "dbt_exposures"], "alias": "dbt_exposures", "checksum": {"name": "sha256", "checksum": "11693171043651333132be14894b4b7acad2ce7f09dea0ae0f722cf7d2417bb0"}, "config": {"enabled": true, "alias": null, "schema": "elementary", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "incremental", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ elementary.upload_dbt_exposures() }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": false, "unique_key": "unique_id", "on_schema_change": "sync_all_columns", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "transient": false, "table_type": null}, "tags": [], "description": "Metadata about exposures in the project, including configuration and properties from the dbt graph. Each row contains information about a single exposure. Data is loaded every time this model is executed. It is recommended to execute the model every time a change is merged to the project.\n", "columns": {"unique_id": {"name": "unique_id", "description": "", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "name": {"name": "name", "description": "", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "maturity": {"name": "maturity", "description": "", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "type": {"name": "type", "description": "", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "owner_email": {"name": "owner_email", "description": "", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "owner_name": {"name": "owner_name", "description": "", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "url": {"name": "url", "description": "", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "depends_on_macros": {"name": "depends_on_macros", "description": "", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "depends_on_nodes": {"name": "depends_on_nodes", "description": "", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "description": {"name": "description", "description": "", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "tags": {"name": "tags", "description": "", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "meta": {"name": "meta", "description": "", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "package_name": {"name": "package_name", "description": "", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "original_path": {"name": "original_path", "description": "", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "path": {"name": "path", "description": "", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "generated_at": {"name": "generated_at", "description": "", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "elementary://models/dbt_artifacts.yml", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "incremental", "transient": false, "unique_key": "unique_id", "on_schema_change": "sync_all_columns", "full_refresh": false, "table_type": null, "incremental_strategy": null, "post-hook": ["{{ elementary.upload_dbt_exposures() }}"], "schema": "elementary"}, "created_at": 1733549924.6651602, "relation_name": "\"neondb\".\"dbt_testing_example_elementary\".\"dbt_exposures\"", "raw_code": "{{\n config(\n materialized='incremental',\n transient=False,\n post_hook='{{ elementary.upload_dbt_exposures() }}',\n unique_key='unique_id',\n on_schema_change='sync_all_columns',\n full_refresh=elementary.get_config_var('elementary_full_refresh'),\n table_type=elementary.get_default_table_type(),\n incremental_strategy=elementary.get_default_incremental_strategy()\n )\n}}\n\n{{ elementary.get_dbt_exposures_empty_table_query() }}", "language": "sql", "refs": [], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.elementary.get_config_var", "macro.elementary.get_default_table_type", "macro.elementary.get_default_incremental_strategy", "macro.elementary.get_dbt_exposures_empty_table_query", "macro.elementary.upload_dbt_exposures"], "nodes": []}, "compiled_path": "docs/compiled/elementary/models/edr/dbt_artifacts/dbt_exposures.sql", "compiled": true, "compiled_code": "\n\nselect * from (\n select\n \n \n cast('dummy_string' as varchar(4096)) as unique_id\n\n,\n \n cast('dummy_string' as varchar(4096)) as name\n\n,\n \n cast('dummy_string' as varchar(4096)) as maturity\n\n,\n \n cast('dummy_string' as varchar(4096)) as type\n\n,\n \n cast('dummy_string' as varchar(4096)) as owner_email\n\n,\n \n cast('dummy_string' as varchar(4096)) as owner_name\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as url\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as depends_on_macros\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as depends_on_nodes\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as depends_on_columns\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as description\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as tags\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as meta\n\n,\n \n cast('dummy_string' as varchar(4096)) as package_name\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as original_path\n\n,\n \n cast('dummy_string' as varchar(4096)) as path\n\n,\n \n cast('dummy_string' as varchar(4096)) as generated_at\n\n,\n \n cast('dummy_string' as varchar(4096)) as metadata_hash\n\n,\n \n cast('dummy_string' as varchar(4096)) as label\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as raw_queries\n\n\n ) as empty_table\n where 1 = 0", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.elementary.dbt_seeds": {"database": "neondb", "schema": "dbt_testing_example_elementary", "name": "dbt_seeds", "resource_type": "model", "package_name": "elementary", "path": "edr/dbt_artifacts/dbt_seeds.sql", "original_file_path": "models/edr/dbt_artifacts/dbt_seeds.sql", "unique_id": "model.elementary.dbt_seeds", "fqn": ["elementary", "edr", "dbt_artifacts", "dbt_seeds"], "alias": "dbt_seeds", "checksum": {"name": "sha256", "checksum": "e768cbfb8ca753297d627bc51d661b4d4278e48650f9479d6a64431cb291a551"}, "config": {"enabled": true, "alias": null, "schema": "elementary", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "incremental", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ elementary.upload_dbt_seeds() }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": false, "unique_key": "unique_id", "on_schema_change": "sync_all_columns", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "transient": false, "table_type": null}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"materialized": "incremental", "transient": false, "unique_key": "unique_id", "on_schema_change": "sync_all_columns", "full_refresh": false, "table_type": null, "incremental_strategy": null, "post-hook": ["{{ elementary.upload_dbt_seeds() }}"], "schema": "elementary"}, "created_at": 1733549924.020685, "relation_name": "\"neondb\".\"dbt_testing_example_elementary\".\"dbt_seeds\"", "raw_code": "{{\n config(\n materialized='incremental',\n transient=False,\n post_hook='{{ elementary.upload_dbt_seeds() }}',\n unique_key='unique_id',\n on_schema_change='sync_all_columns',\n full_refresh=elementary.get_config_var('elementary_full_refresh'),\n table_type=elementary.get_default_table_type(),\n incremental_strategy=elementary.get_default_incremental_strategy()\n )\n}}\n\n{{ elementary.get_dbt_seeds_empty_table_query() }}", "language": "sql", "refs": [], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.elementary.get_config_var", "macro.elementary.get_default_table_type", "macro.elementary.get_default_incremental_strategy", "macro.elementary.get_dbt_seeds_empty_table_query", "macro.elementary.upload_dbt_seeds"], "nodes": []}, "compiled_path": "docs/compiled/elementary/models/edr/dbt_artifacts/dbt_seeds.sql", "compiled": true, "compiled_code": "\n\nselect * from (\n select\n \n \n cast('dummy_string' as varchar(4096)) as unique_id\n\n,\n \n cast('dummy_string' as varchar(4096)) as alias\n\n,\n \n cast('dummy_string' as varchar(4096)) as checksum\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as tags\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as meta\n\n,\n \n cast('dummy_string' as varchar(4096)) as owner\n\n,\n \n cast('dummy_string' as varchar(4096)) as database_name\n\n,\n \n cast('dummy_string' as varchar(4096)) as schema_name\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as description\n\n,\n \n cast('dummy_string' as varchar(4096)) as name\n\n,\n \n cast('dummy_string' as varchar(4096)) as package_name\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as original_path\n\n,\n \n cast('dummy_string' as varchar(4096)) as path\n\n,\n \n cast('dummy_string' as varchar(4096)) as generated_at\n\n,\n \n cast('dummy_string' as varchar(4096)) as metadata_hash\n\n\n ) as empty_table\n where 1 = 0", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.elementary.information_schema_columns": {"database": "neondb", "schema": "dbt_testing_example_elementary", "name": "information_schema_columns", "resource_type": "model", "package_name": "elementary", "path": "edr/dbt_artifacts/information_schema_columns.sql", "original_file_path": "models/edr/dbt_artifacts/information_schema_columns.sql", "unique_id": "model.elementary.information_schema_columns", "fqn": ["elementary", "edr", "dbt_artifacts", "information_schema_columns"], "alias": "information_schema_columns", "checksum": {"name": "sha256", "checksum": "6490e0d9234e48632239108ba3211607d83aa25720bdd3124699b360fe6745b6"}, "config": {"enabled": true, "alias": null, "schema": "elementary", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected"}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"materialized": "view", "schema": "elementary"}, "created_at": 1733549924.0423672, "relation_name": "\"neondb\".\"dbt_testing_example_elementary\".\"information_schema_columns\"", "raw_code": "{{\n config(\n materialized=elementary.get_information_schema_columns_materialized(),\n )\n}}\n{% if elementary.get_information_schema_columns_materialized() == \"view\" %}\n {{ elementary.get_information_schema_columns_query() }}\n{% else %}\n {{ elementary.get_empty_columns_from_information_schema_table() }}\n{% endif %}", "language": "sql", "refs": [{"name": "dbt_models", "package": null, "version": null}, {"name": "dbt_snapshots", "package": null, "version": null}, {"name": "dbt_sources", "package": null, "version": null}, {"name": "dbt_seeds", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.elementary.get_information_schema_columns_materialized", "macro.elementary.get_information_schema_columns_query"], "nodes": ["model.elementary.dbt_models", "model.elementary.dbt_snapshots", "model.elementary.dbt_sources", "model.elementary.dbt_seeds"]}, "compiled_path": "docs/compiled/elementary/models/edr/dbt_artifacts/information_schema_columns.sql", "compiled": true, "compiled_code": "\n\n \n \n \n \n\n with dbt_models_data as (\n select\n database_name,\n schema_name,\n alias as table_name\n from \"neondb\".\"dbt_testing_example_elementary\".\"dbt_models\"\n ),\n\n dbt_snapshots_data as (\n select\n database_name,\n schema_name,\n alias as table_name\n from \"neondb\".\"dbt_testing_example_elementary\".\"dbt_snapshots\"\n ),\n\n dbt_sources_data as (\n select\n database_name,\n schema_name,\n name as table_name\n from \"neondb\".\"dbt_testing_example_elementary\".\"dbt_sources\"\n ),\n\n dbt_seeds_data as (\n select\n database_name,\n schema_name,\n name as table_name\n from \"neondb\".\"dbt_testing_example_elementary\".\"dbt_seeds\"\n ),\n\n tables_information as (\n select * from dbt_models_data\n union all\n select * from dbt_sources_data\n union all\n select * from dbt_snapshots_data\n union all\n select * from dbt_seeds_data\n ),\n\n columns_information as (\n \n \n \n \n (\n select\n upper(table_catalog || '.' || table_schema || '.' || table_name) as full_table_name,\n upper(table_catalog) as database_name,\n upper(table_schema) as schema_name,\n upper(table_name) as table_name,\n upper(column_name) as column_name,\n data_type\n from information_schema.columns\n where upper(table_schema) = upper('dbt_testing_example')\n \n)\n \n \n\n\n\n ),\n\n information_schema_columns as (\n select col_info.*\n from tables_information tbl_info\n join columns_information col_info\n on (lower(tbl_info.database_name) = lower(col_info.database_name) and\n lower(tbl_info.schema_name) = lower(col_info.schema_name) and\n lower(tbl_info.table_name) = lower(col_info.table_name)\n )\n )\n\n select *\n from information_schema_columns\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.elementary.dbt_invocations": {"database": "neondb", "schema": "dbt_testing_example_elementary", "name": "dbt_invocations", "resource_type": "model", "package_name": "elementary", "path": "edr/dbt_artifacts/dbt_invocations.sql", "original_file_path": "models/edr/dbt_artifacts/dbt_invocations.sql", "unique_id": "model.elementary.dbt_invocations", "fqn": ["elementary", "edr", "dbt_artifacts", "dbt_invocations"], "alias": "dbt_invocations", "checksum": {"name": "sha256", "checksum": "6ec0cb09a0a3991db91ebd8a52625cc508faa4aac958138022aeaa3abb960755"}, "config": {"enabled": true, "alias": null, "schema": "elementary", "database": null, "tags": [], "meta": {"timestamp_column": "created_at", "prev_timestamp_column": "generated_at"}, "group": null, "materialized": "incremental", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": false, "unique_key": "invocation_id", "on_schema_change": "append_new_columns", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "transient": false, "table_type": null}, "tags": [], "description": "Attributes associated with each dbt invocation. Inserted at the end of each invocation.\n", "columns": {"invocation_id": {"name": "invocation_id", "description": "Primary key of this table.", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "run_started_at": {"name": "run_started_at", "description": "Timestamp the invocation was started.", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "run_completed_at": {"name": "run_completed_at", "description": "Timestamp the invocation was completed", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "generated_at": {"name": "generated_at", "description": "The time this invocation was uploaded to the database.", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "command": {"name": "command", "description": "dbt command that was used. For example, run.", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "dbt_version": {"name": "dbt_version", "description": "Version of dbt that was used in this invocation.", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "elementary_version": {"name": "elementary_version", "description": "Version of the elementary package that was used in this invocation.", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "full_refresh": {"name": "full_refresh", "description": "Whether or not this invocation was executed as a full-refresh.", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "invocation_vars": {"name": "invocation_vars", "description": "Dictionary of the variables (and values) that were declared in the invocation.", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "vars": {"name": "vars", "description": "Dictionary of all variables (and values) in the dbt project. If none were declared at runtime, these are the variables declared in dbt_project yml", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "target_name": {"name": "target_name", "description": "Name of the target used in this invocation.", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "target_database": {"name": "target_database", "description": "Name of the target database that was used in this invocation.", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "target_schema": {"name": "target_schema", "description": "Name of the target schema that was used in this invocation.", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "target_profile_name": {"name": "target_profile_name", "description": "Name of the dbt profile that was used in this invocation.", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "threads": {"name": "threads", "description": "Number of threads that were used to run this dbt invocation. (This number could impact the performance of a dbt invocation).", "meta": {}, "data_type": "integer", "constraints": [], "quote": null, "tags": []}, "selected": {"name": "selected", "description": "The selected resources in the dbt command. While this is a string in the database, this can easily be converted to an array.", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "yaml_selector": {"name": "yaml_selector", "description": "The yaml selector that was passed in this invocation.", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "job_id": {"name": "job_id", "description": "The ID of a job, defined in the `job_id` var or in the `JOB_ID` env var or by the orchestrator (dbt Cloud, GitHub Actions, etc).", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "job_name": {"name": "job_name", "description": "The name of a job, defined in the `job_name` var or in the `JOB_NAME` env var.", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "job_run_id": {"name": "job_run_id", "description": "The run ID of a job, defined in the `job_run_id` var or in the `DBT_JOB_RUN_ID` env var or by the orchestrator (dbt Cloud, GitHub Actions, etc).", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "env": {"name": "env", "description": "The environment's name, defined in the `DBT_ENV` env var.", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "env_id": {"name": "env_id", "description": "The ID of an environment, defined in the `DBT_ENV_ID` env var.", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "project_id": {"name": "project_id", "description": "The ID of a project, defined in the `DBT_PROJECT_ID` env var or by the orchestrator (dbt Cloud, GitHub Actions, etc).", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "cause_category": {"name": "cause_category", "description": "The category of the cause of the invocation. For example, if the invocation was triggered by a schedule, the cause category would be schedule.\nDefined in the `DBT_CAUSE_CATEGORY` env var or by the orchestrator (dbt Cloud, GitHub Actions, etc).\n", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "cause": {"name": "cause", "description": "The cause of the invocation. For example, if the invocation was triggered by a manual run, the cause would be _\"Kicked off by Joe.\"_.\nDefined in the `DBT_CAUSE` env var or by the orchestrator (dbt Cloud, GitHub Actions, etc).\n", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "pull_request_id": {"name": "pull_request_id", "description": "The ID of a pull request, defined in the `DBT_PULL_REQUEST_ID` env var or by the orchestrator (dbt Cloud, GitHub Actions, etc).", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "git_sha": {"name": "git_sha", "description": "The git SHA of the commit that was used in this invocation, defined in the `DBT_GIT_SHA` env var or by the orchestrator (dbt Cloud, GitHub Actions, etc).", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "orchestrator": {"name": "orchestrator", "description": "The orchestrator that was used to run this invocation, defined in the `orchestrator` var or in the `ORCHESTRATOR` env var or by the orchestrator env vars. For example, dbt Cloud, GitHub Actions, etc.", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "job_url": {"name": "job_url", "description": "The name of a job, defined in the `job_url` var or in the `JOB_URL` env var or by the orchestrator. For GitHub Actions orchestrator, the value is calculated.", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "account_id": {"name": "account_id", "description": "The ID of the account, defined in the `account_id` var or in the `ACCOUNT_ID` env var or by the orchestrator.", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}}, "meta": {"timestamp_column": "created_at", "prev_timestamp_column": "generated_at"}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "elementary://models/run_results.yml", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "incremental", "transient": false, "unique_key": "invocation_id", "on_schema_change": "append_new_columns", "full_refresh": false, "meta": {"timestamp_column": "created_at", "prev_timestamp_column": "generated_at"}, "table_type": null, "incremental_strategy": null, "schema": "elementary"}, "created_at": 1733549924.6335247, "relation_name": "\"neondb\".\"dbt_testing_example_elementary\".\"dbt_invocations\"", "raw_code": "{{\n config(\n materialized = 'incremental',\n transient=False,\n unique_key = 'invocation_id',\n on_schema_change = 'append_new_columns',\n full_refresh=elementary.get_config_var('elementary_full_refresh'),\n meta={\n \"timestamp_column\": \"created_at\",\n \"prev_timestamp_column\": \"generated_at\",\n },\n table_type=elementary.get_default_table_type(),\n incremental_strategy=elementary.get_default_incremental_strategy()\n )\n}}\n\n{{ elementary.get_dbt_invocations_empty_table_query() }}", "language": "sql", "refs": [], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.elementary.get_config_var", "macro.elementary.get_default_table_type", "macro.elementary.get_default_incremental_strategy", "macro.elementary.get_dbt_invocations_empty_table_query"], "nodes": []}, "compiled_path": "docs/compiled/elementary/models/edr/dbt_artifacts/dbt_invocations.sql", "compiled": true, "compiled_code": "\n\nselect * from (\n select\n \n \n cast('this_is_just_a_long_dummy_string' as text) as invocation_id\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as job_id\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as job_name\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as job_run_id\n\n,\n \n cast('dummy_string' as varchar(4096)) as run_started_at\n\n,\n \n cast('dummy_string' as varchar(4096)) as run_completed_at\n\n,\n \n cast('dummy_string' as varchar(4096)) as generated_at\n\n,\n cast('2091-02-17' as timestamp) as created_at\n\n,\n \n cast('dummy_string' as varchar(4096)) as command\n\n,\n \n cast('dummy_string' as varchar(4096)) as dbt_version\n\n,\n \n cast('dummy_string' as varchar(4096)) as elementary_version\n\n,\n \n cast (True as boolean) as full_refresh\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as invocation_vars\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as vars\n\n,\n \n cast('dummy_string' as varchar(4096)) as target_name\n\n,\n \n cast('dummy_string' as varchar(4096)) as target_database\n\n,\n \n cast('dummy_string' as varchar(4096)) as target_schema\n\n,\n \n cast('dummy_string' as varchar(4096)) as target_profile_name\n\n,\n \n cast(123456789 as integer) as threads\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as selected\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as yaml_selector\n\n,\n \n cast('dummy_string' as varchar(4096)) as project_id\n\n,\n \n cast('dummy_string' as varchar(4096)) as project_name\n\n,\n \n cast('dummy_string' as varchar(4096)) as env\n\n,\n \n cast('dummy_string' as varchar(4096)) as env_id\n\n,\n \n cast('dummy_string' as varchar(4096)) as cause_category\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as cause\n\n,\n \n cast('dummy_string' as varchar(4096)) as pull_request_id\n\n,\n \n cast('dummy_string' as varchar(4096)) as git_sha\n\n,\n \n cast('dummy_string' as varchar(4096)) as orchestrator\n\n,\n \n cast('dummy_string' as varchar(4096)) as dbt_user\n\n,\n \n cast('dummy_string' as varchar(4096)) as job_url\n\n,\n \n cast('dummy_string' as varchar(4096)) as job_run_url\n\n,\n \n cast('dummy_string' as varchar(4096)) as account_id\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as target_adapter_specific_fields\n\n\n ) as empty_table\n where 1 = 0", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.elementary.dbt_columns": {"database": "neondb", "schema": "dbt_testing_example_elementary", "name": "dbt_columns", "resource_type": "model", "package_name": "elementary", "path": "edr/dbt_artifacts/dbt_columns.sql", "original_file_path": "models/edr/dbt_artifacts/dbt_columns.sql", "unique_id": "model.elementary.dbt_columns", "fqn": ["elementary", "edr", "dbt_artifacts", "dbt_columns"], "alias": "dbt_columns", "checksum": {"name": "sha256", "checksum": "b8a1cdacc7886a9dc3c8595a28fe850e1c39090ca6da04e3431b6549b986dc99"}, "config": {"enabled": true, "alias": null, "schema": "elementary", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "incremental", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "{{ elementary.upload_dbt_columns() }}", "transaction": true, "index": null}], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": false, "unique_key": "unique_id", "on_schema_change": "sync_all_columns", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "transient": false, "table_type": null}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"materialized": "incremental", "transient": false, "unique_key": "unique_id", "on_schema_change": "sync_all_columns", "full_refresh": false, "table_type": null, "incremental_strategy": null, "post-hook": ["{{ elementary.upload_dbt_columns() }}"], "schema": "elementary"}, "created_at": 1733549924.0965905, "relation_name": "\"neondb\".\"dbt_testing_example_elementary\".\"dbt_columns\"", "raw_code": "{{\n config(\n materialized='incremental',\n transient=False,\n post_hook='{{ elementary.upload_dbt_columns() }}',\n unique_key='unique_id',\n on_schema_change='sync_all_columns',\n full_refresh=elementary.get_config_var('elementary_full_refresh'),\n table_type=elementary.get_default_table_type(),\n incremental_strategy=elementary.get_default_incremental_strategy()\n )\n}}\n\n{{ elementary.get_dbt_columns_empty_table_query() }}", "language": "sql", "refs": [], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.elementary.get_config_var", "macro.elementary.get_default_table_type", "macro.elementary.get_default_incremental_strategy", "macro.elementary.get_dbt_columns_empty_table_query", "macro.elementary.upload_dbt_columns"], "nodes": []}, "compiled_path": "docs/compiled/elementary/models/edr/dbt_artifacts/dbt_columns.sql", "compiled": true, "compiled_code": "\n\nselect * from (\n select\n \n \n cast('dummy_string' as varchar(4096)) as unique_id\n\n,\n \n cast('dummy_string' as varchar(4096)) as parent_unique_id\n\n,\n \n cast('dummy_string' as varchar(4096)) as name\n\n,\n \n cast('dummy_string' as varchar(4096)) as data_type\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as tags\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as meta\n\n,\n \n cast('dummy_string' as varchar(4096)) as database_name\n\n,\n \n cast('dummy_string' as varchar(4096)) as schema_name\n\n,\n \n cast('dummy_string' as varchar(4096)) as table_name\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as description\n\n,\n \n cast('dummy_string' as varchar(4096)) as resource_type\n\n,\n \n cast('dummy_string' as varchar(4096)) as generated_at\n\n,\n \n cast('dummy_string' as varchar(4096)) as metadata_hash\n\n\n ) as empty_table\n where 1 = 0", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.elementary.dbt_run_results": {"database": "neondb", "schema": "dbt_testing_example_elementary", "name": "dbt_run_results", "resource_type": "model", "package_name": "elementary", "path": "edr/dbt_artifacts/dbt_run_results.sql", "original_file_path": "models/edr/dbt_artifacts/dbt_run_results.sql", "unique_id": "model.elementary.dbt_run_results", "fqn": ["elementary", "edr", "dbt_artifacts", "dbt_run_results"], "alias": "dbt_run_results", "checksum": {"name": "sha256", "checksum": "9b2317042e53c953bc3839ef18c3e197d2c347ece4d5968731093dd324b349c5"}, "config": {"enabled": true, "alias": null, "schema": "elementary", "database": null, "tags": [], "meta": {"deprecated_columns": [{"name": "compiled_sql", "data_type": "string", "description": "The compiled SQL executed against the database."}], "dedup_by_column": "model_execution_id", "timestamp_column": "created_at", "prev_timestamp_column": "generated_at"}, "group": null, "materialized": "incremental", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": false, "unique_key": "model_execution_id", "on_schema_change": "append_new_columns", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "transient": false, "table_type": null}, "tags": [], "description": "Run results of dbt invocations, inserted at the end of each invocation. Each row is the invocation result of a single resource (model, test, snapshot, etc). New data is loaded to this model on an on-run-end hook named 'elementary.upload_run_results' from each invocation that produces a result object. This is an incremental model.\n", "columns": {"model_execution_id": {"name": "model_execution_id", "description": "Execution id generated by joining the unique_id of the resource and the invocation_id. This is the unique key of each row in this model.", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "unique_id": {"name": "unique_id", "description": "The unique id of the resource (would be similar for all executions of the same resource).", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "invocation_id": {"name": "invocation_id", "description": "The unique id of the invocation (would be similar for all resources executed on the same invocation). FK to dbt_invocations.", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "generated_at": {"name": "generated_at", "description": "", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "name": {"name": "name", "description": "Resource name.", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "message": {"name": "message", "description": "Execution results message returned by dbt.", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "status": {"name": "status", "description": "Execution result status (success, error, pass, fail)", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "resource_type": {"name": "resource_type", "description": "Resource type (model, test, snapshot, seed, etc)", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "execution_time": {"name": "execution_time", "description": "Resource execution duration in seconds.", "meta": {}, "data_type": "float", "constraints": [], "quote": null, "tags": []}, "execute_started_at": {"name": "execute_started_at", "description": "Start time of the execution.", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "execute_completed_at": {"name": "execute_completed_at", "description": "End time of the execution.", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "compile_started_at": {"name": "compile_started_at", "description": "Start time of resource compile action.", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "compile_completed_at": {"name": "compile_completed_at", "description": "End time of resource compile action.", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "rows_affected": {"name": "rows_affected", "description": "", "meta": {}, "data_type": "int", "constraints": [], "quote": null, "tags": []}, "full_refresh": {"name": "full_refresh", "description": "Was this a full refresh execution.", "meta": {}, "data_type": "boolean", "constraints": [], "quote": null, "tags": []}, "compiled_code": {"name": "compiled_code", "description": "The compiled code (SQL / Python) executed against the database.", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "failures": {"name": "failures", "description": "Number of failures in this run.", "meta": {}, "data_type": "int", "constraints": [], "quote": null, "tags": []}, "query_id": {"name": "query_id", "description": "Query ID in the data warehouse, if returned by the adapter (currently only supported in Snowflake, is null for any other adapter).", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "thread_id": {"name": "thread_id", "description": "Id of the thread of this resource run.", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "adapter_response": {"name": "adapter_response", "description": "Response returned by the adapter (Fields will be different for each adapters).", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}}, "meta": {"deprecated_columns": [{"name": "compiled_sql", "data_type": "string", "description": "The compiled SQL executed against the database."}], "dedup_by_column": "model_execution_id", "timestamp_column": "created_at", "prev_timestamp_column": "generated_at"}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "elementary://models/run_results.yml", "build_path": null, "deferred": false, "unrendered_config": {"meta": {"dedup_by_column": "model_execution_id", "timestamp_column": "created_at", "prev_timestamp_column": "generated_at"}, "materialized": "incremental", "transient": false, "unique_key": "model_execution_id", "on_schema_change": "append_new_columns", "full_refresh": false, "table_type": null, "incremental_strategy": null, "schema": "elementary"}, "created_at": 1733549924.642084, "relation_name": "\"neondb\".\"dbt_testing_example_elementary\".\"dbt_run_results\"", "raw_code": "{{\n config(\n materialized = 'incremental',\n transient=False,\n unique_key = 'model_execution_id',\n on_schema_change = 'append_new_columns',\n full_refresh=elementary.get_config_var('elementary_full_refresh'),\n meta={\n \"dedup_by_column\": \"model_execution_id\",\n \"timestamp_column\": \"created_at\",\n \"prev_timestamp_column\": \"generated_at\",\n },\n table_type=elementary.get_default_table_type(),\n incremental_strategy=elementary.get_default_incremental_strategy()\n )\n}}\n\n{{ elementary.get_dbt_run_results_empty_table_query() }}", "language": "sql", "refs": [], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.elementary.get_config_var", "macro.elementary.get_default_table_type", "macro.elementary.get_default_incremental_strategy", "macro.elementary.get_dbt_run_results_empty_table_query"], "nodes": []}, "compiled_path": "docs/compiled/elementary/models/edr/dbt_artifacts/dbt_run_results.sql", "compiled": true, "compiled_code": "\n\nselect * from (\n select\n \n \n cast('this_is_just_a_long_dummy_string' as text) as model_execution_id\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as unique_id\n\n,\n \n cast('dummy_string' as varchar(4096)) as invocation_id\n\n,\n \n cast('dummy_string' as varchar(4096)) as generated_at\n\n,\n cast('2091-02-17' as timestamp) as created_at\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as name\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as message\n\n,\n \n cast('dummy_string' as varchar(4096)) as status\n\n,\n \n cast('dummy_string' as varchar(4096)) as resource_type\n\n,\n \n cast(123456789.99 as float) as execution_time\n\n,\n \n cast('dummy_string' as varchar(4096)) as execute_started_at\n\n,\n \n cast('dummy_string' as varchar(4096)) as execute_completed_at\n\n,\n \n cast('dummy_string' as varchar(4096)) as compile_started_at\n\n,\n \n cast('dummy_string' as varchar(4096)) as compile_completed_at\n\n,\n \n cast(31474836478 as bigint) as rows_affected\n\n,\n \n cast (True as boolean) as full_refresh\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as compiled_code\n\n,\n \n cast(31474836478 as bigint) as failures\n\n,\n \n cast('dummy_string' as varchar(4096)) as query_id\n\n,\n \n cast('dummy_string' as varchar(4096)) as thread_id\n\n,\n \n cast('dummy_string' as varchar(4096)) as materialization\n\n,\n \n cast('dummy_string' as varchar(4096)) as adapter_response\n\n\n ) as empty_table\n where 1 = 0", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.elementary.alerts_anomaly_detection": {"database": "neondb", "schema": "dbt_testing_example_elementary", "name": "alerts_anomaly_detection", "resource_type": "model", "package_name": "elementary", "path": "edr/alerts/alerts_anomaly_detection.sql", "original_file_path": "models/edr/alerts/alerts_anomaly_detection.sql", "unique_id": "model.elementary.alerts_anomaly_detection", "fqn": ["elementary", "edr", "alerts", "alerts_anomaly_detection"], "alias": "alerts_anomaly_detection", "checksum": {"name": "sha256", "checksum": "0d2bb9c33ded81e6501643abeeacde1b21695f406b861f748923e4bd9ce0c4c8"}, "config": {"enabled": true, "alias": null, "schema": "elementary", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": [], "description": "A view that is used by the Elementary CLI to generate alerts on data anomalies detected using the elementary anomaly detection tests. The view filters alerts according to configuration.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "elementary://models/alerts_views.yml", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "view", "bind": false, "schema": "elementary"}, "created_at": 1733549924.645145, "relation_name": "\"neondb\".\"dbt_testing_example_elementary\".\"alerts_anomaly_detection\"", "raw_code": "{{\n config(\n materialized = 'view',\n bind =False\n )\n}}\n\nwith elementary_test_results as (\n select * from {{ ref('elementary_test_results') }}\n),\n\nalerts_anomaly_detection as (\n select id as alert_id,\n data_issue_id,\n test_execution_id,\n test_unique_id,\n model_unique_id,\n detected_at,\n database_name,\n schema_name,\n table_name,\n column_name,\n test_type as alert_type,\n test_sub_type as sub_type,\n test_results_description as alert_description,\n owners,\n tags,\n test_results_query as alert_results_query,\n other,\n test_name,\n test_short_name,\n test_params,\n severity,\n status,\n result_rows\n from elementary_test_results\n where {{ not elementary.get_config_var('disable_test_alerts') }} and lower(status) != 'pass' {%- if elementary.get_config_var('disable_warn_alerts') -%} and lower(status) != 'warn' {%- endif -%} {%- if elementary.get_config_var('disable_skipped_test_alerts') -%} and lower(status) != 'skipped' {%- endif -%} and test_type = 'anomaly_detection'\n)\n\nselect * from alerts_anomaly_detection", "language": "sql", "refs": [{"name": "elementary_test_results", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt_testing_example.ref", "macro.elementary.get_config_var"], "nodes": ["model.elementary.elementary_test_results"]}, "compiled_path": "docs/compiled/elementary/models/edr/alerts/alerts_anomaly_detection.sql", "compiled": true, "compiled_code": "\n\nwith elementary_test_results as (\n select * from \"neondb\".\"dbt_testing_example_elementary\".\"elementary_test_results\"\n),\n\nalerts_anomaly_detection as (\n select id as alert_id,\n data_issue_id,\n test_execution_id,\n test_unique_id,\n model_unique_id,\n detected_at,\n database_name,\n schema_name,\n table_name,\n column_name,\n test_type as alert_type,\n test_sub_type as sub_type,\n test_results_description as alert_description,\n owners,\n tags,\n test_results_query as alert_results_query,\n other,\n test_name,\n test_short_name,\n test_params,\n severity,\n status,\n result_rows\n from elementary_test_results\n where True and lower(status) != 'pass'and lower(status) != 'skipped'and test_type = 'anomaly_detection'\n)\n\nselect * from alerts_anomaly_detection", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.elementary.alerts_dbt_tests": {"database": "neondb", "schema": "dbt_testing_example_elementary", "name": "alerts_dbt_tests", "resource_type": "model", "package_name": "elementary", "path": "edr/alerts/alerts_dbt_tests.sql", "original_file_path": "models/edr/alerts/alerts_dbt_tests.sql", "unique_id": "model.elementary.alerts_dbt_tests", "fqn": ["elementary", "edr", "alerts", "alerts_dbt_tests"], "alias": "alerts_dbt_tests", "checksum": {"name": "sha256", "checksum": "d15f2b4a7ade165ad09b2b9f6d143d9d47ab0f080b2de5dce1c6fae9e30375ba"}, "config": {"enabled": true, "alias": null, "schema": "elementary", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": [], "description": "A view that is used by the Elementary CLI to generate dbt tests alerts, including all the fields the alert will include such as owner, tags, error message, etc. This view includes data about all dbt tests except elementary tests. It filters alerts according to configuration.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "elementary://models/alerts_views.yml", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "view", "bind": false, "schema": "elementary"}, "created_at": 1733549924.6447327, "relation_name": "\"neondb\".\"dbt_testing_example_elementary\".\"alerts_dbt_tests\"", "raw_code": "{{\n config(\n materialized = 'view',\n bind=False\n )\n}}\n\nwith elementary_test_results as (\n select * from {{ ref('elementary_test_results') }}\n),\n\nalerts_dbt_tests as (\n select id as alert_id,\n data_issue_id,\n test_execution_id,\n test_unique_id,\n model_unique_id,\n detected_at,\n database_name,\n schema_name,\n table_name,\n column_name,\n test_type as alert_type,\n test_sub_type as sub_type,\n test_results_description as alert_description,\n owners,\n tags,\n test_results_query as alert_results_query,\n other,\n test_name,\n test_short_name,\n test_params,\n severity,\n status,\n result_rows\n from elementary_test_results\n where {{ not elementary.get_config_var('disable_test_alerts') }} and lower(status) != 'pass' {% if elementary.get_config_var('disable_warn_alerts') %} and lower(status) != 'warn' {% endif %} {% if elementary.get_config_var('disable_skipped_test_alerts') %} and lower(status) != 'skipped' {% endif %} and test_type = 'dbt_test'\n)\n\nselect * from alerts_dbt_tests", "language": "sql", "refs": [{"name": "elementary_test_results", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt_testing_example.ref", "macro.elementary.get_config_var"], "nodes": ["model.elementary.elementary_test_results"]}, "compiled_path": "docs/compiled/elementary/models/edr/alerts/alerts_dbt_tests.sql", "compiled": true, "compiled_code": "\n\nwith elementary_test_results as (\n select * from \"neondb\".\"dbt_testing_example_elementary\".\"elementary_test_results\"\n),\n\nalerts_dbt_tests as (\n select id as alert_id,\n data_issue_id,\n test_execution_id,\n test_unique_id,\n model_unique_id,\n detected_at,\n database_name,\n schema_name,\n table_name,\n column_name,\n test_type as alert_type,\n test_sub_type as sub_type,\n test_results_description as alert_description,\n owners,\n tags,\n test_results_query as alert_results_query,\n other,\n test_name,\n test_short_name,\n test_params,\n severity,\n status,\n result_rows\n from elementary_test_results\n where True and lower(status) != 'pass' and lower(status) != 'skipped' and test_type = 'dbt_test'\n)\n\nselect * from alerts_dbt_tests", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.elementary.alerts_schema_changes": {"database": "neondb", "schema": "dbt_testing_example_elementary", "name": "alerts_schema_changes", "resource_type": "model", "package_name": "elementary", "path": "edr/alerts/alerts_schema_changes.sql", "original_file_path": "models/edr/alerts/alerts_schema_changes.sql", "unique_id": "model.elementary.alerts_schema_changes", "fqn": ["elementary", "edr", "alerts", "alerts_schema_changes"], "alias": "alerts_schema_changes", "checksum": {"name": "sha256", "checksum": "bad7007c54d8885efe0496bd6289998cfed84a250ada4899fb8e53765236db0b"}, "config": {"enabled": true, "alias": null, "schema": "elementary", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": [], "description": "A view that is used by the Elementary CLI to generate alerts on schema changes detected using elementary tests. The view filters alerts according to configuration.", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "elementary://models/alerts_views.yml", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "view", "bind": false, "schema": "elementary"}, "created_at": 1733549924.6455305, "relation_name": "\"neondb\".\"dbt_testing_example_elementary\".\"alerts_schema_changes\"", "raw_code": "{{\n config(\n materialized = 'view',\n bind=False,\n )\n}}\n\n\nwith elementary_test_results as (\n select * from {{ ref('elementary_test_results') }}\n),\n\nalerts_schema_changes as (\n select id as alert_id,\n data_issue_id,\n test_execution_id,\n test_unique_id,\n model_unique_id,\n detected_at,\n database_name,\n schema_name,\n table_name,\n column_name,\n test_type as alert_type,\n test_sub_type as sub_type,\n test_results_description as alert_description,\n owners,\n tags,\n test_results_query as alert_results_query,\n other,\n test_name,\n test_short_name,\n test_params,\n severity,\n status,\n result_rows\n from elementary_test_results\n where {{ not elementary.get_config_var('disable_test_alerts') }} and lower(status) != 'pass' {%- if elementary.get_config_var('disable_warn_alerts') -%} and lower(status) != 'warn' {%- endif -%} {%- if elementary.get_config_var('disable_skipped_test_alerts') -%} and lower(status) != 'skipped' {%- endif -%} and test_type = 'schema_change'\n)\n\nselect * from alerts_schema_changes", "language": "sql", "refs": [{"name": "elementary_test_results", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt_testing_example.ref", "macro.elementary.get_config_var"], "nodes": ["model.elementary.elementary_test_results"]}, "compiled_path": "docs/compiled/elementary/models/edr/alerts/alerts_schema_changes.sql", "compiled": true, "compiled_code": "\n\n\nwith elementary_test_results as (\n select * from \"neondb\".\"dbt_testing_example_elementary\".\"elementary_test_results\"\n),\n\nalerts_schema_changes as (\n select id as alert_id,\n data_issue_id,\n test_execution_id,\n test_unique_id,\n model_unique_id,\n detected_at,\n database_name,\n schema_name,\n table_name,\n column_name,\n test_type as alert_type,\n test_sub_type as sub_type,\n test_results_description as alert_description,\n owners,\n tags,\n test_results_query as alert_results_query,\n other,\n test_name,\n test_short_name,\n test_params,\n severity,\n status,\n result_rows\n from elementary_test_results\n where True and lower(status) != 'pass'and lower(status) != 'skipped'and test_type = 'schema_change'\n)\n\nselect * from alerts_schema_changes", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.elementary.alerts_dbt_source_freshness": {"database": "neondb", "schema": "dbt_testing_example_elementary", "name": "alerts_dbt_source_freshness", "resource_type": "model", "package_name": "elementary", "path": "edr/alerts/alerts_dbt_source_freshness.sql", "original_file_path": "models/edr/alerts/alerts_dbt_source_freshness.sql", "unique_id": "model.elementary.alerts_dbt_source_freshness", "fqn": ["elementary", "edr", "alerts", "alerts_dbt_source_freshness"], "alias": "alerts_dbt_source_freshness", "checksum": {"name": "sha256", "checksum": "59b6900cf93ce1ac9e61f07c3358a21aecda80b7980e55e4387c80ea3463f012"}, "config": {"enabled": true, "alias": null, "schema": "elementary", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"materialized": "view", "bind": false, "schema": "elementary"}, "created_at": 1733549924.1662283, "relation_name": "\"neondb\".\"dbt_testing_example_elementary\".\"alerts_dbt_source_freshness\"", "raw_code": "{{\n config(\n materialized = 'view',\n bind=False\n )\n}}\n\nwith results as (\n select * from {{ ref('dbt_source_freshness_results') }}\n),\n\nsources as (\n select * from {{ ref('dbt_sources') }}\n)\n\nselect\n results.source_freshness_execution_id as alert_id,\n results.max_loaded_at,\n results.snapshotted_at,\n {{ elementary.edr_cast_as_timestamp(\"results.generated_at\") }} as detected_at,\n results.max_loaded_at_time_ago_in_s,\n results.status,\n results.error,\n results.warn_after,\n results.error_after,\n results.filter,\n sources.unique_id,\n sources.database_name,\n sources.schema_name,\n sources.source_name,\n sources.identifier,\n sources.tags,\n sources.meta,\n sources.owner,\n sources.package_name,\n sources.path,\n -- These columns below are deprecated. We add them since this view\n -- was used to be loaded into an incremental model with those columns, their names were later changed\n -- and Databricks doesn't respect `on_schema_change = 'append_new_columns'` properly, as described here -\n -- https://docs.databricks.com/en/delta/update-schema.html#automatic-schema-evolution-for-delta-lake-merge\n results.error_after as freshness_error_after,\n results.warn_after as freshness_warn_after,\n results.filter as freshness_filter\nfrom results\njoin sources on results.unique_id = sources.unique_id\nwhere {{ not elementary.get_config_var('disable_source_freshness_alerts') }} and lower(status) != 'pass'", "language": "sql", "refs": [{"name": "dbt_source_freshness_results", "package": null, "version": null}, {"name": "dbt_sources", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt_testing_example.ref", "macro.elementary.edr_cast_as_timestamp", "macro.elementary.get_config_var"], "nodes": ["model.elementary.dbt_source_freshness_results", "model.elementary.dbt_sources"]}, "compiled_path": "docs/compiled/elementary/models/edr/alerts/alerts_dbt_source_freshness.sql", "compiled": true, "compiled_code": "\n\nwith results as (\n select * from \"neondb\".\"dbt_testing_example_elementary\".\"dbt_source_freshness_results\"\n),\n\nsources as (\n select * from \"neondb\".\"dbt_testing_example_elementary\".\"dbt_sources\"\n)\n\nselect\n results.source_freshness_execution_id as alert_id,\n results.max_loaded_at,\n results.snapshotted_at,\n cast(results.generated_at as timestamp) as detected_at,\n results.max_loaded_at_time_ago_in_s,\n results.status,\n results.error,\n results.warn_after,\n results.error_after,\n results.filter,\n sources.unique_id,\n sources.database_name,\n sources.schema_name,\n sources.source_name,\n sources.identifier,\n sources.tags,\n sources.meta,\n sources.owner,\n sources.package_name,\n sources.path,\n -- These columns below are deprecated. We add them since this view\n -- was used to be loaded into an incremental model with those columns, their names were later changed\n -- and Databricks doesn't respect `on_schema_change = 'append_new_columns'` properly, as described here -\n -- https://docs.databricks.com/en/delta/update-schema.html#automatic-schema-evolution-for-delta-lake-merge\n results.error_after as freshness_error_after,\n results.warn_after as freshness_warn_after,\n results.filter as freshness_filter\nfrom results\njoin sources on results.unique_id = sources.unique_id\nwhere True and lower(status) != 'pass'", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "model.elementary.alerts_dbt_models": {"database": "neondb", "schema": "dbt_testing_example_elementary", "name": "alerts_dbt_models", "resource_type": "model", "package_name": "elementary", "path": "edr/alerts/alerts_dbt_models.sql", "original_file_path": "models/edr/alerts/alerts_dbt_models.sql", "unique_id": "model.elementary.alerts_dbt_models", "fqn": ["elementary", "edr", "alerts", "alerts_dbt_models"], "alias": "alerts_dbt_models", "checksum": {"name": "sha256", "checksum": "6b76b9a7b5f40ef4f9ff316fe90b4d48451442cafac243dc5abf0ac10b4c67eb"}, "config": {"enabled": true, "alias": null, "schema": "elementary", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected", "bind": false}, "tags": [], "description": "A view that is used by the Elementary CLI to generate models alerts, including all the fields the alert will include such as owner, tags, error message, etc. It joins data about models and snapshots run results, and filters alerts according to configuration.\n", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "elementary://models/alerts_views.yml", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "view", "bind": false, "schema": "elementary"}, "created_at": 1733549924.644338, "relation_name": "\"neondb\".\"dbt_testing_example_elementary\".\"alerts_dbt_models\"", "raw_code": "{{\n config(\n materialized = 'view',\n bind=False\n )\n}}\n\nwith error_models as (\n \n select model_execution_id,\n unique_id,\n invocation_id,\n name,\n generated_at,\n status,\n full_refresh,\n message,\n execution_time,\n execute_started_at,\n execute_completed_at,\n compile_started_at,\n compile_completed_at,\n compiled_code,\n database_name,\n schema_name,\n materialization,\n tags,\n package_name,\n path,\n original_path,\n owner,\n alias \n from {{ ref('model_run_results') }}\n \n union all\n \n select model_execution_id,\n unique_id,\n invocation_id,\n name,\n generated_at,\n status,\n full_refresh,\n message,\n execution_time,\n execute_started_at,\n execute_completed_at,\n compile_started_at,\n compile_completed_at,\n compiled_code,\n database_name,\n schema_name,\n materialization,\n tags,\n package_name,\n path,\n original_path,\n owner,\n alias \n from {{ ref('snapshot_run_results') }}\n)\n\n\nselect model_execution_id as alert_id,\n unique_id,\n {{ elementary.edr_cast_as_timestamp(\"generated_at\") }} as detected_at,\n database_name,\n materialization,\n path,\n original_path,\n schema_name,\n message,\n owner as owners,\n tags,\n alias,\n status,\n full_refresh\nfrom error_models\nwhere {{ not elementary.get_config_var('disable_model_alerts') }} and lower(status) != 'success' {%- if elementary.get_config_var('disable_skipped_model_alerts') -%} and lower(status) != 'skipped' {%- endif -%}", "language": "sql", "refs": [{"name": "model_run_results", "package": null, "version": null}, {"name": "snapshot_run_results", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt_testing_example.ref", "macro.elementary.edr_cast_as_timestamp", "macro.elementary.get_config_var"], "nodes": ["model.elementary.model_run_results", "model.elementary.snapshot_run_results"]}, "compiled_path": "docs/compiled/elementary/models/edr/alerts/alerts_dbt_models.sql", "compiled": true, "compiled_code": "\n\nwith error_models as (\n \n select model_execution_id,\n unique_id,\n invocation_id,\n name,\n generated_at,\n status,\n full_refresh,\n message,\n execution_time,\n execute_started_at,\n execute_completed_at,\n compile_started_at,\n compile_completed_at,\n compiled_code,\n database_name,\n schema_name,\n materialization,\n tags,\n package_name,\n path,\n original_path,\n owner,\n alias \n from \"neondb\".\"dbt_testing_example_elementary\".\"model_run_results\"\n \n union all\n \n select model_execution_id,\n unique_id,\n invocation_id,\n name,\n generated_at,\n status,\n full_refresh,\n message,\n execution_time,\n execute_started_at,\n execute_completed_at,\n compile_started_at,\n compile_completed_at,\n compiled_code,\n database_name,\n schema_name,\n materialization,\n tags,\n package_name,\n path,\n original_path,\n owner,\n alias \n from \"neondb\".\"dbt_testing_example_elementary\".\"snapshot_run_results\"\n)\n\n\nselect model_execution_id as alert_id,\n unique_id,\n cast(generated_at as timestamp) as detected_at,\n database_name,\n materialization,\n path,\n original_path,\n schema_name,\n message,\n owner as owners,\n tags,\n alias,\n status,\n full_refresh\nfrom error_models\nwhere True and lower(status) != 'success'and lower(status) != 'skipped'", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "access": "protected", "constraints": [], "version": null, "latest_version": null, "deprecation_date": null}, "operation.elementary.elementary-on-run-start-0": {"database": "neondb", "schema": "dbt_testing_example_elementary", "name": "elementary-on-run-start-0", "resource_type": "operation", "package_name": "elementary", "path": "hooks/elementary-on-run-start-0.sql", "original_file_path": "./dbt_project.yml", "unique_id": "operation.elementary.elementary-on-run-start-0", "fqn": ["elementary", "hooks", "elementary-on-run-start-0"], "alias": "elementary-on-run-start-0", "checksum": {"name": "sha256", "checksum": "da13aaa45ef707af2fbf54b62c3cc9c25b73bc6e2d3eecf27a8e8ae46b2b2cd5"}, "config": {"enabled": true, "alias": null, "schema": "elementary", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}}, "tags": ["on-run-start"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"schema": "elementary"}, "created_at": 1733549924.260228, "relation_name": null, "raw_code": "{{ elementary.on_run_start() }}", "language": "sql", "refs": [], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.elementary.on_run_start"], "nodes": []}, "compiled_path": "docs/compiled/elementary/./dbt_project.yml/hooks/elementary-on-run-start-0.sql", "compiled": true, "compiled_code": "\n \n \n\n \n \n\n \n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "index": 0}, "operation.elementary.elementary-on-run-end-0": {"database": "neondb", "schema": "dbt_testing_example_elementary", "name": "elementary-on-run-end-0", "resource_type": "operation", "package_name": "elementary", "path": "hooks/elementary-on-run-end-0.sql", "original_file_path": "./dbt_project.yml", "unique_id": "operation.elementary.elementary-on-run-end-0", "fqn": ["elementary", "hooks", "elementary-on-run-end-0"], "alias": "elementary-on-run-end-0", "checksum": {"name": "sha256", "checksum": "da13aaa45ef707af2fbf54b62c3cc9c25b73bc6e2d3eecf27a8e8ae46b2b2cd5"}, "config": {"enabled": true, "alias": null, "schema": "elementary", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}}, "tags": ["on-run-end"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"schema": "elementary"}, "created_at": 1733549924.2690434, "relation_name": null, "raw_code": "{{ elementary.on_run_end() }}", "language": "sql", "refs": [], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.elementary.on_run_end"], "nodes": []}, "compiled_path": "docs/compiled/elementary/./dbt_project.yml/hooks/elementary-on-run-end-0.sql", "compiled": true, "compiled_code": "\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "index": 0}, "test.dbt_testing_example.relationships_body_mass_indexes_user_id__user_id__source_gym_app_raw_height_.d338d193c2": {"test_metadata": {"name": "relationships", "kwargs": {"to": "source('gym_app', 'raw_height')", "field": "user_id", "column_name": "user_id", "model": "{{ get_where_subquery(ref('body_mass_indexes')) }}"}, "namespace": null}, "database": "neondb", "schema": "dbt_testing_example_dbt_test__audit", "name": "relationships_body_mass_indexes_user_id__user_id__source_gym_app_raw_height_", "resource_type": "test", "package_name": "dbt_testing_example", "path": "relationships_body_mass_indexe_2ce2c0087b52cfa92fbe92bbf3d083f4.sql", "original_file_path": "models/marts/_body_mass_indexes__models.yml", "unique_id": "test.dbt_testing_example.relationships_body_mass_indexes_user_id__user_id__source_gym_app_raw_height_.d338d193c2", "fqn": ["dbt_testing_example", "marts", "relationships_body_mass_indexes_user_id__user_id__source_gym_app_raw_height_"], "alias": "relationships_body_mass_indexe_2ce2c0087b52cfa92fbe92bbf3d083f4", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "relationships_body_mass_indexe_2ce2c0087b52cfa92fbe92bbf3d083f4", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": ["data-quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "relationships_body_mass_indexe_2ce2c0087b52cfa92fbe92bbf3d083f4"}, "created_at": 1733549924.4733806, "relation_name": null, "raw_code": "{{ test_relationships(**_dbt_generic_test_kwargs) }}{{ config(alias=\"relationships_body_mass_indexe_2ce2c0087b52cfa92fbe92bbf3d083f4\") }}", "language": "sql", "refs": [{"name": "body_mass_indexes", "package": null, "version": null}], "sources": [["gym_app", "raw_height"]], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_relationships", "macro.dbt.get_where_subquery", "macro.dbt_testing_example.source", "macro.dbt_testing_example.ref"], "nodes": ["source.dbt_testing_example.gym_app.raw_height", "model.dbt_testing_example.body_mass_indexes"]}, "compiled_path": "docs/compiled/dbt_testing_example/models/marts/_body_mass_indexes__models.yml/relationships_body_mass_indexe_2ce2c0087b52cfa92fbe92bbf3d083f4.sql", "compiled": true, "compiled_code": "\n \n \n\nwith child as (\n select user_id as from_field\n from \"neondb\".\"dbt_testing_example\".\"body_mass_indexes\"\n where user_id is not null\n),\n\nparent as (\n select user_id as to_field\n from \"neondb\".\"dbt_testing_example\".\"raw_height\"\n)\n\nselect\n from_field\n\nfrom child\nleft join parent\n on child.from_field = parent.to_field\n\nwhere parent.to_field is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "user_id", "file_key_name": "models.body_mass_indexes", "attached_node": "model.dbt_testing_example.body_mass_indexes"}, "test.dbt_testing_example.relationships_body_mass_indexes_user_id__user_id__source_gym_app_raw_weight_.1ef253afa0": {"test_metadata": {"name": "relationships", "kwargs": {"to": "source('gym_app', 'raw_weight')", "field": "user_id", "column_name": "user_id", "model": "{{ get_where_subquery(ref('body_mass_indexes')) }}"}, "namespace": null}, "database": "neondb", "schema": "dbt_testing_example_dbt_test__audit", "name": "relationships_body_mass_indexes_user_id__user_id__source_gym_app_raw_weight_", "resource_type": "test", "package_name": "dbt_testing_example", "path": "relationships_body_mass_indexe_49d5aa6bb90fb311de636b464ab53ae0.sql", "original_file_path": "models/marts/_body_mass_indexes__models.yml", "unique_id": "test.dbt_testing_example.relationships_body_mass_indexes_user_id__user_id__source_gym_app_raw_weight_.1ef253afa0", "fqn": ["dbt_testing_example", "marts", "relationships_body_mass_indexes_user_id__user_id__source_gym_app_raw_weight_"], "alias": "relationships_body_mass_indexe_49d5aa6bb90fb311de636b464ab53ae0", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "relationships_body_mass_indexe_49d5aa6bb90fb311de636b464ab53ae0", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": ["data-quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "relationships_body_mass_indexe_49d5aa6bb90fb311de636b464ab53ae0"}, "created_at": 1733549924.4834025, "relation_name": null, "raw_code": "{{ test_relationships(**_dbt_generic_test_kwargs) }}{{ config(alias=\"relationships_body_mass_indexe_49d5aa6bb90fb311de636b464ab53ae0\") }}", "language": "sql", "refs": [{"name": "body_mass_indexes", "package": null, "version": null}], "sources": [["gym_app", "raw_weight"]], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_relationships", "macro.dbt.get_where_subquery", "macro.dbt_testing_example.source", "macro.dbt_testing_example.ref"], "nodes": ["source.dbt_testing_example.gym_app.raw_weight", "model.dbt_testing_example.body_mass_indexes"]}, "compiled_path": "docs/compiled/dbt_testing_example/models/marts/_body_mass_indexes__models.yml/relationships_body_mass_indexe_49d5aa6bb90fb311de636b464ab53ae0.sql", "compiled": true, "compiled_code": "\n \n \n\nwith child as (\n select user_id as from_field\n from \"neondb\".\"dbt_testing_example\".\"body_mass_indexes\"\n where user_id is not null\n),\n\nparent as (\n select user_id as to_field\n from \"neondb\".\"dbt_testing_example\".\"raw_weight\"\n)\n\nselect\n from_field\n\nfrom child\nleft join parent\n on child.from_field = parent.to_field\n\nwhere parent.to_field is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "user_id", "file_key_name": "models.body_mass_indexes", "attached_node": "model.dbt_testing_example.body_mass_indexes"}, "test.dbt_testing_example.elementary_schema_changes_body_mass_indexes_.5e7b3caf3a": {"test_metadata": {"name": "schema_changes", "kwargs": {"model": "{{ get_where_subquery(ref('body_mass_indexes')) }}"}, "namespace": "elementary"}, "database": "neondb", "schema": "dbt_testing_example_dbt_test__audit", "name": "elementary_schema_changes_body_mass_indexes_", "resource_type": "test", "package_name": "dbt_testing_example", "path": "elementary_schema_changes_body_mass_indexes_.sql", "original_file_path": "models/marts/_body_mass_indexes__models.yml", "unique_id": "test.dbt_testing_example.elementary_schema_changes_body_mass_indexes_.5e7b3caf3a", "fqn": ["dbt_testing_example", "marts", "elementary_schema_changes_body_mass_indexes_"], "alias": "elementary_schema_changes_body_mass_indexes_", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": ["elementary-tests", "data-quality"], "meta": {}, "group": null, "materialized": "test", "severity": "warn", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": ["data-quality", "elementary-tests"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"tags": ["elementary-tests", "data-quality"], "severity": "warn"}, "created_at": 1733549924.4882526, "relation_name": null, "raw_code": "{{ elementary.test_schema_changes(**_dbt_generic_test_kwargs) }}{{ config(severity=\"warn\",tags=['data-quality']) }}", "language": "sql", "refs": [{"name": "body_mass_indexes", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.elementary.test_schema_changes", "macro.dbt.get_where_subquery", "macro.dbt_testing_example.ref"], "nodes": ["model.dbt_testing_example.body_mass_indexes"]}, "compiled_path": "docs/compiled/dbt_testing_example/models/marts/_body_mass_indexes__models.yml/elementary_schema_changes_body_mass_indexes_.sql", "compiled": true, "compiled_code": "\n \n\n \n \n with nothing as (select 1 as num)\n select * from nothing where num = 2\n\n\n \n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": null, "file_key_name": "models.body_mass_indexes", "attached_node": "model.dbt_testing_example.body_mass_indexes"}, "test.dbt_testing_example.elementary_volume_anomalies_body_mass_indexes_.c1d889d103": {"test_metadata": {"name": "volume_anomalies", "kwargs": {"model": "{{ get_where_subquery(ref('body_mass_indexes')) }}"}, "namespace": "elementary"}, "database": "neondb", "schema": "dbt_testing_example_dbt_test__audit", "name": "elementary_volume_anomalies_body_mass_indexes_", "resource_type": "test", "package_name": "dbt_testing_example", "path": "elementary_volume_anomalies_body_mass_indexes_.sql", "original_file_path": "models/marts/_body_mass_indexes__models.yml", "unique_id": "test.dbt_testing_example.elementary_volume_anomalies_body_mass_indexes_.c1d889d103", "fqn": ["dbt_testing_example", "marts", "elementary_volume_anomalies_body_mass_indexes_"], "alias": "elementary_volume_anomalies_body_mass_indexes_", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": ["elementary-tests", "elementary-tests", "data-quality"], "meta": {}, "group": null, "materialized": "test", "severity": "warn", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": ["data-quality", "elementary-tests"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"tags": ["elementary-tests", "elementary-tests", "data-quality"], "severity": "warn"}, "created_at": 1733549924.5007823, "relation_name": null, "raw_code": "{{ elementary.test_volume_anomalies(**_dbt_generic_test_kwargs) }}{{ config(severity=\"warn\",tags=['data-quality']) }}", "language": "sql", "refs": [{"name": "body_mass_indexes", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.elementary.test_volume_anomalies", "macro.dbt.get_where_subquery", "macro.dbt_testing_example.ref"], "nodes": ["model.dbt_testing_example.body_mass_indexes"]}, "compiled_path": "docs/compiled/dbt_testing_example/models/marts/_body_mass_indexes__models.yml/elementary_volume_anomalies_body_mass_indexes_.sql", "compiled": true, "compiled_code": "\n \n\n \n \n\n \n \n with nothing as (select 1 as num)\n select * from nothing where num = 2\n\n\n \n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": null, "file_key_name": "models.body_mass_indexes", "attached_node": "model.dbt_testing_example.body_mass_indexes"}, "test.dbt_testing_example.elementary_freshness_anomalies_body_mass_indexes_hour__2__processed_at.e39d6b3299": {"test_metadata": {"name": "freshness_anomalies", "kwargs": {"timestamp_column": "processed_at", "time_bucket": {"period": "hour", "count": 2}, "model": "{{ get_where_subquery(ref('body_mass_indexes')) }}"}, "namespace": "elementary"}, "database": "neondb", "schema": "dbt_testing_example_dbt_test__audit", "name": "elementary_freshness_anomalies_body_mass_indexes_hour__2__processed_at", "resource_type": "test", "package_name": "dbt_testing_example", "path": "elementary_freshness_anomalies_9a86bd6e410f746dbd11fda53a1b4dbb.sql", "original_file_path": "models/marts/_body_mass_indexes__models.yml", "unique_id": "test.dbt_testing_example.elementary_freshness_anomalies_body_mass_indexes_hour__2__processed_at.e39d6b3299", "fqn": ["dbt_testing_example", "marts", "elementary_freshness_anomalies_body_mass_indexes_hour__2__processed_at"], "alias": "elementary_freshness_anomalies_9a86bd6e410f746dbd11fda53a1b4dbb", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "elementary_freshness_anomalies_9a86bd6e410f746dbd11fda53a1b4dbb", "schema": "dbt_test__audit", "database": null, "tags": ["elementary-tests", "elementary-tests", "data-quality"], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": ["data-quality", "elementary-tests"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"tags": ["elementary-tests", "elementary-tests", "data-quality"], "alias": "elementary_freshness_anomalies_9a86bd6e410f746dbd11fda53a1b4dbb"}, "created_at": 1733549924.5227396, "relation_name": null, "raw_code": "{{ elementary.test_freshness_anomalies(**_dbt_generic_test_kwargs) }}{{ config(tags=['data-quality'],alias=\"elementary_freshness_anomalies_9a86bd6e410f746dbd11fda53a1b4dbb\") }}", "language": "sql", "refs": [{"name": "body_mass_indexes", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.elementary.test_freshness_anomalies", "macro.dbt.get_where_subquery", "macro.dbt_testing_example.ref"], "nodes": ["model.dbt_testing_example.body_mass_indexes"]}, "compiled_path": "docs/compiled/dbt_testing_example/models/marts/_body_mass_indexes__models.yml/elementary_freshness_anomalies_9a86bd6e410f746dbd11fda53a1b4dbb.sql", "compiled": true, "compiled_code": "\n \n \n \n\n \n \n with nothing as (select 1 as num)\n select * from nothing where num = 2\n\n\n \n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": null, "file_key_name": "models.body_mass_indexes", "attached_node": "model.dbt_testing_example.body_mass_indexes"}, "test.dbt_testing_example.dbt_expectations_source_expect_column_values_to_be_of_type_gym_app_raw_height_height_unit__text.c82161c012": {"test_metadata": {"name": "expect_column_values_to_be_of_type", "kwargs": {"column_type": "text", "column_name": "height_unit", "model": "{{ get_where_subquery(source('gym_app', 'raw_height')) }}"}, "namespace": "dbt_expectations"}, "database": "neondb", "schema": "dbt_testing_example_dbt_test__audit", "name": "dbt_expectations_source_expect_column_values_to_be_of_type_gym_app_raw_height_height_unit__text", "resource_type": "test", "package_name": "dbt_testing_example", "path": "dbt_expectations_source_expect_d25b7d4c2c9fca23113cd8cbcfb14445.sql", "original_file_path": "models/staging/gym_app/_gym_app__raw_height_schema.yml", "unique_id": "test.dbt_testing_example.dbt_expectations_source_expect_column_values_to_be_of_type_gym_app_raw_height_height_unit__text.c82161c012", "fqn": ["dbt_testing_example", "staging", "gym_app", "dbt_expectations_source_expect_column_values_to_be_of_type_gym_app_raw_height_height_unit__text"], "alias": "dbt_expectations_source_expect_d25b7d4c2c9fca23113cd8cbcfb14445", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "dbt_expectations_source_expect_d25b7d4c2c9fca23113cd8cbcfb14445", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": ["contract-test-source", "data-quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_expectations_source_expect_d25b7d4c2c9fca23113cd8cbcfb14445"}, "created_at": 1733549924.679908, "relation_name": null, "raw_code": "{{ dbt_expectations.test_expect_column_values_to_be_of_type(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_expectations_source_expect_d25b7d4c2c9fca23113cd8cbcfb14445\") }}", "language": "sql", "refs": [], "sources": [["gym_app", "raw_height"]], "metrics": [], "depends_on": {"macros": ["macro.dbt_expectations.test_expect_column_values_to_be_of_type", "macro.dbt.get_where_subquery", "macro.dbt_testing_example.source"], "nodes": ["source.dbt_testing_example.gym_app.raw_height"]}, "compiled_path": "docs/compiled/dbt_testing_example/models/staging/gym_app/_gym_app__raw_height_schema.yml/dbt_expectations_source_expect_d25b7d4c2c9fca23113cd8cbcfb14445.sql", "compiled": true, "compiled_code": "with relation_columns as (\n\n \n select\n cast('DATE' as TEXT) as relation_column,\n cast('TEXT' as TEXT) as relation_column_type\n union all\n \n select\n cast('USER_ID' as TEXT) as relation_column,\n cast('INTEGER' as TEXT) as relation_column_type\n union all\n \n select\n cast('HEIGHT' as TEXT) as relation_column,\n cast('DOUBLE PRECISION' as TEXT) as relation_column_type\n union all\n \n select\n cast('HEIGHT_UNIT' as TEXT) as relation_column,\n cast('TEXT' as TEXT) as relation_column_type\n \n \n ),\n test_data as (\n\n select\n *\n from\n relation_columns\n where\n relation_column = 'HEIGHT_UNIT'\n and\n relation_column_type not in ('TEXT')\n\n )\n select *\n from test_data", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "height_unit", "file_key_name": "sources.gym_app", "attached_node": null}, "test.dbt_testing_example.source_accepted_values_gym_app_raw_height_height_unit__cm__inches.f4af351a08": {"test_metadata": {"name": "accepted_values", "kwargs": {"values": ["cm", "inches"], "column_name": "height_unit", "model": "{{ get_where_subquery(source('gym_app', 'raw_height')) }}"}, "namespace": null}, "database": "neondb", "schema": "dbt_testing_example_dbt_test__audit", "name": "source_accepted_values_gym_app_raw_height_height_unit__cm__inches", "resource_type": "test", "package_name": "dbt_testing_example", "path": "source_accepted_values_gym_app_3616a0039aa603ccf6fea0c6e492ff79.sql", "original_file_path": "models/staging/gym_app/_gym_app__raw_height_schema.yml", "unique_id": "test.dbt_testing_example.source_accepted_values_gym_app_raw_height_height_unit__cm__inches.f4af351a08", "fqn": ["dbt_testing_example", "staging", "gym_app", "source_accepted_values_gym_app_raw_height_height_unit__cm__inches"], "alias": "source_accepted_values_gym_app_3616a0039aa603ccf6fea0c6e492ff79", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "source_accepted_values_gym_app_3616a0039aa603ccf6fea0c6e492ff79", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": ["contract-test-source", "data-quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "source_accepted_values_gym_app_3616a0039aa603ccf6fea0c6e492ff79"}, "created_at": 1733549924.6891243, "relation_name": null, "raw_code": "{{ test_accepted_values(**_dbt_generic_test_kwargs) }}{{ config(alias=\"source_accepted_values_gym_app_3616a0039aa603ccf6fea0c6e492ff79\") }}", "language": "sql", "refs": [], "sources": [["gym_app", "raw_height"]], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_accepted_values", "macro.dbt.get_where_subquery", "macro.dbt_testing_example.source"], "nodes": ["source.dbt_testing_example.gym_app.raw_height"]}, "compiled_path": "docs/compiled/dbt_testing_example/models/staging/gym_app/_gym_app__raw_height_schema.yml/source_accepted_values_gym_app_3616a0039aa603ccf6fea0c6e492ff79.sql", "compiled": true, "compiled_code": "\n \n \n\nwith all_values as (\n\n select\n height_unit as value_field,\n count(*) as n_records\n\n from \"neondb\".\"dbt_testing_example\".\"raw_height\"\n group by height_unit\n\n)\n\nselect *\nfrom all_values\nwhere value_field not in (\n 'cm','inches'\n)\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "height_unit", "file_key_name": "sources.gym_app", "attached_node": null}, "test.dbt_testing_example.source_not_null_gym_app_raw_height_user_id.4fb45a730a": {"test_metadata": {"name": "not_null", "kwargs": {"column_name": "user_id", "model": "{{ get_where_subquery(source('gym_app', 'raw_height')) }}"}, "namespace": null}, "database": "neondb", "schema": "dbt_testing_example_dbt_test__audit", "name": "source_not_null_gym_app_raw_height_user_id", "resource_type": "test", "package_name": "dbt_testing_example", "path": "source_not_null_gym_app_raw_height_user_id.sql", "original_file_path": "models/staging/gym_app/_gym_app__raw_height_schema.yml", "unique_id": "test.dbt_testing_example.source_not_null_gym_app_raw_height_user_id.4fb45a730a", "fqn": ["dbt_testing_example", "staging", "gym_app", "source_not_null_gym_app_raw_height_user_id"], "alias": "source_not_null_gym_app_raw_height_user_id", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": ["contract-test-source", "data-quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1733549924.6969485, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "language": "sql", "refs": [], "sources": [["gym_app", "raw_height"]], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt_testing_example.source", "macro.dbt.get_where_subquery"], "nodes": ["source.dbt_testing_example.gym_app.raw_height"]}, "compiled_path": "docs/compiled/dbt_testing_example/models/staging/gym_app/_gym_app__raw_height_schema.yml/source_not_null_gym_app_raw_height_user_id.sql", "compiled": true, "compiled_code": "\n \n \n\n\n\nselect user_id\nfrom \"neondb\".\"dbt_testing_example\".\"raw_height\"\nwhere user_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "user_id", "file_key_name": "sources.gym_app", "attached_node": null}, "test.dbt_testing_example.dbt_expectations_source_expect_column_values_to_be_of_type_gym_app_raw_height_user_id__integer.14569ac5f0": {"test_metadata": {"name": "expect_column_values_to_be_of_type", "kwargs": {"column_type": "integer", "column_name": "user_id", "model": "{{ get_where_subquery(source('gym_app', 'raw_height')) }}"}, "namespace": "dbt_expectations"}, "database": "neondb", "schema": "dbt_testing_example_dbt_test__audit", "name": "dbt_expectations_source_expect_column_values_to_be_of_type_gym_app_raw_height_user_id__integer", "resource_type": "test", "package_name": "dbt_testing_example", "path": "dbt_expectations_source_expect_d058c5e89bb36317bea26ae649047e21.sql", "original_file_path": "models/staging/gym_app/_gym_app__raw_height_schema.yml", "unique_id": "test.dbt_testing_example.dbt_expectations_source_expect_column_values_to_be_of_type_gym_app_raw_height_user_id__integer.14569ac5f0", "fqn": ["dbt_testing_example", "staging", "gym_app", "dbt_expectations_source_expect_column_values_to_be_of_type_gym_app_raw_height_user_id__integer"], "alias": "dbt_expectations_source_expect_d058c5e89bb36317bea26ae649047e21", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "dbt_expectations_source_expect_d058c5e89bb36317bea26ae649047e21", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": ["contract-test-source", "data-quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_expectations_source_expect_d058c5e89bb36317bea26ae649047e21"}, "created_at": 1733549924.6985912, "relation_name": null, "raw_code": "{{ dbt_expectations.test_expect_column_values_to_be_of_type(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_expectations_source_expect_d058c5e89bb36317bea26ae649047e21\") }}", "language": "sql", "refs": [], "sources": [["gym_app", "raw_height"]], "metrics": [], "depends_on": {"macros": ["macro.dbt_expectations.test_expect_column_values_to_be_of_type", "macro.dbt.get_where_subquery", "macro.dbt_testing_example.source"], "nodes": ["source.dbt_testing_example.gym_app.raw_height"]}, "compiled_path": "docs/compiled/dbt_testing_example/models/staging/gym_app/_gym_app__raw_height_schema.yml/dbt_expectations_source_expect_d058c5e89bb36317bea26ae649047e21.sql", "compiled": true, "compiled_code": "with relation_columns as (\n\n \n select\n cast('DATE' as TEXT) as relation_column,\n cast('TEXT' as TEXT) as relation_column_type\n union all\n \n select\n cast('USER_ID' as TEXT) as relation_column,\n cast('INTEGER' as TEXT) as relation_column_type\n union all\n \n select\n cast('HEIGHT' as TEXT) as relation_column,\n cast('DOUBLE PRECISION' as TEXT) as relation_column_type\n union all\n \n select\n cast('HEIGHT_UNIT' as TEXT) as relation_column,\n cast('TEXT' as TEXT) as relation_column_type\n \n \n ),\n test_data as (\n\n select\n *\n from\n relation_columns\n where\n relation_column = 'USER_ID'\n and\n relation_column_type not in ('INTEGER')\n\n )\n select *\n from test_data", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "user_id", "file_key_name": "sources.gym_app", "attached_node": null}, "test.dbt_testing_example.source_not_null_gym_app_raw_height_height.e7ed26fbfe": {"test_metadata": {"name": "not_null", "kwargs": {"column_name": "height", "model": "{{ get_where_subquery(source('gym_app', 'raw_height')) }}"}, "namespace": null}, "database": "neondb", "schema": "dbt_testing_example_dbt_test__audit", "name": "source_not_null_gym_app_raw_height_height", "resource_type": "test", "package_name": "dbt_testing_example", "path": "source_not_null_gym_app_raw_height_height.sql", "original_file_path": "models/staging/gym_app/_gym_app__raw_height_schema.yml", "unique_id": "test.dbt_testing_example.source_not_null_gym_app_raw_height_height.e7ed26fbfe", "fqn": ["dbt_testing_example", "staging", "gym_app", "source_not_null_gym_app_raw_height_height"], "alias": "source_not_null_gym_app_raw_height_height", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": ["contract-test-source", "data-quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1733549924.7026122, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "language": "sql", "refs": [], "sources": [["gym_app", "raw_height"]], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt_testing_example.source", "macro.dbt.get_where_subquery"], "nodes": ["source.dbt_testing_example.gym_app.raw_height"]}, "compiled_path": "docs/compiled/dbt_testing_example/models/staging/gym_app/_gym_app__raw_height_schema.yml/source_not_null_gym_app_raw_height_height.sql", "compiled": true, "compiled_code": "\n \n \n\n\n\nselect height\nfrom \"neondb\".\"dbt_testing_example\".\"raw_height\"\nwhere height is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "height", "file_key_name": "sources.gym_app", "attached_node": null}, "test.dbt_testing_example.dbt_expectations_source_expect_column_values_to_be_of_type_gym_app_raw_height_height__double_precision.1f5b371f9e": {"test_metadata": {"name": "expect_column_values_to_be_of_type", "kwargs": {"column_type": "double precision", "column_name": "height", "model": "{{ get_where_subquery(source('gym_app', 'raw_height')) }}"}, "namespace": "dbt_expectations"}, "database": "neondb", "schema": "dbt_testing_example_dbt_test__audit", "name": "dbt_expectations_source_expect_column_values_to_be_of_type_gym_app_raw_height_height__double_precision", "resource_type": "test", "package_name": "dbt_testing_example", "path": "dbt_expectations_source_expect_89d58c60a30ca33e201a445d2f77dbfa.sql", "original_file_path": "models/staging/gym_app/_gym_app__raw_height_schema.yml", "unique_id": "test.dbt_testing_example.dbt_expectations_source_expect_column_values_to_be_of_type_gym_app_raw_height_height__double_precision.1f5b371f9e", "fqn": ["dbt_testing_example", "staging", "gym_app", "dbt_expectations_source_expect_column_values_to_be_of_type_gym_app_raw_height_height__double_precision"], "alias": "dbt_expectations_source_expect_89d58c60a30ca33e201a445d2f77dbfa", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "dbt_expectations_source_expect_89d58c60a30ca33e201a445d2f77dbfa", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": ["contract-test-source", "data-quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_expectations_source_expect_89d58c60a30ca33e201a445d2f77dbfa"}, "created_at": 1733549924.7041726, "relation_name": null, "raw_code": "{{ dbt_expectations.test_expect_column_values_to_be_of_type(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_expectations_source_expect_89d58c60a30ca33e201a445d2f77dbfa\") }}", "language": "sql", "refs": [], "sources": [["gym_app", "raw_height"]], "metrics": [], "depends_on": {"macros": ["macro.dbt_expectations.test_expect_column_values_to_be_of_type", "macro.dbt.get_where_subquery", "macro.dbt_testing_example.source"], "nodes": ["source.dbt_testing_example.gym_app.raw_height"]}, "compiled_path": "docs/compiled/dbt_testing_example/models/staging/gym_app/_gym_app__raw_height_schema.yml/dbt_expectations_source_expect_89d58c60a30ca33e201a445d2f77dbfa.sql", "compiled": true, "compiled_code": "with relation_columns as (\n\n \n select\n cast('DATE' as TEXT) as relation_column,\n cast('TEXT' as TEXT) as relation_column_type\n union all\n \n select\n cast('USER_ID' as TEXT) as relation_column,\n cast('INTEGER' as TEXT) as relation_column_type\n union all\n \n select\n cast('HEIGHT' as TEXT) as relation_column,\n cast('DOUBLE PRECISION' as TEXT) as relation_column_type\n union all\n \n select\n cast('HEIGHT_UNIT' as TEXT) as relation_column,\n cast('TEXT' as TEXT) as relation_column_type\n \n \n ),\n test_data as (\n\n select\n *\n from\n relation_columns\n where\n relation_column = 'HEIGHT'\n and\n relation_column_type not in ('DOUBLE PRECISION')\n\n )\n select *\n from test_data", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "height", "file_key_name": "sources.gym_app", "attached_node": null}, "test.dbt_testing_example.dbt_utils_source_accepted_range_gym_app_raw_height_height__False__0.0dd5e14a3d": {"test_metadata": {"name": "accepted_range", "kwargs": {"min_value": 0, "inclusive": false, "column_name": "height", "model": "{{ get_where_subquery(source('gym_app', 'raw_height')) }}"}, "namespace": "dbt_utils"}, "database": "neondb", "schema": "dbt_testing_example_dbt_test__audit", "name": "dbt_utils_source_accepted_range_gym_app_raw_height_height__False__0", "resource_type": "test", "package_name": "dbt_testing_example", "path": "dbt_utils_source_accepted_rang_f11d86b3627432fa821d885e1ad1b432.sql", "original_file_path": "models/staging/gym_app/_gym_app__raw_height_schema.yml", "unique_id": "test.dbt_testing_example.dbt_utils_source_accepted_range_gym_app_raw_height_height__False__0.0dd5e14a3d", "fqn": ["dbt_testing_example", "staging", "gym_app", "dbt_utils_source_accepted_range_gym_app_raw_height_height__False__0"], "alias": "dbt_utils_source_accepted_rang_f11d86b3627432fa821d885e1ad1b432", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "dbt_utils_source_accepted_rang_f11d86b3627432fa821d885e1ad1b432", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": ["contract-test-source", "data-quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_source_accepted_rang_f11d86b3627432fa821d885e1ad1b432"}, "created_at": 1733549924.708577, "relation_name": null, "raw_code": "{{ dbt_utils.test_accepted_range(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_source_accepted_rang_f11d86b3627432fa821d885e1ad1b432\") }}", "language": "sql", "refs": [], "sources": [["gym_app", "raw_height"]], "metrics": [], "depends_on": {"macros": ["macro.dbt_utils.test_accepted_range", "macro.dbt.get_where_subquery", "macro.dbt_testing_example.source"], "nodes": ["source.dbt_testing_example.gym_app.raw_height"]}, "compiled_path": "docs/compiled/dbt_testing_example/models/staging/gym_app/_gym_app__raw_height_schema.yml/dbt_utils_source_accepted_rang_f11d86b3627432fa821d885e1ad1b432.sql", "compiled": true, "compiled_code": "\n\nwith meet_condition as(\n select *\n from \"neondb\".\"dbt_testing_example\".\"raw_height\"\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 -- records with a value >= min_value are permitted. The `not` flips this to find records that don't meet the rule.\n or not height > 0\n)\n\nselect *\nfrom validation_errors\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "height", "file_key_name": "sources.gym_app", "attached_node": null}, "test.dbt_testing_example.dbt_expectations_source_expect_column_values_to_be_of_type_gym_app_raw_weight_measurement_unit__text.7271116707": {"test_metadata": {"name": "expect_column_values_to_be_of_type", "kwargs": {"column_type": "text", "column_name": "measurement_unit", "model": "{{ get_where_subquery(source('gym_app', 'raw_weight')) }}"}, "namespace": "dbt_expectations"}, "database": "neondb", "schema": "dbt_testing_example_dbt_test__audit", "name": "dbt_expectations_source_expect_column_values_to_be_of_type_gym_app_raw_weight_measurement_unit__text", "resource_type": "test", "package_name": "dbt_testing_example", "path": "dbt_expectations_source_expect_c30c42d8522b41e4f8a1a6e266d8e221.sql", "original_file_path": "models/staging/gym_app/_gym_app__raw_weight_schema.yml", "unique_id": "test.dbt_testing_example.dbt_expectations_source_expect_column_values_to_be_of_type_gym_app_raw_weight_measurement_unit__text.7271116707", "fqn": ["dbt_testing_example", "staging", "gym_app", "dbt_expectations_source_expect_column_values_to_be_of_type_gym_app_raw_weight_measurement_unit__text"], "alias": "dbt_expectations_source_expect_c30c42d8522b41e4f8a1a6e266d8e221", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "dbt_expectations_source_expect_c30c42d8522b41e4f8a1a6e266d8e221", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": ["contract-test-source", "data-quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_expectations_source_expect_c30c42d8522b41e4f8a1a6e266d8e221"}, "created_at": 1733549924.7182467, "relation_name": null, "raw_code": "{{ dbt_expectations.test_expect_column_values_to_be_of_type(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_expectations_source_expect_c30c42d8522b41e4f8a1a6e266d8e221\") }}", "language": "sql", "refs": [], "sources": [["gym_app", "raw_weight"]], "metrics": [], "depends_on": {"macros": ["macro.dbt_expectations.test_expect_column_values_to_be_of_type", "macro.dbt.get_where_subquery", "macro.dbt_testing_example.source"], "nodes": ["source.dbt_testing_example.gym_app.raw_weight"]}, "compiled_path": "docs/compiled/dbt_testing_example/models/staging/gym_app/_gym_app__raw_weight_schema.yml/dbt_expectations_source_expect_c30c42d8522b41e4f8a1a6e266d8e221.sql", "compiled": true, "compiled_code": "with relation_columns as (\n\n \n select\n cast('DATE' as TEXT) as relation_column,\n cast('TEXT' as TEXT) as relation_column_type\n union all\n \n select\n cast('USER_ID' as TEXT) as relation_column,\n cast('INTEGER' as TEXT) as relation_column_type\n union all\n \n select\n cast('WEIGHT' as TEXT) as relation_column,\n cast('DOUBLE PRECISION' as TEXT) as relation_column_type\n union all\n \n select\n cast('MEASUREMENT_UNIT' as TEXT) as relation_column,\n cast('TEXT' as TEXT) as relation_column_type\n \n \n ),\n test_data as (\n\n select\n *\n from\n relation_columns\n where\n relation_column = 'MEASUREMENT_UNIT'\n and\n relation_column_type not in ('TEXT')\n\n )\n select *\n from test_data", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "measurement_unit", "file_key_name": "sources.gym_app", "attached_node": null}, "test.dbt_testing_example.source_accepted_values_gym_app_raw_weight_measurement_unit__kg__pounds.0e8337c1da": {"test_metadata": {"name": "accepted_values", "kwargs": {"values": ["kg", "pounds"], "column_name": "measurement_unit", "model": "{{ get_where_subquery(source('gym_app', 'raw_weight')) }}"}, "namespace": null}, "database": "neondb", "schema": "dbt_testing_example_dbt_test__audit", "name": "source_accepted_values_gym_app_raw_weight_measurement_unit__kg__pounds", "resource_type": "test", "package_name": "dbt_testing_example", "path": "source_accepted_values_gym_app_c4d9451d981a8445339c3a0120cf5a76.sql", "original_file_path": "models/staging/gym_app/_gym_app__raw_weight_schema.yml", "unique_id": "test.dbt_testing_example.source_accepted_values_gym_app_raw_weight_measurement_unit__kg__pounds.0e8337c1da", "fqn": ["dbt_testing_example", "staging", "gym_app", "source_accepted_values_gym_app_raw_weight_measurement_unit__kg__pounds"], "alias": "source_accepted_values_gym_app_c4d9451d981a8445339c3a0120cf5a76", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "source_accepted_values_gym_app_c4d9451d981a8445339c3a0120cf5a76", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": ["contract-test-source", "data-quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "source_accepted_values_gym_app_c4d9451d981a8445339c3a0120cf5a76"}, "created_at": 1733549924.722311, "relation_name": null, "raw_code": "{{ test_accepted_values(**_dbt_generic_test_kwargs) }}{{ config(alias=\"source_accepted_values_gym_app_c4d9451d981a8445339c3a0120cf5a76\") }}", "language": "sql", "refs": [], "sources": [["gym_app", "raw_weight"]], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_accepted_values", "macro.dbt.get_where_subquery", "macro.dbt_testing_example.source"], "nodes": ["source.dbt_testing_example.gym_app.raw_weight"]}, "compiled_path": "docs/compiled/dbt_testing_example/models/staging/gym_app/_gym_app__raw_weight_schema.yml/source_accepted_values_gym_app_c4d9451d981a8445339c3a0120cf5a76.sql", "compiled": true, "compiled_code": "\n \n \n\nwith all_values as (\n\n select\n measurement_unit as value_field,\n count(*) as n_records\n\n from \"neondb\".\"dbt_testing_example\".\"raw_weight\"\n group by measurement_unit\n\n)\n\nselect *\nfrom all_values\nwhere value_field not in (\n 'kg','pounds'\n)\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "measurement_unit", "file_key_name": "sources.gym_app", "attached_node": null}, "test.dbt_testing_example.source_not_null_gym_app_raw_weight_user_id.e854c4fcc8": {"test_metadata": {"name": "not_null", "kwargs": {"column_name": "user_id", "model": "{{ get_where_subquery(source('gym_app', 'raw_weight')) }}"}, "namespace": null}, "database": "neondb", "schema": "dbt_testing_example_dbt_test__audit", "name": "source_not_null_gym_app_raw_weight_user_id", "resource_type": "test", "package_name": "dbt_testing_example", "path": "source_not_null_gym_app_raw_weight_user_id.sql", "original_file_path": "models/staging/gym_app/_gym_app__raw_weight_schema.yml", "unique_id": "test.dbt_testing_example.source_not_null_gym_app_raw_weight_user_id.e854c4fcc8", "fqn": ["dbt_testing_example", "staging", "gym_app", "source_not_null_gym_app_raw_weight_user_id"], "alias": "source_not_null_gym_app_raw_weight_user_id", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": ["contract-test-source", "data-quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1733549924.7275803, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "language": "sql", "refs": [], "sources": [["gym_app", "raw_weight"]], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt_testing_example.source", "macro.dbt.get_where_subquery"], "nodes": ["source.dbt_testing_example.gym_app.raw_weight"]}, "compiled_path": "docs/compiled/dbt_testing_example/models/staging/gym_app/_gym_app__raw_weight_schema.yml/source_not_null_gym_app_raw_weight_user_id.sql", "compiled": true, "compiled_code": "\n \n \n\n\n\nselect user_id\nfrom \"neondb\".\"dbt_testing_example\".\"raw_weight\"\nwhere user_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "user_id", "file_key_name": "sources.gym_app", "attached_node": null}, "test.dbt_testing_example.dbt_expectations_source_expect_column_values_to_be_of_type_gym_app_raw_weight_user_id__integer.feda35ce32": {"test_metadata": {"name": "expect_column_values_to_be_of_type", "kwargs": {"column_type": "integer", "column_name": "user_id", "model": "{{ get_where_subquery(source('gym_app', 'raw_weight')) }}"}, "namespace": "dbt_expectations"}, "database": "neondb", "schema": "dbt_testing_example_dbt_test__audit", "name": "dbt_expectations_source_expect_column_values_to_be_of_type_gym_app_raw_weight_user_id__integer", "resource_type": "test", "package_name": "dbt_testing_example", "path": "dbt_expectations_source_expect_b59b3be08112542eac611e15e1c084e5.sql", "original_file_path": "models/staging/gym_app/_gym_app__raw_weight_schema.yml", "unique_id": "test.dbt_testing_example.dbt_expectations_source_expect_column_values_to_be_of_type_gym_app_raw_weight_user_id__integer.feda35ce32", "fqn": ["dbt_testing_example", "staging", "gym_app", "dbt_expectations_source_expect_column_values_to_be_of_type_gym_app_raw_weight_user_id__integer"], "alias": "dbt_expectations_source_expect_b59b3be08112542eac611e15e1c084e5", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "dbt_expectations_source_expect_b59b3be08112542eac611e15e1c084e5", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": ["contract-test-source", "data-quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_expectations_source_expect_b59b3be08112542eac611e15e1c084e5"}, "created_at": 1733549924.7291641, "relation_name": null, "raw_code": "{{ dbt_expectations.test_expect_column_values_to_be_of_type(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_expectations_source_expect_b59b3be08112542eac611e15e1c084e5\") }}", "language": "sql", "refs": [], "sources": [["gym_app", "raw_weight"]], "metrics": [], "depends_on": {"macros": ["macro.dbt_expectations.test_expect_column_values_to_be_of_type", "macro.dbt.get_where_subquery", "macro.dbt_testing_example.source"], "nodes": ["source.dbt_testing_example.gym_app.raw_weight"]}, "compiled_path": "docs/compiled/dbt_testing_example/models/staging/gym_app/_gym_app__raw_weight_schema.yml/dbt_expectations_source_expect_b59b3be08112542eac611e15e1c084e5.sql", "compiled": true, "compiled_code": "with relation_columns as (\n\n \n select\n cast('DATE' as TEXT) as relation_column,\n cast('TEXT' as TEXT) as relation_column_type\n union all\n \n select\n cast('USER_ID' as TEXT) as relation_column,\n cast('INTEGER' as TEXT) as relation_column_type\n union all\n \n select\n cast('WEIGHT' as TEXT) as relation_column,\n cast('DOUBLE PRECISION' as TEXT) as relation_column_type\n union all\n \n select\n cast('MEASUREMENT_UNIT' as TEXT) as relation_column,\n cast('TEXT' as TEXT) as relation_column_type\n \n \n ),\n test_data as (\n\n select\n *\n from\n relation_columns\n where\n relation_column = 'USER_ID'\n and\n relation_column_type not in ('INTEGER')\n\n )\n select *\n from test_data", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "user_id", "file_key_name": "sources.gym_app", "attached_node": null}, "test.dbt_testing_example.source_not_null_gym_app_raw_weight_weight.3cc3503e9d": {"test_metadata": {"name": "not_null", "kwargs": {"column_name": "weight", "model": "{{ get_where_subquery(source('gym_app', 'raw_weight')) }}"}, "namespace": null}, "database": "neondb", "schema": "dbt_testing_example_dbt_test__audit", "name": "source_not_null_gym_app_raw_weight_weight", "resource_type": "test", "package_name": "dbt_testing_example", "path": "source_not_null_gym_app_raw_weight_weight.sql", "original_file_path": "models/staging/gym_app/_gym_app__raw_weight_schema.yml", "unique_id": "test.dbt_testing_example.source_not_null_gym_app_raw_weight_weight.3cc3503e9d", "fqn": ["dbt_testing_example", "staging", "gym_app", "source_not_null_gym_app_raw_weight_weight"], "alias": "source_not_null_gym_app_raw_weight_weight", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": ["contract-test-source", "data-quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1733549924.7333176, "relation_name": null, "raw_code": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "language": "sql", "refs": [], "sources": [["gym_app", "raw_weight"]], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt_testing_example.source", "macro.dbt.get_where_subquery"], "nodes": ["source.dbt_testing_example.gym_app.raw_weight"]}, "compiled_path": "docs/compiled/dbt_testing_example/models/staging/gym_app/_gym_app__raw_weight_schema.yml/source_not_null_gym_app_raw_weight_weight.sql", "compiled": true, "compiled_code": "\n \n \n\n\n\nselect weight\nfrom \"neondb\".\"dbt_testing_example\".\"raw_weight\"\nwhere weight is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "weight", "file_key_name": "sources.gym_app", "attached_node": null}, "test.dbt_testing_example.dbt_expectations_source_expect_column_values_to_be_of_type_gym_app_raw_weight_weight__double_precision.0c34285381": {"test_metadata": {"name": "expect_column_values_to_be_of_type", "kwargs": {"column_type": "double precision", "column_name": "weight", "model": "{{ get_where_subquery(source('gym_app', 'raw_weight')) }}"}, "namespace": "dbt_expectations"}, "database": "neondb", "schema": "dbt_testing_example_dbt_test__audit", "name": "dbt_expectations_source_expect_column_values_to_be_of_type_gym_app_raw_weight_weight__double_precision", "resource_type": "test", "package_name": "dbt_testing_example", "path": "dbt_expectations_source_expect_ddae5a39468609ab9f63dbccf2db995c.sql", "original_file_path": "models/staging/gym_app/_gym_app__raw_weight_schema.yml", "unique_id": "test.dbt_testing_example.dbt_expectations_source_expect_column_values_to_be_of_type_gym_app_raw_weight_weight__double_precision.0c34285381", "fqn": ["dbt_testing_example", "staging", "gym_app", "dbt_expectations_source_expect_column_values_to_be_of_type_gym_app_raw_weight_weight__double_precision"], "alias": "dbt_expectations_source_expect_ddae5a39468609ab9f63dbccf2db995c", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "dbt_expectations_source_expect_ddae5a39468609ab9f63dbccf2db995c", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": ["contract-test-source", "data-quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_expectations_source_expect_ddae5a39468609ab9f63dbccf2db995c"}, "created_at": 1733549924.7349143, "relation_name": null, "raw_code": "{{ dbt_expectations.test_expect_column_values_to_be_of_type(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_expectations_source_expect_ddae5a39468609ab9f63dbccf2db995c\") }}", "language": "sql", "refs": [], "sources": [["gym_app", "raw_weight"]], "metrics": [], "depends_on": {"macros": ["macro.dbt_expectations.test_expect_column_values_to_be_of_type", "macro.dbt.get_where_subquery", "macro.dbt_testing_example.source"], "nodes": ["source.dbt_testing_example.gym_app.raw_weight"]}, "compiled_path": "docs/compiled/dbt_testing_example/models/staging/gym_app/_gym_app__raw_weight_schema.yml/dbt_expectations_source_expect_ddae5a39468609ab9f63dbccf2db995c.sql", "compiled": true, "compiled_code": "with relation_columns as (\n\n \n select\n cast('DATE' as TEXT) as relation_column,\n cast('TEXT' as TEXT) as relation_column_type\n union all\n \n select\n cast('USER_ID' as TEXT) as relation_column,\n cast('INTEGER' as TEXT) as relation_column_type\n union all\n \n select\n cast('WEIGHT' as TEXT) as relation_column,\n cast('DOUBLE PRECISION' as TEXT) as relation_column_type\n union all\n \n select\n cast('MEASUREMENT_UNIT' as TEXT) as relation_column,\n cast('TEXT' as TEXT) as relation_column_type\n \n \n ),\n test_data as (\n\n select\n *\n from\n relation_columns\n where\n relation_column = 'WEIGHT'\n and\n relation_column_type not in ('DOUBLE PRECISION')\n\n )\n select *\n from test_data", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "weight", "file_key_name": "sources.gym_app", "attached_node": null}, "test.dbt_testing_example.dbt_utils_source_accepted_range_gym_app_raw_weight_weight__False__0.2147fe640d": {"test_metadata": {"name": "accepted_range", "kwargs": {"min_value": 0, "inclusive": false, "column_name": "weight", "model": "{{ get_where_subquery(source('gym_app', 'raw_weight')) }}"}, "namespace": "dbt_utils"}, "database": "neondb", "schema": "dbt_testing_example_dbt_test__audit", "name": "dbt_utils_source_accepted_range_gym_app_raw_weight_weight__False__0", "resource_type": "test", "package_name": "dbt_testing_example", "path": "dbt_utils_source_accepted_rang_8c3cff7ac664119087ba60052df6c918.sql", "original_file_path": "models/staging/gym_app/_gym_app__raw_weight_schema.yml", "unique_id": "test.dbt_testing_example.dbt_utils_source_accepted_range_gym_app_raw_weight_weight__False__0.2147fe640d", "fqn": ["dbt_testing_example", "staging", "gym_app", "dbt_utils_source_accepted_range_gym_app_raw_weight_weight__False__0"], "alias": "dbt_utils_source_accepted_rang_8c3cff7ac664119087ba60052df6c918", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "dbt_utils_source_accepted_rang_8c3cff7ac664119087ba60052df6c918", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "test", "severity": "ERROR", "store_failures": null, "store_failures_as": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "tags": ["contract-test-source", "data-quality"], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_source_accepted_rang_8c3cff7ac664119087ba60052df6c918"}, "created_at": 1733549924.7387607, "relation_name": null, "raw_code": "{{ dbt_utils.test_accepted_range(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_source_accepted_rang_8c3cff7ac664119087ba60052df6c918\") }}", "language": "sql", "refs": [], "sources": [["gym_app", "raw_weight"]], "metrics": [], "depends_on": {"macros": ["macro.dbt_utils.test_accepted_range", "macro.dbt.get_where_subquery", "macro.dbt_testing_example.source"], "nodes": ["source.dbt_testing_example.gym_app.raw_weight"]}, "compiled_path": "docs/compiled/dbt_testing_example/models/staging/gym_app/_gym_app__raw_weight_schema.yml/dbt_utils_source_accepted_rang_8c3cff7ac664119087ba60052df6c918.sql", "compiled": true, "compiled_code": "\n\nwith meet_condition as(\n select *\n from \"neondb\".\"dbt_testing_example\".\"raw_weight\"\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 -- records with a value >= min_value are permitted. The `not` flips this to find records that don't meet the rule.\n or not weight > 0\n)\n\nselect *\nfrom validation_errors\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "weight", "file_key_name": "sources.gym_app", "attached_node": null}}, "sources": {"source.dbt_testing_example.gym_app.raw_height": {"database": "neondb", "schema": "dbt_testing_example", "name": "raw_height", "resource_type": "source", "package_name": "dbt_testing_example", "path": "models/staging/gym_app/_gym_app__raw_height_schema.yml", "original_file_path": "models/staging/gym_app/_gym_app__raw_height_schema.yml", "unique_id": "source.dbt_testing_example.gym_app.raw_height", "fqn": ["dbt_testing_example", "staging", "gym_app", "gym_app", "raw_height"], "source_name": "gym_app", "source_description": "", "loader": "", "identifier": "raw_height", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": null, "freshness": {"warn_after": {"count": null, "period": null}, "error_after": {"count": null, "period": null}, "filter": null}, "external": null, "description": "", "columns": {"height_unit": {"name": "height_unit", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "user_id": {"name": "user_id", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "height": {"name": "height", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": ["contract-test-source", "data-quality"], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "\"neondb\".\"dbt_testing_example\".\"raw_height\"", "created_at": 1733549924.7173786}, "source.dbt_testing_example.gym_app.raw_weight": {"database": "neondb", "schema": "dbt_testing_example", "name": "raw_weight", "resource_type": "source", "package_name": "dbt_testing_example", "path": "models/staging/gym_app/_gym_app__raw_weight_schema.yml", "original_file_path": "models/staging/gym_app/_gym_app__raw_weight_schema.yml", "unique_id": "source.dbt_testing_example.gym_app.raw_weight", "fqn": ["dbt_testing_example", "staging", "gym_app", "gym_app", "raw_weight"], "source_name": "gym_app", "source_description": "", "loader": "", "identifier": "raw_weight", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": null, "freshness": {"warn_after": {"count": null, "period": null}, "error_after": {"count": null, "period": null}, "filter": null}, "external": null, "description": "", "columns": {"measurement_unit": {"name": "measurement_unit", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "user_id": {"name": "user_id", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "weight": {"name": "weight", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": ["contract-test-source", "data-quality"], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "\"neondb\".\"dbt_testing_example\".\"raw_weight\"", "created_at": 1733549924.7421496}}, "macros": {"macro.dbt_testing_example.ref": {"name": "ref", "resource_type": "macro", "package_name": "dbt_testing_example", "path": "macros/testing_macros.sql", "original_file_path": "macros/testing_macros.sql", "unique_id": "macro.dbt_testing_example.ref", "macro_sql": "{% macro ref(model_name) %}\n {{ return(dbt_unit_testing.ref(model_name)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_unit_testing.ref"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549919.9163587, "supported_languages": null}, "macro.dbt_testing_example.source": {"name": "source", "resource_type": "macro", "package_name": "dbt_testing_example", "path": "macros/testing_macros.sql", "original_file_path": "macros/testing_macros.sql", "unique_id": "macro.dbt_testing_example.source", "macro_sql": "{% macro source(source, model_name) %}\n {{ return(dbt_unit_testing.source(source, model_name)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_unit_testing.source"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549919.9166992, "supported_languages": null}, "macro.dbt_postgres.postgres__current_timestamp": {"name": "postgres__current_timestamp", "resource_type": "macro", "package_name": "dbt_postgres", "path": "macros/timestamps.sql", "original_file_path": "macros/timestamps.sql", "unique_id": "macro.dbt_postgres.postgres__current_timestamp", "macro_sql": "{% macro postgres__current_timestamp() -%}\n now()\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549919.9172153, "supported_languages": null}, "macro.dbt_postgres.postgres__snapshot_string_as_time": {"name": "postgres__snapshot_string_as_time", "resource_type": "macro", "package_name": "dbt_postgres", "path": "macros/timestamps.sql", "original_file_path": "macros/timestamps.sql", "unique_id": "macro.dbt_postgres.postgres__snapshot_string_as_time", "macro_sql": "{% macro postgres__snapshot_string_as_time(timestamp) -%}\n {%- set result = \"'\" ~ timestamp ~ \"'::timestamp without time zone\" -%}\n {{ return(result) }}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549919.9175758, "supported_languages": null}, "macro.dbt_postgres.postgres__snapshot_get_time": {"name": "postgres__snapshot_get_time", "resource_type": "macro", "package_name": "dbt_postgres", "path": "macros/timestamps.sql", "original_file_path": "macros/timestamps.sql", "unique_id": "macro.dbt_postgres.postgres__snapshot_get_time", "macro_sql": "{% macro postgres__snapshot_get_time() -%}\n {{ current_timestamp() }}::timestamp without time zone\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.current_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549919.917779, "supported_languages": null}, "macro.dbt_postgres.postgres__current_timestamp_backcompat": {"name": "postgres__current_timestamp_backcompat", "resource_type": "macro", "package_name": "dbt_postgres", "path": "macros/timestamps.sql", "original_file_path": "macros/timestamps.sql", "unique_id": "macro.dbt_postgres.postgres__current_timestamp_backcompat", "macro_sql": "{% macro postgres__current_timestamp_backcompat() %}\n current_timestamp::{{ type_timestamp() }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_expectations.type_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549919.9179792, "supported_languages": null}, "macro.dbt_postgres.postgres__current_timestamp_in_utc_backcompat": {"name": "postgres__current_timestamp_in_utc_backcompat", "resource_type": "macro", "package_name": "dbt_postgres", "path": "macros/timestamps.sql", "original_file_path": "macros/timestamps.sql", "unique_id": "macro.dbt_postgres.postgres__current_timestamp_in_utc_backcompat", "macro_sql": "{% macro postgres__current_timestamp_in_utc_backcompat() %}\n (current_timestamp at time zone 'utc')::{{ type_timestamp() }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_expectations.type_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549919.9181867, "supported_languages": null}, "macro.dbt_postgres.postgres__create_table_as": {"name": "postgres__create_table_as", "resource_type": "macro", "package_name": "dbt_postgres", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_postgres.postgres__create_table_as", "macro_sql": "{% macro postgres__create_table_as(temporary, relation, sql) -%}\n {%- set unlogged = config.get('unlogged', default=false) -%}\n {%- set sql_header = config.get('sql_header', none) -%}\n\n {{ sql_header if sql_header is not none }}\n\n create {% if temporary -%}\n temporary\n {%- elif unlogged -%}\n unlogged\n {%- endif %} table {{ relation }}\n {% set contract_config = config.get('contract') %}\n {% if contract_config.enforced %}\n {{ get_assert_columns_equivalent(sql) }}\n {% endif -%}\n {% if contract_config.enforced and (not temporary) -%}\n {{ get_table_columns_and_constraints() }} ;\n insert into {{ relation }} (\n {{ adapter.dispatch('get_column_names', 'dbt')() }}\n )\n {%- set sql = get_select_subquery(sql) %}\n {% else %}\n as\n {% endif %}\n (\n {{ sql }}\n );\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.get_assert_columns_equivalent", "macro.dbt.get_table_columns_and_constraints", "macro.dbt.default__get_column_names", "macro.dbt.get_select_subquery"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549919.9301023, "supported_languages": null}, "macro.dbt_postgres.postgres__get_create_index_sql": {"name": "postgres__get_create_index_sql", "resource_type": "macro", "package_name": "dbt_postgres", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_postgres.postgres__get_create_index_sql", "macro_sql": "{% macro postgres__get_create_index_sql(relation, index_dict) -%}\n {%- set index_config = adapter.parse_index(index_dict) -%}\n {%- set comma_separated_columns = \", \".join(index_config.columns) -%}\n {%- set index_name = index_config.render(relation) -%}\n\n create {% if index_config.unique -%}\n unique\n {%- endif %} index if not exists\n \"{{ index_name }}\"\n on {{ relation }} {% if index_config.type -%}\n using {{ index_config.type }}\n {%- endif %}\n ({{ comma_separated_columns }});\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549919.9309978, "supported_languages": null}, "macro.dbt_postgres.postgres__create_schema": {"name": "postgres__create_schema", "resource_type": "macro", "package_name": "dbt_postgres", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_postgres.postgres__create_schema", "macro_sql": "{% macro postgres__create_schema(relation) -%}\n {% if relation.database -%}\n {{ adapter.verify_database(relation.database) }}\n {%- endif -%}\n {%- call statement('create_schema') -%}\n create schema if not exists {{ relation.without_identifier().include(database=False) }}\n {%- endcall -%}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549919.9315748, "supported_languages": null}, "macro.dbt_postgres.postgres__drop_schema": {"name": "postgres__drop_schema", "resource_type": "macro", "package_name": "dbt_postgres", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_postgres.postgres__drop_schema", "macro_sql": "{% macro postgres__drop_schema(relation) -%}\n {% if relation.database -%}\n {{ adapter.verify_database(relation.database) }}\n {%- endif -%}\n {%- call statement('drop_schema') -%}\n drop schema if exists {{ relation.without_identifier().include(database=False) }} cascade\n {%- endcall -%}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549919.9321346, "supported_languages": null}, "macro.dbt_postgres.postgres__get_columns_in_relation": {"name": "postgres__get_columns_in_relation", "resource_type": "macro", "package_name": "dbt_postgres", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_postgres.postgres__get_columns_in_relation", "macro_sql": "{% macro postgres__get_columns_in_relation(relation) -%}\n {% call statement('get_columns_in_relation', fetch_result=True) %}\n select\n column_name,\n data_type,\n character_maximum_length,\n numeric_precision,\n numeric_scale\n\n from {{ relation.information_schema('columns') }}\n where table_name = '{{ relation.identifier }}'\n {% if relation.schema %}\n and table_schema = '{{ relation.schema }}'\n {% endif %}\n order by ordinal_position\n\n {% endcall %}\n {% set table = load_result('get_columns_in_relation').table %}\n {{ return(sql_convert_columns_in_relation(table)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt.sql_convert_columns_in_relation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549919.9329991, "supported_languages": null}, "macro.dbt_postgres.postgres__list_relations_without_caching": {"name": "postgres__list_relations_without_caching", "resource_type": "macro", "package_name": "dbt_postgres", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_postgres.postgres__list_relations_without_caching", "macro_sql": "{% macro postgres__list_relations_without_caching(schema_relation) %}\n {% call statement('list_relations_without_caching', fetch_result=True) -%}\n select\n '{{ schema_relation.database }}' as database,\n tablename as name,\n schemaname as schema,\n 'table' as type\n from pg_tables\n where schemaname ilike '{{ schema_relation.schema }}'\n union all\n select\n '{{ schema_relation.database }}' as database,\n viewname as name,\n schemaname as schema,\n 'view' as type\n from pg_views\n where schemaname ilike '{{ schema_relation.schema }}'\n union all\n select\n '{{ schema_relation.database }}' as database,\n matviewname as name,\n schemaname as schema,\n 'materialized_view' as type\n from pg_matviews\n where schemaname ilike '{{ schema_relation.schema }}'\n {% endcall %}\n {{ return(load_result('list_relations_without_caching').table) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549919.9337888, "supported_languages": null}, "macro.dbt_postgres.postgres__information_schema_name": {"name": "postgres__information_schema_name", "resource_type": "macro", "package_name": "dbt_postgres", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_postgres.postgres__information_schema_name", "macro_sql": "{% macro postgres__information_schema_name(database) -%}\n {% if database_name -%}\n {{ adapter.verify_database(database_name) }}\n {%- endif -%}\n information_schema\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549919.9340992, "supported_languages": null}, "macro.dbt_postgres.postgres__list_schemas": {"name": "postgres__list_schemas", "resource_type": "macro", "package_name": "dbt_postgres", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_postgres.postgres__list_schemas", "macro_sql": "{% macro postgres__list_schemas(database) %}\n {% if database -%}\n {{ adapter.verify_database(database) }}\n {%- endif -%}\n {% call statement('list_schemas', fetch_result=True, auto_begin=False) %}\n select distinct nspname from pg_namespace\n {% endcall %}\n {{ return(load_result('list_schemas').table) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549919.934716, "supported_languages": null}, "macro.dbt_postgres.postgres__check_schema_exists": {"name": "postgres__check_schema_exists", "resource_type": "macro", "package_name": "dbt_postgres", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_postgres.postgres__check_schema_exists", "macro_sql": "{% macro postgres__check_schema_exists(information_schema, schema) -%}\n {% if information_schema.database -%}\n {{ adapter.verify_database(information_schema.database) }}\n {%- endif -%}\n {% call statement('check_schema_exists', fetch_result=True, auto_begin=False) %}\n select count(*) from pg_namespace where nspname = '{{ schema }}'\n {% endcall %}\n {{ return(load_result('check_schema_exists').table) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549919.9355056, "supported_languages": null}, "macro.dbt_postgres.postgres__make_relation_with_suffix": {"name": "postgres__make_relation_with_suffix", "resource_type": "macro", "package_name": "dbt_postgres", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_postgres.postgres__make_relation_with_suffix", "macro_sql": "{% macro postgres__make_relation_with_suffix(base_relation, suffix, dstring) %}\n {% if dstring %}\n {% set dt = modules.datetime.datetime.now() %}\n {% set dtstring = dt.strftime(\"%H%M%S%f\") %}\n {% set suffix = suffix ~ dtstring %}\n {% endif %}\n {% set suffix_length = suffix|length %}\n {% set relation_max_name_length = base_relation.relation_max_name_length() %}\n {% if suffix_length > relation_max_name_length %}\n {% do exceptions.raise_compiler_error('Relation suffix is too long (' ~ suffix_length ~ ' characters). Maximum length is ' ~ relation_max_name_length ~ ' characters.') %}\n {% endif %}\n {% set identifier = base_relation.identifier[:relation_max_name_length - suffix_length] ~ suffix %}\n\n {{ return(base_relation.incorporate(path={\"identifier\": identifier })) }}\n\n {% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549919.9370186, "supported_languages": null}, "macro.dbt_postgres.postgres__make_intermediate_relation": {"name": "postgres__make_intermediate_relation", "resource_type": "macro", "package_name": "dbt_postgres", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_postgres.postgres__make_intermediate_relation", "macro_sql": "{% macro postgres__make_intermediate_relation(base_relation, suffix) %}\n {{ return(postgres__make_relation_with_suffix(base_relation, suffix, dstring=False)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_postgres.postgres__make_relation_with_suffix"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549919.9373724, "supported_languages": null}, "macro.dbt_postgres.postgres__make_temp_relation": {"name": "postgres__make_temp_relation", "resource_type": "macro", "package_name": "dbt_postgres", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_postgres.postgres__make_temp_relation", "macro_sql": "{% macro postgres__make_temp_relation(base_relation, suffix) %}\n {% set temp_relation = postgres__make_relation_with_suffix(base_relation, suffix, dstring=True) %}\n {{ return(temp_relation.incorporate(path={\"schema\": none,\n \"database\": none})) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_postgres.postgres__make_relation_with_suffix"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549919.9379323, "supported_languages": null}, "macro.dbt_postgres.postgres__make_backup_relation": {"name": "postgres__make_backup_relation", "resource_type": "macro", "package_name": "dbt_postgres", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_postgres.postgres__make_backup_relation", "macro_sql": "{% macro postgres__make_backup_relation(base_relation, backup_relation_type, suffix) %}\n {% set backup_relation = postgres__make_relation_with_suffix(base_relation, suffix, dstring=False) %}\n {{ return(backup_relation.incorporate(type=backup_relation_type)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_postgres.postgres__make_relation_with_suffix"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549919.9384103, "supported_languages": null}, "macro.dbt_postgres.postgres_escape_comment": {"name": "postgres_escape_comment", "resource_type": "macro", "package_name": "dbt_postgres", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_postgres.postgres_escape_comment", "macro_sql": "{% macro postgres_escape_comment(comment) -%}\n {% if comment is not string %}\n {% do exceptions.raise_compiler_error('cannot escape a non-string: ' ~ comment) %}\n {% endif %}\n {%- set magic = '$dbt_comment_literal_block$' -%}\n {%- if magic in comment -%}\n {%- do exceptions.raise_compiler_error('The string ' ~ magic ~ ' is not allowed in comments.') -%}\n {%- endif -%}\n {{ magic }}{{ comment }}{{ magic }}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549919.9391518, "supported_languages": null}, "macro.dbt_postgres.postgres__alter_relation_comment": {"name": "postgres__alter_relation_comment", "resource_type": "macro", "package_name": "dbt_postgres", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_postgres.postgres__alter_relation_comment", "macro_sql": "{% macro postgres__alter_relation_comment(relation, comment) %}\n {% set escaped_comment = postgres_escape_comment(comment) %}\n comment on {{ relation.type }} {{ relation }} is {{ escaped_comment }};\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_postgres.postgres_escape_comment"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549919.9395378, "supported_languages": null}, "macro.dbt_postgres.postgres__alter_column_comment": {"name": "postgres__alter_column_comment", "resource_type": "macro", "package_name": "dbt_postgres", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_postgres.postgres__alter_column_comment", "macro_sql": "{% macro postgres__alter_column_comment(relation, column_dict) %}\n {% set existing_columns = adapter.get_columns_in_relation(relation) | map(attribute=\"name\") | list %}\n {% for column_name in column_dict if (column_name in existing_columns) %}\n {% set comment = column_dict[column_name]['description'] %}\n {% set escaped_comment = postgres_escape_comment(comment) %}\n comment on column {{ relation }}.{{ adapter.quote(column_name) if column_dict[column_name]['quote'] else column_name }} is {{ escaped_comment }};\n {% endfor %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_postgres.postgres_escape_comment"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549919.940576, "supported_languages": null}, "macro.dbt_postgres.postgres__get_show_grant_sql": {"name": "postgres__get_show_grant_sql", "resource_type": "macro", "package_name": "dbt_postgres", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_postgres.postgres__get_show_grant_sql", "macro_sql": "\n\n{%- macro postgres__get_show_grant_sql(relation) -%}\n select grantee, privilege_type\n from {{ relation.information_schema('role_table_grants') }}\n where grantor = current_role\n and grantee != current_role\n and table_schema = '{{ relation.schema }}'\n and table_name = '{{ relation.identifier }}'\n{%- endmacro -%}\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549919.9409544, "supported_languages": null}, "macro.dbt_postgres.postgres__copy_grants": {"name": "postgres__copy_grants", "resource_type": "macro", "package_name": "dbt_postgres", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_postgres.postgres__copy_grants", "macro_sql": "{% macro postgres__copy_grants() %}\n {{ return(False) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549919.941166, "supported_languages": null}, "macro.dbt_postgres.postgres__get_show_indexes_sql": {"name": "postgres__get_show_indexes_sql", "resource_type": "macro", "package_name": "dbt_postgres", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_postgres.postgres__get_show_indexes_sql", "macro_sql": "{% macro postgres__get_show_indexes_sql(relation) %}\n select\n i.relname as name,\n m.amname as method,\n ix.indisunique as \"unique\",\n array_to_string(array_agg(a.attname), ',') as column_names\n from pg_index ix\n join pg_class i\n on i.oid = ix.indexrelid\n join pg_am m\n on m.oid=i.relam\n join pg_class t\n on t.oid = ix.indrelid\n join pg_namespace n\n on n.oid = t.relnamespace\n join pg_attribute a\n on a.attrelid = t.oid\n and a.attnum = ANY(ix.indkey)\n where t.relname = '{{ relation.identifier }}'\n and n.nspname = '{{ relation.schema }}'\n and t.relkind in ('r', 'm')\n group by 1, 2, 3\n order by 1, 2, 3\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549919.941473, "supported_languages": null}, "macro.dbt_postgres.postgres__get_drop_index_sql": {"name": "postgres__get_drop_index_sql", "resource_type": "macro", "package_name": "dbt_postgres", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_postgres.postgres__get_drop_index_sql", "macro_sql": "\n\n\n{%- macro postgres__get_drop_index_sql(relation, index_name) -%}\n drop index if exists \"{{ relation.schema }}\".\"{{ index_name }}\"\n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549919.9417264, "supported_languages": null}, "macro.dbt_postgres.postgres__get_catalog_relations": {"name": "postgres__get_catalog_relations", "resource_type": "macro", "package_name": "dbt_postgres", "path": "macros/catalog.sql", "original_file_path": "macros/catalog.sql", "unique_id": "macro.dbt_postgres.postgres__get_catalog_relations", "macro_sql": "{% macro postgres__get_catalog_relations(information_schema, relations) -%}\n {%- call statement('catalog', fetch_result=True) -%}\n\n {#\n If the user has multiple databases set and the first one is wrong, this will fail.\n But we won't fail in the case where there are multiple quoting-difference-only dbs, which is better.\n #}\n {% set database = information_schema.database %}\n {{ adapter.verify_database(database) }}\n\n select\n '{{ database }}' as table_database,\n sch.nspname as table_schema,\n tbl.relname as table_name,\n case tbl.relkind\n when 'v' then 'VIEW'\n when 'm' then 'MATERIALIZED VIEW'\n else 'BASE TABLE'\n end as table_type,\n tbl_desc.description as table_comment,\n col.attname as column_name,\n col.attnum as column_index,\n pg_catalog.format_type(col.atttypid, col.atttypmod) as column_type,\n col_desc.description as column_comment,\n pg_get_userbyid(tbl.relowner) as table_owner\n\n from pg_catalog.pg_namespace sch\n join pg_catalog.pg_class tbl on tbl.relnamespace = sch.oid\n join pg_catalog.pg_attribute col on col.attrelid = tbl.oid\n left outer join pg_catalog.pg_description tbl_desc on (tbl_desc.objoid = tbl.oid and tbl_desc.objsubid = 0)\n left outer join pg_catalog.pg_description col_desc on (col_desc.objoid = tbl.oid and col_desc.objsubid = col.attnum)\n where (\n {%- for relation in relations -%}\n {%- if relation.identifier -%}\n (upper(sch.nspname) = upper('{{ relation.schema }}') and\n upper(tbl.relname) = upper('{{ relation.identifier }}'))\n {%- else-%}\n upper(sch.nspname) = upper('{{ relation.schema }}')\n {%- endif -%}\n {%- if not loop.last %} or {% endif -%}\n {%- endfor -%}\n )\n and not pg_is_other_temp_schema(sch.oid) -- not a temporary schema belonging to another session\n and tbl.relpersistence in ('p', 'u') -- [p]ermanent table or [u]nlogged table. Exclude [t]emporary tables\n and tbl.relkind in ('r', 'v', 'f', 'p', 'm') -- o[r]dinary table, [v]iew, [f]oreign table, [p]artitioned table, [m]aterialized view. Other values are [i]ndex, [S]equence, [c]omposite type, [t]OAST table\n and col.attnum > 0 -- negative numbers are used for system columns such as oid\n and not col.attisdropped -- column as not been dropped\n\n order by\n sch.nspname,\n tbl.relname,\n col.attnum\n\n {%- endcall -%}\n\n {{ return(load_result('catalog').table) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549919.9440446, "supported_languages": null}, "macro.dbt_postgres.postgres__get_catalog": {"name": "postgres__get_catalog", "resource_type": "macro", "package_name": "dbt_postgres", "path": "macros/catalog.sql", "original_file_path": "macros/catalog.sql", "unique_id": "macro.dbt_postgres.postgres__get_catalog", "macro_sql": "{% macro postgres__get_catalog(information_schema, schemas) -%}\n {%- set relations = [] -%}\n {%- for schema in schemas -%}\n {%- set dummy = relations.append({'schema': schema}) -%}\n {%- endfor -%}\n {{ return(postgres__get_catalog_relations(information_schema, relations)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_postgres.postgres__get_catalog_relations"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549919.9446537, "supported_languages": null}, "macro.dbt_postgres.postgres__get_relations": {"name": "postgres__get_relations", "resource_type": "macro", "package_name": "dbt_postgres", "path": "macros/relations.sql", "original_file_path": "macros/relations.sql", "unique_id": "macro.dbt_postgres.postgres__get_relations", "macro_sql": "{% macro postgres__get_relations() -%}\n\n {#\n -- in pg_depend, objid is the dependent, refobjid is the referenced object\n -- > a pg_depend entry indicates that the referenced object cannot be\n -- > dropped without also dropping the dependent object.\n #}\n\n {%- call statement('relations', fetch_result=True) -%}\n with relation as (\n select\n pg_rewrite.ev_class as class,\n pg_rewrite.oid as id\n from pg_rewrite\n ),\n class as (\n select\n oid as id,\n relname as name,\n relnamespace as schema,\n relkind as kind\n from pg_class\n ),\n dependency as (\n select distinct\n pg_depend.objid as id,\n pg_depend.refobjid as ref\n from pg_depend\n ),\n schema as (\n select\n pg_namespace.oid as id,\n pg_namespace.nspname as name\n from pg_namespace\n where nspname != 'information_schema' and nspname not like 'pg\\_%'\n ),\n referenced as (\n select\n relation.id AS id,\n referenced_class.name ,\n referenced_class.schema ,\n referenced_class.kind\n from relation\n join class as referenced_class on relation.class=referenced_class.id\n where referenced_class.kind in ('r', 'v', 'm')\n ),\n relationships as (\n select\n referenced.name as referenced_name,\n referenced.schema as referenced_schema_id,\n dependent_class.name as dependent_name,\n dependent_class.schema as dependent_schema_id,\n referenced.kind as kind\n from referenced\n join dependency on referenced.id=dependency.id\n join class as dependent_class on dependency.ref=dependent_class.id\n where\n (referenced.name != dependent_class.name or\n referenced.schema != dependent_class.schema)\n )\n\n select\n referenced_schema.name as referenced_schema,\n relationships.referenced_name as referenced_name,\n dependent_schema.name as dependent_schema,\n relationships.dependent_name as dependent_name\n from relationships\n join schema as dependent_schema on relationships.dependent_schema_id=dependent_schema.id\n join schema as referenced_schema on relationships.referenced_schema_id=referenced_schema.id\n group by referenced_schema, referenced_name, dependent_schema, dependent_name\n order by referenced_schema, referenced_name, dependent_schema, dependent_name;\n\n {%- endcall -%}\n\n {{ return(load_result('relations').table) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549919.9456677, "supported_languages": null}, "macro.dbt_postgres.postgres_get_relations": {"name": "postgres_get_relations", "resource_type": "macro", "package_name": "dbt_postgres", "path": "macros/relations.sql", "original_file_path": "macros/relations.sql", "unique_id": "macro.dbt_postgres.postgres_get_relations", "macro_sql": "{% macro postgres_get_relations() %}\n {{ return(postgres__get_relations()) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_postgres.postgres__get_relations"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549919.9458985, "supported_languages": null}, "macro.dbt_postgres.postgres__get_rename_view_sql": {"name": "postgres__get_rename_view_sql", "resource_type": "macro", "package_name": "dbt_postgres", "path": "macros/relations/view/rename.sql", "original_file_path": "macros/relations/view/rename.sql", "unique_id": "macro.dbt_postgres.postgres__get_rename_view_sql", "macro_sql": "{% macro postgres__get_rename_view_sql(relation, new_name) %}\n alter view {{ relation }} rename to {{ new_name }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549919.9462006, "supported_languages": null}, "macro.dbt_postgres.postgres__drop_view": {"name": "postgres__drop_view", "resource_type": "macro", "package_name": "dbt_postgres", "path": "macros/relations/view/drop.sql", "original_file_path": "macros/relations/view/drop.sql", "unique_id": "macro.dbt_postgres.postgres__drop_view", "macro_sql": "{% macro postgres__drop_view(relation) -%}\n drop view if exists {{ relation }} cascade\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549919.9464343, "supported_languages": null}, "macro.dbt_postgres.postgres__get_replace_view_sql": {"name": "postgres__get_replace_view_sql", "resource_type": "macro", "package_name": "dbt_postgres", "path": "macros/relations/view/replace.sql", "original_file_path": "macros/relations/view/replace.sql", "unique_id": "macro.dbt_postgres.postgres__get_replace_view_sql", "macro_sql": "{% macro postgres__get_replace_view_sql(relation, sql) -%}\n\n {%- set sql_header = config.get('sql_header', none) -%}\n {{ sql_header if sql_header is not none }}\n\n create or replace view {{ relation }}\n {% set contract_config = config.get('contract') %}\n {% if contract_config.enforced %}\n {{ get_assert_columns_equivalent(sql) }}\n {%- endif %}\n as (\n {{ sql }}\n );\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.get_assert_columns_equivalent"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549919.947375, "supported_languages": null}, "macro.dbt_postgres.postgres__get_rename_table_sql": {"name": "postgres__get_rename_table_sql", "resource_type": "macro", "package_name": "dbt_postgres", "path": "macros/relations/table/rename.sql", "original_file_path": "macros/relations/table/rename.sql", "unique_id": "macro.dbt_postgres.postgres__get_rename_table_sql", "macro_sql": "{% macro postgres__get_rename_table_sql(relation, new_name) %}\n alter table {{ relation }} rename to {{ new_name }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549919.9476702, "supported_languages": null}, "macro.dbt_postgres.postgres__drop_table": {"name": "postgres__drop_table", "resource_type": "macro", "package_name": "dbt_postgres", "path": "macros/relations/table/drop.sql", "original_file_path": "macros/relations/table/drop.sql", "unique_id": "macro.dbt_postgres.postgres__drop_table", "macro_sql": "{% macro postgres__drop_table(relation) -%}\n drop table if exists {{ relation }} cascade\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549919.9479191, "supported_languages": null}, "macro.dbt_postgres.postgres__get_replace_table_sql": {"name": "postgres__get_replace_table_sql", "resource_type": "macro", "package_name": "dbt_postgres", "path": "macros/relations/table/replace.sql", "original_file_path": "macros/relations/table/replace.sql", "unique_id": "macro.dbt_postgres.postgres__get_replace_table_sql", "macro_sql": "{% macro postgres__get_replace_table_sql(relation, sql) -%}\n\n {%- set sql_header = config.get('sql_header', none) -%}\n {{ sql_header if sql_header is not none }}\n\n create or replace table {{ relation }}\n {% set contract_config = config.get('contract') %}\n {% if contract_config.enforced %}\n {{ get_assert_columns_equivalent(sql) }}\n {{ get_table_columns_and_constraints() }}\n {%- set sql = get_select_subquery(sql) %}\n {% endif %}\n as (\n {{ sql }}\n );\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.get_assert_columns_equivalent", "macro.dbt.get_table_columns_and_constraints", "macro.dbt.get_select_subquery"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549919.94921, "supported_languages": null}, "macro.dbt_postgres.postgres__refresh_materialized_view": {"name": "postgres__refresh_materialized_view", "resource_type": "macro", "package_name": "dbt_postgres", "path": "macros/relations/materialized_view/refresh.sql", "original_file_path": "macros/relations/materialized_view/refresh.sql", "unique_id": "macro.dbt_postgres.postgres__refresh_materialized_view", "macro_sql": "{% macro postgres__refresh_materialized_view(relation) %}\n refresh materialized view {{ relation }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549919.9494634, "supported_languages": null}, "macro.dbt_postgres.postgres__get_rename_materialized_view_sql": {"name": "postgres__get_rename_materialized_view_sql", "resource_type": "macro", "package_name": "dbt_postgres", "path": "macros/relations/materialized_view/rename.sql", "original_file_path": "macros/relations/materialized_view/rename.sql", "unique_id": "macro.dbt_postgres.postgres__get_rename_materialized_view_sql", "macro_sql": "{% macro postgres__get_rename_materialized_view_sql(relation, new_name) %}\n alter materialized view {{ relation }} rename to {{ new_name }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549919.9497623, "supported_languages": null}, "macro.dbt_postgres.postgres__describe_materialized_view": {"name": "postgres__describe_materialized_view", "resource_type": "macro", "package_name": "dbt_postgres", "path": "macros/relations/materialized_view/describe.sql", "original_file_path": "macros/relations/materialized_view/describe.sql", "unique_id": "macro.dbt_postgres.postgres__describe_materialized_view", "macro_sql": "{% macro postgres__describe_materialized_view(relation) %}\n -- for now just get the indexes, we don't need the name or the query yet\n {% set _indexes = run_query(get_show_indexes_sql(relation)) %}\n {% do return({'indexes': _indexes}) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.run_query", "macro.dbt.get_show_indexes_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549919.9502647, "supported_languages": null}, "macro.dbt_postgres.postgres__drop_materialized_view": {"name": "postgres__drop_materialized_view", "resource_type": "macro", "package_name": "dbt_postgres", "path": "macros/relations/materialized_view/drop.sql", "original_file_path": "macros/relations/materialized_view/drop.sql", "unique_id": "macro.dbt_postgres.postgres__drop_materialized_view", "macro_sql": "{% macro postgres__drop_materialized_view(relation) -%}\n drop materialized view if exists {{ relation }} cascade\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549919.9505029, "supported_languages": null}, "macro.dbt_postgres.postgres__get_alter_materialized_view_as_sql": {"name": "postgres__get_alter_materialized_view_as_sql", "resource_type": "macro", "package_name": "dbt_postgres", "path": "macros/relations/materialized_view/alter.sql", "original_file_path": "macros/relations/materialized_view/alter.sql", "unique_id": "macro.dbt_postgres.postgres__get_alter_materialized_view_as_sql", "macro_sql": "{% macro postgres__get_alter_materialized_view_as_sql(\n relation,\n configuration_changes,\n sql,\n existing_relation,\n backup_relation,\n intermediate_relation\n) %}\n\n -- apply a full refresh immediately if needed\n {% if configuration_changes.requires_full_refresh %}\n\n {{ get_replace_sql(existing_relation, relation, sql) }}\n\n -- otherwise apply individual changes as needed\n {% else %}\n\n {{ postgres__update_indexes_on_materialized_view(relation, configuration_changes.indexes) }}\n\n {%- endif -%}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_replace_sql", "macro.dbt_postgres.postgres__update_indexes_on_materialized_view"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549919.9518428, "supported_languages": null}, "macro.dbt_postgres.postgres__update_indexes_on_materialized_view": {"name": "postgres__update_indexes_on_materialized_view", "resource_type": "macro", "package_name": "dbt_postgres", "path": "macros/relations/materialized_view/alter.sql", "original_file_path": "macros/relations/materialized_view/alter.sql", "unique_id": "macro.dbt_postgres.postgres__update_indexes_on_materialized_view", "macro_sql": "\n\n\n{%- macro postgres__update_indexes_on_materialized_view(relation, index_changes) -%}\n {{- log(\"Applying UPDATE INDEXES to: \" ~ relation) -}}\n\n {%- for _index_change in index_changes -%}\n {%- set _index = _index_change.context -%}\n\n {%- if _index_change.action == \"drop\" -%}\n\n {{ postgres__get_drop_index_sql(relation, _index.name) }};\n\n {%- elif _index_change.action == \"create\" -%}\n\n {{ postgres__get_create_index_sql(relation, _index.as_node_config) }}\n\n {%- endif -%}\n\n {%- endfor -%}\n\n{%- endmacro -%}\n\n\n", "depends_on": {"macros": ["macro.dbt_postgres.postgres__get_drop_index_sql", "macro.dbt_postgres.postgres__get_create_index_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549919.9526608, "supported_languages": null}, "macro.dbt_postgres.postgres__get_materialized_view_configuration_changes": {"name": "postgres__get_materialized_view_configuration_changes", "resource_type": "macro", "package_name": "dbt_postgres", "path": "macros/relations/materialized_view/alter.sql", "original_file_path": "macros/relations/materialized_view/alter.sql", "unique_id": "macro.dbt_postgres.postgres__get_materialized_view_configuration_changes", "macro_sql": "{% macro postgres__get_materialized_view_configuration_changes(existing_relation, new_config) %}\n {% set _existing_materialized_view = postgres__describe_materialized_view(existing_relation) %}\n {% set _configuration_changes = existing_relation.get_materialized_view_config_change_collection(_existing_materialized_view, new_config) %}\n {% do return(_configuration_changes) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_postgres.postgres__describe_materialized_view"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549919.953183, "supported_languages": null}, "macro.dbt_postgres.postgres__get_create_materialized_view_as_sql": {"name": "postgres__get_create_materialized_view_as_sql", "resource_type": "macro", "package_name": "dbt_postgres", "path": "macros/relations/materialized_view/create.sql", "original_file_path": "macros/relations/materialized_view/create.sql", "unique_id": "macro.dbt_postgres.postgres__get_create_materialized_view_as_sql", "macro_sql": "{% macro postgres__get_create_materialized_view_as_sql(relation, sql) %}\n create materialized view if not exists {{ relation }} as {{ sql }};\n\n {% for _index_dict in config.get('indexes', []) -%}\n {{- get_create_index_sql(relation, _index_dict) -}}\n {%- endfor -%}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_create_index_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549919.9538057, "supported_languages": null}, "macro.dbt_postgres.postgres__snapshot_merge_sql": {"name": "postgres__snapshot_merge_sql", "resource_type": "macro", "package_name": "dbt_postgres", "path": "macros/materializations/snapshot_merge.sql", "original_file_path": "macros/materializations/snapshot_merge.sql", "unique_id": "macro.dbt_postgres.postgres__snapshot_merge_sql", "macro_sql": "{% macro postgres__snapshot_merge_sql(target, source, insert_cols) -%}\n {%- set insert_cols_csv = insert_cols | join(', ') -%}\n\n update {{ target }}\n set dbt_valid_to = DBT_INTERNAL_SOURCE.dbt_valid_to\n from {{ source }} as DBT_INTERNAL_SOURCE\n where DBT_INTERNAL_SOURCE.dbt_scd_id::text = {{ target }}.dbt_scd_id::text\n and DBT_INTERNAL_SOURCE.dbt_change_type::text in ('update'::text, 'delete'::text)\n and {{ target }}.dbt_valid_to is null;\n\n insert into {{ target }} ({{ insert_cols_csv }})\n select {% for column in insert_cols -%}\n DBT_INTERNAL_SOURCE.{{ column }} {%- if not loop.last %}, {%- endif %}\n {%- endfor %}\n from {{ source }} as DBT_INTERNAL_SOURCE\n where DBT_INTERNAL_SOURCE.dbt_change_type::text = 'insert'::text;\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549919.9549708, "supported_languages": null}, "macro.dbt_postgres.postgres__get_incremental_default_sql": {"name": "postgres__get_incremental_default_sql", "resource_type": "macro", "package_name": "dbt_postgres", "path": "macros/materializations/incremental_strategies.sql", "original_file_path": "macros/materializations/incremental_strategies.sql", "unique_id": "macro.dbt_postgres.postgres__get_incremental_default_sql", "macro_sql": "{% macro postgres__get_incremental_default_sql(arg_dict) %}\n\n {% if arg_dict[\"unique_key\"] %}\n {% do return(get_incremental_delete_insert_sql(arg_dict)) %}\n {% else %}\n {% do return(get_incremental_append_sql(arg_dict)) %}\n {% endif %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_incremental_delete_insert_sql", "macro.dbt.get_incremental_append_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549919.9556086, "supported_languages": null}, "macro.dbt_postgres.postgres__last_day": {"name": "postgres__last_day", "resource_type": "macro", "package_name": "dbt_postgres", "path": "macros/utils/last_day.sql", "original_file_path": "macros/utils/last_day.sql", "unique_id": "macro.dbt_postgres.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.dateadd('day', '-1',\n dbt.dateadd('month', '3', dbt.date_trunc(datepart, date))\n )}}\n as date)\n {%- else -%}\n {{dbt.default_last_day(date, datepart)}}\n {%- endif -%}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.dateadd", "macro.dbt.date_trunc", "macro.dbt.default_last_day"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549919.9564433, "supported_languages": null}, "macro.dbt_postgres.postgres__split_part": {"name": "postgres__split_part", "resource_type": "macro", "package_name": "dbt_postgres", "path": "macros/utils/split_part.sql", "original_file_path": "macros/utils/split_part.sql", "unique_id": "macro.dbt_postgres.postgres__split_part", "macro_sql": "{% macro postgres__split_part(string_text, delimiter_text, part_number) %}\n\n {% if part_number >= 0 %}\n {{ dbt.default__split_part(string_text, delimiter_text, part_number) }}\n {% else %}\n {{ dbt._split_part_negative(string_text, delimiter_text, part_number) }}\n {% endif %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__split_part", "macro.dbt._split_part_negative"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549919.9571471, "supported_languages": null}, "macro.dbt_postgres.postgres__dateadd": {"name": "postgres__dateadd", "resource_type": "macro", "package_name": "dbt_postgres", "path": "macros/utils/dateadd.sql", "original_file_path": "macros/utils/dateadd.sql", "unique_id": "macro.dbt_postgres.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 %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549919.957508, "supported_languages": null}, "macro.dbt_postgres.postgres__datediff": {"name": "postgres__datediff", "resource_type": "macro", "package_name": "dbt_postgres", "path": "macros/utils/datediff.sql", "original_file_path": "macros/utils/datediff.sql", "unique_id": "macro.dbt_postgres.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 ({{ datediff(first_date, second_date, 'year') }} * 4 + date_part('quarter', ({{second_date}})::date) - date_part('quarter', ({{first_date}})::date))\n {% elif datepart == 'month' %}\n ({{ 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 ({{ 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 ({{ datediff(first_date, second_date, 'day') }} * 24 + date_part('hour', ({{second_date}})::timestamp) - date_part('hour', ({{first_date}})::timestamp))\n {% elif datepart == 'minute' %}\n ({{ datediff(first_date, second_date, 'hour') }} * 60 + date_part('minute', ({{second_date}})::timestamp) - date_part('minute', ({{first_date}})::timestamp))\n {% elif datepart == 'second' %}\n ({{ 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 ({{ 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 ({{ 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 %}", "depends_on": {"macros": ["macro.dbt.datediff"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549919.9625862, "supported_languages": null}, "macro.dbt_postgres.postgres__listagg": {"name": "postgres__listagg", "resource_type": "macro", "package_name": "dbt_postgres", "path": "macros/utils/listagg.sql", "original_file_path": "macros/utils/listagg.sql", "unique_id": "macro.dbt_postgres.postgres__listagg", "macro_sql": "{% macro postgres__listagg(measure, delimiter_text, order_by_clause, limit_num) -%}\n\n {% if limit_num -%}\n array_to_string(\n (array_agg(\n {{ measure }}\n {% if order_by_clause -%}\n {{ order_by_clause }}\n {%- endif %}\n ))[1:{{ limit_num }}],\n {{ delimiter_text }}\n )\n {%- else %}\n string_agg(\n {{ measure }},\n {{ delimiter_text }}\n {% if order_by_clause -%}\n {{ order_by_clause }}\n {%- endif %}\n )\n {%- endif %}\n\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549919.963629, "supported_languages": null}, "macro.dbt_postgres.postgres__any_value": {"name": "postgres__any_value", "resource_type": "macro", "package_name": "dbt_postgres", "path": "macros/utils/any_value.sql", "original_file_path": "macros/utils/any_value.sql", "unique_id": "macro.dbt_postgres.postgres__any_value", "macro_sql": "{% macro postgres__any_value(expression) -%}\n\n min({{ expression }})\n\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549919.9638774, "supported_languages": null}, "macro.dbt.get_create_intermediate_sql": {"name": "get_create_intermediate_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/create_intermediate.sql", "original_file_path": "macros/relations/create_intermediate.sql", "unique_id": "macro.dbt.get_create_intermediate_sql", "macro_sql": "{%- macro get_create_intermediate_sql(relation, sql) -%}\n {{- log('Applying CREATE INTERMEDIATE to: ' ~ relation) -}}\n {{- adapter.dispatch('get_create_intermediate_sql', 'dbt')(relation, sql) -}}\n{%- endmacro -%}\n\n\n", "depends_on": {"macros": ["macro.dbt.default__get_create_intermediate_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549919.9644897, "supported_languages": null}, "macro.dbt.default__get_create_intermediate_sql": {"name": "default__get_create_intermediate_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/create_intermediate.sql", "original_file_path": "macros/relations/create_intermediate.sql", "unique_id": "macro.dbt.default__get_create_intermediate_sql", "macro_sql": "{%- macro default__get_create_intermediate_sql(relation, sql) -%}\n\n -- get the standard intermediate name\n {% set intermediate_relation = make_intermediate_relation(relation) %}\n\n -- drop any pre-existing intermediate\n {{ get_drop_sql(intermediate_relation) }};\n\n {{ get_create_sql(intermediate_relation, sql) }}\n\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt.make_intermediate_relation", "macro.dbt.get_drop_sql", "macro.dbt.get_create_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549919.9649482, "supported_languages": null}, "macro.dbt.get_rename_sql": {"name": "get_rename_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/rename.sql", "original_file_path": "macros/relations/rename.sql", "unique_id": "macro.dbt.get_rename_sql", "macro_sql": "{%- macro get_rename_sql(relation, new_name) -%}\n {{- log('Applying RENAME to: ' ~ relation) -}}\n {{- adapter.dispatch('get_rename_sql', 'dbt')(relation, new_name) -}}\n{%- endmacro -%}\n\n\n", "depends_on": {"macros": ["macro.dbt.default__get_rename_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549919.9660952, "supported_languages": null}, "macro.dbt.default__get_rename_sql": {"name": "default__get_rename_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/rename.sql", "original_file_path": "macros/relations/rename.sql", "unique_id": "macro.dbt.default__get_rename_sql", "macro_sql": "{%- macro default__get_rename_sql(relation, new_name) -%}\n\n {%- if relation.is_view -%}\n {{ get_rename_view_sql(relation, new_name) }}\n\n {%- elif relation.is_table -%}\n {{ get_rename_table_sql(relation, new_name) }}\n\n {%- elif relation.is_materialized_view -%}\n {{ get_rename_materialized_view_sql(relation, new_name) }}\n\n {%- else -%}\n {{- exceptions.raise_compiler_error(\"`get_rename_sql` has not been implemented for: \" ~ relation.type ) -}}\n\n {%- endif -%}\n\n{%- endmacro -%}\n\n\n", "depends_on": {"macros": ["macro.dbt.get_rename_view_sql", "macro.dbt.get_rename_table_sql", "macro.dbt.get_rename_materialized_view_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549919.9668722, "supported_languages": null}, "macro.dbt.rename_relation": {"name": "rename_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/rename.sql", "original_file_path": "macros/relations/rename.sql", "unique_id": "macro.dbt.rename_relation", "macro_sql": "{% macro rename_relation(from_relation, to_relation) -%}\n {{ return(adapter.dispatch('rename_relation', 'dbt')(from_relation, to_relation)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__rename_relation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549919.9672344, "supported_languages": null}, "macro.dbt.default__rename_relation": {"name": "default__rename_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/rename.sql", "original_file_path": "macros/relations/rename.sql", "unique_id": "macro.dbt.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 %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549919.9677267, "supported_languages": null}, "macro.dbt.get_drop_backup_sql": {"name": "get_drop_backup_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/drop_backup.sql", "original_file_path": "macros/relations/drop_backup.sql", "unique_id": "macro.dbt.get_drop_backup_sql", "macro_sql": "{%- macro get_drop_backup_sql(relation) -%}\n {{- log('Applying DROP BACKUP to: ' ~ relation) -}}\n {{- adapter.dispatch('get_drop_backup_sql', 'dbt')(relation) -}}\n{%- endmacro -%}\n\n\n", "depends_on": {"macros": ["macro.dbt.default__get_drop_backup_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549919.9682653, "supported_languages": null}, "macro.dbt.default__get_drop_backup_sql": {"name": "default__get_drop_backup_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/drop_backup.sql", "original_file_path": "macros/relations/drop_backup.sql", "unique_id": "macro.dbt.default__get_drop_backup_sql", "macro_sql": "{%- macro default__get_drop_backup_sql(relation) -%}\n\n -- get the standard backup name\n {% set backup_relation = make_backup_relation(relation, relation.type) %}\n\n {{ get_drop_sql(backup_relation) }}\n\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt.make_backup_relation", "macro.dbt.get_drop_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549919.9686215, "supported_languages": null}, "macro.dbt.get_rename_intermediate_sql": {"name": "get_rename_intermediate_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/rename_intermediate.sql", "original_file_path": "macros/relations/rename_intermediate.sql", "unique_id": "macro.dbt.get_rename_intermediate_sql", "macro_sql": "{%- macro get_rename_intermediate_sql(relation) -%}\n {{- log('Applying RENAME INTERMEDIATE to: ' ~ relation) -}}\n {{- adapter.dispatch('get_rename_intermediate_sql', 'dbt')(relation) -}}\n{%- endmacro -%}\n\n\n", "depends_on": {"macros": ["macro.dbt.default__get_rename_intermediate_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549919.969184, "supported_languages": null}, "macro.dbt.default__get_rename_intermediate_sql": {"name": "default__get_rename_intermediate_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/rename_intermediate.sql", "original_file_path": "macros/relations/rename_intermediate.sql", "unique_id": "macro.dbt.default__get_rename_intermediate_sql", "macro_sql": "{%- macro default__get_rename_intermediate_sql(relation) -%}\n\n -- get the standard intermediate name\n {% set intermediate_relation = make_intermediate_relation(relation) %}\n\n {{ get_rename_sql(intermediate_relation, relation.identifier) }}\n\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt.make_intermediate_relation", "macro.dbt.get_rename_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549919.9695413, "supported_languages": null}, "macro.dbt.get_drop_sql": {"name": "get_drop_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/drop.sql", "original_file_path": "macros/relations/drop.sql", "unique_id": "macro.dbt.get_drop_sql", "macro_sql": "{%- macro get_drop_sql(relation) -%}\n {{- log('Applying DROP to: ' ~ relation) -}}\n {{- adapter.dispatch('get_drop_sql', 'dbt')(relation) -}}\n{%- endmacro -%}\n\n\n", "depends_on": {"macros": ["macro.dbt.default__get_drop_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549919.9706118, "supported_languages": null}, "macro.dbt.default__get_drop_sql": {"name": "default__get_drop_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/drop.sql", "original_file_path": "macros/relations/drop.sql", "unique_id": "macro.dbt.default__get_drop_sql", "macro_sql": "{%- macro default__get_drop_sql(relation) -%}\n\n {%- if relation.is_view -%}\n {{ drop_view(relation) }}\n\n {%- elif relation.is_table -%}\n {{ drop_table(relation) }}\n\n {%- elif relation.is_materialized_view -%}\n {{ drop_materialized_view(relation) }}\n\n {%- else -%}\n drop {{ relation.type }} if exists {{ relation }} cascade\n\n {%- endif -%}\n\n{%- endmacro -%}\n\n\n", "depends_on": {"macros": ["macro.dbt.drop_view", "macro.dbt.drop_table", "macro.dbt.drop_materialized_view"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549919.971243, "supported_languages": null}, "macro.dbt.drop_relation": {"name": "drop_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/drop.sql", "original_file_path": "macros/relations/drop.sql", "unique_id": "macro.dbt.drop_relation", "macro_sql": "{% macro drop_relation(relation) -%}\n {{ return(adapter.dispatch('drop_relation', 'dbt')(relation)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__drop_relation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549919.9715567, "supported_languages": null}, "macro.dbt.default__drop_relation": {"name": "default__drop_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/drop.sql", "original_file_path": "macros/relations/drop.sql", "unique_id": "macro.dbt.default__drop_relation", "macro_sql": "{% macro default__drop_relation(relation) -%}\n {% call statement('drop_relation', auto_begin=False) -%}\n {{ get_drop_sql(relation) }}\n {%- endcall %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt.get_drop_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549919.971905, "supported_languages": null}, "macro.dbt.drop_relation_if_exists": {"name": "drop_relation_if_exists", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/drop.sql", "original_file_path": "macros/relations/drop.sql", "unique_id": "macro.dbt.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 %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549919.9722407, "supported_languages": null}, "macro.dbt.get_create_backup_sql": {"name": "get_create_backup_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/create_backup.sql", "original_file_path": "macros/relations/create_backup.sql", "unique_id": "macro.dbt.get_create_backup_sql", "macro_sql": "{%- macro get_create_backup_sql(relation) -%}\n {{- log('Applying CREATE BACKUP to: ' ~ relation) -}}\n {{- adapter.dispatch('get_create_backup_sql', 'dbt')(relation) -}}\n{%- endmacro -%}\n\n\n", "depends_on": {"macros": ["macro.dbt.default__get_create_backup_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549919.9728081, "supported_languages": null}, "macro.dbt.default__get_create_backup_sql": {"name": "default__get_create_backup_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/create_backup.sql", "original_file_path": "macros/relations/create_backup.sql", "unique_id": "macro.dbt.default__get_create_backup_sql", "macro_sql": "{%- macro default__get_create_backup_sql(relation) -%}\n\n -- get the standard backup name\n {% set backup_relation = make_backup_relation(relation, relation.type) %}\n\n -- drop any pre-existing backup\n {{ get_drop_sql(backup_relation) }};\n\n {{ get_rename_sql(relation, backup_relation.identifier) }}\n\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt.make_backup_relation", "macro.dbt.get_drop_sql", "macro.dbt.get_rename_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549919.9733942, "supported_languages": null}, "macro.dbt.get_create_sql": {"name": "get_create_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/create.sql", "original_file_path": "macros/relations/create.sql", "unique_id": "macro.dbt.get_create_sql", "macro_sql": "{%- macro get_create_sql(relation, sql) -%}\n {{- log('Applying CREATE to: ' ~ relation) -}}\n {{- adapter.dispatch('get_create_sql', 'dbt')(relation, sql) -}}\n{%- endmacro -%}\n\n\n", "depends_on": {"macros": ["macro.dbt.default__get_create_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549919.9741597, "supported_languages": null}, "macro.dbt.default__get_create_sql": {"name": "default__get_create_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/create.sql", "original_file_path": "macros/relations/create.sql", "unique_id": "macro.dbt.default__get_create_sql", "macro_sql": "{%- macro default__get_create_sql(relation, sql) -%}\n\n {%- if relation.is_view -%}\n {{ get_create_view_as_sql(relation, sql) }}\n\n {%- elif relation.is_table -%}\n {{ get_create_table_as_sql(False, relation, sql) }}\n\n {%- elif relation.is_materialized_view -%}\n {{ get_create_materialized_view_as_sql(relation, sql) }}\n\n {%- else -%}\n {{- exceptions.raise_compiler_error(\"`get_create_sql` has not been implemented for: \" ~ relation.type ) -}}\n\n {%- endif -%}\n\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt.get_create_view_as_sql", "macro.dbt.get_create_table_as_sql", "macro.dbt.get_create_materialized_view_as_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549919.9749298, "supported_languages": null}, "macro.dbt.get_replace_sql": {"name": "get_replace_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/replace.sql", "original_file_path": "macros/relations/replace.sql", "unique_id": "macro.dbt.get_replace_sql", "macro_sql": "{% macro get_replace_sql(existing_relation, target_relation, sql) %}\n {{- log('Applying REPLACE to: ' ~ existing_relation) -}}\n {{- adapter.dispatch('get_replace_sql', 'dbt')(existing_relation, target_relation, sql) -}}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_replace_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549919.9761882, "supported_languages": null}, "macro.dbt.default__get_replace_sql": {"name": "default__get_replace_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/replace.sql", "original_file_path": "macros/relations/replace.sql", "unique_id": "macro.dbt.default__get_replace_sql", "macro_sql": "{% macro default__get_replace_sql(existing_relation, target_relation, sql) %}\n\n {# /* use a create or replace statement if possible */ #}\n\n {% set is_replaceable = existing_relation.type == target_relation_type and existing_relation.can_be_replaced %}\n\n {% if is_replaceable and existing_relation.is_view %}\n {{ get_replace_view_sql(target_relation, sql) }}\n\n {% elif is_replaceable and existing_relation.is_table %}\n {{ get_replace_table_sql(target_relation, sql) }}\n\n {% elif is_replaceable and existing_relation.is_materialized_view %}\n {{ get_replace_materialized_view_sql(target_relation, sql) }}\n\n {# /* a create or replace statement is not possible, so try to stage and/or backup to be safe */ #}\n\n {# /* create target_relation as an intermediate relation, then swap it out with the existing one using a backup */ #}\n {%- elif target_relation.can_be_renamed and existing_relation.can_be_renamed -%}\n {{ get_create_intermediate_sql(target_relation, sql) }};\n {{ get_create_backup_sql(existing_relation) }};\n {{ get_rename_intermediate_sql(target_relation) }};\n {{ get_drop_backup_sql(existing_relation) }}\n\n {# /* create target_relation as an intermediate relation, then swap it out with the existing one without using a backup */ #}\n {%- elif target_relation.can_be_renamed -%}\n {{ get_create_intermediate_sql(target_relation, sql) }};\n {{ get_drop_sql(existing_relation) }};\n {{ get_rename_intermediate_sql(target_relation) }}\n\n {# /* create target_relation in place by first backing up the existing relation */ #}\n {%- elif existing_relation.can_be_renamed -%}\n {{ get_create_backup_sql(existing_relation) }};\n {{ get_create_sql(target_relation, sql) }};\n {{ get_drop_backup_sql(existing_relation) }}\n\n {# /* no renaming is allowed, so just drop and create */ #}\n {%- else -%}\n {{ get_drop_sql(existing_relation) }};\n {{ get_create_sql(target_relation, sql) }}\n\n {%- endif -%}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_replace_view_sql", "macro.dbt.get_replace_table_sql", "macro.dbt.get_replace_materialized_view_sql", "macro.dbt.get_create_intermediate_sql", "macro.dbt.get_create_backup_sql", "macro.dbt.get_rename_intermediate_sql", "macro.dbt.get_drop_backup_sql", "macro.dbt.get_drop_sql", "macro.dbt.get_create_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549919.9782948, "supported_languages": null}, "macro.dbt.get_rename_view_sql": {"name": "get_rename_view_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/view/rename.sql", "original_file_path": "macros/relations/view/rename.sql", "unique_id": "macro.dbt.get_rename_view_sql", "macro_sql": "{% macro get_rename_view_sql(relation, new_name) %}\n {{- adapter.dispatch('get_rename_view_sql', 'dbt')(relation, new_name) -}}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_postgres.postgres__get_rename_view_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549919.978778, "supported_languages": null}, "macro.dbt.default__get_rename_view_sql": {"name": "default__get_rename_view_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/view/rename.sql", "original_file_path": "macros/relations/view/rename.sql", "unique_id": "macro.dbt.default__get_rename_view_sql", "macro_sql": "{% macro default__get_rename_view_sql(relation, new_name) %}\n {{ exceptions.raise_compiler_error(\n \"`get_rename_view_sql` has not been implemented for this adapter.\"\n ) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549919.979038, "supported_languages": null}, "macro.dbt.drop_view": {"name": "drop_view", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/view/drop.sql", "original_file_path": "macros/relations/view/drop.sql", "unique_id": "macro.dbt.drop_view", "macro_sql": "{% macro drop_view(relation) -%}\n {{ return(adapter.dispatch('drop_view', 'dbt')(relation)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_postgres.postgres__drop_view"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549919.97948, "supported_languages": null}, "macro.dbt.default__drop_view": {"name": "default__drop_view", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/view/drop.sql", "original_file_path": "macros/relations/view/drop.sql", "unique_id": "macro.dbt.default__drop_view", "macro_sql": "{% macro default__drop_view(relation) -%}\n drop view if exists {{ relation }} cascade\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549919.979665, "supported_languages": null}, "macro.dbt.get_create_view_as_sql": {"name": "get_create_view_as_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/view/create.sql", "original_file_path": "macros/relations/view/create.sql", "unique_id": "macro.dbt.get_create_view_as_sql", "macro_sql": "{% macro get_create_view_as_sql(relation, sql) -%}\n {{ adapter.dispatch('get_create_view_as_sql', 'dbt')(relation, sql) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_create_view_as_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549919.9803321, "supported_languages": null}, "macro.dbt.default__get_create_view_as_sql": {"name": "default__get_create_view_as_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/view/create.sql", "original_file_path": "macros/relations/view/create.sql", "unique_id": "macro.dbt.default__get_create_view_as_sql", "macro_sql": "{% macro default__get_create_view_as_sql(relation, sql) -%}\n {{ return(create_view_as(relation, sql)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.create_view_as"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549919.980609, "supported_languages": null}, "macro.dbt.create_view_as": {"name": "create_view_as", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/view/create.sql", "original_file_path": "macros/relations/view/create.sql", "unique_id": "macro.dbt.create_view_as", "macro_sql": "{% macro create_view_as(relation, sql) -%}\n {{ adapter.dispatch('create_view_as', 'dbt')(relation, sql) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__create_view_as"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549919.980947, "supported_languages": null}, "macro.dbt.default__create_view_as": {"name": "default__create_view_as", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/view/create.sql", "original_file_path": "macros/relations/view/create.sql", "unique_id": "macro.dbt.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 }}\n {% set contract_config = config.get('contract') %}\n {% if contract_config.enforced %}\n {{ get_assert_columns_equivalent(sql) }}\n {%- endif %}\n as (\n {{ sql }}\n );\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.get_assert_columns_equivalent"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549919.9816947, "supported_languages": null}, "macro.dbt.get_replace_view_sql": {"name": "get_replace_view_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/view/replace.sql", "original_file_path": "macros/relations/view/replace.sql", "unique_id": "macro.dbt.get_replace_view_sql", "macro_sql": "{% macro get_replace_view_sql(relation, sql) %}\n {{- adapter.dispatch('get_replace_view_sql', 'dbt')(relation, sql) -}}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_postgres.postgres__get_replace_view_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549919.9830012, "supported_languages": null}, "macro.dbt.default__get_replace_view_sql": {"name": "default__get_replace_view_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/view/replace.sql", "original_file_path": "macros/relations/view/replace.sql", "unique_id": "macro.dbt.default__get_replace_view_sql", "macro_sql": "{% macro default__get_replace_view_sql(relation, sql) %}\n {{ exceptions.raise_compiler_error(\n \"`get_replace_view_sql` has not been implemented for this adapter.\"\n ) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549919.9832597, "supported_languages": null}, "macro.dbt.create_or_replace_view": {"name": "create_or_replace_view", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/view/replace.sql", "original_file_path": "macros/relations/view/replace.sql", "unique_id": "macro.dbt.create_or_replace_view", "macro_sql": "{% macro create_or_replace_view() %}\n {%- set identifier = model['alias'] -%}\n\n {%- set old_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) -%}\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 {% set grant_config = config.get('grants') %}\n\n {{ run_hooks(pre_hooks) }}\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 {{ get_create_view_as_sql(target_relation, sql) }}\n {%- endcall %}\n\n {% set should_revoke = should_revoke(exists_as_view, full_refresh_mode=True) %}\n {% do apply_grants(target_relation, grant_config, should_revoke=should_revoke) %}\n\n {{ run_hooks(post_hooks) }}\n\n {{ return({'relations': [target_relation]}) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.run_hooks", "macro.dbt.handle_existing_table", "macro.dbt.should_full_refresh", "macro.dbt.statement", "macro.dbt.get_create_view_as_sql", "macro.dbt.should_revoke", "macro.dbt.apply_grants"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549919.9852548, "supported_languages": null}, "macro.dbt.handle_existing_table": {"name": "handle_existing_table", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/view/replace.sql", "original_file_path": "macros/relations/view/replace.sql", "unique_id": "macro.dbt.handle_existing_table", "macro_sql": "{% macro handle_existing_table(full_refresh, old_relation) %}\n {{ adapter.dispatch('handle_existing_table', 'dbt')(full_refresh, old_relation) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__handle_existing_table"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549919.9855976, "supported_languages": null}, "macro.dbt.default__handle_existing_table": {"name": "default__handle_existing_table", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/view/replace.sql", "original_file_path": "macros/relations/view/replace.sql", "unique_id": "macro.dbt.default__handle_existing_table", "macro_sql": "{% macro default__handle_existing_table(full_refresh, old_relation) %}\n {{ log(\"Dropping relation \" ~ old_relation ~ \" because it is of type \" ~ old_relation.type) }}\n {{ adapter.drop_relation(old_relation) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549919.985976, "supported_languages": null}, "macro.dbt.get_rename_table_sql": {"name": "get_rename_table_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/table/rename.sql", "original_file_path": "macros/relations/table/rename.sql", "unique_id": "macro.dbt.get_rename_table_sql", "macro_sql": "{% macro get_rename_table_sql(relation, new_name) %}\n {{- adapter.dispatch('get_rename_table_sql', 'dbt')(relation, new_name) -}}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_postgres.postgres__get_rename_table_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549919.9864326, "supported_languages": null}, "macro.dbt.default__get_rename_table_sql": {"name": "default__get_rename_table_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/table/rename.sql", "original_file_path": "macros/relations/table/rename.sql", "unique_id": "macro.dbt.default__get_rename_table_sql", "macro_sql": "{% macro default__get_rename_table_sql(relation, new_name) %}\n {{ exceptions.raise_compiler_error(\n \"`get_rename_table_sql` has not been implemented for this adapter.\"\n ) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549919.9866905, "supported_languages": null}, "macro.dbt.drop_table": {"name": "drop_table", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/table/drop.sql", "original_file_path": "macros/relations/table/drop.sql", "unique_id": "macro.dbt.drop_table", "macro_sql": "{% macro drop_table(relation) -%}\n {{ return(adapter.dispatch('drop_table', 'dbt')(relation)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_postgres.postgres__drop_table"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549919.9871304, "supported_languages": null}, "macro.dbt.default__drop_table": {"name": "default__drop_table", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/table/drop.sql", "original_file_path": "macros/relations/table/drop.sql", "unique_id": "macro.dbt.default__drop_table", "macro_sql": "{% macro default__drop_table(relation) -%}\n drop table if exists {{ relation }} cascade\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549919.9873137, "supported_languages": null}, "macro.dbt.get_create_table_as_sql": {"name": "get_create_table_as_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/table/create.sql", "original_file_path": "macros/relations/table/create.sql", "unique_id": "macro.dbt.get_create_table_as_sql", "macro_sql": "{% macro get_create_table_as_sql(temporary, relation, sql) -%}\n {{ adapter.dispatch('get_create_table_as_sql', 'dbt')(temporary, relation, sql) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_create_table_as_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549919.988647, "supported_languages": null}, "macro.dbt.default__get_create_table_as_sql": {"name": "default__get_create_table_as_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/table/create.sql", "original_file_path": "macros/relations/table/create.sql", "unique_id": "macro.dbt.default__get_create_table_as_sql", "macro_sql": "{% macro default__get_create_table_as_sql(temporary, relation, sql) -%}\n {{ return(create_table_as(temporary, relation, sql)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.create_table_as"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549919.9889863, "supported_languages": null}, "macro.dbt.create_table_as": {"name": "create_table_as", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/table/create.sql", "original_file_path": "macros/relations/table/create.sql", "unique_id": "macro.dbt.create_table_as", "macro_sql": "{% macro create_table_as(temporary, relation, compiled_code, language='sql') -%}\n {# backward compatibility for create_table_as that does not support language #}\n {% if language == \"sql\" %}\n {{ adapter.dispatch('create_table_as', 'dbt')(temporary, relation, compiled_code)}}\n {% else %}\n {{ adapter.dispatch('create_table_as', 'dbt')(temporary, relation, compiled_code, language) }}\n {% endif %}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_postgres.postgres__create_table_as"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549919.9897256, "supported_languages": null}, "macro.dbt.default__create_table_as": {"name": "default__create_table_as", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/table/create.sql", "original_file_path": "macros/relations/table/create.sql", "unique_id": "macro.dbt.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 {% set contract_config = config.get('contract') %}\n {% if contract_config.enforced and (not temporary) %}\n {{ get_assert_columns_equivalent(sql) }}\n {{ get_table_columns_and_constraints() }}\n {%- set sql = get_select_subquery(sql) %}\n {% endif %}\n as (\n {{ sql }}\n );\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.get_assert_columns_equivalent", "macro.dbt.get_table_columns_and_constraints", "macro.dbt.get_select_subquery"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549919.9909275, "supported_languages": null}, "macro.dbt.default__get_column_names": {"name": "default__get_column_names", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/table/create.sql", "original_file_path": "macros/relations/table/create.sql", "unique_id": "macro.dbt.default__get_column_names", "macro_sql": "{% macro default__get_column_names() %}\n {#- loop through user_provided_columns to get column names -#}\n {%- set user_provided_columns = model['columns'] -%}\n {%- for i in user_provided_columns %}\n {%- set col = user_provided_columns[i] -%}\n {%- set col_name = adapter.quote(col['name']) if col.get('quote') else col['name'] -%}\n {{ col_name }}{{ \", \" if not loop.last }}\n {%- endfor -%}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549919.9917212, "supported_languages": null}, "macro.dbt.get_select_subquery": {"name": "get_select_subquery", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/table/create.sql", "original_file_path": "macros/relations/table/create.sql", "unique_id": "macro.dbt.get_select_subquery", "macro_sql": "{% macro get_select_subquery(sql) %}\n {{ return(adapter.dispatch('get_select_subquery', 'dbt')(sql)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_select_subquery"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549919.992048, "supported_languages": null}, "macro.dbt.default__get_select_subquery": {"name": "default__get_select_subquery", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/table/create.sql", "original_file_path": "macros/relations/table/create.sql", "unique_id": "macro.dbt.default__get_select_subquery", "macro_sql": "{% macro default__get_select_subquery(sql) %}\n select {{ adapter.dispatch('get_column_names', 'dbt')() }}\n from (\n {{ sql }}\n ) as model_subq\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_column_names"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549919.9923563, "supported_languages": null}, "macro.dbt.get_replace_table_sql": {"name": "get_replace_table_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/table/replace.sql", "original_file_path": "macros/relations/table/replace.sql", "unique_id": "macro.dbt.get_replace_table_sql", "macro_sql": "{% macro get_replace_table_sql(relation, sql) %}\n {{- adapter.dispatch('get_replace_table_sql', 'dbt')(relation, sql) -}}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_postgres.postgres__get_replace_table_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549919.9928112, "supported_languages": null}, "macro.dbt.default__get_replace_table_sql": {"name": "default__get_replace_table_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/table/replace.sql", "original_file_path": "macros/relations/table/replace.sql", "unique_id": "macro.dbt.default__get_replace_table_sql", "macro_sql": "{% macro default__get_replace_table_sql(relation, sql) %}\n {{ exceptions.raise_compiler_error(\n \"`get_replace_table_sql` has not been implemented for this adapter.\"\n ) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549919.9930882, "supported_languages": null}, "macro.dbt.refresh_materialized_view": {"name": "refresh_materialized_view", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/materialized_view/refresh.sql", "original_file_path": "macros/relations/materialized_view/refresh.sql", "unique_id": "macro.dbt.refresh_materialized_view", "macro_sql": "{% macro refresh_materialized_view(relation) %}\n {{- log('Applying REFRESH to: ' ~ relation) -}}\n {{- adapter.dispatch('refresh_materialized_view', 'dbt')(relation) -}}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_postgres.postgres__refresh_materialized_view"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549919.993608, "supported_languages": null}, "macro.dbt.default__refresh_materialized_view": {"name": "default__refresh_materialized_view", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/materialized_view/refresh.sql", "original_file_path": "macros/relations/materialized_view/refresh.sql", "unique_id": "macro.dbt.default__refresh_materialized_view", "macro_sql": "{% macro default__refresh_materialized_view(relation) %}\n {{ exceptions.raise_compiler_error(\"`refresh_materialized_view` has not been implemented for this adapter.\") }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549919.9938447, "supported_languages": null}, "macro.dbt.get_rename_materialized_view_sql": {"name": "get_rename_materialized_view_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/materialized_view/rename.sql", "original_file_path": "macros/relations/materialized_view/rename.sql", "unique_id": "macro.dbt.get_rename_materialized_view_sql", "macro_sql": "{% macro get_rename_materialized_view_sql(relation, new_name) %}\n {{- adapter.dispatch('get_rename_materialized_view_sql', 'dbt')(relation, new_name) -}}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_postgres.postgres__get_rename_materialized_view_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549919.994299, "supported_languages": null}, "macro.dbt.default__get_rename_materialized_view_sql": {"name": "default__get_rename_materialized_view_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/materialized_view/rename.sql", "original_file_path": "macros/relations/materialized_view/rename.sql", "unique_id": "macro.dbt.default__get_rename_materialized_view_sql", "macro_sql": "{% macro default__get_rename_materialized_view_sql(relation, new_name) %}\n {{ exceptions.raise_compiler_error(\n \"`get_rename_materialized_view_sql` has not been implemented for this adapter.\"\n ) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549919.9945667, "supported_languages": null}, "macro.dbt.drop_materialized_view": {"name": "drop_materialized_view", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/materialized_view/drop.sql", "original_file_path": "macros/relations/materialized_view/drop.sql", "unique_id": "macro.dbt.drop_materialized_view", "macro_sql": "{% macro drop_materialized_view(relation) -%}\n {{ return(adapter.dispatch('drop_materialized_view', 'dbt')(relation)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_postgres.postgres__drop_materialized_view"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549919.9950004, "supported_languages": null}, "macro.dbt.default__drop_materialized_view": {"name": "default__drop_materialized_view", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/materialized_view/drop.sql", "original_file_path": "macros/relations/materialized_view/drop.sql", "unique_id": "macro.dbt.default__drop_materialized_view", "macro_sql": "{% macro default__drop_materialized_view(relation) -%}\n drop materialized view if exists {{ relation }} cascade\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549919.9952974, "supported_languages": null}, "macro.dbt.get_alter_materialized_view_as_sql": {"name": "get_alter_materialized_view_as_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/materialized_view/alter.sql", "original_file_path": "macros/relations/materialized_view/alter.sql", "unique_id": "macro.dbt.get_alter_materialized_view_as_sql", "macro_sql": "{% macro get_alter_materialized_view_as_sql(\n relation,\n configuration_changes,\n sql,\n existing_relation,\n backup_relation,\n intermediate_relation\n) %}\n {{- log('Applying ALTER to: ' ~ relation) -}}\n {{- adapter.dispatch('get_alter_materialized_view_as_sql', 'dbt')(\n relation,\n configuration_changes,\n sql,\n existing_relation,\n backup_relation,\n intermediate_relation\n ) -}}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_postgres.postgres__get_alter_materialized_view_as_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549919.996255, "supported_languages": null}, "macro.dbt.default__get_alter_materialized_view_as_sql": {"name": "default__get_alter_materialized_view_as_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/materialized_view/alter.sql", "original_file_path": "macros/relations/materialized_view/alter.sql", "unique_id": "macro.dbt.default__get_alter_materialized_view_as_sql", "macro_sql": "{% macro default__get_alter_materialized_view_as_sql(\n relation,\n configuration_changes,\n sql,\n existing_relation,\n backup_relation,\n intermediate_relation\n) %}\n {{ exceptions.raise_compiler_error(\"Materialized views have not been implemented for this adapter.\") }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549919.996579, "supported_languages": null}, "macro.dbt.get_materialized_view_configuration_changes": {"name": "get_materialized_view_configuration_changes", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/materialized_view/alter.sql", "original_file_path": "macros/relations/materialized_view/alter.sql", "unique_id": "macro.dbt.get_materialized_view_configuration_changes", "macro_sql": "{% macro get_materialized_view_configuration_changes(existing_relation, new_config) %}\n /* {#\n It's recommended that configuration changes be formatted as follows:\n {\"\": [{\"action\": \"\", \"context\": ...}]}\n\n For example:\n {\n \"indexes\": [\n {\"action\": \"drop\", \"context\": \"index_abc\"},\n {\"action\": \"create\", \"context\": {\"columns\": [\"column_1\", \"column_2\"], \"type\": \"hash\", \"unique\": True}},\n ],\n }\n\n Either way, `get_materialized_view_configuration_changes` needs to align with `get_alter_materialized_view_as_sql`.\n #} */\n {{- log('Determining configuration changes on: ' ~ existing_relation) -}}\n {%- do return(adapter.dispatch('get_materialized_view_configuration_changes', 'dbt')(existing_relation, new_config)) -%}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_postgres.postgres__get_materialized_view_configuration_changes"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549919.9970875, "supported_languages": null}, "macro.dbt.default__get_materialized_view_configuration_changes": {"name": "default__get_materialized_view_configuration_changes", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/materialized_view/alter.sql", "original_file_path": "macros/relations/materialized_view/alter.sql", "unique_id": "macro.dbt.default__get_materialized_view_configuration_changes", "macro_sql": "{% macro default__get_materialized_view_configuration_changes(existing_relation, new_config) %}\n {{ exceptions.raise_compiler_error(\"Materialized views have not been implemented for this adapter.\") }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549919.9973469, "supported_languages": null}, "macro.dbt.get_create_materialized_view_as_sql": {"name": "get_create_materialized_view_as_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/materialized_view/create.sql", "original_file_path": "macros/relations/materialized_view/create.sql", "unique_id": "macro.dbt.get_create_materialized_view_as_sql", "macro_sql": "{% macro get_create_materialized_view_as_sql(relation, sql) -%}\n {{- adapter.dispatch('get_create_materialized_view_as_sql', 'dbt')(relation, sql) -}}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_postgres.postgres__get_create_materialized_view_as_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549919.9978104, "supported_languages": null}, "macro.dbt.default__get_create_materialized_view_as_sql": {"name": "default__get_create_materialized_view_as_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/materialized_view/create.sql", "original_file_path": "macros/relations/materialized_view/create.sql", "unique_id": "macro.dbt.default__get_create_materialized_view_as_sql", "macro_sql": "{% macro default__get_create_materialized_view_as_sql(relation, sql) -%}\n {{ exceptions.raise_compiler_error(\n \"`get_create_materialized_view_as_sql` has not been implemented for this adapter.\"\n ) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549919.9980607, "supported_languages": null}, "macro.dbt.get_replace_materialized_view_sql": {"name": "get_replace_materialized_view_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/materialized_view/replace.sql", "original_file_path": "macros/relations/materialized_view/replace.sql", "unique_id": "macro.dbt.get_replace_materialized_view_sql", "macro_sql": "{% macro get_replace_materialized_view_sql(relation, sql) %}\n {{- adapter.dispatch('get_replace_materialized_view_sql', 'dbt')(relation, sql) -}}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_replace_materialized_view_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549919.998518, "supported_languages": null}, "macro.dbt.default__get_replace_materialized_view_sql": {"name": "default__get_replace_materialized_view_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/materialized_view/replace.sql", "original_file_path": "macros/relations/materialized_view/replace.sql", "unique_id": "macro.dbt.default__get_replace_materialized_view_sql", "macro_sql": "{% macro default__get_replace_materialized_view_sql(relation, sql) %}\n {{ exceptions.raise_compiler_error(\n \"`get_replace_materialized_view_sql` has not been implemented for this adapter.\"\n ) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549919.9987843, "supported_languages": null}, "macro.dbt.get_table_columns_and_constraints": {"name": "get_table_columns_and_constraints", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/column/columns_spec_ddl.sql", "original_file_path": "macros/relations/column/columns_spec_ddl.sql", "unique_id": "macro.dbt.get_table_columns_and_constraints", "macro_sql": "{%- macro get_table_columns_and_constraints() -%}\n {{ adapter.dispatch('get_table_columns_and_constraints', 'dbt')() }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt.default__get_table_columns_and_constraints"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.0003295, "supported_languages": null}, "macro.dbt.default__get_table_columns_and_constraints": {"name": "default__get_table_columns_and_constraints", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/column/columns_spec_ddl.sql", "original_file_path": "macros/relations/column/columns_spec_ddl.sql", "unique_id": "macro.dbt.default__get_table_columns_and_constraints", "macro_sql": "{% macro default__get_table_columns_and_constraints() -%}\n {{ return(table_columns_and_constraints()) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.table_columns_and_constraints"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.0005422, "supported_languages": null}, "macro.dbt.table_columns_and_constraints": {"name": "table_columns_and_constraints", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/column/columns_spec_ddl.sql", "original_file_path": "macros/relations/column/columns_spec_ddl.sql", "unique_id": "macro.dbt.table_columns_and_constraints", "macro_sql": "{% macro table_columns_and_constraints() %}\n {# loop through user_provided_columns to create DDL with data types and constraints #}\n {%- set raw_column_constraints = adapter.render_raw_columns_constraints(raw_columns=model['columns']) -%}\n {%- set raw_model_constraints = adapter.render_raw_model_constraints(raw_constraints=model['constraints']) -%}\n (\n {% for c in raw_column_constraints -%}\n {{ c }}{{ \",\" if not loop.last or raw_model_constraints }}\n {% endfor %}\n {% for c in raw_model_constraints -%}\n {{ c }}{{ \",\" if not loop.last }}\n {% endfor -%}\n )\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.0014904, "supported_languages": null}, "macro.dbt.get_assert_columns_equivalent": {"name": "get_assert_columns_equivalent", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/column/columns_spec_ddl.sql", "original_file_path": "macros/relations/column/columns_spec_ddl.sql", "unique_id": "macro.dbt.get_assert_columns_equivalent", "macro_sql": "\n\n{%- macro get_assert_columns_equivalent(sql) -%}\n {{ adapter.dispatch('get_assert_columns_equivalent', 'dbt')(sql) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt.default__get_assert_columns_equivalent"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.001788, "supported_languages": null}, "macro.dbt.default__get_assert_columns_equivalent": {"name": "default__get_assert_columns_equivalent", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/column/columns_spec_ddl.sql", "original_file_path": "macros/relations/column/columns_spec_ddl.sql", "unique_id": "macro.dbt.default__get_assert_columns_equivalent", "macro_sql": "{% macro default__get_assert_columns_equivalent(sql) -%}\n {{ return(assert_columns_equivalent(sql)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.assert_columns_equivalent"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.002029, "supported_languages": null}, "macro.dbt.assert_columns_equivalent": {"name": "assert_columns_equivalent", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/column/columns_spec_ddl.sql", "original_file_path": "macros/relations/column/columns_spec_ddl.sql", "unique_id": "macro.dbt.assert_columns_equivalent", "macro_sql": "{% macro assert_columns_equivalent(sql) %}\n\n {#-- First ensure the user has defined 'columns' in yaml specification --#}\n {%- set user_defined_columns = model['columns'] -%}\n {%- if not user_defined_columns -%}\n {{ exceptions.raise_contract_error([], []) }}\n {%- endif -%}\n\n {#-- Obtain the column schema provided by sql file. #}\n {%- set sql_file_provided_columns = get_column_schema_from_query(sql, config.get('sql_header', none)) -%}\n {#--Obtain the column schema provided by the schema file by generating an 'empty schema' query from the model's columns. #}\n {%- set schema_file_provided_columns = get_column_schema_from_query(get_empty_schema_sql(user_defined_columns)) -%}\n\n {#-- create dictionaries with name and formatted data type and strings for exception #}\n {%- set sql_columns = format_columns(sql_file_provided_columns) -%}\n {%- set yaml_columns = format_columns(schema_file_provided_columns) -%}\n\n {%- if sql_columns|length != yaml_columns|length -%}\n {%- do exceptions.raise_contract_error(yaml_columns, sql_columns) -%}\n {%- endif -%}\n\n {%- for sql_col in sql_columns -%}\n {%- set yaml_col = [] -%}\n {%- for this_col in yaml_columns -%}\n {%- if this_col['name'] == sql_col['name'] -%}\n {%- do yaml_col.append(this_col) -%}\n {%- break -%}\n {%- endif -%}\n {%- endfor -%}\n {%- if not yaml_col -%}\n {#-- Column with name not found in yaml #}\n {%- do exceptions.raise_contract_error(yaml_columns, sql_columns) -%}\n {%- endif -%}\n {%- if sql_col['formatted'] != yaml_col[0]['formatted'] -%}\n {#-- Column data types don't match #}\n {%- do exceptions.raise_contract_error(yaml_columns, sql_columns) -%}\n {%- endif -%}\n {%- endfor -%}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_column_schema_from_query", "macro.dbt.get_empty_schema_sql", "macro.dbt.format_columns"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.0042746, "supported_languages": null}, "macro.dbt.format_columns": {"name": "format_columns", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/column/columns_spec_ddl.sql", "original_file_path": "macros/relations/column/columns_spec_ddl.sql", "unique_id": "macro.dbt.format_columns", "macro_sql": "{% macro format_columns(columns) %}\n {% set formatted_columns = [] %}\n {% for column in columns %}\n {%- set formatted_column = adapter.dispatch('format_column', 'dbt')(column) -%}\n {%- do formatted_columns.append(formatted_column) -%}\n {% endfor %}\n {{ return(formatted_columns) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__format_column"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.0049505, "supported_languages": null}, "macro.dbt.default__format_column": {"name": "default__format_column", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/column/columns_spec_ddl.sql", "original_file_path": "macros/relations/column/columns_spec_ddl.sql", "unique_id": "macro.dbt.default__format_column", "macro_sql": "{% macro default__format_column(column) -%}\n {% set data_type = column.dtype %}\n {% set formatted = column.column.lower() ~ \" \" ~ data_type %}\n {{ return({'name': column.name, 'data_type': data_type, 'formatted': formatted}) }}\n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.0055432, "supported_languages": null}, "macro.dbt.resolve_model_name": {"name": "resolve_model_name", "resource_type": "macro", "package_name": "dbt", "path": "macros/python_model/python.sql", "original_file_path": "macros/python_model/python.sql", "unique_id": "macro.dbt.resolve_model_name", "macro_sql": "{% macro resolve_model_name(input_model_name) %}\n {{ return(adapter.dispatch('resolve_model_name', 'dbt')(input_model_name)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__resolve_model_name"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.0079458, "supported_languages": null}, "macro.dbt.default__resolve_model_name": {"name": "default__resolve_model_name", "resource_type": "macro", "package_name": "dbt", "path": "macros/python_model/python.sql", "original_file_path": "macros/python_model/python.sql", "unique_id": "macro.dbt.default__resolve_model_name", "macro_sql": "\n\n{%- macro default__resolve_model_name(input_model_name) -%}\n {{ input_model_name | string | replace('\"', '\\\"') }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.0082126, "supported_languages": null}, "macro.dbt.build_ref_function": {"name": "build_ref_function", "resource_type": "macro", "package_name": "dbt", "path": "macros/python_model/python.sql", "original_file_path": "macros/python_model/python.sql", "unique_id": "macro.dbt.build_ref_function", "macro_sql": "{% macro build_ref_function(model) %}\n\n {%- set ref_dict = {} -%}\n {%- for _ref in model.refs -%}\n {% set _ref_args = [_ref.get('package'), _ref['name']] if _ref.get('package') else [_ref['name'],] %}\n {%- set resolved = ref(*_ref_args, v=_ref.get('version')) -%}\n {%- if _ref.get('version') -%}\n {% do _ref_args.extend([\"v\" ~ _ref['version']]) %}\n {%- endif -%}\n {%- do ref_dict.update({_ref_args | join('.'): resolve_model_name(resolved)}) -%}\n {%- endfor -%}\n\ndef ref(*args, **kwargs):\n refs = {{ ref_dict | tojson }}\n key = '.'.join(args)\n version = kwargs.get(\"v\") or kwargs.get(\"version\")\n if version:\n key += f\".v{version}\"\n dbt_load_df_function = kwargs.get(\"dbt_load_df_function\")\n return dbt_load_df_function(refs[key])\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.resolve_model_name"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.0096428, "supported_languages": null}, "macro.dbt.build_source_function": {"name": "build_source_function", "resource_type": "macro", "package_name": "dbt", "path": "macros/python_model/python.sql", "original_file_path": "macros/python_model/python.sql", "unique_id": "macro.dbt.build_source_function", "macro_sql": "{% macro build_source_function(model) %}\n\n {%- set source_dict = {} -%}\n {%- for _source in model.sources -%}\n {%- set resolved = source(*_source) -%}\n {%- do source_dict.update({_source | join('.'): resolve_model_name(resolved)}) -%}\n {%- endfor -%}\n\ndef source(*args, dbt_load_df_function):\n sources = {{ source_dict | tojson }}\n key = '.'.join(args)\n return dbt_load_df_function(sources[key])\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.resolve_model_name"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.010352, "supported_languages": null}, "macro.dbt.build_config_dict": {"name": "build_config_dict", "resource_type": "macro", "package_name": "dbt", "path": "macros/python_model/python.sql", "original_file_path": "macros/python_model/python.sql", "unique_id": "macro.dbt.build_config_dict", "macro_sql": "{% macro build_config_dict(model) %}\n {%- set config_dict = {} -%}\n {% set config_dbt_used = zip(model.config.config_keys_used, model.config.config_keys_defaults) | list %}\n {%- for key, default in config_dbt_used -%}\n {# weird type testing with enum, would be much easier to write this logic in Python! #}\n {%- if key == \"language\" -%}\n {%- set value = \"python\" -%}\n {%- endif -%}\n {%- set value = model.config.get(key, default) -%}\n {%- do config_dict.update({key: value}) -%}\n {%- endfor -%}\nconfig_dict = {{ config_dict }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.0113633, "supported_languages": null}, "macro.dbt.py_script_postfix": {"name": "py_script_postfix", "resource_type": "macro", "package_name": "dbt", "path": "macros/python_model/python.sql", "original_file_path": "macros/python_model/python.sql", "unique_id": "macro.dbt.py_script_postfix", "macro_sql": "{% macro py_script_postfix(model) %}\n# This part is user provided model code\n# you will need to copy the next section to run the code\n# COMMAND ----------\n# this part is dbt logic for get ref work, do not modify\n\n{{ build_ref_function(model ) }}\n{{ build_source_function(model ) }}\n{{ build_config_dict(model) }}\n\nclass config:\n def __init__(self, *args, **kwargs):\n pass\n\n @staticmethod\n def get(key, default=None):\n return config_dict.get(key, default)\n\nclass this:\n \"\"\"dbt.this() or dbt.this.identifier\"\"\"\n database = \"{{ this.database }}\"\n schema = \"{{ this.schema }}\"\n identifier = \"{{ this.identifier }}\"\n {% set this_relation_name = resolve_model_name(this) %}\n def __repr__(self):\n return '{{ this_relation_name }}'\n\n\nclass dbtObj:\n def __init__(self, load_df_function) -> None:\n self.source = lambda *args: source(*args, dbt_load_df_function=load_df_function)\n self.ref = lambda *args, **kwargs: ref(*args, **kwargs, dbt_load_df_function=load_df_function)\n self.config = config\n self.this = this()\n self.is_incremental = {{ is_incremental() }}\n\n# COMMAND ----------\n{{py_script_comment()}}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.build_ref_function", "macro.dbt.build_source_function", "macro.dbt.build_config_dict", "macro.dbt.resolve_model_name", "macro.dbt.is_incremental", "macro.dbt.py_script_comment"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.0121806, "supported_languages": null}, "macro.dbt.py_script_comment": {"name": "py_script_comment", "resource_type": "macro", "package_name": "dbt", "path": "macros/python_model/python.sql", "original_file_path": "macros/python_model/python.sql", "unique_id": "macro.dbt.py_script_comment", "macro_sql": "{%macro py_script_comment()%}\n{%endmacro%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.0123172, "supported_languages": null}, "macro.dbt.generate_alias_name": {"name": "generate_alias_name", "resource_type": "macro", "package_name": "dbt", "path": "macros/get_custom_name/get_custom_alias.sql", "original_file_path": "macros/get_custom_name/get_custom_alias.sql", "unique_id": "macro.dbt.generate_alias_name", "macro_sql": "{% macro generate_alias_name(custom_alias_name=none, node=none) -%}\n {% do return(adapter.dispatch('generate_alias_name', 'dbt')(custom_alias_name, node)) %}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__generate_alias_name"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.0130324, "supported_languages": null}, "macro.dbt.default__generate_alias_name": {"name": "default__generate_alias_name", "resource_type": "macro", "package_name": "dbt", "path": "macros/get_custom_name/get_custom_alias.sql", "original_file_path": "macros/get_custom_name/get_custom_alias.sql", "unique_id": "macro.dbt.default__generate_alias_name", "macro_sql": "{% macro default__generate_alias_name(custom_alias_name=none, node=none) -%}\n\n {%- if custom_alias_name -%}\n\n {{ custom_alias_name | trim }}\n\n {%- elif node.version -%}\n\n {{ return(node.name ~ \"_v\" ~ (node.version | replace(\".\", \"_\"))) }}\n\n {%- else -%}\n\n {{ node.name }}\n\n {%- endif -%}\n\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.0136874, "supported_languages": null}, "macro.dbt.generate_schema_name": {"name": "generate_schema_name", "resource_type": "macro", "package_name": "dbt", "path": "macros/get_custom_name/get_custom_schema.sql", "original_file_path": "macros/get_custom_name/get_custom_schema.sql", "unique_id": "macro.dbt.generate_schema_name", "macro_sql": "{% macro generate_schema_name(custom_schema_name=none, node=none) -%}\n {{ return(adapter.dispatch('generate_schema_name', 'dbt')(custom_schema_name, node)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__generate_schema_name"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.0145485, "supported_languages": null}, "macro.dbt.default__generate_schema_name": {"name": "default__generate_schema_name", "resource_type": "macro", "package_name": "dbt", "path": "macros/get_custom_name/get_custom_schema.sql", "original_file_path": "macros/get_custom_name/get_custom_schema.sql", "unique_id": "macro.dbt.default__generate_schema_name", "macro_sql": "{% macro default__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 %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.0150006, "supported_languages": null}, "macro.dbt.generate_schema_name_for_env": {"name": "generate_schema_name_for_env", "resource_type": "macro", "package_name": "dbt", "path": "macros/get_custom_name/get_custom_schema.sql", "original_file_path": "macros/get_custom_name/get_custom_schema.sql", "unique_id": "macro.dbt.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 %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.0154898, "supported_languages": null}, "macro.dbt.generate_database_name": {"name": "generate_database_name", "resource_type": "macro", "package_name": "dbt", "path": "macros/get_custom_name/get_custom_database.sql", "original_file_path": "macros/get_custom_name/get_custom_database.sql", "unique_id": "macro.dbt.generate_database_name", "macro_sql": "{% macro generate_database_name(custom_database_name=none, node=none) -%}\n {% do return(adapter.dispatch('generate_database_name', 'dbt')(custom_database_name, node)) %}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__generate_database_name"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.016121, "supported_languages": null}, "macro.dbt.default__generate_database_name": {"name": "default__generate_database_name", "resource_type": "macro", "package_name": "dbt", "path": "macros/get_custom_name/get_custom_database.sql", "original_file_path": "macros/get_custom_name/get_custom_database.sql", "unique_id": "macro.dbt.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 %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.0165513, "supported_languages": null}, "macro.dbt.statement": {"name": "statement", "resource_type": "macro", "package_name": "dbt", "path": "macros/etc/statement.sql", "original_file_path": "macros/etc/statement.sql", "unique_id": "macro.dbt.statement", "macro_sql": "\n{%- macro statement(name=None, fetch_result=False, auto_begin=True, language='sql') -%}\n {%- if execute: -%}\n {%- set compiled_code = caller() -%}\n\n {%- if name == 'main' -%}\n {{ log('Writing runtime {} for node \"{}\"'.format(language, model['unique_id'])) }}\n {{ write(compiled_code) }}\n {%- endif -%}\n {%- if language == 'sql'-%}\n {%- set res, table = adapter.execute(compiled_code, auto_begin=auto_begin, fetch=fetch_result) -%}\n {%- elif language == 'python' -%}\n {%- set res = submit_python_job(model, compiled_code) -%}\n {#-- TODO: What should table be for python models? --#}\n {%- set table = None -%}\n {%- else -%}\n {% do exceptions.raise_compiler_error(\"statement macro didn't get supported language\") %}\n {%- endif -%}\n\n {%- if name is not none -%}\n {{ store_result(name, response=res, agate_table=table) }}\n {%- endif -%}\n\n {%- endif -%}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.0189216, "supported_languages": null}, "macro.dbt.noop_statement": {"name": "noop_statement", "resource_type": "macro", "package_name": "dbt", "path": "macros/etc/statement.sql", "original_file_path": "macros/etc/statement.sql", "unique_id": "macro.dbt.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 %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.0200934, "supported_languages": null}, "macro.dbt.run_query": {"name": "run_query", "resource_type": "macro", "package_name": "dbt", "path": "macros/etc/statement.sql", "original_file_path": "macros/etc/statement.sql", "unique_id": "macro.dbt.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 %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.0205984, "supported_languages": null}, "macro.dbt.convert_datetime": {"name": "convert_datetime", "resource_type": "macro", "package_name": "dbt", "path": "macros/etc/datetime.sql", "original_file_path": "macros/etc/datetime.sql", "unique_id": "macro.dbt.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 %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.0233498, "supported_languages": null}, "macro.dbt.dates_in_range": {"name": "dates_in_range", "resource_type": "macro", "package_name": "dbt", "path": "macros/etc/datetime.sql", "original_file_path": "macros/etc/datetime.sql", "unique_id": "macro.dbt.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 Partition 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 %}", "depends_on": {"macros": ["macro.dbt.convert_datetime"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.0254123, "supported_languages": null}, "macro.dbt.partition_range": {"name": "partition_range", "resource_type": "macro", "package_name": "dbt", "path": "macros/etc/datetime.sql", "original_file_path": "macros/etc/datetime.sql", "unique_id": "macro.dbt.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 %}", "depends_on": {"macros": ["macro.dbt.dates_in_range"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.0266943, "supported_languages": null}, "macro.dbt.py_current_timestring": {"name": "py_current_timestring", "resource_type": "macro", "package_name": "dbt", "path": "macros/etc/datetime.sql", "original_file_path": "macros/etc/datetime.sql", "unique_id": "macro.dbt.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 %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.0270932, "supported_languages": null}, "macro.dbt.set_sql_header": {"name": "set_sql_header", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/configs.sql", "original_file_path": "macros/materializations/configs.sql", "unique_id": "macro.dbt.set_sql_header", "macro_sql": "{% macro set_sql_header(config) -%}\n {{ config.set('sql_header', caller()) }}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.0277061, "supported_languages": null}, "macro.dbt.should_full_refresh": {"name": "should_full_refresh", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/configs.sql", "original_file_path": "macros/materializations/configs.sql", "unique_id": "macro.dbt.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 %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.0282347, "supported_languages": null}, "macro.dbt.should_store_failures": {"name": "should_store_failures", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/configs.sql", "original_file_path": "macros/materializations/configs.sql", "unique_id": "macro.dbt.should_store_failures", "macro_sql": "{% macro should_store_failures() %}\n {% set config_store_failures = config.get('store_failures') %}\n {% if config_store_failures is none %}\n {% set config_store_failures = flags.STORE_FAILURES %}\n {% endif %}\n {% do return(config_store_failures) %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.0287628, "supported_languages": null}, "macro.dbt.run_hooks": {"name": "run_hooks", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/hooks.sql", "original_file_path": "macros/materializations/hooks.sql", "unique_id": "macro.dbt.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 %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.0305355, "supported_languages": null}, "macro.dbt.make_hook_config": {"name": "make_hook_config", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/hooks.sql", "original_file_path": "macros/materializations/hooks.sql", "unique_id": "macro.dbt.make_hook_config", "macro_sql": "{% macro make_hook_config(sql, inside_transaction) %}\n {{ tojson({\"sql\": sql, \"transaction\": inside_transaction}) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.0308678, "supported_languages": null}, "macro.dbt.before_begin": {"name": "before_begin", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/hooks.sql", "original_file_path": "macros/materializations/hooks.sql", "unique_id": "macro.dbt.before_begin", "macro_sql": "{% macro before_begin(sql) %}\n {{ make_hook_config(sql, inside_transaction=False) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.make_hook_config"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.0311227, "supported_languages": null}, "macro.dbt.in_transaction": {"name": "in_transaction", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/hooks.sql", "original_file_path": "macros/materializations/hooks.sql", "unique_id": "macro.dbt.in_transaction", "macro_sql": "{% macro in_transaction(sql) %}\n {{ make_hook_config(sql, inside_transaction=True) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.make_hook_config"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.031373, "supported_languages": null}, "macro.dbt.after_commit": {"name": "after_commit", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/hooks.sql", "original_file_path": "macros/materializations/hooks.sql", "unique_id": "macro.dbt.after_commit", "macro_sql": "{% macro after_commit(sql) %}\n {{ make_hook_config(sql, inside_transaction=False) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.make_hook_config"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.031622, "supported_languages": null}, "macro.dbt.materialization_materialized_view_default": {"name": "materialization_materialized_view_default", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/materialized_view.sql", "original_file_path": "macros/materializations/models/materialized_view.sql", "unique_id": "macro.dbt.materialization_materialized_view_default", "macro_sql": "{% materialization materialized_view, default %}\n {% set existing_relation = load_cached_relation(this) %}\n {% set target_relation = this.incorporate(type=this.MaterializedView) %}\n {% set intermediate_relation = make_intermediate_relation(target_relation) %}\n {% set backup_relation_type = target_relation.MaterializedView if existing_relation is none else existing_relation.type %}\n {% set backup_relation = make_backup_relation(target_relation, backup_relation_type) %}\n\n {{ materialized_view_setup(backup_relation, intermediate_relation, pre_hooks) }}\n\n {% set build_sql = materialized_view_get_build_sql(existing_relation, target_relation, backup_relation, intermediate_relation) %}\n\n {% if build_sql == '' %}\n {{ materialized_view_execute_no_op(target_relation) }}\n {% else %}\n {{ materialized_view_execute_build_sql(build_sql, existing_relation, target_relation, post_hooks) }}\n {% endif %}\n\n {{ materialized_view_teardown(backup_relation, intermediate_relation, post_hooks) }}\n\n {{ return({'relations': [target_relation]}) }}\n\n{% endmaterialization %}", "depends_on": {"macros": ["macro.dbt.load_cached_relation", "macro.dbt.make_intermediate_relation", "macro.dbt.make_backup_relation", "macro.dbt.materialized_view_setup", "macro.dbt.materialized_view_get_build_sql", "macro.dbt.materialized_view_execute_no_op", "macro.dbt.materialized_view_execute_build_sql", "macro.dbt.materialized_view_teardown"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.0387692, "supported_languages": ["sql"]}, "macro.dbt.materialized_view_setup": {"name": "materialized_view_setup", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/materialized_view.sql", "original_file_path": "macros/materializations/models/materialized_view.sql", "unique_id": "macro.dbt.materialized_view_setup", "macro_sql": "{% macro materialized_view_setup(backup_relation, intermediate_relation, pre_hooks) %}\n\n -- backup_relation and intermediate_relation should not already exist in the database\n -- it's possible these exist because of a previous run that exited unexpectedly\n {% set preexisting_backup_relation = load_cached_relation(backup_relation) %}\n {% set preexisting_intermediate_relation = load_cached_relation(intermediate_relation) %}\n\n -- drop the temp relations if they exist already in the database\n {{ drop_relation_if_exists(preexisting_backup_relation) }}\n {{ drop_relation_if_exists(preexisting_intermediate_relation) }}\n\n {{ run_hooks(pre_hooks, inside_transaction=False) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.load_cached_relation", "macro.dbt.drop_relation_if_exists", "macro.dbt.run_hooks"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.039537, "supported_languages": null}, "macro.dbt.materialized_view_teardown": {"name": "materialized_view_teardown", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/materialized_view.sql", "original_file_path": "macros/materializations/models/materialized_view.sql", "unique_id": "macro.dbt.materialized_view_teardown", "macro_sql": "{% macro materialized_view_teardown(backup_relation, intermediate_relation, post_hooks) %}\n\n -- drop the temp relations if they exist to leave the database clean for the next run\n {{ drop_relation_if_exists(backup_relation) }}\n {{ drop_relation_if_exists(intermediate_relation) }}\n\n {{ run_hooks(post_hooks, inside_transaction=False) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.drop_relation_if_exists", "macro.dbt.run_hooks"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.0399702, "supported_languages": null}, "macro.dbt.materialized_view_get_build_sql": {"name": "materialized_view_get_build_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/materialized_view.sql", "original_file_path": "macros/materializations/models/materialized_view.sql", "unique_id": "macro.dbt.materialized_view_get_build_sql", "macro_sql": "{% macro materialized_view_get_build_sql(existing_relation, target_relation, backup_relation, intermediate_relation) %}\n\n {% set full_refresh_mode = should_full_refresh() %}\n\n -- determine the scenario we're in: create, full_refresh, alter, refresh data\n {% if existing_relation is none %}\n {% set build_sql = get_create_materialized_view_as_sql(target_relation, sql) %}\n {% elif full_refresh_mode or not existing_relation.is_materialized_view %}\n {% set build_sql = get_replace_sql(existing_relation, target_relation, sql) %}\n {% else %}\n\n -- get config options\n {% set on_configuration_change = config.get('on_configuration_change') %}\n {% set configuration_changes = get_materialized_view_configuration_changes(existing_relation, config) %}\n\n {% if configuration_changes is none %}\n {% set build_sql = refresh_materialized_view(target_relation) %}\n\n {% elif on_configuration_change == 'apply' %}\n {% set build_sql = get_alter_materialized_view_as_sql(target_relation, configuration_changes, sql, existing_relation, backup_relation, intermediate_relation) %}\n {% elif on_configuration_change == 'continue' %}\n {% set build_sql = '' %}\n {{ exceptions.warn(\"Configuration changes were identified and `on_configuration_change` was set to `continue` for `\" ~ target_relation ~ \"`\") }}\n {% elif on_configuration_change == 'fail' %}\n {{ exceptions.raise_fail_fast_error(\"Configuration changes were identified and `on_configuration_change` was set to `fail` for `\" ~ target_relation ~ \"`\") }}\n\n {% else %}\n -- this only happens if the user provides a value other than `apply`, 'skip', 'fail'\n {{ exceptions.raise_compiler_error(\"Unexpected configuration scenario\") }}\n\n {% endif %}\n\n {% endif %}\n\n {% do return(build_sql) %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.should_full_refresh", "macro.dbt.get_create_materialized_view_as_sql", "macro.dbt.get_replace_sql", "macro.dbt.get_materialized_view_configuration_changes", "macro.dbt.refresh_materialized_view", "macro.dbt.get_alter_materialized_view_as_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.0422149, "supported_languages": null}, "macro.dbt.materialized_view_execute_no_op": {"name": "materialized_view_execute_no_op", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/materialized_view.sql", "original_file_path": "macros/materializations/models/materialized_view.sql", "unique_id": "macro.dbt.materialized_view_execute_no_op", "macro_sql": "{% macro materialized_view_execute_no_op(target_relation) %}\n {% do store_raw_result(\n name=\"main\",\n message=\"skip \" ~ target_relation,\n code=\"skip\",\n rows_affected=\"-1\"\n ) %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.0426214, "supported_languages": null}, "macro.dbt.materialized_view_execute_build_sql": {"name": "materialized_view_execute_build_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/materialized_view.sql", "original_file_path": "macros/materializations/models/materialized_view.sql", "unique_id": "macro.dbt.materialized_view_execute_build_sql", "macro_sql": "{% macro materialized_view_execute_build_sql(build_sql, existing_relation, target_relation, post_hooks) %}\n\n -- `BEGIN` happens here:\n {{ run_hooks(pre_hooks, inside_transaction=True) }}\n\n {% set grant_config = config.get('grants') %}\n\n {% call statement(name=\"main\") %}\n {{ build_sql }}\n {% endcall %}\n\n {% set should_revoke = should_revoke(existing_relation, full_refresh_mode=True) %}\n {% do apply_grants(target_relation, grant_config, should_revoke=should_revoke) %}\n\n {% do persist_docs(target_relation, model) %}\n\n {{ run_hooks(post_hooks, inside_transaction=True) }}\n\n {{ adapter.commit() }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.run_hooks", "macro.dbt.statement", "macro.dbt.should_revoke", "macro.dbt.apply_grants", "macro.dbt.persist_docs"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.0437427, "supported_languages": null}, "macro.dbt.materialization_table_default": {"name": "materialization_table_default", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/table.sql", "original_file_path": "macros/materializations/models/table.sql", "unique_id": "macro.dbt.materialization_table_default", "macro_sql": "{% materialization table, default %}\n\n {%- set existing_relation = load_cached_relation(this) -%}\n {%- set target_relation = this.incorporate(type='table') %}\n {%- set intermediate_relation = make_intermediate_relation(target_relation) -%}\n -- the intermediate_relation should not already exist in the database; get_relation\n -- will return None in that case. Otherwise, we get a relation that we can drop\n -- later, before we try to use this name for the current operation\n {%- set preexisting_intermediate_relation = load_cached_relation(intermediate_relation) -%}\n /*\n See ../view/view.sql for more information about this relation.\n */\n {%- set backup_relation_type = 'table' if existing_relation is none else existing_relation.type -%}\n {%- set backup_relation = make_backup_relation(target_relation, backup_relation_type) -%}\n -- as above, the backup_relation should not already exist\n {%- set preexisting_backup_relation = load_cached_relation(backup_relation) -%}\n -- grab current tables grants config for comparision later on\n {% set grant_config = config.get('grants') %}\n\n -- drop the temp relations if they exist already in the database\n {{ drop_relation_if_exists(preexisting_intermediate_relation) }}\n {{ drop_relation_if_exists(preexisting_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 {{ get_create_table_as_sql(False, intermediate_relation, sql) }}\n {%- endcall %}\n\n -- cleanup\n {% if existing_relation is not none %}\n /* Do the equivalent of rename_if_exists. 'existing_relation' could have been dropped\n since the variable was first set. */\n {% set existing_relation = load_cached_relation(existing_relation) %}\n {% if existing_relation is not none %}\n {{ adapter.rename_relation(existing_relation, backup_relation) }}\n {% endif %}\n {% endif %}\n\n {{ adapter.rename_relation(intermediate_relation, target_relation) }}\n\n {% do create_indexes(target_relation) %}\n\n {{ run_hooks(post_hooks, inside_transaction=True) }}\n\n {% set should_revoke = should_revoke(existing_relation, full_refresh_mode=True) %}\n {% do apply_grants(target_relation, grant_config, should_revoke=should_revoke) %}\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 %}", "depends_on": {"macros": ["macro.dbt.load_cached_relation", "macro.dbt.make_intermediate_relation", "macro.dbt.make_backup_relation", "macro.dbt.drop_relation_if_exists", "macro.dbt.run_hooks", "macro.dbt.statement", "macro.dbt.get_create_table_as_sql", "macro.dbt.create_indexes", "macro.dbt.should_revoke", "macro.dbt.apply_grants", "macro.dbt.persist_docs"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.0483942, "supported_languages": ["sql"]}, "macro.dbt.materialization_view_default": {"name": "materialization_view_default", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/view.sql", "original_file_path": "macros/materializations/models/view.sql", "unique_id": "macro.dbt.materialization_view_default", "macro_sql": "{%- materialization view, default -%}\n\n {%- set existing_relation = load_cached_relation(this) -%}\n {%- set target_relation = this.incorporate(type='view') -%}\n {%- set intermediate_relation = make_intermediate_relation(target_relation) -%}\n\n -- the intermediate_relation should not already exist in the database; get_relation\n -- will return None in that case. Otherwise, we get a relation that we can drop\n -- later, before we try to use this name for the current operation\n {%- set preexisting_intermediate_relation = load_cached_relation(intermediate_relation) -%}\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 \"existing_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 existing_relation, if it exists,\n or else \"view\" as a sane default if it does not. Note that if the existing_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 existing_relation is none else existing_relation.type -%}\n {%- set backup_relation = make_backup_relation(target_relation, backup_relation_type) -%}\n -- as above, the backup_relation should not already exist\n {%- set preexisting_backup_relation = load_cached_relation(backup_relation) -%}\n -- grab current tables grants config for comparision later on\n {% set grant_config = config.get('grants') %}\n\n {{ run_hooks(pre_hooks, inside_transaction=False) }}\n\n -- drop the temp relations if they exist already in the database\n {{ drop_relation_if_exists(preexisting_intermediate_relation) }}\n {{ drop_relation_if_exists(preexisting_backup_relation) }}\n\n -- `BEGIN` happens here:\n {{ run_hooks(pre_hooks, inside_transaction=True) }}\n\n -- build model\n {% call statement('main') -%}\n {{ get_create_view_as_sql(intermediate_relation, sql) }}\n {%- endcall %}\n\n -- cleanup\n -- move the existing view out of the way\n {% if existing_relation is not none %}\n /* Do the equivalent of rename_if_exists. 'existing_relation' could have been dropped\n since the variable was first set. */\n {% set existing_relation = load_cached_relation(existing_relation) %}\n {% if existing_relation is not none %}\n {{ adapter.rename_relation(existing_relation, backup_relation) }}\n {% endif %}\n {% endif %}\n {{ adapter.rename_relation(intermediate_relation, target_relation) }}\n\n {% set should_revoke = should_revoke(existing_relation, full_refresh_mode=True) %}\n {% do apply_grants(target_relation, grant_config, should_revoke=should_revoke) %}\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 -%}", "depends_on": {"macros": ["macro.dbt.load_cached_relation", "macro.dbt.make_intermediate_relation", "macro.dbt.make_backup_relation", "macro.dbt.run_hooks", "macro.dbt.drop_relation_if_exists", "macro.dbt.statement", "macro.dbt.get_create_view_as_sql", "macro.dbt.should_revoke", "macro.dbt.apply_grants", "macro.dbt.persist_docs"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.0530417, "supported_languages": ["sql"]}, "macro.dbt.create_or_replace_clone": {"name": "create_or_replace_clone", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/clone/create_or_replace_clone.sql", "original_file_path": "macros/materializations/models/clone/create_or_replace_clone.sql", "unique_id": "macro.dbt.create_or_replace_clone", "macro_sql": "{% macro create_or_replace_clone(this_relation, defer_relation) %}\n {{ return(adapter.dispatch('create_or_replace_clone', 'dbt')(this_relation, defer_relation)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__create_or_replace_clone"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.053577, "supported_languages": null}, "macro.dbt.default__create_or_replace_clone": {"name": "default__create_or_replace_clone", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/clone/create_or_replace_clone.sql", "original_file_path": "macros/materializations/models/clone/create_or_replace_clone.sql", "unique_id": "macro.dbt.default__create_or_replace_clone", "macro_sql": "{% macro default__create_or_replace_clone(this_relation, defer_relation) %}\n create or replace table {{ this_relation }} clone {{ defer_relation }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.0538173, "supported_languages": null}, "macro.dbt.materialization_clone_default": {"name": "materialization_clone_default", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/clone/clone.sql", "original_file_path": "macros/materializations/models/clone/clone.sql", "unique_id": "macro.dbt.materialization_clone_default", "macro_sql": "{%- materialization clone, default -%}\n\n {%- set relations = {'relations': []} -%}\n\n {%- if not defer_relation -%}\n -- nothing to do\n {{ log(\"No relation found in state manifest for \" ~ model.unique_id, info=True) }}\n {{ return(relations) }}\n {%- endif -%}\n\n {%- set existing_relation = load_cached_relation(this) -%}\n\n {%- if existing_relation and not flags.FULL_REFRESH -%}\n -- noop!\n {{ log(\"Relation \" ~ existing_relation ~ \" already exists\", info=True) }}\n {{ return(relations) }}\n {%- endif -%}\n\n {%- set other_existing_relation = load_cached_relation(defer_relation) -%}\n\n -- If this is a database that can do zero-copy cloning of tables, and the other relation is a table, then this will be a table\n -- Otherwise, this will be a view\n\n {% set can_clone_table = can_clone_table() %}\n\n {%- if other_existing_relation and other_existing_relation.type == 'table' and can_clone_table -%}\n\n {%- set target_relation = this.incorporate(type='table') -%}\n {% if existing_relation is not none and not existing_relation.is_table %}\n {{ log(\"Dropping relation \" ~ existing_relation ~ \" because it is of type \" ~ existing_relation.type) }}\n {{ drop_relation_if_exists(existing_relation) }}\n {% endif %}\n\n -- as a general rule, data platforms that can clone tables can also do atomic 'create or replace'\n {% call statement('main') %}\n {% if target_relation and defer_relation and target_relation == defer_relation %}\n {{ log(\"Target relation and defer relation are the same, skipping clone for relation: \" ~ target_relation) }}\n {% else %}\n {{ create_or_replace_clone(target_relation, defer_relation) }}\n {% endif %}\n\n {% endcall %}\n\n {% set should_revoke = should_revoke(existing_relation, full_refresh_mode=True) %}\n {% do apply_grants(target_relation, grant_config, should_revoke=should_revoke) %}\n {% do persist_docs(target_relation, model) %}\n\n {{ return({'relations': [target_relation]}) }}\n\n {%- else -%}\n\n {%- set target_relation = this.incorporate(type='view') -%}\n\n -- reuse the view materialization\n -- TODO: support actual dispatch for materialization macros\n -- Tracking ticket: https://github.com/dbt-labs/dbt-core/issues/7799\n {% set search_name = \"materialization_view_\" ~ adapter.type() %}\n {% if not search_name in context %}\n {% set search_name = \"materialization_view_default\" %}\n {% endif %}\n {% set materialization_macro = context[search_name] %}\n {% set relations = materialization_macro() %}\n {{ return(relations) }}\n\n {%- endif -%}\n\n{%- endmaterialization -%}", "depends_on": {"macros": ["macro.dbt.load_cached_relation", "macro.dbt.can_clone_table", "macro.dbt.drop_relation_if_exists", "macro.dbt.statement", "macro.dbt.create_or_replace_clone", "macro.dbt.should_revoke", "macro.dbt.apply_grants", "macro.dbt.persist_docs"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.0596867, "supported_languages": ["sql"]}, "macro.dbt.can_clone_table": {"name": "can_clone_table", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/clone/can_clone_table.sql", "original_file_path": "macros/materializations/models/clone/can_clone_table.sql", "unique_id": "macro.dbt.can_clone_table", "macro_sql": "{% macro can_clone_table() %}\n {{ return(adapter.dispatch('can_clone_table', 'dbt')()) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__can_clone_table"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.0601244, "supported_languages": null}, "macro.dbt.default__can_clone_table": {"name": "default__can_clone_table", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/clone/can_clone_table.sql", "original_file_path": "macros/materializations/models/clone/can_clone_table.sql", "unique_id": "macro.dbt.default__can_clone_table", "macro_sql": "{% macro default__can_clone_table() %}\n {{ return(False) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.0603325, "supported_languages": null}, "macro.dbt.incremental_validate_on_schema_change": {"name": "incremental_validate_on_schema_change", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/on_schema_change.sql", "original_file_path": "macros/materializations/models/incremental/on_schema_change.sql", "unique_id": "macro.dbt.incremental_validate_on_schema_change", "macro_sql": "{% macro incremental_validate_on_schema_change(on_schema_change, default='ignore') %}\n\n {% if on_schema_change not in ['sync_all_columns', 'append_new_columns', 'fail', 'ignore'] %}\n\n {% set log_message = 'Invalid value for on_schema_change (%s) specified. Setting default value of %s.' % (on_schema_change, default) %}\n {% do log(log_message) %}\n\n {{ return(default) }}\n\n {% else %}\n\n {{ return(on_schema_change) }}\n\n {% endif %}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.0677664, "supported_languages": null}, "macro.dbt.check_for_schema_changes": {"name": "check_for_schema_changes", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/on_schema_change.sql", "original_file_path": "macros/materializations/models/incremental/on_schema_change.sql", "unique_id": "macro.dbt.check_for_schema_changes", "macro_sql": "{% macro check_for_schema_changes(source_relation, target_relation) %}\n\n {% set schema_changed = False %}\n\n {%- set source_columns = adapter.get_columns_in_relation(source_relation) -%}\n {%- set target_columns = adapter.get_columns_in_relation(target_relation) -%}\n {%- set source_not_in_target = diff_columns(source_columns, target_columns) -%}\n {%- set target_not_in_source = diff_columns(target_columns, source_columns) -%}\n\n {% set new_target_types = diff_column_data_types(source_columns, target_columns) %}\n\n {% if source_not_in_target != [] %}\n {% set schema_changed = True %}\n {% elif target_not_in_source != [] or new_target_types != [] %}\n {% set schema_changed = True %}\n {% elif new_target_types != [] %}\n {% set schema_changed = True %}\n {% endif %}\n\n {% set changes_dict = {\n 'schema_changed': schema_changed,\n 'source_not_in_target': source_not_in_target,\n 'target_not_in_source': target_not_in_source,\n 'source_columns': source_columns,\n 'target_columns': target_columns,\n 'new_target_types': new_target_types\n } %}\n\n {% set msg %}\n In {{ target_relation }}:\n Schema changed: {{ schema_changed }}\n Source columns not in target: {{ source_not_in_target }}\n Target columns not in source: {{ target_not_in_source }}\n New column types: {{ new_target_types }}\n {% endset %}\n\n {% do log(msg) %}\n\n {{ return(changes_dict) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.diff_columns", "macro.dbt.diff_column_data_types"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.0698285, "supported_languages": null}, "macro.dbt.sync_column_schemas": {"name": "sync_column_schemas", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/on_schema_change.sql", "original_file_path": "macros/materializations/models/incremental/on_schema_change.sql", "unique_id": "macro.dbt.sync_column_schemas", "macro_sql": "{% macro sync_column_schemas(on_schema_change, target_relation, schema_changes_dict) %}\n\n {%- set add_to_target_arr = schema_changes_dict['source_not_in_target'] -%}\n\n {%- if on_schema_change == 'append_new_columns'-%}\n {%- if add_to_target_arr | length > 0 -%}\n {%- do alter_relation_add_remove_columns(target_relation, add_to_target_arr, none) -%}\n {%- endif -%}\n\n {% elif on_schema_change == 'sync_all_columns' %}\n {%- set remove_from_target_arr = schema_changes_dict['target_not_in_source'] -%}\n {%- set new_target_types = schema_changes_dict['new_target_types'] -%}\n\n {% if add_to_target_arr | length > 0 or remove_from_target_arr | length > 0 %}\n {%- do alter_relation_add_remove_columns(target_relation, add_to_target_arr, remove_from_target_arr) -%}\n {% endif %}\n\n {% if new_target_types != [] %}\n {% for ntt in new_target_types %}\n {% set column_name = ntt['column_name'] %}\n {% set new_type = ntt['new_type'] %}\n {% do alter_column_type(target_relation, column_name, new_type) %}\n {% endfor %}\n {% endif %}\n\n {% endif %}\n\n {% set schema_change_message %}\n In {{ target_relation }}:\n Schema change approach: {{ on_schema_change }}\n Columns added: {{ add_to_target_arr }}\n Columns removed: {{ remove_from_target_arr }}\n Data types changed: {{ new_target_types }}\n {% endset %}\n\n {% do log(schema_change_message) %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.alter_relation_add_remove_columns", "macro.dbt.alter_column_type"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.0719476, "supported_languages": null}, "macro.dbt.process_schema_changes": {"name": "process_schema_changes", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/on_schema_change.sql", "original_file_path": "macros/materializations/models/incremental/on_schema_change.sql", "unique_id": "macro.dbt.process_schema_changes", "macro_sql": "{% macro process_schema_changes(on_schema_change, source_relation, target_relation) %}\n\n {% if on_schema_change == 'ignore' %}\n\n {{ return({}) }}\n\n {% else %}\n\n {% set schema_changes_dict = check_for_schema_changes(source_relation, target_relation) %}\n\n {% if schema_changes_dict['schema_changed'] %}\n\n {% if on_schema_change == 'fail' %}\n\n {% set fail_msg %}\n The source and target schemas on this incremental model are out of sync!\n They can be reconciled in several ways:\n - set the `on_schema_change` config to either append_new_columns or sync_all_columns, depending on your situation.\n - Re-run the incremental model with `full_refresh: True` to update the target schema.\n - update the schema manually and re-run the process.\n\n Additional troubleshooting context:\n Source columns not in target: {{ schema_changes_dict['source_not_in_target'] }}\n Target columns not in source: {{ schema_changes_dict['target_not_in_source'] }}\n New column types: {{ schema_changes_dict['new_target_types'] }}\n {% endset %}\n\n {% do exceptions.raise_compiler_error(fail_msg) %}\n\n {# -- unless we ignore, run the sync operation per the config #}\n {% else %}\n\n {% do sync_column_schemas(on_schema_change, target_relation, schema_changes_dict) %}\n\n {% endif %}\n\n {% endif %}\n\n {{ return(schema_changes_dict['source_columns']) }}\n\n {% endif %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.check_for_schema_changes", "macro.dbt.sync_column_schemas"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.073484, "supported_languages": null}, "macro.dbt.get_merge_sql": {"name": "get_merge_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/merge.sql", "original_file_path": "macros/materializations/models/incremental/merge.sql", "unique_id": "macro.dbt.get_merge_sql", "macro_sql": "{% macro get_merge_sql(target, source, unique_key, dest_columns, incremental_predicates=none) -%}\n -- back compat for old kwarg name\n {% set incremental_predicates = kwargs.get('predicates', incremental_predicates) %}\n {{ adapter.dispatch('get_merge_sql', 'dbt')(target, source, unique_key, dest_columns, incremental_predicates) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_merge_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.0821836, "supported_languages": null}, "macro.dbt.default__get_merge_sql": {"name": "default__get_merge_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/merge.sql", "original_file_path": "macros/materializations/models/incremental/merge.sql", "unique_id": "macro.dbt.default__get_merge_sql", "macro_sql": "{% macro default__get_merge_sql(target, source, unique_key, dest_columns, incremental_predicates=none) -%}\n {%- set predicates = [] if incremental_predicates is none else [] + incremental_predicates -%}\n {%- set dest_cols_csv = get_quoted_csv(dest_columns | map(attribute=\"name\")) -%}\n {%- set merge_update_columns = config.get('merge_update_columns') -%}\n {%- set merge_exclude_columns = config.get('merge_exclude_columns') -%}\n {%- set update_columns = get_merge_update_columns(merge_update_columns, merge_exclude_columns, dest_columns) -%}\n {%- set sql_header = config.get('sql_header', none) -%}\n\n {% if unique_key %}\n {% if unique_key is sequence and unique_key is not mapping and unique_key is not string %}\n {% for key in unique_key %}\n {% set this_key_match %}\n DBT_INTERNAL_SOURCE.{{ key }} = DBT_INTERNAL_DEST.{{ key }}\n {% endset %}\n {% do predicates.append(this_key_match) %}\n {% endfor %}\n {% else %}\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 {% endif %}\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_name in update_columns -%}\n {{ column_name }} = DBT_INTERNAL_SOURCE.{{ 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 %}", "depends_on": {"macros": ["macro.dbt.get_quoted_csv", "macro.dbt.get_merge_update_columns"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.0849345, "supported_languages": null}, "macro.dbt.get_delete_insert_merge_sql": {"name": "get_delete_insert_merge_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/merge.sql", "original_file_path": "macros/materializations/models/incremental/merge.sql", "unique_id": "macro.dbt.get_delete_insert_merge_sql", "macro_sql": "{% macro get_delete_insert_merge_sql(target, source, unique_key, dest_columns, incremental_predicates) -%}\n {{ adapter.dispatch('get_delete_insert_merge_sql', 'dbt')(target, source, unique_key, dest_columns, incremental_predicates) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_delete_insert_merge_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.0853958, "supported_languages": null}, "macro.dbt.default__get_delete_insert_merge_sql": {"name": "default__get_delete_insert_merge_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/merge.sql", "original_file_path": "macros/materializations/models/incremental/merge.sql", "unique_id": "macro.dbt.default__get_delete_insert_merge_sql", "macro_sql": "{% macro default__get_delete_insert_merge_sql(target, source, unique_key, dest_columns, incremental_predicates) -%}\n\n {%- set dest_cols_csv = get_quoted_csv(dest_columns | map(attribute=\"name\")) -%}\n\n {% if unique_key %}\n {% if unique_key is sequence and unique_key is not string %}\n delete from {{target }}\n using {{ source }}\n where (\n {% for key in unique_key %}\n {{ source }}.{{ key }} = {{ target }}.{{ key }}\n {{ \"and \" if not loop.last}}\n {% endfor %}\n {% if incremental_predicates %}\n {% for predicate in incremental_predicates %}\n and {{ predicate }}\n {% endfor %}\n {% endif %}\n );\n {% else %}\n delete from {{ target }}\n where (\n {{ unique_key }}) in (\n select ({{ unique_key }})\n from {{ source }}\n )\n {%- if incremental_predicates %}\n {% for predicate in incremental_predicates %}\n and {{ predicate }}\n {% endfor %}\n {%- endif -%};\n\n {% endif %}\n {% endif %}\n\n insert into {{ target }} ({{ dest_cols_csv }})\n (\n select {{ dest_cols_csv }}\n from {{ source }}\n )\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.get_quoted_csv"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.0870876, "supported_languages": null}, "macro.dbt.get_insert_overwrite_merge_sql": {"name": "get_insert_overwrite_merge_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/merge.sql", "original_file_path": "macros/materializations/models/incremental/merge.sql", "unique_id": "macro.dbt.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', 'dbt')(target, source, dest_columns, predicates, include_sql_header) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_insert_overwrite_merge_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.0875661, "supported_languages": null}, "macro.dbt.default__get_insert_overwrite_merge_sql": {"name": "default__get_insert_overwrite_merge_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/merge.sql", "original_file_path": "macros/materializations/models/incremental/merge.sql", "unique_id": "macro.dbt.default__get_insert_overwrite_merge_sql", "macro_sql": "{% macro default__get_insert_overwrite_merge_sql(target, source, dest_columns, predicates, include_sql_header) -%}\n {#-- The only time include_sql_header is True: --#}\n {#-- BigQuery + insert_overwrite strategy + \"static\" partitions config --#}\n {#-- We should consider including the sql header at the materialization level instead --#}\n\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 %}", "depends_on": {"macros": ["macro.dbt.get_quoted_csv"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.0886617, "supported_languages": null}, "macro.dbt.materialization_incremental_default": {"name": "materialization_incremental_default", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/incremental.sql", "original_file_path": "macros/materializations/models/incremental/incremental.sql", "unique_id": "macro.dbt.materialization_incremental_default", "macro_sql": "{% materialization incremental, default -%}\n\n -- relations\n {%- set existing_relation = load_cached_relation(this) -%}\n {%- set target_relation = this.incorporate(type='table') -%}\n {%- set temp_relation = make_temp_relation(target_relation)-%}\n {%- set intermediate_relation = make_intermediate_relation(target_relation)-%}\n {%- set backup_relation_type = 'table' if existing_relation is none else existing_relation.type -%}\n {%- set backup_relation = make_backup_relation(target_relation, backup_relation_type) -%}\n\n -- configs\n {%- set unique_key = config.get('unique_key') -%}\n {%- set full_refresh_mode = (should_full_refresh() or existing_relation.is_view) -%}\n {%- set on_schema_change = incremental_validate_on_schema_change(config.get('on_schema_change'), default='ignore') -%}\n\n -- the temp_ and backup_ relations should not already exist in the database; get_relation\n -- will return None in that case. Otherwise, we get a relation that we can drop\n -- later, before we try to use this name for the current operation. This has to happen before\n -- BEGIN, in a separate transaction\n {%- set preexisting_intermediate_relation = load_cached_relation(intermediate_relation)-%}\n {%- set preexisting_backup_relation = load_cached_relation(backup_relation) -%}\n -- grab current tables grants config for comparision later on\n {% set grant_config = config.get('grants') %}\n {{ drop_relation_if_exists(preexisting_intermediate_relation) }}\n {{ drop_relation_if_exists(preexisting_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 {% set to_drop = [] %}\n\n {% if existing_relation is none %}\n {% set build_sql = get_create_table_as_sql(False, target_relation, sql) %}\n {% elif full_refresh_mode %}\n {% set build_sql = get_create_table_as_sql(False, intermediate_relation, sql) %}\n {% set need_swap = true %}\n {% else %}\n {% do run_query(get_create_table_as_sql(True, temp_relation, sql)) %}\n {% do adapter.expand_target_column_types(\n from_relation=temp_relation,\n to_relation=target_relation) %}\n {#-- Process schema changes. Returns dict of changes if successful. Use source columns for upserting/merging --#}\n {% set dest_columns = process_schema_changes(on_schema_change, temp_relation, existing_relation) %}\n {% if not dest_columns %}\n {% set dest_columns = adapter.get_columns_in_relation(existing_relation) %}\n {% endif %}\n\n {#-- Get the incremental_strategy, the macro to use for the strategy, and build the sql --#}\n {% set incremental_strategy = config.get('incremental_strategy') or 'default' %}\n {% set incremental_predicates = config.get('predicates', none) or config.get('incremental_predicates', none) %}\n {% set strategy_sql_macro_func = adapter.get_incremental_strategy_macro(context, incremental_strategy) %}\n {% set strategy_arg_dict = ({'target_relation': target_relation, 'temp_relation': temp_relation, 'unique_key': unique_key, 'dest_columns': dest_columns, 'incremental_predicates': incremental_predicates }) %}\n {% set build_sql = strategy_sql_macro_func(strategy_arg_dict) %}\n\n {% endif %}\n\n {% call statement(\"main\") %}\n {{ build_sql }}\n {% endcall %}\n\n {% if need_swap %}\n {% do adapter.rename_relation(target_relation, backup_relation) %}\n {% do adapter.rename_relation(intermediate_relation, target_relation) %}\n {% do to_drop.append(backup_relation) %}\n {% endif %}\n\n {% set should_revoke = should_revoke(existing_relation, full_refresh_mode) %}\n {% do apply_grants(target_relation, grant_config, should_revoke=should_revoke) %}\n\n {% do persist_docs(target_relation, model) %}\n\n {% if existing_relation is none or existing_relation.is_view or should_full_refresh() %}\n {% do create_indexes(target_relation) %}\n {% endif %}\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 %}", "depends_on": {"macros": ["macro.dbt.load_cached_relation", "macro.dbt.make_temp_relation", "macro.dbt.make_intermediate_relation", "macro.dbt.make_backup_relation", "macro.dbt.should_full_refresh", "macro.dbt.incremental_validate_on_schema_change", "macro.dbt.drop_relation_if_exists", "macro.dbt.run_hooks", "macro.dbt.get_create_table_as_sql", "macro.dbt.run_query", "macro.dbt.process_schema_changes", "macro.dbt.statement", "macro.dbt.should_revoke", "macro.dbt.apply_grants", "macro.dbt.persist_docs", "macro.dbt.create_indexes"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.0969183, "supported_languages": ["sql"]}, "macro.dbt.is_incremental": {"name": "is_incremental", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/is_incremental.sql", "original_file_path": "macros/materializations/models/incremental/is_incremental.sql", "unique_id": "macro.dbt.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 %}", "depends_on": {"macros": ["macro.dbt.should_full_refresh"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.0980108, "supported_languages": null}, "macro.dbt.get_quoted_csv": {"name": "get_quoted_csv", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/column_helpers.sql", "original_file_path": "macros/materializations/models/incremental/column_helpers.sql", "unique_id": "macro.dbt.get_quoted_csv", "macro_sql": "{% macro get_quoted_csv(column_names) %}\n\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\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.1004248, "supported_languages": null}, "macro.dbt.diff_columns": {"name": "diff_columns", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/column_helpers.sql", "original_file_path": "macros/materializations/models/incremental/column_helpers.sql", "unique_id": "macro.dbt.diff_columns", "macro_sql": "{% macro diff_columns(source_columns, target_columns) %}\n\n {% set result = [] %}\n {% set source_names = source_columns | map(attribute = 'column') | list %}\n {% set target_names = target_columns | map(attribute = 'column') | list %}\n\n {# --check whether the name attribute exists in the target - this does not perform a data type check #}\n {% for sc in source_columns %}\n {% if sc.name not in target_names %}\n {{ result.append(sc) }}\n {% endif %}\n {% endfor %}\n\n {{ return(result) }}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.1013904, "supported_languages": null}, "macro.dbt.diff_column_data_types": {"name": "diff_column_data_types", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/column_helpers.sql", "original_file_path": "macros/materializations/models/incremental/column_helpers.sql", "unique_id": "macro.dbt.diff_column_data_types", "macro_sql": "{% macro diff_column_data_types(source_columns, target_columns) %}\n\n {% set result = [] %}\n {% for sc in source_columns %}\n {% set tc = target_columns | selectattr(\"name\", \"equalto\", sc.name) | list | first %}\n {% if tc %}\n {% if sc.data_type != tc.data_type and not sc.can_expand_to(other_column=tc) %}\n {{ result.append( { 'column_name': tc.name, 'new_type': sc.data_type } ) }}\n {% endif %}\n {% endif %}\n {% endfor %}\n\n {{ return(result) }}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.1025121, "supported_languages": null}, "macro.dbt.get_merge_update_columns": {"name": "get_merge_update_columns", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/column_helpers.sql", "original_file_path": "macros/materializations/models/incremental/column_helpers.sql", "unique_id": "macro.dbt.get_merge_update_columns", "macro_sql": "{% macro get_merge_update_columns(merge_update_columns, merge_exclude_columns, dest_columns) %}\n {{ return(adapter.dispatch('get_merge_update_columns', 'dbt')(merge_update_columns, merge_exclude_columns, dest_columns)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_merge_update_columns"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.1029146, "supported_languages": null}, "macro.dbt.default__get_merge_update_columns": {"name": "default__get_merge_update_columns", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/column_helpers.sql", "original_file_path": "macros/materializations/models/incremental/column_helpers.sql", "unique_id": "macro.dbt.default__get_merge_update_columns", "macro_sql": "{% macro default__get_merge_update_columns(merge_update_columns, merge_exclude_columns, dest_columns) %}\n {%- set default_cols = dest_columns | map(attribute=\"quoted\") | list -%}\n\n {%- if merge_update_columns and merge_exclude_columns -%}\n {{ exceptions.raise_compiler_error(\n 'Model cannot specify merge_update_columns and merge_exclude_columns. Please update model to use only one config'\n )}}\n {%- elif merge_update_columns -%}\n {%- set update_columns = merge_update_columns -%}\n {%- elif merge_exclude_columns -%}\n {%- set update_columns = [] -%}\n {%- for column in dest_columns -%}\n {% if column.column | lower not in merge_exclude_columns | map(\"lower\") | list %}\n {%- do update_columns.append(column.quoted) -%}\n {% endif %}\n {%- endfor -%}\n {%- else -%}\n {%- set update_columns = default_cols -%}\n {%- endif -%}\n\n {{ return(update_columns) }}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.1041422, "supported_languages": null}, "macro.dbt.get_incremental_append_sql": {"name": "get_incremental_append_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/strategies.sql", "original_file_path": "macros/materializations/models/incremental/strategies.sql", "unique_id": "macro.dbt.get_incremental_append_sql", "macro_sql": "{% macro get_incremental_append_sql(arg_dict) %}\n\n {{ return(adapter.dispatch('get_incremental_append_sql', 'dbt')(arg_dict)) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_incremental_append_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.1055417, "supported_languages": null}, "macro.dbt.default__get_incremental_append_sql": {"name": "default__get_incremental_append_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/strategies.sql", "original_file_path": "macros/materializations/models/incremental/strategies.sql", "unique_id": "macro.dbt.default__get_incremental_append_sql", "macro_sql": "{% macro default__get_incremental_append_sql(arg_dict) %}\n\n {% do return(get_insert_into_sql(arg_dict[\"target_relation\"], arg_dict[\"temp_relation\"], arg_dict[\"dest_columns\"])) %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_insert_into_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.1059499, "supported_languages": null}, "macro.dbt.get_incremental_delete_insert_sql": {"name": "get_incremental_delete_insert_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/strategies.sql", "original_file_path": "macros/materializations/models/incremental/strategies.sql", "unique_id": "macro.dbt.get_incremental_delete_insert_sql", "macro_sql": "{% macro get_incremental_delete_insert_sql(arg_dict) %}\n\n {{ return(adapter.dispatch('get_incremental_delete_insert_sql', 'dbt')(arg_dict)) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_incremental_delete_insert_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.1062708, "supported_languages": null}, "macro.dbt.default__get_incremental_delete_insert_sql": {"name": "default__get_incremental_delete_insert_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/strategies.sql", "original_file_path": "macros/materializations/models/incremental/strategies.sql", "unique_id": "macro.dbt.default__get_incremental_delete_insert_sql", "macro_sql": "{% macro default__get_incremental_delete_insert_sql(arg_dict) %}\n\n {% do return(get_delete_insert_merge_sql(arg_dict[\"target_relation\"], arg_dict[\"temp_relation\"], arg_dict[\"unique_key\"], arg_dict[\"dest_columns\"], arg_dict[\"incremental_predicates\"])) %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_delete_insert_merge_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.106775, "supported_languages": null}, "macro.dbt.get_incremental_merge_sql": {"name": "get_incremental_merge_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/strategies.sql", "original_file_path": "macros/materializations/models/incremental/strategies.sql", "unique_id": "macro.dbt.get_incremental_merge_sql", "macro_sql": "{% macro get_incremental_merge_sql(arg_dict) %}\n\n {{ return(adapter.dispatch('get_incremental_merge_sql', 'dbt')(arg_dict)) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_incremental_merge_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.1070971, "supported_languages": null}, "macro.dbt.default__get_incremental_merge_sql": {"name": "default__get_incremental_merge_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/strategies.sql", "original_file_path": "macros/materializations/models/incremental/strategies.sql", "unique_id": "macro.dbt.default__get_incremental_merge_sql", "macro_sql": "{% macro default__get_incremental_merge_sql(arg_dict) %}\n\n {% do return(get_merge_sql(arg_dict[\"target_relation\"], arg_dict[\"temp_relation\"], arg_dict[\"unique_key\"], arg_dict[\"dest_columns\"], arg_dict[\"incremental_predicates\"])) %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_merge_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.107589, "supported_languages": null}, "macro.dbt.get_incremental_insert_overwrite_sql": {"name": "get_incremental_insert_overwrite_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/strategies.sql", "original_file_path": "macros/materializations/models/incremental/strategies.sql", "unique_id": "macro.dbt.get_incremental_insert_overwrite_sql", "macro_sql": "{% macro get_incremental_insert_overwrite_sql(arg_dict) %}\n\n {{ return(adapter.dispatch('get_incremental_insert_overwrite_sql', 'dbt')(arg_dict)) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_incremental_insert_overwrite_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.1079006, "supported_languages": null}, "macro.dbt.default__get_incremental_insert_overwrite_sql": {"name": "default__get_incremental_insert_overwrite_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/strategies.sql", "original_file_path": "macros/materializations/models/incremental/strategies.sql", "unique_id": "macro.dbt.default__get_incremental_insert_overwrite_sql", "macro_sql": "{% macro default__get_incremental_insert_overwrite_sql(arg_dict) %}\n\n {% do return(get_insert_overwrite_merge_sql(arg_dict[\"target_relation\"], arg_dict[\"temp_relation\"], arg_dict[\"dest_columns\"], arg_dict[\"incremental_predicates\"])) %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_insert_overwrite_merge_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.1083505, "supported_languages": null}, "macro.dbt.get_incremental_default_sql": {"name": "get_incremental_default_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/strategies.sql", "original_file_path": "macros/materializations/models/incremental/strategies.sql", "unique_id": "macro.dbt.get_incremental_default_sql", "macro_sql": "{% macro get_incremental_default_sql(arg_dict) %}\n\n {{ return(adapter.dispatch('get_incremental_default_sql', 'dbt')(arg_dict)) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_postgres.postgres__get_incremental_default_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.108676, "supported_languages": null}, "macro.dbt.default__get_incremental_default_sql": {"name": "default__get_incremental_default_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/strategies.sql", "original_file_path": "macros/materializations/models/incremental/strategies.sql", "unique_id": "macro.dbt.default__get_incremental_default_sql", "macro_sql": "{% macro default__get_incremental_default_sql(arg_dict) %}\n\n {% do return(get_incremental_append_sql(arg_dict)) %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_incremental_append_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.1089559, "supported_languages": null}, "macro.dbt.get_insert_into_sql": {"name": "get_insert_into_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/models/incremental/strategies.sql", "original_file_path": "macros/materializations/models/incremental/strategies.sql", "unique_id": "macro.dbt.get_insert_into_sql", "macro_sql": "{% macro get_insert_into_sql(target_relation, temp_relation, dest_columns) %}\n\n {%- set dest_cols_csv = get_quoted_csv(dest_columns | map(attribute=\"name\")) -%}\n\n insert into {{ target_relation }} ({{ dest_cols_csv }})\n (\n select {{ dest_cols_csv }}\n from {{ temp_relation }}\n )\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_quoted_csv"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.1094313, "supported_languages": null}, "macro.dbt.create_columns": {"name": "create_columns", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "unique_id": "macro.dbt.create_columns", "macro_sql": "{% macro create_columns(relation, columns) %}\n {{ adapter.dispatch('create_columns', 'dbt')(relation, columns) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__create_columns"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.1151288, "supported_languages": null}, "macro.dbt.default__create_columns": {"name": "default__create_columns", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "unique_id": "macro.dbt.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 %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.115725, "supported_languages": null}, "macro.dbt.post_snapshot": {"name": "post_snapshot", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "unique_id": "macro.dbt.post_snapshot", "macro_sql": "{% macro post_snapshot(staging_relation) %}\n {{ adapter.dispatch('post_snapshot', 'dbt')(staging_relation) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__post_snapshot"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.1160243, "supported_languages": null}, "macro.dbt.default__post_snapshot": {"name": "default__post_snapshot", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "unique_id": "macro.dbt.default__post_snapshot", "macro_sql": "{% macro default__post_snapshot(staging_relation) %}\n {# no-op #}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.1161897, "supported_languages": null}, "macro.dbt.get_true_sql": {"name": "get_true_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "unique_id": "macro.dbt.get_true_sql", "macro_sql": "{% macro get_true_sql() %}\n {{ adapter.dispatch('get_true_sql', 'dbt')() }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_true_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.1164503, "supported_languages": null}, "macro.dbt.default__get_true_sql": {"name": "default__get_true_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "unique_id": "macro.dbt.default__get_true_sql", "macro_sql": "{% macro default__get_true_sql() %}\n {{ return('TRUE') }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.1166594, "supported_languages": null}, "macro.dbt.snapshot_staging_table": {"name": "snapshot_staging_table", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "unique_id": "macro.dbt.snapshot_staging_table", "macro_sql": "{% macro snapshot_staging_table(strategy, source_sql, target_relation) -%}\n {{ adapter.dispatch('snapshot_staging_table', 'dbt')(strategy, source_sql, target_relation) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__snapshot_staging_table"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.1170413, "supported_languages": null}, "macro.dbt.default__snapshot_staging_table": {"name": "default__snapshot_staging_table", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "unique_id": "macro.dbt.default__snapshot_staging_table", "macro_sql": "{% macro default__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 %}", "depends_on": {"macros": ["macro.dbt.snapshot_get_time"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.1185517, "supported_languages": null}, "macro.dbt.build_snapshot_table": {"name": "build_snapshot_table", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "unique_id": "macro.dbt.build_snapshot_table", "macro_sql": "{% macro build_snapshot_table(strategy, sql) -%}\n {{ adapter.dispatch('build_snapshot_table', 'dbt')(strategy, sql) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__build_snapshot_table"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.118904, "supported_languages": null}, "macro.dbt.default__build_snapshot_table": {"name": "default__build_snapshot_table", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "unique_id": "macro.dbt.default__build_snapshot_table", "macro_sql": "{% macro default__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 %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.119358, "supported_languages": null}, "macro.dbt.build_snapshot_staging_table": {"name": "build_snapshot_staging_table", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "unique_id": "macro.dbt.build_snapshot_staging_table", "macro_sql": "{% macro build_snapshot_staging_table(strategy, sql, target_relation) %}\n {% set temp_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, temp_relation, select) }}\n {% endcall %}\n\n {% do return(temp_relation) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.make_temp_relation", "macro.dbt.snapshot_staging_table", "macro.dbt.statement", "macro.dbt.create_table_as"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.1200945, "supported_languages": null}, "macro.dbt.snapshot_merge_sql": {"name": "snapshot_merge_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/snapshot_merge.sql", "original_file_path": "macros/materializations/snapshots/snapshot_merge.sql", "unique_id": "macro.dbt.snapshot_merge_sql", "macro_sql": "{% macro snapshot_merge_sql(target, source, insert_cols) -%}\n {{ adapter.dispatch('snapshot_merge_sql', 'dbt')(target, source, insert_cols) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_postgres.postgres__snapshot_merge_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.1208084, "supported_languages": null}, "macro.dbt.default__snapshot_merge_sql": {"name": "default__snapshot_merge_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/snapshot_merge.sql", "original_file_path": "macros/materializations/snapshots/snapshot_merge.sql", "unique_id": "macro.dbt.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 %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.1213095, "supported_languages": null}, "macro.dbt.strategy_dispatch": {"name": "strategy_dispatch", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "unique_id": "macro.dbt.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 %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.1268408, "supported_languages": null}, "macro.dbt.snapshot_hash_arguments": {"name": "snapshot_hash_arguments", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "unique_id": "macro.dbt.snapshot_hash_arguments", "macro_sql": "{% macro snapshot_hash_arguments(args) -%}\n {{ adapter.dispatch('snapshot_hash_arguments', 'dbt')(args) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__snapshot_hash_arguments"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.1271472, "supported_languages": null}, "macro.dbt.default__snapshot_hash_arguments": {"name": "default__snapshot_hash_arguments", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "unique_id": "macro.dbt.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 %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.1275337, "supported_languages": null}, "macro.dbt.snapshot_timestamp_strategy": {"name": "snapshot_timestamp_strategy", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "unique_id": "macro.dbt.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/dbt-labs/dbt-core/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 %}", "depends_on": {"macros": ["macro.dbt.snapshot_hash_arguments"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.128734, "supported_languages": null}, "macro.dbt.snapshot_string_as_time": {"name": "snapshot_string_as_time", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "unique_id": "macro.dbt.snapshot_string_as_time", "macro_sql": "{% macro snapshot_string_as_time(timestamp) -%}\n {{ adapter.dispatch('snapshot_string_as_time', 'dbt')(timestamp) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_postgres.postgres__snapshot_string_as_time"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.1290445, "supported_languages": null}, "macro.dbt.default__snapshot_string_as_time": {"name": "default__snapshot_string_as_time", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "unique_id": "macro.dbt.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 %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.1293492, "supported_languages": null}, "macro.dbt.snapshot_check_all_get_existing_columns": {"name": "snapshot_check_all_get_existing_columns", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "unique_id": "macro.dbt.snapshot_check_all_get_existing_columns", "macro_sql": "{% macro snapshot_check_all_get_existing_columns(node, target_exists, check_cols_config) -%}\n {%- if not target_exists -%}\n {#-- no table yet -> return whatever the query does --#}\n {{ return((false, query_columns)) }}\n {%- endif -%}\n\n {#-- handle any schema changes --#}\n {%- set target_relation = adapter.get_relation(database=node.database, schema=node.schema, identifier=node.alias) -%}\n\n {% if check_cols_config == 'all' %}\n {%- set query_columns = get_columns_in_query(node['compiled_code']) -%}\n\n {% elif check_cols_config is iterable and (check_cols_config | length) > 0 %}\n {#-- query for proper casing/quoting, to support comparison below --#}\n {%- set select_check_cols_from_target -%}\n {#-- N.B. The whitespace below is necessary to avoid edge case issue with comments --#}\n {#-- See: https://github.com/dbt-labs/dbt-core/issues/6781 --#}\n select {{ check_cols_config | join(', ') }} from (\n {{ node['compiled_code'] }}\n ) subq\n {%- endset -%}\n {% set query_columns = get_columns_in_query(select_check_cols_from_target) %}\n\n {% else %}\n {% do exceptions.raise_compiler_error(\"Invalid value for 'check_cols': \" ~ check_cols_config) %}\n {% endif %}\n\n {%- set existing_cols = adapter.get_columns_in_relation(target_relation) | map(attribute = 'name') | list -%}\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(adapter.quote(col)) -%}\n {%- else -%}\n {% set ns.column_added = true %}\n {%- endif -%}\n {%- endfor -%}\n {{ return((ns.column_added, intersection)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.get_columns_in_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.1318495, "supported_languages": null}, "macro.dbt.snapshot_check_strategy": {"name": "snapshot_check_strategy", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "unique_id": "macro.dbt.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 {% set updated_at = config.get('updated_at', snapshot_get_time()) %}\n\n {% set column_added = false %}\n\n {% set column_added, check_cols = snapshot_check_all_get_existing_columns(node, target_exists, check_cols_config) %}\n\n {%- set row_changed_expr -%}\n (\n {%- if column_added -%}\n {{ get_true_sql() }}\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 %}", "depends_on": {"macros": ["macro.dbt.snapshot_get_time", "macro.dbt.snapshot_check_all_get_existing_columns", "macro.dbt.get_true_sql", "macro.dbt.snapshot_hash_arguments"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.1340723, "supported_languages": null}, "macro.dbt.materialization_snapshot_default": {"name": "materialization_snapshot_default", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/snapshots/snapshot.sql", "original_file_path": "macros/materializations/snapshots/snapshot.sql", "unique_id": "macro.dbt.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 -- grab current tables grants config for comparision later on\n {%- set grant_config = config.get('grants') -%}\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_code']) %}\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 {% set should_revoke = should_revoke(target_relation_exists, full_refresh_mode=False) %}\n {% do apply_grants(target_relation, grant_config, should_revoke=should_revoke) %}\n\n {% do persist_docs(target_relation, model) %}\n\n {% if not target_relation_exists %}\n {% do create_indexes(target_relation) %}\n {% endif %}\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 %}", "depends_on": {"macros": ["macro.dbt.get_or_create_relation", "macro.dbt.run_hooks", "macro.dbt.strategy_dispatch", "macro.dbt.build_snapshot_table", "macro.dbt.create_table_as", "macro.dbt.build_snapshot_staging_table", "macro.dbt.create_columns", "macro.dbt.snapshot_merge_sql", "macro.dbt.statement", "macro.dbt.should_revoke", "macro.dbt.apply_grants", "macro.dbt.persist_docs", "macro.dbt.create_indexes", "macro.dbt.post_snapshot"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.1435907, "supported_languages": ["sql"]}, "macro.dbt.get_test_sql": {"name": "get_test_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/tests/helpers.sql", "original_file_path": "macros/materializations/tests/helpers.sql", "unique_id": "macro.dbt.get_test_sql", "macro_sql": "{% macro get_test_sql(main_sql, fail_calc, warn_if, error_if, limit) -%}\n {{ adapter.dispatch('get_test_sql', 'dbt')(main_sql, fail_calc, warn_if, error_if, limit) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_test_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.1443493, "supported_languages": null}, "macro.dbt.default__get_test_sql": {"name": "default__get_test_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/tests/helpers.sql", "original_file_path": "macros/materializations/tests/helpers.sql", "unique_id": "macro.dbt.default__get_test_sql", "macro_sql": "{% macro default__get_test_sql(main_sql, fail_calc, warn_if, error_if, limit) -%}\n select\n {{ fail_calc }} as failures,\n {{ fail_calc }} {{ warn_if }} as should_warn,\n {{ fail_calc }} {{ error_if }} as should_error\n from (\n {{ main_sql }}\n {{ \"limit \" ~ limit if limit != none }}\n ) dbt_internal_test\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.1449044, "supported_languages": null}, "macro.dbt.get_where_subquery": {"name": "get_where_subquery", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/tests/where_subquery.sql", "original_file_path": "macros/materializations/tests/where_subquery.sql", "unique_id": "macro.dbt.get_where_subquery", "macro_sql": "{% macro get_where_subquery(relation) -%}\n {% do return(adapter.dispatch('get_where_subquery', 'dbt')(relation)) %}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_where_subquery"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.1455204, "supported_languages": null}, "macro.dbt.default__get_where_subquery": {"name": "default__get_where_subquery", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/tests/where_subquery.sql", "original_file_path": "macros/materializations/tests/where_subquery.sql", "unique_id": "macro.dbt.default__get_where_subquery", "macro_sql": "{% macro default__get_where_subquery(relation) -%}\n {% set where = config.get('where', '') %}\n {% if where %}\n {%- set filtered -%}\n (select * from {{ relation }} where {{ where }}) dbt_subquery\n {%- endset -%}\n {% do return(filtered) %}\n {%- else -%}\n {% do return(relation) %}\n {%- endif -%}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.1461825, "supported_languages": null}, "macro.dbt.materialization_test_default": {"name": "materialization_test_default", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/tests/test.sql", "original_file_path": "macros/materializations/tests/test.sql", "unique_id": "macro.dbt.materialization_test_default", "macro_sql": "{%- materialization test, default -%}\n\n {% set relations = [] %}\n\n {% if should_store_failures() %}\n\n {% set identifier = model['alias'] %}\n {% set old_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) %}\n\n {% set store_failures_as = config.get('store_failures_as') %}\n -- if `--store-failures` is invoked via command line and `store_failures_as` is not set,\n -- config.get('store_failures_as', 'table') returns None, not 'table'\n {% if store_failures_as == none %}{% set store_failures_as = 'table' %}{% endif %}\n {% if store_failures_as not in ['table', 'view'] %}\n {{ exceptions.raise_compiler_error(\n \"'\" ~ store_failures_as ~ \"' is not a valid value for `store_failures_as`. \"\n \"Accepted values are: ['ephemeral', 'table', 'view']\"\n ) }}\n {% endif %}\n\n {% set target_relation = api.Relation.create(\n identifier=identifier, schema=schema, database=database, type=store_failures_as) -%} %}\n\n {% if old_relation %}\n {% do adapter.drop_relation(old_relation) %}\n {% endif %}\n\n {% call statement(auto_begin=True) %}\n {{ get_create_sql(target_relation, sql) }}\n {% endcall %}\n\n {% do relations.append(target_relation) %}\n\n {% set main_sql %}\n select *\n from {{ target_relation }}\n {% endset %}\n\n {{ adapter.commit() }}\n\n {% else %}\n\n {% set main_sql = sql %}\n\n {% endif %}\n\n {% set limit = config.get('limit') %}\n {% set fail_calc = config.get('fail_calc') %}\n {% set warn_if = config.get('warn_if') %}\n {% set error_if = config.get('error_if') %}\n\n {% call statement('main', fetch_result=True) -%}\n\n {{ get_test_sql(main_sql, fail_calc, warn_if, error_if, limit)}}\n\n {%- endcall %}\n\n {{ return({'relations': relations}) }}\n\n{%- endmaterialization -%}", "depends_on": {"macros": ["macro.dbt.should_store_failures", "macro.dbt.statement", "macro.dbt.get_create_sql", "macro.dbt.get_test_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.150532, "supported_languages": ["sql"]}, "macro.dbt.create_csv_table": {"name": "create_csv_table", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "unique_id": "macro.dbt.create_csv_table", "macro_sql": "{% macro create_csv_table(model, agate_table) -%}\n {{ adapter.dispatch('create_csv_table', 'dbt')(model, agate_table) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__create_csv_table"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.1575136, "supported_languages": null}, "macro.dbt.default__create_csv_table": {"name": "default__create_csv_table", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "unique_id": "macro.dbt.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 %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.15905, "supported_languages": null}, "macro.dbt.reset_csv_table": {"name": "reset_csv_table", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "unique_id": "macro.dbt.reset_csv_table", "macro_sql": "{% macro reset_csv_table(model, full_refresh, old_relation, agate_table) -%}\n {{ adapter.dispatch('reset_csv_table', 'dbt')(model, full_refresh, old_relation, agate_table) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__reset_csv_table"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.1594493, "supported_languages": null}, "macro.dbt.default__reset_csv_table": {"name": "default__reset_csv_table", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "unique_id": "macro.dbt.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 %}", "depends_on": {"macros": ["macro.dbt.create_csv_table"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.1602726, "supported_languages": null}, "macro.dbt.get_csv_sql": {"name": "get_csv_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "unique_id": "macro.dbt.get_csv_sql", "macro_sql": "{% macro get_csv_sql(create_or_truncate_sql, insert_sql) %}\n {{ adapter.dispatch('get_csv_sql', 'dbt')(create_or_truncate_sql, insert_sql) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_csv_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.1606023, "supported_languages": null}, "macro.dbt.default__get_csv_sql": {"name": "default__get_csv_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "unique_id": "macro.dbt.default__get_csv_sql", "macro_sql": "{% macro default__get_csv_sql(create_or_truncate_sql, insert_sql) %}\n {{ create_or_truncate_sql }};\n -- dbt seed --\n {{ insert_sql }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.1608334, "supported_languages": null}, "macro.dbt.get_binding_char": {"name": "get_binding_char", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "unique_id": "macro.dbt.get_binding_char", "macro_sql": "{% macro get_binding_char() -%}\n {{ adapter.dispatch('get_binding_char', 'dbt')() }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_binding_char"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.1611073, "supported_languages": null}, "macro.dbt.default__get_binding_char": {"name": "default__get_binding_char", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "unique_id": "macro.dbt.default__get_binding_char", "macro_sql": "{% macro default__get_binding_char() %}\n {{ return('%s') }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.1613128, "supported_languages": null}, "macro.dbt.get_batch_size": {"name": "get_batch_size", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "unique_id": "macro.dbt.get_batch_size", "macro_sql": "{% macro get_batch_size() -%}\n {{ return(adapter.dispatch('get_batch_size', 'dbt')()) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_batch_size"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.1615853, "supported_languages": null}, "macro.dbt.default__get_batch_size": {"name": "default__get_batch_size", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "unique_id": "macro.dbt.default__get_batch_size", "macro_sql": "{% macro default__get_batch_size() %}\n {{ return(10000) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.1617906, "supported_languages": null}, "macro.dbt.get_seed_column_quoted_csv": {"name": "get_seed_column_quoted_csv", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "unique_id": "macro.dbt.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 %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.1625926, "supported_languages": null}, "macro.dbt.load_csv_rows": {"name": "load_csv_rows", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "unique_id": "macro.dbt.load_csv_rows", "macro_sql": "{% macro load_csv_rows(model, agate_table) -%}\n {{ adapter.dispatch('load_csv_rows', 'dbt')(model, agate_table) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__load_csv_rows"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.163006, "supported_languages": null}, "macro.dbt.default__load_csv_rows": {"name": "default__load_csv_rows", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "unique_id": "macro.dbt.default__load_csv_rows", "macro_sql": "{% macro default__load_csv_rows(model, agate_table) %}\n\n {% set batch_size = get_batch_size() %}\n\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 {{ get_binding_char() }}\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 %}", "depends_on": {"macros": ["macro.dbt.get_batch_size", "macro.dbt.get_seed_column_quoted_csv", "macro.dbt.get_binding_char"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.1651118, "supported_languages": null}, "macro.dbt.materialization_seed_default": {"name": "materialization_seed_default", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/seeds/seed.sql", "original_file_path": "macros/materializations/seeds/seed.sql", "unique_id": "macro.dbt.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 grant_config = config.get('grants') -%}\n {%- set agate_table = load_agate_table() -%}\n -- grab current tables grants config for comparison later on\n\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 {{ get_csv_sql(create_table_sql, sql) }};\n {% endcall %}\n\n {% set target_relation = this.incorporate(type='table') %}\n\n {% set should_revoke = should_revoke(old_relation, full_refresh_mode) %}\n {% do apply_grants(target_relation, grant_config, should_revoke=should_revoke) %}\n\n {% do persist_docs(target_relation, model) %}\n\n {% if full_refresh_mode or not exists_as_table %}\n {% do create_indexes(target_relation) %}\n {% endif %}\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 %}", "depends_on": {"macros": ["macro.dbt.should_full_refresh", "macro.dbt.run_hooks", "macro.dbt.reset_csv_table", "macro.dbt.create_csv_table", "macro.dbt.load_csv_rows", "macro.dbt.noop_statement", "macro.dbt.get_csv_sql", "macro.dbt.should_revoke", "macro.dbt.apply_grants", "macro.dbt.persist_docs", "macro.dbt.create_indexes"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.1703105, "supported_languages": ["sql"]}, "macro.dbt.default__test_accepted_values": {"name": "default__test_accepted_values", "resource_type": "macro", "package_name": "dbt", "path": "macros/generic_test_sql/accepted_values.sql", "original_file_path": "macros/generic_test_sql/accepted_values.sql", "unique_id": "macro.dbt.default__test_accepted_values", "macro_sql": "{% macro default__test_accepted_values(model, column_name, values, quote=True) %}\n\nwith all_values as (\n\n select\n {{ column_name }} as value_field,\n count(*) as n_records\n\n from {{ model }}\n group by {{ column_name }}\n\n)\n\nselect *\nfrom all_values\nwhere value_field not in (\n {% for value in values -%}\n {% if quote -%}\n '{{ value }}'\n {%- else -%}\n {{ value }}\n {%- endif -%}\n {%- if not loop.last -%},{%- endif %}\n {%- endfor %}\n)\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.1712778, "supported_languages": null}, "macro.dbt.default__test_unique": {"name": "default__test_unique", "resource_type": "macro", "package_name": "dbt", "path": "macros/generic_test_sql/unique.sql", "original_file_path": "macros/generic_test_sql/unique.sql", "unique_id": "macro.dbt.default__test_unique", "macro_sql": "{% macro default__test_unique(model, column_name) %}\n\nselect\n {{ column_name }} as unique_field,\n count(*) as n_records\n\nfrom {{ model }}\nwhere {{ column_name }} is not null\ngroup by {{ column_name }}\nhaving count(*) > 1\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.171696, "supported_languages": null}, "macro.dbt.default__test_not_null": {"name": "default__test_not_null", "resource_type": "macro", "package_name": "dbt", "path": "macros/generic_test_sql/not_null.sql", "original_file_path": "macros/generic_test_sql/not_null.sql", "unique_id": "macro.dbt.default__test_not_null", "macro_sql": "{% macro default__test_not_null(model, column_name) %}\n\n{% set column_list = '*' if should_store_failures() else column_name %}\n\nselect {{ column_list }}\nfrom {{ model }}\nwhere {{ column_name }} is null\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.should_store_failures"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.1721961, "supported_languages": null}, "macro.dbt.default__test_relationships": {"name": "default__test_relationships", "resource_type": "macro", "package_name": "dbt", "path": "macros/generic_test_sql/relationships.sql", "original_file_path": "macros/generic_test_sql/relationships.sql", "unique_id": "macro.dbt.default__test_relationships", "macro_sql": "{% macro default__test_relationships(model, column_name, to, field) %}\n\nwith child as (\n select {{ column_name }} as from_field\n from {{ model }}\n where {{ column_name }} is not null\n),\n\nparent as (\n select {{ field }} as to_field\n from {{ to }}\n)\n\nselect\n from_field\n\nfrom child\nleft join parent\n on child.from_field = parent.to_field\n\nwhere parent.to_field is null\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.172753, "supported_languages": null}, "macro.dbt.get_columns_in_relation": {"name": "get_columns_in_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "unique_id": "macro.dbt.get_columns_in_relation", "macro_sql": "{% macro get_columns_in_relation(relation) -%}\n {{ return(adapter.dispatch('get_columns_in_relation', 'dbt')(relation)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_postgres.postgres__get_columns_in_relation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.1760688, "supported_languages": null}, "macro.dbt.default__get_columns_in_relation": {"name": "default__get_columns_in_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "unique_id": "macro.dbt.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 %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.176352, "supported_languages": null}, "macro.dbt.sql_convert_columns_in_relation": {"name": "sql_convert_columns_in_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "unique_id": "macro.dbt.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 %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.176903, "supported_languages": null}, "macro.dbt.get_empty_subquery_sql": {"name": "get_empty_subquery_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "unique_id": "macro.dbt.get_empty_subquery_sql", "macro_sql": "{% macro get_empty_subquery_sql(select_sql, select_sql_header=none) -%}\n {{ return(adapter.dispatch('get_empty_subquery_sql', 'dbt')(select_sql, select_sql_header)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_empty_subquery_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.177289, "supported_languages": null}, "macro.dbt.default__get_empty_subquery_sql": {"name": "default__get_empty_subquery_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "unique_id": "macro.dbt.default__get_empty_subquery_sql", "macro_sql": "{% macro default__get_empty_subquery_sql(select_sql, select_sql_header=none) %}\n {%- if select_sql_header is not none -%}\n {{ select_sql_header }}\n {%- endif -%}\n select * from (\n {{ select_sql }}\n ) as __dbt_sbq\n where false\n limit 0\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.1776469, "supported_languages": null}, "macro.dbt.get_empty_schema_sql": {"name": "get_empty_schema_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "unique_id": "macro.dbt.get_empty_schema_sql", "macro_sql": "{% macro get_empty_schema_sql(columns) -%}\n {{ return(adapter.dispatch('get_empty_schema_sql', 'dbt')(columns)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_empty_schema_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.177971, "supported_languages": null}, "macro.dbt.default__get_empty_schema_sql": {"name": "default__get_empty_schema_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "unique_id": "macro.dbt.default__get_empty_schema_sql", "macro_sql": "{% macro default__get_empty_schema_sql(columns) %}\n {%- set col_err = [] -%}\n {%- set col_naked_numeric = [] -%}\n select\n {% for i in columns %}\n {%- set col = columns[i] -%}\n {%- if col['data_type'] is not defined -%}\n {%- do col_err.append(col['name']) -%}\n {#-- If this column's type is just 'numeric' then it is missing precision/scale, raise a warning --#}\n {%- elif col['data_type'].strip().lower() in ('numeric', 'decimal', 'number') -%}\n {%- do col_naked_numeric.append(col['name']) -%}\n {%- endif -%}\n {% set col_name = adapter.quote(col['name']) if col.get('quote') else col['name'] %}\n cast(null as {{ col['data_type'] }}) as {{ col_name }}{{ \", \" if not loop.last }}\n {%- endfor -%}\n {%- if (col_err | length) > 0 -%}\n {{ exceptions.column_type_missing(column_names=col_err) }}\n {%- elif (col_naked_numeric | length) > 0 -%}\n {{ exceptions.warn(\"Detected columns with numeric type and unspecified precision/scale, this can lead to unintended rounding: \" ~ col_naked_numeric ~ \"`\") }}\n {%- endif -%}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.1798894, "supported_languages": null}, "macro.dbt.get_column_schema_from_query": {"name": "get_column_schema_from_query", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "unique_id": "macro.dbt.get_column_schema_from_query", "macro_sql": "{% macro get_column_schema_from_query(select_sql, select_sql_header=none) -%}\n {% set columns = [] %}\n {# -- Using an 'empty subquery' here to get the same schema as the given select_sql statement, without necessitating a data scan.#}\n {% set sql = get_empty_subquery_sql(select_sql, select_sql_header) %}\n {% set column_schema = adapter.get_column_schema_from_query(sql) %}\n {{ return(column_schema) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_empty_subquery_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.1805725, "supported_languages": null}, "macro.dbt.get_columns_in_query": {"name": "get_columns_in_query", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "unique_id": "macro.dbt.get_columns_in_query", "macro_sql": "{% macro get_columns_in_query(select_sql) -%}\n {{ return(adapter.dispatch('get_columns_in_query', 'dbt')(select_sql)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_columns_in_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.1809113, "supported_languages": null}, "macro.dbt.default__get_columns_in_query": {"name": "default__get_columns_in_query", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "unique_id": "macro.dbt.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 {{ get_empty_subquery_sql(select_sql) }}\n {% endcall %}\n {{ return(load_result('get_columns_in_query').table.columns | map(attribute='name') | list) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt.get_empty_subquery_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.181522, "supported_languages": null}, "macro.dbt.alter_column_type": {"name": "alter_column_type", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "unique_id": "macro.dbt.alter_column_type", "macro_sql": "{% macro alter_column_type(relation, column_name, new_column_type) -%}\n {{ return(adapter.dispatch('alter_column_type', 'dbt')(relation, column_name, new_column_type)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__alter_column_type"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.181908, "supported_languages": null}, "macro.dbt.default__alter_column_type": {"name": "default__alter_column_type", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "unique_id": "macro.dbt.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 %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.1829243, "supported_languages": null}, "macro.dbt.alter_relation_add_remove_columns": {"name": "alter_relation_add_remove_columns", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "unique_id": "macro.dbt.alter_relation_add_remove_columns", "macro_sql": "{% macro alter_relation_add_remove_columns(relation, add_columns = none, remove_columns = none) -%}\n {{ return(adapter.dispatch('alter_relation_add_remove_columns', 'dbt')(relation, add_columns, remove_columns)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__alter_relation_add_remove_columns"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.183362, "supported_languages": null}, "macro.dbt.default__alter_relation_add_remove_columns": {"name": "default__alter_relation_add_remove_columns", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "unique_id": "macro.dbt.default__alter_relation_add_remove_columns", "macro_sql": "{% macro default__alter_relation_add_remove_columns(relation, add_columns, remove_columns) %}\n\n {% if add_columns is none %}\n {% set add_columns = [] %}\n {% endif %}\n {% if remove_columns is none %}\n {% set remove_columns = [] %}\n {% endif %}\n\n {% set sql -%}\n\n alter {{ relation.type }} {{ relation }}\n\n {% for column in add_columns %}\n add column {{ column.name }} {{ column.data_type }}{{ ',' if not loop.last }}\n {% endfor %}{{ ',' if add_columns and remove_columns }}\n\n {% for column in remove_columns %}\n drop column {{ column.name }}{{ ',' if not loop.last }}\n {% endfor %}\n\n {%- endset -%}\n\n {% do run_query(sql) %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.184693, "supported_languages": null}, "macro.dbt.get_catalog_relations": {"name": "get_catalog_relations", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "unique_id": "macro.dbt.get_catalog_relations", "macro_sql": "{% macro get_catalog_relations(information_schema, relations) -%}\n {{ return(adapter.dispatch('get_catalog_relations', 'dbt')(information_schema, relations)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_postgres.postgres__get_catalog_relations"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.1889012, "supported_languages": null}, "macro.dbt.default__get_catalog_relations": {"name": "default__get_catalog_relations", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "unique_id": "macro.dbt.default__get_catalog_relations", "macro_sql": "{% macro default__get_catalog_relations(information_schema, relations) -%}\n {% set typename = adapter.type() %}\n {% set msg -%}\n get_catalog_relations not implemented for {{ typename }}\n {%- endset %}\n\n {{ exceptions.raise_compiler_error(msg) }}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.1893535, "supported_languages": null}, "macro.dbt.get_catalog": {"name": "get_catalog", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "unique_id": "macro.dbt.get_catalog", "macro_sql": "{% macro get_catalog(information_schema, schemas) -%}\n {{ return(adapter.dispatch('get_catalog', 'dbt')(information_schema, schemas)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_postgres.postgres__get_catalog"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.189699, "supported_languages": null}, "macro.dbt.default__get_catalog": {"name": "default__get_catalog", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "unique_id": "macro.dbt.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 %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.1901407, "supported_languages": null}, "macro.dbt.information_schema_name": {"name": "information_schema_name", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "unique_id": "macro.dbt.information_schema_name", "macro_sql": "{% macro information_schema_name(database) %}\n {{ return(adapter.dispatch('information_schema_name', 'dbt')(database)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_postgres.postgres__information_schema_name"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.190454, "supported_languages": null}, "macro.dbt.default__information_schema_name": {"name": "default__information_schema_name", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "unique_id": "macro.dbt.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 %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.1907349, "supported_languages": null}, "macro.dbt.list_schemas": {"name": "list_schemas", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "unique_id": "macro.dbt.list_schemas", "macro_sql": "{% macro list_schemas(database) -%}\n {{ return(adapter.dispatch('list_schemas', 'dbt')(database)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_postgres.postgres__list_schemas"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.191052, "supported_languages": null}, "macro.dbt.default__list_schemas": {"name": "default__list_schemas", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "unique_id": "macro.dbt.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 %}", "depends_on": {"macros": ["macro.dbt.information_schema_name", "macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.1914713, "supported_languages": null}, "macro.dbt.check_schema_exists": {"name": "check_schema_exists", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "unique_id": "macro.dbt.check_schema_exists", "macro_sql": "{% macro check_schema_exists(information_schema, schema) -%}\n {{ return(adapter.dispatch('check_schema_exists', 'dbt')(information_schema, schema)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_postgres.postgres__check_schema_exists"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.1918168, "supported_languages": null}, "macro.dbt.default__check_schema_exists": {"name": "default__check_schema_exists", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "unique_id": "macro.dbt.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 %}", "depends_on": {"macros": ["macro.dbt.replace", "macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.192331, "supported_languages": null}, "macro.dbt.list_relations_without_caching": {"name": "list_relations_without_caching", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "unique_id": "macro.dbt.list_relations_without_caching", "macro_sql": "{% macro list_relations_without_caching(schema_relation) %}\n {{ return(adapter.dispatch('list_relations_without_caching', 'dbt')(schema_relation)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_postgres.postgres__list_relations_without_caching"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.1926467, "supported_languages": null}, "macro.dbt.default__list_relations_without_caching": {"name": "default__list_relations_without_caching", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "unique_id": "macro.dbt.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 %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.19296, "supported_languages": null}, "macro.dbt.get_relations": {"name": "get_relations", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "unique_id": "macro.dbt.get_relations", "macro_sql": "{% macro get_relations() %}\n {{ return(adapter.dispatch('get_relations', 'dbt')()) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_postgres.postgres__get_relations"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.1932583, "supported_languages": null}, "macro.dbt.default__get_relations": {"name": "default__get_relations", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "unique_id": "macro.dbt.default__get_relations", "macro_sql": "{% macro default__get_relations() %}\n {{ exceptions.raise_not_implemented(\n 'get_relations macro not implemented for adapter '+adapter.type()) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.1935325, "supported_languages": null}, "macro.dbt.get_relation_last_modified": {"name": "get_relation_last_modified", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "unique_id": "macro.dbt.get_relation_last_modified", "macro_sql": "{% macro get_relation_last_modified(information_schema, relations) %}\n {{ return(adapter.dispatch('get_relation_last_modified', 'dbt')(information_schema, relations)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_relation_last_modified"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.1939902, "supported_languages": null}, "macro.dbt.default__get_relation_last_modified": {"name": "default__get_relation_last_modified", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "unique_id": "macro.dbt.default__get_relation_last_modified", "macro_sql": "{% macro default__get_relation_last_modified(information_schema, relations) %}\n {{ exceptions.raise_not_implemented(\n 'get_relation_last_modified macro not implemented for adapter ' + adapter.type()) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.194295, "supported_languages": null}, "macro.dbt.current_timestamp": {"name": "current_timestamp", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/timestamps.sql", "original_file_path": "macros/adapters/timestamps.sql", "unique_id": "macro.dbt.current_timestamp", "macro_sql": "{%- macro current_timestamp() -%}\n {{ adapter.dispatch('current_timestamp', 'dbt')() }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt_postgres.postgres__current_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.195095, "supported_languages": null}, "macro.dbt.default__current_timestamp": {"name": "default__current_timestamp", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/timestamps.sql", "original_file_path": "macros/adapters/timestamps.sql", "unique_id": "macro.dbt.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 %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.1953597, "supported_languages": null}, "macro.dbt.snapshot_get_time": {"name": "snapshot_get_time", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/timestamps.sql", "original_file_path": "macros/adapters/timestamps.sql", "unique_id": "macro.dbt.snapshot_get_time", "macro_sql": "\n\n{%- macro snapshot_get_time() -%}\n {{ adapter.dispatch('snapshot_get_time', 'dbt')() }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt_postgres.postgres__snapshot_get_time"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.19561, "supported_languages": null}, "macro.dbt.default__snapshot_get_time": {"name": "default__snapshot_get_time", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/timestamps.sql", "original_file_path": "macros/adapters/timestamps.sql", "unique_id": "macro.dbt.default__snapshot_get_time", "macro_sql": "{% macro default__snapshot_get_time() %}\n {{ current_timestamp() }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.current_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.195799, "supported_languages": null}, "macro.dbt.current_timestamp_backcompat": {"name": "current_timestamp_backcompat", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/timestamps.sql", "original_file_path": "macros/adapters/timestamps.sql", "unique_id": "macro.dbt.current_timestamp_backcompat", "macro_sql": "{% macro current_timestamp_backcompat() %}\n {{ return(adapter.dispatch('current_timestamp_backcompat', 'dbt')()) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_postgres.postgres__current_timestamp_backcompat"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.196087, "supported_languages": null}, "macro.dbt.default__current_timestamp_backcompat": {"name": "default__current_timestamp_backcompat", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/timestamps.sql", "original_file_path": "macros/adapters/timestamps.sql", "unique_id": "macro.dbt.default__current_timestamp_backcompat", "macro_sql": "{% macro default__current_timestamp_backcompat() %}\n current_timestamp::timestamp\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.1962235, "supported_languages": null}, "macro.dbt.current_timestamp_in_utc_backcompat": {"name": "current_timestamp_in_utc_backcompat", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/timestamps.sql", "original_file_path": "macros/adapters/timestamps.sql", "unique_id": "macro.dbt.current_timestamp_in_utc_backcompat", "macro_sql": "{% macro current_timestamp_in_utc_backcompat() %}\n {{ return(adapter.dispatch('current_timestamp_in_utc_backcompat', 'dbt')()) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_postgres.postgres__current_timestamp_in_utc_backcompat"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.1965077, "supported_languages": null}, "macro.dbt.default__current_timestamp_in_utc_backcompat": {"name": "default__current_timestamp_in_utc_backcompat", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/timestamps.sql", "original_file_path": "macros/adapters/timestamps.sql", "unique_id": "macro.dbt.default__current_timestamp_in_utc_backcompat", "macro_sql": "{% macro default__current_timestamp_in_utc_backcompat() %}\n {{ return(adapter.dispatch('current_timestamp_backcompat', 'dbt')()) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.current_timestamp_backcompat", "macro.dbt_postgres.postgres__current_timestamp_backcompat"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.196806, "supported_languages": null}, "macro.dbt.get_show_sql": {"name": "get_show_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/show.sql", "original_file_path": "macros/adapters/show.sql", "unique_id": "macro.dbt.get_show_sql", "macro_sql": "{% macro get_show_sql(compiled_code, sql_header, limit) -%}\n {%- if sql_header -%}\n {{ sql_header }}\n {%- endif -%}\n {%- if limit is not none -%}\n {{ get_limit_subquery_sql(compiled_code, limit) }}\n {%- else -%}\n {{ compiled_code }}\n {%- endif -%}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_limit_subquery_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.197688, "supported_languages": null}, "macro.dbt.get_limit_subquery_sql": {"name": "get_limit_subquery_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/show.sql", "original_file_path": "macros/adapters/show.sql", "unique_id": "macro.dbt.get_limit_subquery_sql", "macro_sql": "{% macro get_limit_subquery_sql(sql, limit) %}\n {{ adapter.dispatch('get_limit_subquery_sql', 'dbt')(sql, limit) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_limit_subquery_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.198019, "supported_languages": null}, "macro.dbt.default__get_limit_subquery_sql": {"name": "default__get_limit_subquery_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/show.sql", "original_file_path": "macros/adapters/show.sql", "unique_id": "macro.dbt.default__get_limit_subquery_sql", "macro_sql": "{% macro default__get_limit_subquery_sql(sql, limit) %}\n select *\n from (\n {{ sql }}\n ) as model_limit_subq\n limit {{ limit }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.1982589, "supported_languages": null}, "macro.dbt.copy_grants": {"name": "copy_grants", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt.copy_grants", "macro_sql": "{% macro copy_grants() %}\n {{ return(adapter.dispatch('copy_grants', 'dbt')()) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_postgres.postgres__copy_grants"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2008717, "supported_languages": null}, "macro.dbt.default__copy_grants": {"name": "default__copy_grants", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt.default__copy_grants", "macro_sql": "{% macro default__copy_grants() %}\n {{ return(True) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2010858, "supported_languages": null}, "macro.dbt.support_multiple_grantees_per_dcl_statement": {"name": "support_multiple_grantees_per_dcl_statement", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt.support_multiple_grantees_per_dcl_statement", "macro_sql": "{% macro support_multiple_grantees_per_dcl_statement() %}\n {{ return(adapter.dispatch('support_multiple_grantees_per_dcl_statement', 'dbt')()) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__support_multiple_grantees_per_dcl_statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2013886, "supported_languages": null}, "macro.dbt.default__support_multiple_grantees_per_dcl_statement": {"name": "default__support_multiple_grantees_per_dcl_statement", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt.default__support_multiple_grantees_per_dcl_statement", "macro_sql": "\n\n{%- macro default__support_multiple_grantees_per_dcl_statement() -%}\n {{ return(True) }}\n{%- endmacro -%}\n\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2015886, "supported_languages": null}, "macro.dbt.should_revoke": {"name": "should_revoke", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt.should_revoke", "macro_sql": "{% macro should_revoke(existing_relation, full_refresh_mode=True) %}\n\n {% if not existing_relation %}\n {#-- The table doesn't already exist, so no grants to copy over --#}\n {{ return(False) }}\n {% elif full_refresh_mode %}\n {#-- The object is being REPLACED -- whether grants are copied over depends on the value of user config --#}\n {{ return(copy_grants()) }}\n {% else %}\n {#-- The table is being merged/upserted/inserted -- grants will be carried over --#}\n {{ return(True) }}\n {% endif %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.copy_grants"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2021754, "supported_languages": null}, "macro.dbt.get_show_grant_sql": {"name": "get_show_grant_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt.get_show_grant_sql", "macro_sql": "{% macro get_show_grant_sql(relation) %}\n {{ return(adapter.dispatch(\"get_show_grant_sql\", \"dbt\")(relation)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_postgres.postgres__get_show_grant_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2025928, "supported_languages": null}, "macro.dbt.default__get_show_grant_sql": {"name": "default__get_show_grant_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt.default__get_show_grant_sql", "macro_sql": "{% macro default__get_show_grant_sql(relation) %}\n show grants on {{ relation }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.202778, "supported_languages": null}, "macro.dbt.get_grant_sql": {"name": "get_grant_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt.get_grant_sql", "macro_sql": "{% macro get_grant_sql(relation, privilege, grantees) %}\n {{ return(adapter.dispatch('get_grant_sql', 'dbt')(relation, privilege, grantees)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_grant_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2031696, "supported_languages": null}, "macro.dbt.default__get_grant_sql": {"name": "default__get_grant_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt.default__get_grant_sql", "macro_sql": "\n\n{%- macro default__get_grant_sql(relation, privilege, grantees) -%}\n grant {{ privilege }} on {{ relation }} to {{ grantees | join(', ') }}\n{%- endmacro -%}\n\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2034943, "supported_languages": null}, "macro.dbt.get_revoke_sql": {"name": "get_revoke_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt.get_revoke_sql", "macro_sql": "{% macro get_revoke_sql(relation, privilege, grantees) %}\n {{ return(adapter.dispatch('get_revoke_sql', 'dbt')(relation, privilege, grantees)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_revoke_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2038891, "supported_languages": null}, "macro.dbt.default__get_revoke_sql": {"name": "default__get_revoke_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt.default__get_revoke_sql", "macro_sql": "\n\n{%- macro default__get_revoke_sql(relation, privilege, grantees) -%}\n revoke {{ privilege }} on {{ relation }} from {{ grantees | join(', ') }}\n{%- endmacro -%}\n\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2042158, "supported_languages": null}, "macro.dbt.get_dcl_statement_list": {"name": "get_dcl_statement_list", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt.get_dcl_statement_list", "macro_sql": "{% macro get_dcl_statement_list(relation, grant_config, get_dcl_macro) %}\n {{ return(adapter.dispatch('get_dcl_statement_list', 'dbt')(relation, grant_config, get_dcl_macro)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_dcl_statement_list"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2046115, "supported_languages": null}, "macro.dbt.default__get_dcl_statement_list": {"name": "default__get_dcl_statement_list", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt.default__get_dcl_statement_list", "macro_sql": "\n\n{%- macro default__get_dcl_statement_list(relation, grant_config, get_dcl_macro) -%}\n {#\n -- Unpack grant_config into specific privileges and the set of users who need them granted/revoked.\n -- Depending on whether this database supports multiple grantees per statement, pass in the list of\n -- all grantees per privilege, or (if not) template one statement per privilege-grantee pair.\n -- `get_dcl_macro` will be either `get_grant_sql` or `get_revoke_sql`\n #}\n {%- set dcl_statements = [] -%}\n {%- for privilege, grantees in grant_config.items() %}\n {%- if support_multiple_grantees_per_dcl_statement() and grantees -%}\n {%- set dcl = get_dcl_macro(relation, privilege, grantees) -%}\n {%- do dcl_statements.append(dcl) -%}\n {%- else -%}\n {%- for grantee in grantees -%}\n {% set dcl = get_dcl_macro(relation, privilege, [grantee]) %}\n {%- do dcl_statements.append(dcl) -%}\n {% endfor -%}\n {%- endif -%}\n {%- endfor -%}\n {{ return(dcl_statements) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.support_multiple_grantees_per_dcl_statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2057736, "supported_languages": null}, "macro.dbt.call_dcl_statements": {"name": "call_dcl_statements", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt.call_dcl_statements", "macro_sql": "{% macro call_dcl_statements(dcl_statement_list) %}\n {{ return(adapter.dispatch(\"call_dcl_statements\", \"dbt\")(dcl_statement_list)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__call_dcl_statements"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2061043, "supported_languages": null}, "macro.dbt.default__call_dcl_statements": {"name": "default__call_dcl_statements", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt.default__call_dcl_statements", "macro_sql": "{% macro default__call_dcl_statements(dcl_statement_list) %}\n {#\n -- By default, supply all grant + revoke statements in a single semicolon-separated block,\n -- so that they're all processed together.\n\n -- Some databases do not support this. Those adapters will need to override this macro\n -- to run each statement individually.\n #}\n {% call statement('grants') %}\n {% for dcl_statement in dcl_statement_list %}\n {{ dcl_statement }};\n {% endfor %}\n {% endcall %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.20654, "supported_languages": null}, "macro.dbt.apply_grants": {"name": "apply_grants", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt.apply_grants", "macro_sql": "{% macro apply_grants(relation, grant_config, should_revoke) %}\n {{ return(adapter.dispatch(\"apply_grants\", \"dbt\")(relation, grant_config, should_revoke)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__apply_grants"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2069244, "supported_languages": null}, "macro.dbt.default__apply_grants": {"name": "default__apply_grants", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt.default__apply_grants", "macro_sql": "{% macro default__apply_grants(relation, grant_config, should_revoke=True) %}\n {#-- If grant_config is {} or None, this is a no-op --#}\n {% if grant_config %}\n {% if should_revoke %}\n {#-- We think previous grants may have carried over --#}\n {#-- Show current grants and calculate diffs --#}\n {% set current_grants_table = run_query(get_show_grant_sql(relation)) %}\n {% set current_grants_dict = adapter.standardize_grants_dict(current_grants_table) %}\n {% set needs_granting = diff_of_two_dicts(grant_config, current_grants_dict) %}\n {% set needs_revoking = diff_of_two_dicts(current_grants_dict, grant_config) %}\n {% if not (needs_granting or needs_revoking) %}\n {{ log('On ' ~ relation ~': All grants are in place, no revocation or granting needed.')}}\n {% endif %}\n {% else %}\n {#-- We don't think there's any chance of previous grants having carried over. --#}\n {#-- Jump straight to granting what the user has configured. --#}\n {% set needs_revoking = {} %}\n {% set needs_granting = grant_config %}\n {% endif %}\n {% if needs_granting or needs_revoking %}\n {% set revoke_statement_list = get_dcl_statement_list(relation, needs_revoking, get_revoke_sql) %}\n {% set grant_statement_list = get_dcl_statement_list(relation, needs_granting, get_grant_sql) %}\n {% set dcl_statement_list = revoke_statement_list + grant_statement_list %}\n {% if dcl_statement_list %}\n {{ call_dcl_statements(dcl_statement_list) }}\n {% endif %}\n {% endif %}\n {% endif %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.run_query", "macro.dbt.get_show_grant_sql", "macro.dbt.get_dcl_statement_list", "macro.dbt.call_dcl_statements"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2088776, "supported_languages": null}, "macro.dbt.validate_sql": {"name": "validate_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/validate_sql.sql", "original_file_path": "macros/adapters/validate_sql.sql", "unique_id": "macro.dbt.validate_sql", "macro_sql": "{% macro validate_sql(sql) -%}\n {{ return(adapter.dispatch('validate_sql', 'dbt')(sql)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__validate_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2093852, "supported_languages": null}, "macro.dbt.default__validate_sql": {"name": "default__validate_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/validate_sql.sql", "original_file_path": "macros/adapters/validate_sql.sql", "unique_id": "macro.dbt.default__validate_sql", "macro_sql": "{% macro default__validate_sql(sql) -%}\n {% call statement('validate_sql') -%}\n explain {{ sql }}\n {% endcall %}\n {{ return(load_result('validate_sql')) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2097826, "supported_languages": null}, "macro.dbt.get_create_index_sql": {"name": "get_create_index_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/indexes.sql", "original_file_path": "macros/adapters/indexes.sql", "unique_id": "macro.dbt.get_create_index_sql", "macro_sql": "{% macro get_create_index_sql(relation, index_dict) -%}\n {{ return(adapter.dispatch('get_create_index_sql', 'dbt')(relation, index_dict)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_postgres.postgres__get_create_index_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2111003, "supported_languages": null}, "macro.dbt.default__get_create_index_sql": {"name": "default__get_create_index_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/indexes.sql", "original_file_path": "macros/adapters/indexes.sql", "unique_id": "macro.dbt.default__get_create_index_sql", "macro_sql": "{% macro default__get_create_index_sql(relation, index_dict) -%}\n {% do return(None) %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2113411, "supported_languages": null}, "macro.dbt.create_indexes": {"name": "create_indexes", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/indexes.sql", "original_file_path": "macros/adapters/indexes.sql", "unique_id": "macro.dbt.create_indexes", "macro_sql": "{% macro create_indexes(relation) -%}\n {{ adapter.dispatch('create_indexes', 'dbt')(relation) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__create_indexes"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2116108, "supported_languages": null}, "macro.dbt.default__create_indexes": {"name": "default__create_indexes", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/indexes.sql", "original_file_path": "macros/adapters/indexes.sql", "unique_id": "macro.dbt.default__create_indexes", "macro_sql": "{% macro default__create_indexes(relation) -%}\n {%- set _indexes = config.get('indexes', default=[]) -%}\n\n {% for _index_dict in _indexes %}\n {% set create_index_sql = get_create_index_sql(relation, _index_dict) %}\n {% if create_index_sql %}\n {% do run_query(create_index_sql) %}\n {% endif %}\n {% endfor %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_create_index_sql", "macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2122743, "supported_languages": null}, "macro.dbt.get_drop_index_sql": {"name": "get_drop_index_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/indexes.sql", "original_file_path": "macros/adapters/indexes.sql", "unique_id": "macro.dbt.get_drop_index_sql", "macro_sql": "{% macro get_drop_index_sql(relation, index_name) -%}\n {{ adapter.dispatch('get_drop_index_sql', 'dbt')(relation, index_name) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_postgres.postgres__get_drop_index_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.212599, "supported_languages": null}, "macro.dbt.default__get_drop_index_sql": {"name": "default__get_drop_index_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/indexes.sql", "original_file_path": "macros/adapters/indexes.sql", "unique_id": "macro.dbt.default__get_drop_index_sql", "macro_sql": "{% macro default__get_drop_index_sql(relation, index_name) -%}\n {{ exceptions.raise_compiler_error(\"`get_drop_index_sql has not been implemented for this adapter.\") }}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2128441, "supported_languages": null}, "macro.dbt.get_show_indexes_sql": {"name": "get_show_indexes_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/indexes.sql", "original_file_path": "macros/adapters/indexes.sql", "unique_id": "macro.dbt.get_show_indexes_sql", "macro_sql": "{% macro get_show_indexes_sql(relation) -%}\n {{ adapter.dispatch('get_show_indexes_sql', 'dbt')(relation) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_postgres.postgres__get_show_indexes_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2131429, "supported_languages": null}, "macro.dbt.default__get_show_indexes_sql": {"name": "default__get_show_indexes_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/indexes.sql", "original_file_path": "macros/adapters/indexes.sql", "unique_id": "macro.dbt.default__get_show_indexes_sql", "macro_sql": "{% macro default__get_show_indexes_sql(relation) -%}\n {{ exceptions.raise_compiler_error(\"`get_show_indexes_sql has not been implemented for this adapter.\") }}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2136133, "supported_languages": null}, "macro.dbt.collect_freshness": {"name": "collect_freshness", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/freshness.sql", "original_file_path": "macros/adapters/freshness.sql", "unique_id": "macro.dbt.collect_freshness", "macro_sql": "{% macro collect_freshness(source, loaded_at_field, filter) %}\n {{ return(adapter.dispatch('collect_freshness', 'dbt')(source, loaded_at_field, filter))}}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__collect_freshness"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2142956, "supported_languages": null}, "macro.dbt.default__collect_freshness": {"name": "default__collect_freshness", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/freshness.sql", "original_file_path": "macros/adapters/freshness.sql", "unique_id": "macro.dbt.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')) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt.current_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2149956, "supported_languages": null}, "macro.dbt.create_schema": {"name": "create_schema", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/schema.sql", "original_file_path": "macros/adapters/schema.sql", "unique_id": "macro.dbt.create_schema", "macro_sql": "{% macro create_schema(relation) -%}\n {{ adapter.dispatch('create_schema', 'dbt')(relation) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_postgres.postgres__create_schema"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.215599, "supported_languages": null}, "macro.dbt.default__create_schema": {"name": "default__create_schema", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/schema.sql", "original_file_path": "macros/adapters/schema.sql", "unique_id": "macro.dbt.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 %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2159214, "supported_languages": null}, "macro.dbt.drop_schema": {"name": "drop_schema", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/schema.sql", "original_file_path": "macros/adapters/schema.sql", "unique_id": "macro.dbt.drop_schema", "macro_sql": "{% macro drop_schema(relation) -%}\n {{ adapter.dispatch('drop_schema', 'dbt')(relation) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_postgres.postgres__drop_schema"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2161965, "supported_languages": null}, "macro.dbt.default__drop_schema": {"name": "default__drop_schema", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/schema.sql", "original_file_path": "macros/adapters/schema.sql", "unique_id": "macro.dbt.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 %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2165139, "supported_languages": null}, "macro.dbt.make_intermediate_relation": {"name": "make_intermediate_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "unique_id": "macro.dbt.make_intermediate_relation", "macro_sql": "{% macro make_intermediate_relation(base_relation, suffix='__dbt_tmp') %}\n {{ return(adapter.dispatch('make_intermediate_relation', 'dbt')(base_relation, suffix)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_postgres.postgres__make_intermediate_relation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2194972, "supported_languages": null}, "macro.dbt.default__make_intermediate_relation": {"name": "default__make_intermediate_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "unique_id": "macro.dbt.default__make_intermediate_relation", "macro_sql": "{% macro default__make_intermediate_relation(base_relation, suffix) %}\n {{ return(default__make_temp_relation(base_relation, suffix)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__make_temp_relation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2197826, "supported_languages": null}, "macro.dbt.make_temp_relation": {"name": "make_temp_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "unique_id": "macro.dbt.make_temp_relation", "macro_sql": "{% macro make_temp_relation(base_relation, suffix='__dbt_tmp') %}\n {{ return(adapter.dispatch('make_temp_relation', 'dbt')(base_relation, suffix)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_postgres.postgres__make_temp_relation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.220154, "supported_languages": null}, "macro.dbt.default__make_temp_relation": {"name": "default__make_temp_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "unique_id": "macro.dbt.default__make_temp_relation", "macro_sql": "{% macro default__make_temp_relation(base_relation, suffix) %}\n {%- set temp_identifier = base_relation.identifier ~ suffix -%}\n {%- set temp_relation = base_relation.incorporate(\n path={\"identifier\": temp_identifier}) -%}\n\n {{ return(temp_relation) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2206488, "supported_languages": null}, "macro.dbt.make_backup_relation": {"name": "make_backup_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "unique_id": "macro.dbt.make_backup_relation", "macro_sql": "{% macro make_backup_relation(base_relation, backup_relation_type, suffix='__dbt_backup') %}\n {{ return(adapter.dispatch('make_backup_relation', 'dbt')(base_relation, backup_relation_type, suffix)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_postgres.postgres__make_backup_relation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2210865, "supported_languages": null}, "macro.dbt.default__make_backup_relation": {"name": "default__make_backup_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "unique_id": "macro.dbt.default__make_backup_relation", "macro_sql": "{% macro default__make_backup_relation(base_relation, backup_relation_type, suffix) %}\n {%- set backup_identifier = base_relation.identifier ~ suffix -%}\n {%- set backup_relation = base_relation.incorporate(\n path={\"identifier\": backup_identifier},\n type=backup_relation_type\n ) -%}\n {{ return(backup_relation) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2216485, "supported_languages": null}, "macro.dbt.truncate_relation": {"name": "truncate_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "unique_id": "macro.dbt.truncate_relation", "macro_sql": "{% macro truncate_relation(relation) -%}\n {{ return(adapter.dispatch('truncate_relation', 'dbt')(relation)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__truncate_relation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2219908, "supported_languages": null}, "macro.dbt.default__truncate_relation": {"name": "default__truncate_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "unique_id": "macro.dbt.default__truncate_relation", "macro_sql": "{% macro default__truncate_relation(relation) -%}\n {% call statement('truncate_relation') -%}\n truncate table {{ relation }}\n {%- endcall %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2222981, "supported_languages": null}, "macro.dbt.get_or_create_relation": {"name": "get_or_create_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "unique_id": "macro.dbt.get_or_create_relation", "macro_sql": "{% macro get_or_create_relation(database, schema, identifier, type) -%}\n {{ return(adapter.dispatch('get_or_create_relation', 'dbt')(database, schema, identifier, type)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_or_create_relation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2227454, "supported_languages": null}, "macro.dbt.default__get_or_create_relation": {"name": "default__get_or_create_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "unique_id": "macro.dbt.default__get_or_create_relation", "macro_sql": "{% macro default__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 %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2237887, "supported_languages": null}, "macro.dbt.load_cached_relation": {"name": "load_cached_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "unique_id": "macro.dbt.load_cached_relation", "macro_sql": "{% macro load_cached_relation(relation) %}\n {% do return(adapter.get_relation(\n database=relation.database,\n schema=relation.schema,\n identifier=relation.identifier\n )) -%}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.224178, "supported_languages": null}, "macro.dbt.load_relation": {"name": "load_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "unique_id": "macro.dbt.load_relation", "macro_sql": "{% macro load_relation(relation) %}\n {{ return(load_cached_relation(relation)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.load_cached_relation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2244234, "supported_languages": null}, "macro.dbt.alter_column_comment": {"name": "alter_column_comment", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/persist_docs.sql", "original_file_path": "macros/adapters/persist_docs.sql", "unique_id": "macro.dbt.alter_column_comment", "macro_sql": "{% macro alter_column_comment(relation, column_dict) -%}\n {{ return(adapter.dispatch('alter_column_comment', 'dbt')(relation, column_dict)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_postgres.postgres__alter_column_comment"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2255223, "supported_languages": null}, "macro.dbt.default__alter_column_comment": {"name": "default__alter_column_comment", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/persist_docs.sql", "original_file_path": "macros/adapters/persist_docs.sql", "unique_id": "macro.dbt.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 %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2258236, "supported_languages": null}, "macro.dbt.alter_relation_comment": {"name": "alter_relation_comment", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/persist_docs.sql", "original_file_path": "macros/adapters/persist_docs.sql", "unique_id": "macro.dbt.alter_relation_comment", "macro_sql": "{% macro alter_relation_comment(relation, relation_comment) -%}\n {{ return(adapter.dispatch('alter_relation_comment', 'dbt')(relation, relation_comment)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_postgres.postgres__alter_relation_comment"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2261755, "supported_languages": null}, "macro.dbt.default__alter_relation_comment": {"name": "default__alter_relation_comment", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/persist_docs.sql", "original_file_path": "macros/adapters/persist_docs.sql", "unique_id": "macro.dbt.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 %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.226471, "supported_languages": null}, "macro.dbt.persist_docs": {"name": "persist_docs", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/persist_docs.sql", "original_file_path": "macros/adapters/persist_docs.sql", "unique_id": "macro.dbt.persist_docs", "macro_sql": "{% macro persist_docs(relation, model, for_relation=true, for_columns=true) -%}\n {{ return(adapter.dispatch('persist_docs', 'dbt')(relation, model, for_relation, for_columns)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__persist_docs"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.226934, "supported_languages": null}, "macro.dbt.default__persist_docs": {"name": "default__persist_docs", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/persist_docs.sql", "original_file_path": "macros/adapters/persist_docs.sql", "unique_id": "macro.dbt.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 %}", "depends_on": {"macros": ["macro.dbt.run_query", "macro.dbt.alter_relation_comment", "macro.dbt.alter_column_comment"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2277477, "supported_languages": null}, "macro.dbt.length": {"name": "length", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/length.sql", "original_file_path": "macros/utils/length.sql", "unique_id": "macro.dbt.length", "macro_sql": "{% macro length(expression) -%}\n {{ return(adapter.dispatch('length', 'dbt') (expression)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__length"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.228197, "supported_languages": null}, "macro.dbt.default__length": {"name": "default__length", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/length.sql", "original_file_path": "macros/utils/length.sql", "unique_id": "macro.dbt.default__length", "macro_sql": "{% macro default__length(expression) %}\n\n length(\n {{ expression }}\n )\n\n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2283845, "supported_languages": null}, "macro.dbt.position": {"name": "position", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/position.sql", "original_file_path": "macros/utils/position.sql", "unique_id": "macro.dbt.position", "macro_sql": "{% macro position(substring_text, string_text) -%}\n {{ return(adapter.dispatch('position', 'dbt') (substring_text, string_text)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__position"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.228887, "supported_languages": null}, "macro.dbt.default__position": {"name": "default__position", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/position.sql", "original_file_path": "macros/utils/position.sql", "unique_id": "macro.dbt.default__position", "macro_sql": "{% macro default__position(substring_text, string_text) %}\n\n position(\n {{ substring_text }} in {{ string_text }}\n )\n\n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2291386, "supported_languages": null}, "macro.dbt.get_powers_of_two": {"name": "get_powers_of_two", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/generate_series.sql", "original_file_path": "macros/utils/generate_series.sql", "unique_id": "macro.dbt.get_powers_of_two", "macro_sql": "{% macro get_powers_of_two(upper_bound) %}\n {{ return(adapter.dispatch('get_powers_of_two', 'dbt')(upper_bound)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_powers_of_two"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2304232, "supported_languages": null}, "macro.dbt.default__get_powers_of_two": {"name": "default__get_powers_of_two", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/generate_series.sql", "original_file_path": "macros/utils/generate_series.sql", "unique_id": "macro.dbt.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 %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.23114, "supported_languages": null}, "macro.dbt.generate_series": {"name": "generate_series", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/generate_series.sql", "original_file_path": "macros/utils/generate_series.sql", "unique_id": "macro.dbt.generate_series", "macro_sql": "{% macro generate_series(upper_bound) %}\n {{ return(adapter.dispatch('generate_series', 'dbt')(upper_bound)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__generate_series"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2314656, "supported_languages": null}, "macro.dbt.default__generate_series": {"name": "default__generate_series", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/generate_series.sql", "original_file_path": "macros/utils/generate_series.sql", "unique_id": "macro.dbt.default__generate_series", "macro_sql": "{% macro default__generate_series(upper_bound) %}\n\n {% set n = dbt.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 * power(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 %}", "depends_on": {"macros": ["macro.dbt.get_powers_of_two"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2323549, "supported_languages": null}, "macro.dbt.string_literal": {"name": "string_literal", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/literal.sql", "original_file_path": "macros/utils/literal.sql", "unique_id": "macro.dbt.string_literal", "macro_sql": "{%- macro string_literal(value) -%}\n {{ return(adapter.dispatch('string_literal', 'dbt') (value)) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt.default__string_literal"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2327795, "supported_languages": null}, "macro.dbt.default__string_literal": {"name": "default__string_literal", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/literal.sql", "original_file_path": "macros/utils/literal.sql", "unique_id": "macro.dbt.default__string_literal", "macro_sql": "{% macro default__string_literal(value) -%}\n '{{ value }}'\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2329822, "supported_languages": null}, "macro.dbt.escape_single_quotes": {"name": "escape_single_quotes", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/escape_single_quotes.sql", "original_file_path": "macros/utils/escape_single_quotes.sql", "unique_id": "macro.dbt.escape_single_quotes", "macro_sql": "{% macro escape_single_quotes(expression) %}\n {{ return(adapter.dispatch('escape_single_quotes', 'dbt') (expression)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__escape_single_quotes"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.233428, "supported_languages": null}, "macro.dbt.default__escape_single_quotes": {"name": "default__escape_single_quotes", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/escape_single_quotes.sql", "original_file_path": "macros/utils/escape_single_quotes.sql", "unique_id": "macro.dbt.default__escape_single_quotes", "macro_sql": "{% macro default__escape_single_quotes(expression) -%}\n{{ expression | replace(\"'\",\"''\") }}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2336783, "supported_languages": null}, "macro.dbt.last_day": {"name": "last_day", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/last_day.sql", "original_file_path": "macros/utils/last_day.sql", "unique_id": "macro.dbt.last_day", "macro_sql": "{% macro last_day(date, datepart) %}\n {{ return(adapter.dispatch('last_day', 'dbt') (date, datepart)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_postgres.postgres__last_day"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2343366, "supported_languages": null}, "macro.dbt.default_last_day": {"name": "default_last_day", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/last_day.sql", "original_file_path": "macros/utils/last_day.sql", "unique_id": "macro.dbt.default_last_day", "macro_sql": "\n\n{%- macro default_last_day(date, datepart) -%}\n cast(\n {{dbt.dateadd('day', '-1',\n dbt.dateadd(datepart, '1', dbt.date_trunc(datepart, date))\n )}}\n as date)\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt.dateadd", "macro.dbt.date_trunc"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2348082, "supported_languages": null}, "macro.dbt.default__last_day": {"name": "default__last_day", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/last_day.sql", "original_file_path": "macros/utils/last_day.sql", "unique_id": "macro.dbt.default__last_day", "macro_sql": "{% macro default__last_day(date, datepart) -%}\n {{dbt.default_last_day(date, datepart)}}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default_last_day"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2350664, "supported_languages": null}, "macro.dbt.safe_cast": {"name": "safe_cast", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/safe_cast.sql", "original_file_path": "macros/utils/safe_cast.sql", "unique_id": "macro.dbt.safe_cast", "macro_sql": "{% macro safe_cast(field, type) %}\n {{ return(adapter.dispatch('safe_cast', 'dbt') (field, type)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__safe_cast"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2355475, "supported_languages": null}, "macro.dbt.default__safe_cast": {"name": "default__safe_cast", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/safe_cast.sql", "original_file_path": "macros/utils/safe_cast.sql", "unique_id": "macro.dbt.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 %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2357912, "supported_languages": null}, "macro.dbt.array_append": {"name": "array_append", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/array_append.sql", "original_file_path": "macros/utils/array_append.sql", "unique_id": "macro.dbt.array_append", "macro_sql": "{% macro array_append(array, new_element) -%}\n {{ return(adapter.dispatch('array_append', 'dbt')(array, new_element)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__array_append"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2362602, "supported_languages": null}, "macro.dbt.default__array_append": {"name": "default__array_append", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/array_append.sql", "original_file_path": "macros/utils/array_append.sql", "unique_id": "macro.dbt.default__array_append", "macro_sql": "{% macro default__array_append(array, new_element) -%}\n array_append({{ array }}, {{ new_element }})\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.236495, "supported_languages": null}, "macro.dbt.type_string": {"name": "type_string", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/data_types.sql", "original_file_path": "macros/utils/data_types.sql", "unique_id": "macro.dbt.type_string", "macro_sql": "\n\n{%- macro type_string() -%}\n {{ return(adapter.dispatch('type_string', 'dbt')()) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt.default__type_string"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2380524, "supported_languages": null}, "macro.dbt.default__type_string": {"name": "default__type_string", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/data_types.sql", "original_file_path": "macros/utils/data_types.sql", "unique_id": "macro.dbt.default__type_string", "macro_sql": "{% macro default__type_string() %}\n {{ return(api.Column.translate_type(\"string\")) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.238326, "supported_languages": null}, "macro.dbt.type_timestamp": {"name": "type_timestamp", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/data_types.sql", "original_file_path": "macros/utils/data_types.sql", "unique_id": "macro.dbt.type_timestamp", "macro_sql": "\n\n{%- macro type_timestamp() -%}\n {{ return(adapter.dispatch('type_timestamp', 'dbt')()) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt.default__type_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2386086, "supported_languages": null}, "macro.dbt.default__type_timestamp": {"name": "default__type_timestamp", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/data_types.sql", "original_file_path": "macros/utils/data_types.sql", "unique_id": "macro.dbt.default__type_timestamp", "macro_sql": "{% macro default__type_timestamp() %}\n {{ return(api.Column.translate_type(\"timestamp\")) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2388794, "supported_languages": null}, "macro.dbt.type_float": {"name": "type_float", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/data_types.sql", "original_file_path": "macros/utils/data_types.sql", "unique_id": "macro.dbt.type_float", "macro_sql": "\n\n{%- macro type_float() -%}\n {{ return(adapter.dispatch('type_float', 'dbt')()) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt.default__type_float"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2391622, "supported_languages": null}, "macro.dbt.default__type_float": {"name": "default__type_float", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/data_types.sql", "original_file_path": "macros/utils/data_types.sql", "unique_id": "macro.dbt.default__type_float", "macro_sql": "{% macro default__type_float() %}\n {{ return(api.Column.translate_type(\"float\")) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2394283, "supported_languages": null}, "macro.dbt.type_numeric": {"name": "type_numeric", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/data_types.sql", "original_file_path": "macros/utils/data_types.sql", "unique_id": "macro.dbt.type_numeric", "macro_sql": "\n\n{%- macro type_numeric() -%}\n {{ return(adapter.dispatch('type_numeric', 'dbt')()) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt.default__type_numeric"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2397094, "supported_languages": null}, "macro.dbt.default__type_numeric": {"name": "default__type_numeric", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/data_types.sql", "original_file_path": "macros/utils/data_types.sql", "unique_id": "macro.dbt.default__type_numeric", "macro_sql": "{% macro default__type_numeric() %}\n {{ return(api.Column.numeric_type(\"numeric\", 28, 6)) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.240014, "supported_languages": null}, "macro.dbt.type_bigint": {"name": "type_bigint", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/data_types.sql", "original_file_path": "macros/utils/data_types.sql", "unique_id": "macro.dbt.type_bigint", "macro_sql": "\n\n{%- macro type_bigint() -%}\n {{ return(adapter.dispatch('type_bigint', 'dbt')()) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt.default__type_bigint"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2402909, "supported_languages": null}, "macro.dbt.default__type_bigint": {"name": "default__type_bigint", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/data_types.sql", "original_file_path": "macros/utils/data_types.sql", "unique_id": "macro.dbt.default__type_bigint", "macro_sql": "{% macro default__type_bigint() %}\n {{ return(api.Column.translate_type(\"bigint\")) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2405603, "supported_languages": null}, "macro.dbt.type_int": {"name": "type_int", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/data_types.sql", "original_file_path": "macros/utils/data_types.sql", "unique_id": "macro.dbt.type_int", "macro_sql": "\n\n{%- macro type_int() -%}\n {{ return(adapter.dispatch('type_int', 'dbt')()) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt.default__type_int"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2408361, "supported_languages": null}, "macro.dbt.default__type_int": {"name": "default__type_int", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/data_types.sql", "original_file_path": "macros/utils/data_types.sql", "unique_id": "macro.dbt.default__type_int", "macro_sql": "{%- macro default__type_int() -%}\n {{ return(api.Column.translate_type(\"integer\")) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2411118, "supported_languages": null}, "macro.dbt.type_boolean": {"name": "type_boolean", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/data_types.sql", "original_file_path": "macros/utils/data_types.sql", "unique_id": "macro.dbt.type_boolean", "macro_sql": "\n\n{%- macro type_boolean() -%}\n {{ return(adapter.dispatch('type_boolean', 'dbt')()) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt.default__type_boolean"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2415035, "supported_languages": null}, "macro.dbt.default__type_boolean": {"name": "default__type_boolean", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/data_types.sql", "original_file_path": "macros/utils/data_types.sql", "unique_id": "macro.dbt.default__type_boolean", "macro_sql": "{%- macro default__type_boolean() -%}\n {{ return(api.Column.translate_type(\"boolean\")) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.241763, "supported_languages": null}, "macro.dbt.array_concat": {"name": "array_concat", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/array_concat.sql", "original_file_path": "macros/utils/array_concat.sql", "unique_id": "macro.dbt.array_concat", "macro_sql": "{% macro array_concat(array_1, array_2) -%}\n {{ return(adapter.dispatch('array_concat', 'dbt')(array_1, array_2)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__array_concat"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2422347, "supported_languages": null}, "macro.dbt.default__array_concat": {"name": "default__array_concat", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/array_concat.sql", "original_file_path": "macros/utils/array_concat.sql", "unique_id": "macro.dbt.default__array_concat", "macro_sql": "{% macro default__array_concat(array_1, array_2) -%}\n array_cat({{ array_1 }}, {{ array_2 }})\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.242466, "supported_languages": null}, "macro.dbt.split_part": {"name": "split_part", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/split_part.sql", "original_file_path": "macros/utils/split_part.sql", "unique_id": "macro.dbt.split_part", "macro_sql": "{% macro split_part(string_text, delimiter_text, part_number) %}\n {{ return(adapter.dispatch('split_part', 'dbt') (string_text, delimiter_text, part_number)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_postgres.postgres__split_part"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2432878, "supported_languages": null}, "macro.dbt.default__split_part": {"name": "default__split_part", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/split_part.sql", "original_file_path": "macros/utils/split_part.sql", "unique_id": "macro.dbt.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 %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.243577, "supported_languages": null}, "macro.dbt._split_part_negative": {"name": "_split_part_negative", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/split_part.sql", "original_file_path": "macros/utils/split_part.sql", "unique_id": "macro.dbt._split_part_negative", "macro_sql": "{% macro _split_part_negative(string_text, delimiter_text, part_number) %}\n\n split_part(\n {{ string_text }},\n {{ delimiter_text }},\n length({{ string_text }})\n - length(\n replace({{ string_text }}, {{ delimiter_text }}, '')\n ) + 2 + {{ part_number }}\n )\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2439716, "supported_languages": null}, "macro.dbt.intersect": {"name": "intersect", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/intersect.sql", "original_file_path": "macros/utils/intersect.sql", "unique_id": "macro.dbt.intersect", "macro_sql": "{% macro intersect() %}\n {{ return(adapter.dispatch('intersect', 'dbt')()) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__intersect"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2443583, "supported_languages": null}, "macro.dbt.default__intersect": {"name": "default__intersect", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/intersect.sql", "original_file_path": "macros/utils/intersect.sql", "unique_id": "macro.dbt.default__intersect", "macro_sql": "{% macro default__intersect() %}\n\n intersect\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.244496, "supported_languages": null}, "macro.dbt.date_trunc": {"name": "date_trunc", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/date_trunc.sql", "original_file_path": "macros/utils/date_trunc.sql", "unique_id": "macro.dbt.date_trunc", "macro_sql": "{% macro date_trunc(datepart, date) -%}\n {{ return(adapter.dispatch('date_trunc', 'dbt') (datepart, date)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__date_trunc"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2449825, "supported_languages": null}, "macro.dbt.default__date_trunc": {"name": "default__date_trunc", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/date_trunc.sql", "original_file_path": "macros/utils/date_trunc.sql", "unique_id": "macro.dbt.default__date_trunc", "macro_sql": "{% macro default__date_trunc(datepart, date) -%}\n date_trunc('{{datepart}}', {{date}})\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2452126, "supported_languages": null}, "macro.dbt.bool_or": {"name": "bool_or", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/bool_or.sql", "original_file_path": "macros/utils/bool_or.sql", "unique_id": "macro.dbt.bool_or", "macro_sql": "{% macro bool_or(expression) -%}\n {{ return(adapter.dispatch('bool_or', 'dbt') (expression)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__bool_or"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.245629, "supported_languages": null}, "macro.dbt.default__bool_or": {"name": "default__bool_or", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/bool_or.sql", "original_file_path": "macros/utils/bool_or.sql", "unique_id": "macro.dbt.default__bool_or", "macro_sql": "{% macro default__bool_or(expression) -%}\n\n bool_or({{ expression }})\n\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2458105, "supported_languages": null}, "macro.dbt.hash": {"name": "hash", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/hash.sql", "original_file_path": "macros/utils/hash.sql", "unique_id": "macro.dbt.hash", "macro_sql": "{% macro hash(field) -%}\n {{ return(adapter.dispatch('hash', 'dbt') (field)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__hash"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2462318, "supported_languages": null}, "macro.dbt.default__hash": {"name": "default__hash", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/hash.sql", "original_file_path": "macros/utils/hash.sql", "unique_id": "macro.dbt.default__hash", "macro_sql": "{% macro default__hash(field) -%}\n md5(cast({{ field }} as {{ api.Column.translate_type('string') }}))\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.246513, "supported_languages": null}, "macro.dbt.right": {"name": "right", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/right.sql", "original_file_path": "macros/utils/right.sql", "unique_id": "macro.dbt.right", "macro_sql": "{% macro right(string_text, length_expression) -%}\n {{ return(adapter.dispatch('right', 'dbt') (string_text, length_expression)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__right"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2469983, "supported_languages": null}, "macro.dbt.default__right": {"name": "default__right", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/right.sql", "original_file_path": "macros/utils/right.sql", "unique_id": "macro.dbt.default__right", "macro_sql": "{% macro default__right(string_text, length_expression) %}\n\n right(\n {{ string_text }},\n {{ length_expression }}\n )\n\n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2472603, "supported_languages": null}, "macro.dbt.dateadd": {"name": "dateadd", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/dateadd.sql", "original_file_path": "macros/utils/dateadd.sql", "unique_id": "macro.dbt.dateadd", "macro_sql": "{% macro dateadd(datepart, interval, from_date_or_timestamp) %}\n {{ return(adapter.dispatch('dateadd', 'dbt')(datepart, interval, from_date_or_timestamp)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_postgres.postgres__dateadd"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2478194, "supported_languages": null}, "macro.dbt.default__dateadd": {"name": "default__dateadd", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/dateadd.sql", "original_file_path": "macros/utils/dateadd.sql", "unique_id": "macro.dbt.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 %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2481086, "supported_languages": null}, "macro.dbt.datediff": {"name": "datediff", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/datediff.sql", "original_file_path": "macros/utils/datediff.sql", "unique_id": "macro.dbt.datediff", "macro_sql": "{% macro datediff(first_date, second_date, datepart) %}\n {{ return(adapter.dispatch('datediff', 'dbt')(first_date, second_date, datepart)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_postgres.postgres__datediff"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2486603, "supported_languages": null}, "macro.dbt.default__datediff": {"name": "default__datediff", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/datediff.sql", "original_file_path": "macros/utils/datediff.sql", "unique_id": "macro.dbt.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 %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.249062, "supported_languages": null}, "macro.dbt.cast_bool_to_text": {"name": "cast_bool_to_text", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/cast_bool_to_text.sql", "original_file_path": "macros/utils/cast_bool_to_text.sql", "unique_id": "macro.dbt.cast_bool_to_text", "macro_sql": "{% macro cast_bool_to_text(field) %}\n {{ adapter.dispatch('cast_bool_to_text', 'dbt') (field) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__cast_bool_to_text"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2494805, "supported_languages": null}, "macro.dbt.default__cast_bool_to_text": {"name": "default__cast_bool_to_text", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/cast_bool_to_text.sql", "original_file_path": "macros/utils/cast_bool_to_text.sql", "unique_id": "macro.dbt.default__cast_bool_to_text", "macro_sql": "{% macro default__cast_bool_to_text(field) %}\n cast({{ field }} as {{ api.Column.translate_type('string') }})\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2497578, "supported_languages": null}, "macro.dbt.array_construct": {"name": "array_construct", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/array_construct.sql", "original_file_path": "macros/utils/array_construct.sql", "unique_id": "macro.dbt.array_construct", "macro_sql": "{% macro array_construct(inputs=[], data_type=api.Column.translate_type('integer')) -%}\n {{ return(adapter.dispatch('array_construct', 'dbt')(inputs, data_type)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__array_construct"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2503815, "supported_languages": null}, "macro.dbt.default__array_construct": {"name": "default__array_construct", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/array_construct.sql", "original_file_path": "macros/utils/array_construct.sql", "unique_id": "macro.dbt.default__array_construct", "macro_sql": "{% macro default__array_construct(inputs, data_type) -%}\n {% if inputs|length > 0 %}\n array[ {{ inputs|join(' , ') }} ]\n {% else %}\n array[]::{{data_type}}[]\n {% endif %}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2508047, "supported_languages": null}, "macro.dbt.get_intervals_between": {"name": "get_intervals_between", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/date_spine.sql", "original_file_path": "macros/utils/date_spine.sql", "unique_id": "macro.dbt.get_intervals_between", "macro_sql": "{% macro get_intervals_between(start_date, end_date, datepart) -%}\n {{ return(adapter.dispatch('get_intervals_between', 'dbt')(start_date, end_date, datepart)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_intervals_between"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2519193, "supported_languages": null}, "macro.dbt.default__get_intervals_between": {"name": "default__get_intervals_between", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/date_spine.sql", "original_file_path": "macros/utils/date_spine.sql", "unique_id": "macro.dbt.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.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 %}", "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt.datediff"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2529643, "supported_languages": null}, "macro.dbt.date_spine": {"name": "date_spine", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/date_spine.sql", "original_file_path": "macros/utils/date_spine.sql", "unique_id": "macro.dbt.date_spine", "macro_sql": "{% macro date_spine(datepart, start_date, end_date) %}\n {{ return(adapter.dispatch('date_spine', 'dbt')(datepart, start_date, end_date)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__date_spine"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2533667, "supported_languages": null}, "macro.dbt.default__date_spine": {"name": "default__date_spine", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/date_spine.sql", "original_file_path": "macros/utils/date_spine.sql", "unique_id": "macro.dbt.default__date_spine", "macro_sql": "{% macro default__date_spine(datepart, start_date, end_date) %}\n\n\n {# call as follows:\n\n date_spine(\n \"day\",\n \"to_date('01/01/2016', 'mm/dd/yyyy')\",\n \"dbt.dateadd(week, 1, current_date)\"\n ) #}\n\n\n with rawdata as (\n\n {{dbt.generate_series(\n dbt.get_intervals_between(start_date, end_date, datepart)\n )}}\n\n ),\n\n all_periods as (\n\n select (\n {{\n dbt.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\n filtered as (\n\n select *\n from all_periods\n where date_{{datepart}} <= {{ end_date }}\n\n )\n\n select * from filtered\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.generate_series", "macro.dbt.get_intervals_between", "macro.dbt.dateadd"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.253989, "supported_languages": null}, "macro.dbt.concat": {"name": "concat", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/concat.sql", "original_file_path": "macros/utils/concat.sql", "unique_id": "macro.dbt.concat", "macro_sql": "{% macro concat(fields) -%}\n {{ return(adapter.dispatch('concat', 'dbt')(fields)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__concat"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.254411, "supported_languages": null}, "macro.dbt.default__concat": {"name": "default__concat", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/concat.sql", "original_file_path": "macros/utils/concat.sql", "unique_id": "macro.dbt.default__concat", "macro_sql": "{% macro default__concat(fields) -%}\n {{ fields|join(' || ') }}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.254634, "supported_languages": null}, "macro.dbt.except": {"name": "except", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/except.sql", "original_file_path": "macros/utils/except.sql", "unique_id": "macro.dbt.except", "macro_sql": "{% macro except() %}\n {{ return(adapter.dispatch('except', 'dbt')()) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__except"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2550137, "supported_languages": null}, "macro.dbt.default__except": {"name": "default__except", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/except.sql", "original_file_path": "macros/utils/except.sql", "unique_id": "macro.dbt.default__except", "macro_sql": "{% macro default__except() %}\n\n except\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2551515, "supported_languages": null}, "macro.dbt.listagg": {"name": "listagg", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/listagg.sql", "original_file_path": "macros/utils/listagg.sql", "unique_id": "macro.dbt.listagg", "macro_sql": "{% macro listagg(measure, delimiter_text=\"','\", order_by_clause=none, limit_num=none) -%}\n {{ return(adapter.dispatch('listagg', 'dbt') (measure, delimiter_text, order_by_clause, limit_num)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_postgres.postgres__listagg"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2561474, "supported_languages": null}, "macro.dbt.default__listagg": {"name": "default__listagg", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/listagg.sql", "original_file_path": "macros/utils/listagg.sql", "unique_id": "macro.dbt.default__listagg", "macro_sql": "{% macro default__listagg(measure, delimiter_text, order_by_clause, limit_num) -%}\n\n {% if limit_num -%}\n array_to_string(\n array_slice(\n array_agg(\n {{ measure }}\n ){% if order_by_clause -%}\n within group ({{ order_by_clause }})\n {%- endif %}\n ,0\n ,{{ limit_num }}\n ),\n {{ delimiter_text }}\n )\n {%- else %}\n listagg(\n {{ measure }},\n {{ delimiter_text }}\n )\n {% if order_by_clause -%}\n within group ({{ order_by_clause }})\n {%- endif %}\n {%- endif %}\n\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2568693, "supported_languages": null}, "macro.dbt.replace": {"name": "replace", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/replace.sql", "original_file_path": "macros/utils/replace.sql", "unique_id": "macro.dbt.replace", "macro_sql": "{% macro replace(field, old_chars, new_chars) -%}\n {{ return(adapter.dispatch('replace', 'dbt') (field, old_chars, new_chars)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__replace"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2574277, "supported_languages": null}, "macro.dbt.default__replace": {"name": "default__replace", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/replace.sql", "original_file_path": "macros/utils/replace.sql", "unique_id": "macro.dbt.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 %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2577116, "supported_languages": null}, "macro.dbt.any_value": {"name": "any_value", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/any_value.sql", "original_file_path": "macros/utils/any_value.sql", "unique_id": "macro.dbt.any_value", "macro_sql": "{% macro any_value(expression) -%}\n {{ return(adapter.dispatch('any_value', 'dbt') (expression)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_postgres.postgres__any_value"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2581275, "supported_languages": null}, "macro.dbt.default__any_value": {"name": "default__any_value", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/any_value.sql", "original_file_path": "macros/utils/any_value.sql", "unique_id": "macro.dbt.default__any_value", "macro_sql": "{% macro default__any_value(expression) -%}\n\n any_value({{ expression }})\n\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2583106, "supported_languages": null}, "macro.dbt.test_unique": {"name": "test_unique", "resource_type": "macro", "package_name": "dbt", "path": "tests/generic/builtin.sql", "original_file_path": "tests/generic/builtin.sql", "unique_id": "macro.dbt.test_unique", "macro_sql": "{% test unique(model, column_name) %}\n {% set macro = adapter.dispatch('test_unique', 'dbt') %}\n {{ macro(model, column_name) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt.default__test_unique"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2592878, "supported_languages": null}, "macro.dbt.test_not_null": {"name": "test_not_null", "resource_type": "macro", "package_name": "dbt", "path": "tests/generic/builtin.sql", "original_file_path": "tests/generic/builtin.sql", "unique_id": "macro.dbt.test_not_null", "macro_sql": "{% test not_null(model, column_name) %}\n {% set macro = adapter.dispatch('test_not_null', 'dbt') %}\n {{ macro(model, column_name) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt.default__test_not_null"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2597072, "supported_languages": null}, "macro.dbt.test_accepted_values": {"name": "test_accepted_values", "resource_type": "macro", "package_name": "dbt", "path": "tests/generic/builtin.sql", "original_file_path": "tests/generic/builtin.sql", "unique_id": "macro.dbt.test_accepted_values", "macro_sql": "{% test accepted_values(model, column_name, values, quote=True) %}\n {% set macro = adapter.dispatch('test_accepted_values', 'dbt') %}\n {{ macro(model, column_name, values, quote) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt.default__test_accepted_values"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2601943, "supported_languages": null}, "macro.dbt.test_relationships": {"name": "test_relationships", "resource_type": "macro", "package_name": "dbt", "path": "tests/generic/builtin.sql", "original_file_path": "tests/generic/builtin.sql", "unique_id": "macro.dbt.test_relationships", "macro_sql": "{% test relationships(model, column_name, to, field) %}\n {% set macro = adapter.dispatch('test_relationships', 'dbt') %}\n {{ macro(model, column_name, to, field) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt.default__test_relationships"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2606657, "supported_languages": null}, "macro.dbt_expectations.rand": {"name": "rand", "resource_type": "macro", "package_name": "dbt_expectations", "path": "macros/math/rand.sql", "original_file_path": "macros/math/rand.sql", "unique_id": "macro.dbt_expectations.rand", "macro_sql": "{% macro rand() -%}\n {{ adapter.dispatch('rand', 'dbt_expectations') () }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_expectations.postgres__rand"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2612462, "supported_languages": null}, "macro.dbt_expectations.default__rand": {"name": "default__rand", "resource_type": "macro", "package_name": "dbt_expectations", "path": "macros/math/rand.sql", "original_file_path": "macros/math/rand.sql", "unique_id": "macro.dbt_expectations.default__rand", "macro_sql": "{% macro default__rand() -%}\n\n rand()\n\n{%- endmacro -%}\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.261384, "supported_languages": null}, "macro.dbt_expectations.bigquery__rand": {"name": "bigquery__rand", "resource_type": "macro", "package_name": "dbt_expectations", "path": "macros/math/rand.sql", "original_file_path": "macros/math/rand.sql", "unique_id": "macro.dbt_expectations.bigquery__rand", "macro_sql": "{% macro bigquery__rand() -%}\n\n rand()\n\n{%- endmacro -%}\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2615156, "supported_languages": null}, "macro.dbt_expectations.snowflake__rand": {"name": "snowflake__rand", "resource_type": "macro", "package_name": "dbt_expectations", "path": "macros/math/rand.sql", "original_file_path": "macros/math/rand.sql", "unique_id": "macro.dbt_expectations.snowflake__rand", "macro_sql": "{% macro snowflake__rand(seed) -%}\n\n uniform(0::float, 1::float, random())\n\n{%- endmacro -%}\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.261663, "supported_languages": null}, "macro.dbt_expectations.postgres__rand": {"name": "postgres__rand", "resource_type": "macro", "package_name": "dbt_expectations", "path": "macros/math/rand.sql", "original_file_path": "macros/math/rand.sql", "unique_id": "macro.dbt_expectations.postgres__rand", "macro_sql": "{% macro postgres__rand() -%}\n\n random()\n\n{%- endmacro -%}\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.261796, "supported_languages": null}, "macro.dbt_expectations.redshift__rand": {"name": "redshift__rand", "resource_type": "macro", "package_name": "dbt_expectations", "path": "macros/math/rand.sql", "original_file_path": "macros/math/rand.sql", "unique_id": "macro.dbt_expectations.redshift__rand", "macro_sql": "{% macro redshift__rand() -%}\n\n random()\n\n{%- endmacro -%}\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2619293, "supported_languages": null}, "macro.dbt_expectations.duckdb__rand": {"name": "duckdb__rand", "resource_type": "macro", "package_name": "dbt_expectations", "path": "macros/math/rand.sql", "original_file_path": "macros/math/rand.sql", "unique_id": "macro.dbt_expectations.duckdb__rand", "macro_sql": "{% macro duckdb__rand() -%}\n\n random()\n\n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.26206, "supported_languages": null}, "macro.dbt_expectations.log_natural": {"name": "log_natural", "resource_type": "macro", "package_name": "dbt_expectations", "path": "macros/math/log_natural.sql", "original_file_path": "macros/math/log_natural.sql", "unique_id": "macro.dbt_expectations.log_natural", "macro_sql": "{% macro log_natural(x) -%}\n {{ adapter.dispatch('log_natural', 'dbt_expectations') (x) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_expectations.default__log_natural"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2625902, "supported_languages": null}, "macro.dbt_expectations.default__log_natural": {"name": "default__log_natural", "resource_type": "macro", "package_name": "dbt_expectations", "path": "macros/math/log_natural.sql", "original_file_path": "macros/math/log_natural.sql", "unique_id": "macro.dbt_expectations.default__log_natural", "macro_sql": "{% macro default__log_natural(x) -%}\n\n ln({{ x }})\n\n{%- endmacro -%}\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2627714, "supported_languages": null}, "macro.dbt_expectations.bigquery__log_natural": {"name": "bigquery__log_natural", "resource_type": "macro", "package_name": "dbt_expectations", "path": "macros/math/log_natural.sql", "original_file_path": "macros/math/log_natural.sql", "unique_id": "macro.dbt_expectations.bigquery__log_natural", "macro_sql": "{% macro bigquery__log_natural(x) -%}\n\n ln({{ x }})\n\n{%- endmacro -%}\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2629495, "supported_languages": null}, "macro.dbt_expectations.snowflake__log_natural": {"name": "snowflake__log_natural", "resource_type": "macro", "package_name": "dbt_expectations", "path": "macros/math/log_natural.sql", "original_file_path": "macros/math/log_natural.sql", "unique_id": "macro.dbt_expectations.snowflake__log_natural", "macro_sql": "{% macro snowflake__log_natural(x) -%}\n\n ln({{ x }})\n\n{%- endmacro -%}\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2631383, "supported_languages": null}, "macro.dbt_expectations.spark__log_natural": {"name": "spark__log_natural", "resource_type": "macro", "package_name": "dbt_expectations", "path": "macros/math/log_natural.sql", "original_file_path": "macros/math/log_natural.sql", "unique_id": "macro.dbt_expectations.spark__log_natural", "macro_sql": "{% macro spark__log_natural(x) -%}\n\n ln({{ x }})\n\n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.263322, "supported_languages": null}, "macro.dbt_expectations.percentile_cont": {"name": "percentile_cont", "resource_type": "macro", "package_name": "dbt_expectations", "path": "macros/math/percentile_cont.sql", "original_file_path": "macros/math/percentile_cont.sql", "unique_id": "macro.dbt_expectations.percentile_cont", "macro_sql": "{% macro percentile_cont(field, quantile, partition=None) %}\n {{ adapter.dispatch('quantile', 'dbt_expectations') (field, quantile, partition) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_expectations.default__quantile"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2642133, "supported_languages": null}, "macro.dbt_expectations.default__quantile": {"name": "default__quantile", "resource_type": "macro", "package_name": "dbt_expectations", "path": "macros/math/percentile_cont.sql", "original_file_path": "macros/math/percentile_cont.sql", "unique_id": "macro.dbt_expectations.default__quantile", "macro_sql": "{% macro default__quantile(field, quantile, partition) -%}\n percentile_cont({{ quantile }}) within group (order by {{ field }})\n {%- if partition %}over(partition by {{ partition }}){% endif -%}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.264581, "supported_languages": null}, "macro.dbt_expectations.bigquery__quantile": {"name": "bigquery__quantile", "resource_type": "macro", "package_name": "dbt_expectations", "path": "macros/math/percentile_cont.sql", "original_file_path": "macros/math/percentile_cont.sql", "unique_id": "macro.dbt_expectations.bigquery__quantile", "macro_sql": "{% macro bigquery__quantile(field, quantile, partition) -%}\n percentile_cont({{ field }}, {{ quantile }})\n over({%- if partition %}partition by {{ partition }}{% endif -%})\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2649672, "supported_languages": null}, "macro.dbt_expectations.spark__quantile": {"name": "spark__quantile", "resource_type": "macro", "package_name": "dbt_expectations", "path": "macros/math/percentile_cont.sql", "original_file_path": "macros/math/percentile_cont.sql", "unique_id": "macro.dbt_expectations.spark__quantile", "macro_sql": "{% macro spark__quantile(field, quantile, partition) -%}\n percentile({{ field }}, {{ quantile }})\n over({%- if partition %}partition by {{ partition }}{% endif -%})\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2654436, "supported_languages": null}, "macro.dbt_expectations.median": {"name": "median", "resource_type": "macro", "package_name": "dbt_expectations", "path": "macros/math/median.sql", "original_file_path": "macros/math/median.sql", "unique_id": "macro.dbt_expectations.median", "macro_sql": "{% macro median(field) %}\n{{ dbt_expectations.percentile_cont(field, 0.5) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_expectations.percentile_cont"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2657905, "supported_languages": null}, "macro.dbt_expectations.test_expect_table_column_count_to_be_between": {"name": "test_expect_table_column_count_to_be_between", "resource_type": "macro", "package_name": "dbt_expectations", "path": "macros/schema_tests/table_shape/expect_table_column_count_to_be_between.sql", "original_file_path": "macros/schema_tests/table_shape/expect_table_column_count_to_be_between.sql", "unique_id": "macro.dbt_expectations.test_expect_table_column_count_to_be_between", "macro_sql": "{%- test expect_table_column_count_to_be_between(model,\n min_value=None,\n max_value=None\n ) -%}\n{%- if min_value is none and max_value is none -%}\n{{ exceptions.raise_compiler_error(\n \"You have to provide either a min_value, max_value or both.\"\n) }}\n{%- endif -%}\n{%- if execute -%}\n{%- set number_actual_columns = (adapter.get_columns_in_relation(model) | length) -%}\n\n{%- set expression %}\n( 1=1\n{%- if min_value %} and number_actual_columns >= min_value{% endif %}\n{%- if max_value %} and number_actual_columns <= max_value{% endif %}\n)\n{% endset -%}\n\nwith test_data as (\n\n select\n {{ number_actual_columns }} as number_actual_columns,\n {{ min_value if min_value else 0 }} as min_value,\n {{ max_value if max_value else 0 }} as max_value\n\n)\nselect *\nfrom test_data\nwhere\n not {{ expression }}\n{%- endif -%}\n{%- endtest -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.267424, "supported_languages": null}, "macro.dbt_expectations.test_expect_table_aggregation_to_equal_other_table": {"name": "test_expect_table_aggregation_to_equal_other_table", "resource_type": "macro", "package_name": "dbt_expectations", "path": "macros/schema_tests/table_shape/expect_table_aggregation_to_equal_other_table.sql", "original_file_path": "macros/schema_tests/table_shape/expect_table_aggregation_to_equal_other_table.sql", "unique_id": "macro.dbt_expectations.test_expect_table_aggregation_to_equal_other_table", "macro_sql": "{%- test expect_table_aggregation_to_equal_other_table(model,\n expression,\n compare_model,\n compare_expression=None,\n group_by=None,\n compare_group_by=None,\n row_condition=None,\n compare_row_condition=None,\n tolerance=0.0,\n tolerance_percent=None\n ) -%}\n\n\n{{ dbt_expectations.test_equal_expression(\n model,\n expression=expression,\n compare_model=compare_model,\n compare_expression=compare_expression,\n group_by=group_by,\n compare_group_by=compare_group_by,\n row_condition=row_condition,\n compare_row_condition=compare_row_condition,\n tolerance=tolerance,\n tolerance_percent=tolerance_percent\n) }}\n\n{%- endtest -%}", "depends_on": {"macros": ["macro.dbt_expectations.test_equal_expression"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2684565, "supported_languages": null}, "macro.dbt_expectations._get_column_list": {"name": "_get_column_list", "resource_type": "macro", "package_name": "dbt_expectations", "path": "macros/schema_tests/table_shape/_get_column_list.sql", "original_file_path": "macros/schema_tests/table_shape/_get_column_list.sql", "unique_id": "macro.dbt_expectations._get_column_list", "macro_sql": "{%- macro _get_column_list(model, transform=\"upper\") -%}\n{%- set relation_columns = adapter.get_columns_in_relation(model) -%}\n{%- set relation_column_names = relation_columns | map(attribute=\"name\") | map(transform) | list -%}\n{%- do return(relation_column_names) -%}\n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2691455, "supported_languages": null}, "macro.dbt_expectations.test_expect_table_columns_to_not_contain_set": {"name": "test_expect_table_columns_to_not_contain_set", "resource_type": "macro", "package_name": "dbt_expectations", "path": "macros/schema_tests/table_shape/expect_table_columns_to_not_contain_set.sql", "original_file_path": "macros/schema_tests/table_shape/expect_table_columns_to_not_contain_set.sql", "unique_id": "macro.dbt_expectations.test_expect_table_columns_to_not_contain_set", "macro_sql": "{%- test expect_table_columns_to_not_contain_set(model, column_list, transform=\"upper\") -%}\n{%- if execute -%}\n {%- set column_list = column_list | map(transform) | list -%}\n {%- set relation_column_names = dbt_expectations._get_column_list(model, transform) -%}\n {%- set matching_columns = dbt_expectations._list_intersect(column_list, relation_column_names) -%}\n with relation_columns as (\n\n {% for col_name in relation_column_names %}\n select cast('{{ col_name }}' as {{ dbt.type_string() }}) as relation_column\n {% if not loop.last %}union all{% endif %}\n {% endfor %}\n ),\n input_columns as (\n\n {% for col_name in column_list %}\n select cast('{{ col_name }}' as {{ dbt.type_string() }}) as input_column\n {% if not loop.last %}union all{% endif %}\n {% endfor %}\n )\n -- catch any column in input list that is in the list of table columns\n select *\n from\n input_columns i\n inner join\n relation_columns r on r.relation_column = i.input_column\n\n{%- endif -%}\n{%- endtest -%}", "depends_on": {"macros": ["macro.dbt_expectations._get_column_list", "macro.dbt_expectations._list_intersect", "macro.dbt.type_string"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2710073, "supported_languages": null}, "macro.dbt_expectations.test_expect_table_columns_to_contain_set": {"name": "test_expect_table_columns_to_contain_set", "resource_type": "macro", "package_name": "dbt_expectations", "path": "macros/schema_tests/table_shape/expect_table_columns_to_contain_set.sql", "original_file_path": "macros/schema_tests/table_shape/expect_table_columns_to_contain_set.sql", "unique_id": "macro.dbt_expectations.test_expect_table_columns_to_contain_set", "macro_sql": "{%- test expect_table_columns_to_contain_set(model, column_list, transform=\"upper\") -%}\n{%- if execute -%}\n {%- set column_list = column_list | map(transform) | list -%}\n {%- set relation_column_names = dbt_expectations._get_column_list(model, transform) -%}\n {%- set matching_columns = dbt_expectations._list_intersect(column_list, relation_column_names) -%}\n with relation_columns as (\n\n {% for col_name in relation_column_names %}\n select cast('{{ col_name }}' as {{ dbt.type_string() }}) as relation_column\n {% if not loop.last %}union all{% endif %}\n {% endfor %}\n ),\n input_columns as (\n\n {% for col_name in column_list %}\n select cast('{{ col_name }}' as {{ dbt.type_string() }}) as input_column\n {% if not loop.last %}union all{% endif %}\n {% endfor %}\n )\n select *\n from\n input_columns i\n left join\n relation_columns r on r.relation_column = i.input_column\n where\n -- catch any column in input list that is not in the list of table columns\n r.relation_column is null\n{%- endif -%}\n{%- endtest -%}", "depends_on": {"macros": ["macro.dbt_expectations._get_column_list", "macro.dbt_expectations._list_intersect", "macro.dbt.type_string"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2729156, "supported_languages": null}, "macro.dbt_expectations.test_expect_table_row_count_to_equal_other_table_times_factor": {"name": "test_expect_table_row_count_to_equal_other_table_times_factor", "resource_type": "macro", "package_name": "dbt_expectations", "path": "macros/schema_tests/table_shape/expect_table_row_count_to_equal_other_table_times_factor.sql", "original_file_path": "macros/schema_tests/table_shape/expect_table_row_count_to_equal_other_table_times_factor.sql", "unique_id": "macro.dbt_expectations.test_expect_table_row_count_to_equal_other_table_times_factor", "macro_sql": "{%- test expect_table_row_count_to_equal_other_table_times_factor(model,\n compare_model,\n factor,\n group_by=None,\n compare_group_by=None,\n row_condition=None,\n compare_row_condition=None\n ) -%}\n {{ adapter.dispatch('test_expect_table_row_count_to_equal_other_table_times_factor',\n 'dbt_expectations') (model,\n compare_model,\n factor,\n group_by,\n compare_group_by,\n row_condition,\n compare_row_condition\n ) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_expectations.default__test_expect_table_row_count_to_equal_other_table_times_factor"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2753313, "supported_languages": null}, "macro.dbt_expectations.default__test_expect_table_row_count_to_equal_other_table_times_factor": {"name": "default__test_expect_table_row_count_to_equal_other_table_times_factor", "resource_type": "macro", "package_name": "dbt_expectations", "path": "macros/schema_tests/table_shape/expect_table_row_count_to_equal_other_table_times_factor.sql", "original_file_path": "macros/schema_tests/table_shape/expect_table_row_count_to_equal_other_table_times_factor.sql", "unique_id": "macro.dbt_expectations.default__test_expect_table_row_count_to_equal_other_table_times_factor", "macro_sql": "\n\n{%- macro default__test_expect_table_row_count_to_equal_other_table_times_factor(model,\n compare_model,\n factor,\n group_by,\n compare_group_by,\n row_condition,\n compare_row_condition\n ) -%}\n\n{{ dbt_expectations.test_expect_table_row_count_to_equal_other_table(model,\n compare_model,\n group_by=group_by,\n compare_group_by=compare_group_by,\n factor=factor,\n row_condition=row_condition,\n compare_row_condition=compare_row_condition\n) }}\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt_expectations.test_expect_table_row_count_to_equal_other_table"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2760675, "supported_languages": null}, "macro.dbt_expectations.test_expect_table_columns_to_match_ordered_list": {"name": "test_expect_table_columns_to_match_ordered_list", "resource_type": "macro", "package_name": "dbt_expectations", "path": "macros/schema_tests/table_shape/expect_table_columns_to_match_ordered_list.sql", "original_file_path": "macros/schema_tests/table_shape/expect_table_columns_to_match_ordered_list.sql", "unique_id": "macro.dbt_expectations.test_expect_table_columns_to_match_ordered_list", "macro_sql": "{%- test expect_table_columns_to_match_ordered_list(model, column_list, transform=\"upper\") -%}\n{%- if execute -%}\n {%- set column_list = column_list | map(transform) | list -%}\n {%- set relation_column_names = dbt_expectations._get_column_list(model, transform) -%}\n {%- set matching_columns = dbt_expectations._list_intersect(column_list, relation_column_names) -%}\n with relation_columns as (\n\n {% for col_name in relation_column_names %}\n select\n {{ loop.index }} as relation_column_idx,\n cast('{{ col_name }}' as {{ dbt.type_string() }}) as relation_column\n {% if not loop.last %}union all{% endif %}\n {% endfor %}\n ),\n input_columns as (\n\n {% for col_name in column_list %}\n select\n {{ loop.index }} as input_column_idx,\n cast('{{ col_name }}' as {{ dbt.type_string() }}) as input_column\n {% if not loop.last %}union all{% endif %}\n {% endfor %}\n )\n select *\n from\n relation_columns r\n full outer join\n input_columns i on r.relation_column = i.input_column and r.relation_column_idx = i.input_column_idx\n where\n -- catch any column in input list that is not in the sequence of table columns\n -- or any table column that is not in the input sequence\n r.relation_column is null or\n i.input_column is null\n\n{%- endif -%}\n{%- endtest -%}", "depends_on": {"macros": ["macro.dbt_expectations._get_column_list", "macro.dbt_expectations._list_intersect", "macro.dbt.type_string"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2787244, "supported_languages": null}, "macro.dbt_expectations.test_expect_table_columns_to_match_set": {"name": "test_expect_table_columns_to_match_set", "resource_type": "macro", "package_name": "dbt_expectations", "path": "macros/schema_tests/table_shape/expect_table_columns_to_match_set.sql", "original_file_path": "macros/schema_tests/table_shape/expect_table_columns_to_match_set.sql", "unique_id": "macro.dbt_expectations.test_expect_table_columns_to_match_set", "macro_sql": "{%- test expect_table_columns_to_match_set(model, column_list, transform=\"upper\") -%}\n{%- if execute -%}\n {%- set column_list = column_list | map(transform) | list -%}\n {%- set relation_column_names = dbt_expectations._get_column_list(model, transform) -%}\n {%- set matching_columns = dbt_expectations._list_intersect(column_list, relation_column_names) -%}\n with relation_columns as (\n\n {% for col_name in relation_column_names %}\n select cast('{{ col_name }}' as {{ dbt.type_string() }}) as relation_column\n {% if not loop.last %}union all{% endif %}\n {% endfor %}\n ),\n input_columns as (\n\n {% for col_name in column_list %}\n select cast('{{ col_name }}' as {{ dbt.type_string() }}) as input_column\n {% if not loop.last %}union all{% endif %}\n {% endfor %}\n )\n select *\n from\n relation_columns r\n full outer join\n input_columns i on r.relation_column = i.input_column\n where\n -- catch any column in input list that is not in the list of table columns\n -- or any table column that is not in the input list\n r.relation_column is null or\n i.input_column is null\n\n{%- endif -%}\n{%- endtest -%}", "depends_on": {"macros": ["macro.dbt_expectations._get_column_list", "macro.dbt_expectations._list_intersect", "macro.dbt.type_string"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.280748, "supported_languages": null}, "macro.dbt_expectations.test_expect_grouped_row_values_to_have_recent_data": {"name": "test_expect_grouped_row_values_to_have_recent_data", "resource_type": "macro", "package_name": "dbt_expectations", "path": "macros/schema_tests/table_shape/expect_grouped_row_values_to_have_recent_data.sql", "original_file_path": "macros/schema_tests/table_shape/expect_grouped_row_values_to_have_recent_data.sql", "unique_id": "macro.dbt_expectations.test_expect_grouped_row_values_to_have_recent_data", "macro_sql": "{% test expect_grouped_row_values_to_have_recent_data(model,\n group_by,\n timestamp_column,\n datepart,\n interval,\n row_condition=None) %}\n\n {{ adapter.dispatch('test_expect_grouped_row_values_to_have_recent_data', 'dbt_expectations') (model,\n group_by,\n timestamp_column,\n datepart,\n interval,\n row_condition) }}\n\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_expectations.default__test_expect_grouped_row_values_to_have_recent_data"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.28422, "supported_languages": null}, "macro.dbt_expectations.default__test_expect_grouped_row_values_to_have_recent_data": {"name": "default__test_expect_grouped_row_values_to_have_recent_data", "resource_type": "macro", "package_name": "dbt_expectations", "path": "macros/schema_tests/table_shape/expect_grouped_row_values_to_have_recent_data.sql", "original_file_path": "macros/schema_tests/table_shape/expect_grouped_row_values_to_have_recent_data.sql", "unique_id": "macro.dbt_expectations.default__test_expect_grouped_row_values_to_have_recent_data", "macro_sql": "{% macro default__test_expect_grouped_row_values_to_have_recent_data(model,\n group_by,\n timestamp_column,\n datepart,\n interval,\n row_condition) %}\nwith latest_grouped_timestamps as (\n\n select\n {{ group_by | join(\",\") ~ \",\" if group_by }}\n max(1) as join_key,\n max(cast({{ timestamp_column }} as {{ dbt_expectations.type_timestamp() }})) as latest_timestamp_column\n from\n {{ model }}\n where\n -- to exclude erroneous future dates\n cast({{ timestamp_column }} as {{ dbt_expectations.type_timestamp() }}) <= {{ dbt_date.now() }}\n {% if row_condition %}\n and {{ row_condition }}\n {% endif %}\n\n {% if group_by -%}\n {{ dbt_expectations.group_by(group_by | length) }}\n {%- endif %}\n),\ntotal_row_counts as (\n\n select\n {{ group_by | join(\",\") ~ \",\" if group_by }}\n max(1) as join_key,\n count(*) as row_count\n from\n latest_grouped_timestamps\n {% if group_by -%}\n {{ dbt_expectations.group_by(group_by | length) }}\n {%- endif %}\n\n\n),\noutdated_grouped_timestamps as (\n\n select *\n from\n latest_grouped_timestamps\n where\n -- are the max timestamps per group older than the specified cutoff?\n latest_timestamp_column <\n cast(\n {{ dbt.dateadd(datepart, interval * -1, dbt_date.now()) }}\n as {{ dbt_expectations.type_timestamp() }}\n )\n\n),\nvalidation_errors as (\n\n select\n r.row_count,\n t.*\n from\n total_row_counts r\n left join\n outdated_grouped_timestamps t\n on\n {% for g in group_by %}\n r.{{ g }} = t.{{ g }} and\n {% endfor %}\n r.join_key = t.join_key\n where\n -- fail if either no rows were returned due to row_condition,\n -- or the recency test returned failed rows\n r.row_count = 0\n or\n t.join_key is not null\n\n)\nselect * from validation_errors\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_expectations.type_timestamp", "macro.dbt_date.now", "macro.dbt_expectations.group_by", "macro.dbt.dateadd"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.286053, "supported_languages": null}, "macro.dbt_expectations.test_expect_table_row_count_to_be_between": {"name": "test_expect_table_row_count_to_be_between", "resource_type": "macro", "package_name": "dbt_expectations", "path": "macros/schema_tests/table_shape/expect_table_row_count_to_be_between.sql", "original_file_path": "macros/schema_tests/table_shape/expect_table_row_count_to_be_between.sql", "unique_id": "macro.dbt_expectations.test_expect_table_row_count_to_be_between", "macro_sql": "{%- test expect_table_row_count_to_be_between(model,\n min_value=None,\n max_value=None,\n group_by=None,\n row_condition=None,\n strictly=False\n ) -%}\n {{ adapter.dispatch('test_expect_table_row_count_to_be_between',\n 'dbt_expectations') (model,\n min_value,\n max_value,\n group_by,\n row_condition,\n strictly\n ) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_expectations.default__test_expect_table_row_count_to_be_between"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2874408, "supported_languages": null}, "macro.dbt_expectations.default__test_expect_table_row_count_to_be_between": {"name": "default__test_expect_table_row_count_to_be_between", "resource_type": "macro", "package_name": "dbt_expectations", "path": "macros/schema_tests/table_shape/expect_table_row_count_to_be_between.sql", "original_file_path": "macros/schema_tests/table_shape/expect_table_row_count_to_be_between.sql", "unique_id": "macro.dbt_expectations.default__test_expect_table_row_count_to_be_between", "macro_sql": "\n\n{%- macro default__test_expect_table_row_count_to_be_between(model,\n min_value,\n max_value,\n group_by,\n row_condition,\n strictly\n ) -%}\n{% set expression %}\ncount(*)\n{% endset %}\n{{ dbt_expectations.expression_between(model,\n expression=expression,\n min_value=min_value,\n max_value=max_value,\n group_by_columns=group_by,\n row_condition=row_condition,\n strictly=strictly\n ) }}\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt_expectations.expression_between"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2880497, "supported_languages": null}, "macro.dbt_expectations.test_expect_row_values_to_have_recent_data": {"name": "test_expect_row_values_to_have_recent_data", "resource_type": "macro", "package_name": "dbt_expectations", "path": "macros/schema_tests/table_shape/expect_row_values_to_have_recent_data.sql", "original_file_path": "macros/schema_tests/table_shape/expect_row_values_to_have_recent_data.sql", "unique_id": "macro.dbt_expectations.test_expect_row_values_to_have_recent_data", "macro_sql": "{% test expect_row_values_to_have_recent_data(model,\n column_name,\n datepart,\n interval,\n row_condition=None) %}\n\n {{ adapter.dispatch('test_expect_row_values_to_have_recent_data', 'dbt_expectations') (model,\n column_name,\n datepart,\n interval,\n row_condition) }}\n\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_expectations.default__test_expect_row_values_to_have_recent_data"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2898283, "supported_languages": null}, "macro.dbt_expectations.default__test_expect_row_values_to_have_recent_data": {"name": "default__test_expect_row_values_to_have_recent_data", "resource_type": "macro", "package_name": "dbt_expectations", "path": "macros/schema_tests/table_shape/expect_row_values_to_have_recent_data.sql", "original_file_path": "macros/schema_tests/table_shape/expect_row_values_to_have_recent_data.sql", "unique_id": "macro.dbt_expectations.default__test_expect_row_values_to_have_recent_data", "macro_sql": "{% macro default__test_expect_row_values_to_have_recent_data(model, column_name, datepart, interval, row_condition) %}\n{%- set default_start_date = '1970-01-01' -%}\nwith max_recency as (\n\n select max(cast({{ column_name }} as {{ dbt_expectations.type_timestamp() }})) as max_timestamp\n from\n {{ model }}\n where\n -- to exclude erroneous future dates\n cast({{ column_name }} as {{ dbt_expectations.type_timestamp() }}) <= {{ dbt_date.now() }}\n {% if row_condition %}\n and {{ row_condition }}\n {% endif %}\n)\nselect\n *\nfrom\n max_recency\nwhere\n -- if the row_condition excludes all rows, we need to compare against a default date\n -- to avoid false negatives\n coalesce(max_timestamp, cast('{{ default_start_date }}' as {{ dbt_expectations.type_timestamp() }}))\n <\n cast({{ dbt.dateadd(datepart, interval * -1, dbt_date.now()) }} as {{ dbt_expectations.type_timestamp() }})\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_expectations.type_timestamp", "macro.dbt_date.now", "macro.dbt.dateadd"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2909875, "supported_languages": null}, "macro.dbt_expectations.test_expect_table_row_count_to_equal": {"name": "test_expect_table_row_count_to_equal", "resource_type": "macro", "package_name": "dbt_expectations", "path": "macros/schema_tests/table_shape/expect_table_row_count_to_equal.sql", "original_file_path": "macros/schema_tests/table_shape/expect_table_row_count_to_equal.sql", "unique_id": "macro.dbt_expectations.test_expect_table_row_count_to_equal", "macro_sql": "{%- test expect_table_row_count_to_equal(model,\n value,\n group_by=None,\n row_condition=None\n ) -%}\n {{ adapter.dispatch('test_expect_table_row_count_to_equal',\n 'dbt_expectations') (model,\n value,\n group_by,\n row_condition\n ) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_expectations.default__test_expect_table_row_count_to_equal"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2920322, "supported_languages": null}, "macro.dbt_expectations.default__test_expect_table_row_count_to_equal": {"name": "default__test_expect_table_row_count_to_equal", "resource_type": "macro", "package_name": "dbt_expectations", "path": "macros/schema_tests/table_shape/expect_table_row_count_to_equal.sql", "original_file_path": "macros/schema_tests/table_shape/expect_table_row_count_to_equal.sql", "unique_id": "macro.dbt_expectations.default__test_expect_table_row_count_to_equal", "macro_sql": "\n\n\n\n{%- macro default__test_expect_table_row_count_to_equal(model,\n value,\n group_by,\n row_condition\n ) -%}\n{% set expression %}\ncount(*) = {{ value }}\n{% endset %}\n{{ dbt_expectations.expression_is_true(model,\n expression=expression,\n group_by_columns=group_by,\n row_condition=row_condition)\n }}\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt_expectations.expression_is_true"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.292524, "supported_languages": null}, "macro.dbt_expectations.test_expect_column_to_exist": {"name": "test_expect_column_to_exist", "resource_type": "macro", "package_name": "dbt_expectations", "path": "macros/schema_tests/table_shape/expect_column_to_exist.sql", "original_file_path": "macros/schema_tests/table_shape/expect_column_to_exist.sql", "unique_id": "macro.dbt_expectations.test_expect_column_to_exist", "macro_sql": "{%- test expect_column_to_exist(model, column_name, column_index=None, transform=\"upper\") -%}\n{%- if execute -%}\n\n {%- set column_name = column_name | map(transform) | join -%}\n {%- set relation_column_names = dbt_expectations._get_column_list(model, transform) -%}\n\n {%- set matching_column_index = relation_column_names.index(column_name) if column_name in relation_column_names else -1 %}\n\n {%- if column_index -%}\n\n {%- set column_index_0 = column_index - 1 if column_index > 0 else 0 -%}\n\n {%- set column_index_matches = true if matching_column_index == column_index_0 else false %}\n\n {%- else -%}\n\n {%- set column_index_matches = true -%}\n\n {%- endif %}\n\n with test_data as (\n\n select\n cast('{{ column_name }}' as {{ dbt.type_string() }}) as column_name,\n {{ matching_column_index }} as matching_column_index,\n {{ column_index_matches }} as column_index_matches\n\n )\n select *\n from test_data\n where\n not(matching_column_index >= 0 and column_index_matches)\n\n{%- endif -%}\n{%- endtest -%}", "depends_on": {"macros": ["macro.dbt_expectations._get_column_list", "macro.dbt.type_string"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.29449, "supported_languages": null}, "macro.dbt_expectations.test_expect_table_row_count_to_equal_other_table": {"name": "test_expect_table_row_count_to_equal_other_table", "resource_type": "macro", "package_name": "dbt_expectations", "path": "macros/schema_tests/table_shape/expect_table_row_count_to_equal_other_table.sql", "original_file_path": "macros/schema_tests/table_shape/expect_table_row_count_to_equal_other_table.sql", "unique_id": "macro.dbt_expectations.test_expect_table_row_count_to_equal_other_table", "macro_sql": "{%- test expect_table_row_count_to_equal_other_table(model,\n compare_model,\n group_by=None,\n compare_group_by=None,\n factor=1,\n row_condition=None,\n compare_row_condition=None\n ) -%}\n\n {{ adapter.dispatch('test_expect_table_row_count_to_equal_other_table',\n 'dbt_expectations') (model,\n compare_model,\n group_by,\n compare_group_by,\n factor,\n row_condition,\n compare_row_condition\n ) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_expectations.default__test_expect_table_row_count_to_equal_other_table"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2960267, "supported_languages": null}, "macro.dbt_expectations.default__test_expect_table_row_count_to_equal_other_table": {"name": "default__test_expect_table_row_count_to_equal_other_table", "resource_type": "macro", "package_name": "dbt_expectations", "path": "macros/schema_tests/table_shape/expect_table_row_count_to_equal_other_table.sql", "original_file_path": "macros/schema_tests/table_shape/expect_table_row_count_to_equal_other_table.sql", "unique_id": "macro.dbt_expectations.default__test_expect_table_row_count_to_equal_other_table", "macro_sql": "\n\n{%- macro default__test_expect_table_row_count_to_equal_other_table(model,\n compare_model,\n group_by,\n compare_group_by,\n factor,\n row_condition,\n compare_row_condition\n ) -%}\n{{ dbt_expectations.test_equal_expression(model, \"count(*)\",\n compare_model=compare_model,\n compare_expression=\"count(*) * \" + factor|string,\n group_by=group_by,\n compare_group_by=compare_group_by,\n row_condition=row_condition,\n compare_row_condition=compare_row_condition\n) }}\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt_expectations.test_equal_expression"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2966259, "supported_languages": null}, "macro.dbt_expectations._list_intersect": {"name": "_list_intersect", "resource_type": "macro", "package_name": "dbt_expectations", "path": "macros/schema_tests/table_shape/_list_intersect.sql", "original_file_path": "macros/schema_tests/table_shape/_list_intersect.sql", "unique_id": "macro.dbt_expectations._list_intersect", "macro_sql": "{%- macro _list_intersect(list1, list2) -%}\n{%- set matching_items = [] -%}\n{%- for itm in list1 -%}\n {%- if itm in list2 -%}\n {%- do matching_items.append(itm) -%}\n {%- endif -%}\n{%- endfor -%}\n{%- do return(matching_items) -%}\n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2973683, "supported_languages": null}, "macro.dbt_expectations.test_expect_table_column_count_to_equal_other_table": {"name": "test_expect_table_column_count_to_equal_other_table", "resource_type": "macro", "package_name": "dbt_expectations", "path": "macros/schema_tests/table_shape/expect_table_column_count_to_equal_other_table.sql", "original_file_path": "macros/schema_tests/table_shape/expect_table_column_count_to_equal_other_table.sql", "unique_id": "macro.dbt_expectations.test_expect_table_column_count_to_equal_other_table", "macro_sql": "{%- test expect_table_column_count_to_equal_other_table(model, compare_model) -%}\n{%- if execute -%}\n{%- set number_columns = (adapter.get_columns_in_relation(model) | length) -%}\n{%- set compare_number_columns = (adapter.get_columns_in_relation(compare_model) | length) -%}\nwith test_data as (\n\n select\n {{ number_columns }} as number_columns,\n {{ compare_number_columns }} as compare_number_columns\n\n)\nselect *\nfrom test_data\nwhere\n number_columns != compare_number_columns\n{%- endif -%}\n{%- endtest -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2981699, "supported_languages": null}, "macro.dbt_expectations.test_expect_table_column_count_to_equal": {"name": "test_expect_table_column_count_to_equal", "resource_type": "macro", "package_name": "dbt_expectations", "path": "macros/schema_tests/table_shape/expect_table_column_count_to_equal.sql", "original_file_path": "macros/schema_tests/table_shape/expect_table_column_count_to_equal.sql", "unique_id": "macro.dbt_expectations.test_expect_table_column_count_to_equal", "macro_sql": "{%- test expect_table_column_count_to_equal(model, value) -%}\n{%- if execute -%}\n{%- set number_actual_columns = (adapter.get_columns_in_relation(model) | length) -%}\nwith test_data as (\n\n select\n {{ number_actual_columns }} as number_actual_columns,\n {{ value }} as value\n\n)\nselect *\nfrom test_data\nwhere\n number_actual_columns != value\n{%- endif -%}\n{%- endtest -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.2987764, "supported_languages": null}, "macro.dbt_expectations.test_expect_column_distinct_count_to_equal_other_table": {"name": "test_expect_column_distinct_count_to_equal_other_table", "resource_type": "macro", "package_name": "dbt_expectations", "path": "macros/schema_tests/aggregate_functions/expect_column_distinct_count_to_equal_other_table.sql", "original_file_path": "macros/schema_tests/aggregate_functions/expect_column_distinct_count_to_equal_other_table.sql", "unique_id": "macro.dbt_expectations.test_expect_column_distinct_count_to_equal_other_table", "macro_sql": "{% test expect_column_distinct_count_to_equal_other_table(model,\n compare_model,\n column_name,\n compare_column_name,\n row_condition=None,\n compare_row_condition=None\n ) %}\n{%- set expression -%}\ncount(distinct {{ column_name }})\n{%- endset -%}\n{%- set compare_expression -%}\n{%- if compare_column_name -%}\ncount(distinct {{ compare_column_name }})\n{%- else -%}\n{{ expression }}\n{%- endif -%}\n{%- endset -%}\n{{ dbt_expectations.test_equal_expression(\n model,\n expression=expression,\n compare_model=compare_model,\n compare_expression=compare_expression,\n row_condition=row_condition,\n compare_row_condition=compare_row_condition\n) }}\n{%- endtest -%}", "depends_on": {"macros": ["macro.dbt_expectations.test_equal_expression"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.30001, "supported_languages": null}, "macro.dbt_expectations.test_expect_column_min_to_be_between": {"name": "test_expect_column_min_to_be_between", "resource_type": "macro", "package_name": "dbt_expectations", "path": "macros/schema_tests/aggregate_functions/expect_column_min_to_be_between.sql", "original_file_path": "macros/schema_tests/aggregate_functions/expect_column_min_to_be_between.sql", "unique_id": "macro.dbt_expectations.test_expect_column_min_to_be_between", "macro_sql": "{% test expect_column_min_to_be_between(model, column_name,\n min_value=None,\n max_value=None,\n group_by=None,\n row_condition=None,\n strictly=False\n ) %}\n{% set expression %}\nmin({{ column_name }})\n{% endset %}\n{{ dbt_expectations.expression_between(model,\n expression=expression,\n min_value=min_value,\n max_value=max_value,\n group_by_columns=group_by,\n row_condition=row_condition,\n strictly=strictly\n ) }}\n\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_expectations.expression_between"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.3012848, "supported_languages": null}, "macro.dbt_expectations.test_expect_column_quantile_values_to_be_between": {"name": "test_expect_column_quantile_values_to_be_between", "resource_type": "macro", "package_name": "dbt_expectations", "path": "macros/schema_tests/aggregate_functions/expect_column_quantile_values_to_be_between.sql", "original_file_path": "macros/schema_tests/aggregate_functions/expect_column_quantile_values_to_be_between.sql", "unique_id": "macro.dbt_expectations.test_expect_column_quantile_values_to_be_between", "macro_sql": "{% test expect_column_quantile_values_to_be_between(model, column_name,\n quantile,\n min_value=None,\n max_value=None,\n group_by=None,\n row_condition=None,\n strictly=False\n ) %}\n\n{% set expression %}\n{{ dbt_expectations.percentile_cont(column_name, quantile) }}\n{% endset %}\n{{ dbt_expectations.expression_between(model,\n expression=expression,\n min_value=min_value,\n max_value=max_value,\n group_by_columns=group_by,\n row_condition=row_condition,\n strictly=strictly\n ) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_expectations.percentile_cont", "macro.dbt_expectations.expression_between"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.3026469, "supported_languages": null}, "macro.dbt_expectations.test_expect_column_proportion_of_unique_values_to_be_between": {"name": "test_expect_column_proportion_of_unique_values_to_be_between", "resource_type": "macro", "package_name": "dbt_expectations", "path": "macros/schema_tests/aggregate_functions/expect_column_proportion_of_unique_values_to_be_between.sql", "original_file_path": "macros/schema_tests/aggregate_functions/expect_column_proportion_of_unique_values_to_be_between.sql", "unique_id": "macro.dbt_expectations.test_expect_column_proportion_of_unique_values_to_be_between", "macro_sql": "{% test expect_column_proportion_of_unique_values_to_be_between(model, column_name,\n min_value=None,\n max_value=None,\n group_by=None,\n row_condition=None,\n strictly=False\n ) %}\n{% set expression %}\ncast(count(distinct {{ column_name }}) as {{ dbt.type_float() }})/count({{ column_name }})\n{% endset %}\n{{ dbt_expectations.expression_between(model,\n expression=expression,\n min_value=min_value,\n max_value=max_value,\n group_by_columns=group_by,\n row_condition=row_condition,\n strictly=strictly\n ) }}\n\n{% endtest %}", "depends_on": {"macros": ["macro.dbt.type_float", "macro.dbt_expectations.expression_between"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.304128, "supported_languages": null}, "macro.dbt_expectations.test_expect_column_distinct_values_to_contain_set": {"name": "test_expect_column_distinct_values_to_contain_set", "resource_type": "macro", "package_name": "dbt_expectations", "path": "macros/schema_tests/aggregate_functions/expect_column_distinct_values_to_contain_set.sql", "original_file_path": "macros/schema_tests/aggregate_functions/expect_column_distinct_values_to_contain_set.sql", "unique_id": "macro.dbt_expectations.test_expect_column_distinct_values_to_contain_set", "macro_sql": "{% test expect_column_distinct_values_to_contain_set(model, column_name,\n value_set,\n quote_values=True,\n row_condition=None\n ) %}\n\nwith all_values as (\n\n select distinct\n {{ column_name }} as value_field\n\n from {{ model }}\n {% if row_condition %}\n where {{ row_condition }}\n {% endif %}\n\n),\nset_values as (\n\n {% for value in value_set -%}\n select\n {% if quote_values -%}\n '{{ value }}'\n {%- else -%}\n {{ value }}\n {%- endif %} as value_field\n {% if not loop.last %}union all{% endif %}\n {% endfor %}\n\n),\nunique_set_values as (\n\n select distinct value_field\n from\n set_values\n\n),\nvalidation_errors as (\n -- values in set that are not in the list of values from the model\n select\n s.value_field\n from\n unique_set_values s\n left join\n all_values v on s.value_field = v.value_field\n where\n v.value_field is null\n\n)\n\nselect *\nfrom validation_errors\n\n{% endtest %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.3056242, "supported_languages": null}, "macro.dbt_expectations.test_expect_column_distinct_count_to_be_greater_than": {"name": "test_expect_column_distinct_count_to_be_greater_than", "resource_type": "macro", "package_name": "dbt_expectations", "path": "macros/schema_tests/aggregate_functions/expect_column_distinct_count_to_be_greater_than.sql", "original_file_path": "macros/schema_tests/aggregate_functions/expect_column_distinct_count_to_be_greater_than.sql", "unique_id": "macro.dbt_expectations.test_expect_column_distinct_count_to_be_greater_than", "macro_sql": "{% test expect_column_distinct_count_to_be_greater_than(model,\n column_name,\n value,\n group_by=None,\n row_condition=None\n ) %}\n{% set expression %}\ncount(distinct {{ column_name }}) > {{ value }}\n{% endset %}\n{{ dbt_expectations.expression_is_true(model,\n expression=expression,\n group_by_columns=group_by,\n row_condition=row_condition)\n }}\n{%- endtest -%}", "depends_on": {"macros": ["macro.dbt_expectations.expression_is_true"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.3066058, "supported_languages": null}, "macro.dbt_expectations.test_expect_column_stdev_to_be_between": {"name": "test_expect_column_stdev_to_be_between", "resource_type": "macro", "package_name": "dbt_expectations", "path": "macros/schema_tests/aggregate_functions/expect_column_stdev_to_be_between.sql", "original_file_path": "macros/schema_tests/aggregate_functions/expect_column_stdev_to_be_between.sql", "unique_id": "macro.dbt_expectations.test_expect_column_stdev_to_be_between", "macro_sql": "{% test expect_column_stdev_to_be_between(model, column_name,\n min_value=None,\n max_value=None,\n group_by=None,\n row_condition=None,\n strictly=False\n ) -%}\n {{ adapter.dispatch('test_expect_column_stdev_to_be_between', 'dbt_expectations') (\n model, column_name,\n min_value,\n max_value,\n group_by,\n row_condition,\n strictly\n ) }}\n{%- endtest %}", "depends_on": {"macros": ["macro.dbt_expectations.default__test_expect_column_stdev_to_be_between"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.3085904, "supported_languages": null}, "macro.dbt_expectations.default__test_expect_column_stdev_to_be_between": {"name": "default__test_expect_column_stdev_to_be_between", "resource_type": "macro", "package_name": "dbt_expectations", "path": "macros/schema_tests/aggregate_functions/expect_column_stdev_to_be_between.sql", "original_file_path": "macros/schema_tests/aggregate_functions/expect_column_stdev_to_be_between.sql", "unique_id": "macro.dbt_expectations.default__test_expect_column_stdev_to_be_between", "macro_sql": "{% macro default__test_expect_column_stdev_to_be_between(\n model, column_name,\n min_value,\n max_value,\n group_by,\n row_condition,\n strictly\n ) %}\n\n{% set expression %}\nstddev({{ column_name }})\n{% endset %}\n{{ dbt_expectations.expression_between(model,\n expression=expression,\n min_value=min_value,\n max_value=max_value,\n group_by_columns=group_by,\n row_condition=row_condition,\n strictly=strictly\n ) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_expectations.expression_between"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.3092897, "supported_languages": null}, "macro.dbt_expectations.test_expect_column_distinct_count_to_equal": {"name": "test_expect_column_distinct_count_to_equal", "resource_type": "macro", "package_name": "dbt_expectations", "path": "macros/schema_tests/aggregate_functions/expect_column_distinct_count_to_equal.sql", "original_file_path": "macros/schema_tests/aggregate_functions/expect_column_distinct_count_to_equal.sql", "unique_id": "macro.dbt_expectations.test_expect_column_distinct_count_to_equal", "macro_sql": "{% test expect_column_distinct_count_to_equal(model,\n column_name,\n value,\n group_by=None,\n row_condition=None\n ) %}\n{% set expression %}\ncount(distinct {{ column_name }}) = {{ value }}\n{% endset %}\n{{ dbt_expectations.expression_is_true(model,\n expression=expression,\n group_by_columns=group_by,\n row_condition=row_condition)\n }}\n{%- endtest -%}", "depends_on": {"macros": ["macro.dbt_expectations.expression_is_true"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.310193, "supported_languages": null}, "macro.dbt_expectations.test_expect_column_distinct_values_to_equal_set": {"name": "test_expect_column_distinct_values_to_equal_set", "resource_type": "macro", "package_name": "dbt_expectations", "path": "macros/schema_tests/aggregate_functions/expect_column_distinct_values_to_equal_set.sql", "original_file_path": "macros/schema_tests/aggregate_functions/expect_column_distinct_values_to_equal_set.sql", "unique_id": "macro.dbt_expectations.test_expect_column_distinct_values_to_equal_set", "macro_sql": "{% test expect_column_distinct_values_to_equal_set(model, column_name,\n value_set,\n quote_values=True,\n row_condition=None\n ) %}\n\nwith all_values as (\n\n select distinct\n {{ column_name }} as column_value\n\n from {{ model }}\n {% if row_condition %}\n where {{ row_condition }}\n {% endif %}\n\n),\nset_values as (\n\n {% for value in value_set -%}\n select\n {% if quote_values -%}\n '{{ value }}'\n {%- else -%}\n {{ value }}\n {%- endif %} as value_field\n {% if not loop.last %}union all{% endif %}\n {% endfor %}\n\n),\nunique_set_values as (\n\n select distinct value_field\n from\n set_values\n\n),\nvalidation_errors as (\n\n select\n *\n from\n all_values v\n full outer join\n unique_set_values s on v.column_value = s.value_field\n where\n v.column_value is null or\n s.value_field is null\n\n)\n\nselect *\nfrom validation_errors\n\n{% endtest %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.3117204, "supported_languages": null}, "macro.dbt_expectations.test_expect_column_most_common_value_to_be_in_set": {"name": "test_expect_column_most_common_value_to_be_in_set", "resource_type": "macro", "package_name": "dbt_expectations", "path": "macros/schema_tests/aggregate_functions/expect_column_most_common_value_to_be_in_set.sql", "original_file_path": "macros/schema_tests/aggregate_functions/expect_column_most_common_value_to_be_in_set.sql", "unique_id": "macro.dbt_expectations.test_expect_column_most_common_value_to_be_in_set", "macro_sql": "{% test expect_column_most_common_value_to_be_in_set(model,\n column_name,\n value_set,\n top_n,\n quote_values=True,\n data_type=\"decimal\",\n row_condition=None\n ) -%}\n\n {{ adapter.dispatch('test_expect_column_most_common_value_to_be_in_set', 'dbt_expectations') (\n model, column_name, value_set, top_n, quote_values, data_type, row_condition\n ) }}\n\n{%- endtest %}", "depends_on": {"macros": ["macro.dbt_expectations.default__test_expect_column_most_common_value_to_be_in_set"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.3144336, "supported_languages": null}, "macro.dbt_expectations.default__test_expect_column_most_common_value_to_be_in_set": {"name": "default__test_expect_column_most_common_value_to_be_in_set", "resource_type": "macro", "package_name": "dbt_expectations", "path": "macros/schema_tests/aggregate_functions/expect_column_most_common_value_to_be_in_set.sql", "original_file_path": "macros/schema_tests/aggregate_functions/expect_column_most_common_value_to_be_in_set.sql", "unique_id": "macro.dbt_expectations.default__test_expect_column_most_common_value_to_be_in_set", "macro_sql": "{% macro default__test_expect_column_most_common_value_to_be_in_set(model,\n column_name,\n value_set,\n top_n,\n quote_values,\n data_type,\n row_condition\n ) %}\n\nwith value_counts as (\n\n select\n {% if quote_values -%}\n {{ column_name }}\n {%- else -%}\n cast({{ column_name }} as {{ data_type }})\n {%- endif %} as value_field,\n count(*) as value_count\n\n from {{ model }}\n {% if row_condition %}\n where {{ row_condition }}\n {% endif %}\n\n group by {% if quote_values -%}\n {{ column_name }}\n {%- else -%}\n cast({{ column_name }} as {{ data_type }})\n {%- endif %}\n\n),\nvalue_counts_ranked as (\n\n select\n *,\n row_number() over(order by value_count desc) as value_count_rank\n from\n value_counts\n\n),\nvalue_count_top_n as (\n\n select\n value_field\n from\n value_counts_ranked\n where\n value_count_rank = {{ top_n }}\n\n),\nset_values as (\n\n {% for value in value_set -%}\n select\n {% if quote_values -%}\n '{{ value }}'\n {%- else -%}\n cast({{ value }} as {{ data_type }})\n {%- endif %} as value_field\n {% if not loop.last %}union all{% endif %}\n {% endfor %}\n\n),\nunique_set_values as (\n\n select distinct value_field\n from\n set_values\n\n),\nvalidation_errors as (\n -- values from the model that are not in the set\n select\n value_field\n from\n value_count_top_n\n where\n value_field not in (select value_field from unique_set_values)\n\n)\n\nselect *\nfrom validation_errors\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.3157887, "supported_languages": null}, "macro.dbt_expectations.test_expect_column_distinct_values_to_be_in_set": {"name": "test_expect_column_distinct_values_to_be_in_set", "resource_type": "macro", "package_name": "dbt_expectations", "path": "macros/schema_tests/aggregate_functions/expect_column_distinct_values_to_be_in_set.sql", "original_file_path": "macros/schema_tests/aggregate_functions/expect_column_distinct_values_to_be_in_set.sql", "unique_id": "macro.dbt_expectations.test_expect_column_distinct_values_to_be_in_set", "macro_sql": "{% test expect_column_distinct_values_to_be_in_set(model,\n column_name,\n value_set,\n quote_values=True,\n row_condition=None\n ) %}\n\nwith all_values as (\n\n select distinct\n {{ column_name }} as value_field\n\n from {{ model }}\n {% if row_condition %}\n where {{ row_condition }}\n {% endif %}\n\n),\nset_values as (\n\n {% for value in value_set -%}\n select\n {% if quote_values -%}\n '{{ value }}'\n {%- else -%}\n {{ value }}\n {%- endif %} as value_field\n {% if not loop.last %}union all{% endif %}\n {% endfor %}\n\n),\nunique_set_values as (\n\n select distinct value_field\n from\n set_values\n\n),\nvalidation_errors as (\n -- values from the model that are not in the set\n select\n v.value_field\n from\n all_values v\n left join\n unique_set_values s on v.value_field = s.value_field\n where\n s.value_field is null\n\n)\n\nselect *\nfrom validation_errors\n\n{% endtest %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.3172698, "supported_languages": null}, "macro.dbt_expectations.test_expect_column_sum_to_be_between": {"name": "test_expect_column_sum_to_be_between", "resource_type": "macro", "package_name": "dbt_expectations", "path": "macros/schema_tests/aggregate_functions/expect_column_sum_to_be_between.sql", "original_file_path": "macros/schema_tests/aggregate_functions/expect_column_sum_to_be_between.sql", "unique_id": "macro.dbt_expectations.test_expect_column_sum_to_be_between", "macro_sql": "{% test expect_column_sum_to_be_between(model, column_name,\n min_value=None,\n max_value=None,\n group_by=None,\n row_condition=None,\n strictly=False\n ) %}\n{% set expression %}\nsum({{ column_name }})\n{% endset %}\n{{ dbt_expectations.expression_between(model,\n expression=expression,\n min_value=min_value,\n max_value=max_value,\n group_by_columns=group_by,\n row_condition=row_condition,\n strictly=strictly\n ) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_expectations.expression_between"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.3185034, "supported_languages": null}, "macro.dbt_expectations.test_expect_column_distinct_count_to_be_less_than": {"name": "test_expect_column_distinct_count_to_be_less_than", "resource_type": "macro", "package_name": "dbt_expectations", "path": "macros/schema_tests/aggregate_functions/expect_column_distinct_count_to_be_less_than.sql", "original_file_path": "macros/schema_tests/aggregate_functions/expect_column_distinct_count_to_be_less_than.sql", "unique_id": "macro.dbt_expectations.test_expect_column_distinct_count_to_be_less_than", "macro_sql": "{% test expect_column_distinct_count_to_be_less_than(model,\n column_name,\n value,\n group_by=None,\n row_condition=None\n ) %}\n{% set expression %}\ncount(distinct {{ column_name }}) < {{ value }}\n{% endset %}\n{{ dbt_expectations.expression_is_true(model,\n expression=expression,\n group_by_columns=group_by,\n row_condition=row_condition)\n }}\n{%- endtest -%}", "depends_on": {"macros": ["macro.dbt_expectations.expression_is_true"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.3194695, "supported_languages": null}, "macro.dbt_expectations.test_expect_column_max_to_be_between": {"name": "test_expect_column_max_to_be_between", "resource_type": "macro", "package_name": "dbt_expectations", "path": "macros/schema_tests/aggregate_functions/expect_column_max_to_be_between.sql", "original_file_path": "macros/schema_tests/aggregate_functions/expect_column_max_to_be_between.sql", "unique_id": "macro.dbt_expectations.test_expect_column_max_to_be_between", "macro_sql": "{% test expect_column_max_to_be_between(model, column_name,\n min_value=None,\n max_value=None,\n group_by=None,\n row_condition=None,\n strictly=False\n ) %}\n{% set expression %}\nmax({{ column_name }})\n{% endset %}\n{{ dbt_expectations.expression_between(model,\n expression=expression,\n min_value=min_value,\n max_value=max_value,\n group_by_columns=group_by,\n row_condition=row_condition,\n strictly=strictly\n ) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_expectations.expression_between"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.3206794, "supported_languages": null}, "macro.dbt_expectations.test_expect_column_median_to_be_between": {"name": "test_expect_column_median_to_be_between", "resource_type": "macro", "package_name": "dbt_expectations", "path": "macros/schema_tests/aggregate_functions/expect_column_median_to_be_between.sql", "original_file_path": "macros/schema_tests/aggregate_functions/expect_column_median_to_be_between.sql", "unique_id": "macro.dbt_expectations.test_expect_column_median_to_be_between", "macro_sql": "{% test expect_column_median_to_be_between(model, column_name,\n min_value=None,\n max_value=None,\n group_by=None,\n row_condition=None,\n strictly=False\n ) %}\n\n{% set expression %}\n{{ dbt_expectations.median(column_name) }}\n{% endset %}\n{{ dbt_expectations.expression_between(model,\n expression=expression,\n min_value=min_value,\n max_value=max_value,\n group_by_columns=group_by,\n row_condition=row_condition,\n strictly=strictly\n ) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_expectations.median", "macro.dbt_expectations.expression_between"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.3219779, "supported_languages": null}, "macro.dbt_expectations.test_expect_column_mean_to_be_between": {"name": "test_expect_column_mean_to_be_between", "resource_type": "macro", "package_name": "dbt_expectations", "path": "macros/schema_tests/aggregate_functions/expect_column_mean_to_be_between.sql", "original_file_path": "macros/schema_tests/aggregate_functions/expect_column_mean_to_be_between.sql", "unique_id": "macro.dbt_expectations.test_expect_column_mean_to_be_between", "macro_sql": "{% test expect_column_mean_to_be_between(model, column_name,\n min_value=None,\n max_value=None,\n group_by=None,\n row_condition=None,\n strictly=False\n ) %}\n{% set expression %}\navg({{ column_name }})\n{% endset %}\n{{ dbt_expectations.expression_between(model,\n expression=expression,\n min_value=min_value,\n max_value=max_value,\n group_by_columns=group_by,\n row_condition=row_condition,\n strictly=strictly\n ) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_expectations.expression_between"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.3232548, "supported_languages": null}, "macro.dbt_expectations.test_expect_column_unique_value_count_to_be_between": {"name": "test_expect_column_unique_value_count_to_be_between", "resource_type": "macro", "package_name": "dbt_expectations", "path": "macros/schema_tests/aggregate_functions/expect_column_unique_value_count_to_be_between.sql", "original_file_path": "macros/schema_tests/aggregate_functions/expect_column_unique_value_count_to_be_between.sql", "unique_id": "macro.dbt_expectations.test_expect_column_unique_value_count_to_be_between", "macro_sql": "{% test expect_column_unique_value_count_to_be_between(model, column_name,\n min_value=None,\n max_value=None,\n group_by=None,\n row_condition=None,\n strictly=False\n ) %}\n{% set expression %}\ncount(distinct {{ column_name }})\n{% endset %}\n{{ dbt_expectations.expression_between(model,\n expression=expression,\n min_value=min_value,\n max_value=max_value,\n group_by_columns=group_by,\n row_condition=row_condition,\n strictly=strictly\n ) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_expectations.expression_between"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.3245203, "supported_languages": null}, "macro.dbt_expectations.test_expect_column_pair_values_A_to_be_greater_than_B": {"name": "test_expect_column_pair_values_A_to_be_greater_than_B", "resource_type": "macro", "package_name": "dbt_expectations", "path": "macros/schema_tests/multi-column/expect_column_pair_values_A_to_be_greater_than_B.sql", "original_file_path": "macros/schema_tests/multi-column/expect_column_pair_values_A_to_be_greater_than_B.sql", "unique_id": "macro.dbt_expectations.test_expect_column_pair_values_A_to_be_greater_than_B", "macro_sql": "{% test expect_column_pair_values_A_to_be_greater_than_B(model,\n column_A,\n column_B,\n or_equal=False,\n row_condition=None\n ) %}\n\n{% set operator = \">=\" if or_equal else \">\" %}\n{% set expression = column_A ~ \" \" ~ operator ~ \" \" ~ column_B %}\n\n{{ dbt_expectations.expression_is_true(model,\n expression=expression,\n group_by_columns=None,\n row_condition=row_condition\n )\n }}\n\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_expectations.expression_is_true"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.3256302, "supported_languages": null}, "macro.dbt_expectations.test_expect_compound_columns_to_be_unique": {"name": "test_expect_compound_columns_to_be_unique", "resource_type": "macro", "package_name": "dbt_expectations", "path": "macros/schema_tests/multi-column/expect_compound_columns_to_be_unique.sql", "original_file_path": "macros/schema_tests/multi-column/expect_compound_columns_to_be_unique.sql", "unique_id": "macro.dbt_expectations.test_expect_compound_columns_to_be_unique", "macro_sql": "{% test expect_compound_columns_to_be_unique(model,\n column_list,\n quote_columns=False,\n ignore_row_if=\"all_values_are_missing\",\n row_condition=None\n ) %}\n{% if not column_list %}\n {{ exceptions.raise_compiler_error(\n \"`column_list` must be specified as a list of columns. Got: '\" ~ column_list ~\"'.'\"\n ) }}\n{% endif %}\n\n{% if not quote_columns %}\n {%- set columns=column_list %}\n{% elif quote_columns %}\n {%- set columns=[] %}\n {% for column in column_list -%}\n {% set columns = columns.append( adapter.quote(column) ) %}\n {%- endfor %}\n{% else %}\n {{ exceptions.raise_compiler_error(\n \"`quote_columns` argument for expect_compound_columns_to_be_unique test must be one of [True, False] Got: '\" ~ quote_columns ~\"'.'\"\n ) }}\n{% endif %}\n\n{%- set row_condition_ext -%}\n\n {%- if row_condition %}\n {{ row_condition }} and\n {% endif -%}\n\n {{ dbt_expectations.ignore_row_if_expression(ignore_row_if, columns) }}\n\n{%- endset -%}\n\nwith validation_errors as (\n\n select\n {% for column in columns -%}\n {{ column }},\n {%- endfor %}\n count(*) as {{adapter.quote(\"n_records\")}}\n from {{ model }}\n where\n 1=1\n {%- if row_condition_ext %}\n and {{ row_condition_ext }}\n {% endif %}\n group by\n {% for column in columns -%}\n {{ column }}{% if not loop.last %},{% endif %}\n {%- endfor %}\n having count(*) > 1\n\n)\nselect * from validation_errors\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_expectations.ignore_row_if_expression"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.3288677, "supported_languages": null}, "macro.dbt_expectations.test_expect_column_pair_values_to_be_equal": {"name": "test_expect_column_pair_values_to_be_equal", "resource_type": "macro", "package_name": "dbt_expectations", "path": "macros/schema_tests/multi-column/expect_column_pair_values_to_be_equal.sql", "original_file_path": "macros/schema_tests/multi-column/expect_column_pair_values_to_be_equal.sql", "unique_id": "macro.dbt_expectations.test_expect_column_pair_values_to_be_equal", "macro_sql": "{% test expect_column_pair_values_to_be_equal(model,\n column_A,\n column_B,\n row_condition=None\n ) %}\n\n{% set operator = \"=\" %}\n{% set expression = column_A ~ \" \" ~ operator ~ \" \" ~ column_B %}\n\n{{ dbt_expectations.expression_is_true(model,\n expression=expression,\n group_by_columns=None,\n row_condition=row_condition\n )\n }}\n\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_expectations.expression_is_true"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.3298504, "supported_languages": null}, "macro.dbt_expectations.test_expect_column_pair_values_to_be_in_set": {"name": "test_expect_column_pair_values_to_be_in_set", "resource_type": "macro", "package_name": "dbt_expectations", "path": "macros/schema_tests/multi-column/expect_column_pair_values_to_be_in_set.sql", "original_file_path": "macros/schema_tests/multi-column/expect_column_pair_values_to_be_in_set.sql", "unique_id": "macro.dbt_expectations.test_expect_column_pair_values_to_be_in_set", "macro_sql": "{% test expect_column_pair_values_to_be_in_set(model,\n column_A,\n column_B,\n value_pairs_set,\n row_condition=None\n ) %}\n\n{% set expression %}\n{% for pair in value_pairs_set %}\n{%- if (pair | length) == 2 %}\n({{ column_A }} = {{ pair[0] }} and {{ column_B }} = {{ pair[1] }}){% if not loop.last %} or {% endif %}\n{% else %}\n{{ exceptions.raise_compiler_error(\n \"`value_pairs_set` argument for expect_column_pair_values_to_be_in_set test cannot have more than 2 item per element.\n Got: '\" ~ pair ~ \"'.'\"\n ) }}\n{% endif %}\n{% endfor %}\n{% endset %}\n{{ dbt_expectations.expression_is_true(model,\n expression=expression,\n group_by_columns=None,\n row_condition=row_condition\n )\n }}\n\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_expectations.expression_is_true"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.3320277, "supported_languages": null}, "macro.dbt_expectations.test_expect_multicolumn_sum_to_equal": {"name": "test_expect_multicolumn_sum_to_equal", "resource_type": "macro", "package_name": "dbt_expectations", "path": "macros/schema_tests/multi-column/expect_multicolumn_sum_to_equal.sql", "original_file_path": "macros/schema_tests/multi-column/expect_multicolumn_sum_to_equal.sql", "unique_id": "macro.dbt_expectations.test_expect_multicolumn_sum_to_equal", "macro_sql": "{% test expect_multicolumn_sum_to_equal(model,\n column_list,\n sum_total,\n group_by=None,\n row_condition=None\n ) %}\n\n{% set expression %}\n{% for column in column_list %}\nsum({{ column }}){% if not loop.last %} + {% endif %}\n{# the if just allows for column names or literal numbers #}\n{% endfor %} = {% if sum_total is number %}{{sum_total}}{% else %}sum({{ sum_total }}){% endif %}\n{% endset %}\n\n{{ dbt_expectations.expression_is_true(model,\n expression=expression,\n group_by_columns=group_by,\n row_condition=row_condition\n )\n }}\n\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_expectations.expression_is_true"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.3336122, "supported_languages": null}, "macro.dbt_expectations.test_expect_select_column_values_to_be_unique_within_record": {"name": "test_expect_select_column_values_to_be_unique_within_record", "resource_type": "macro", "package_name": "dbt_expectations", "path": "macros/schema_tests/multi-column/expect_select_column_values_to_be_unique_within_record.sql", "original_file_path": "macros/schema_tests/multi-column/expect_select_column_values_to_be_unique_within_record.sql", "unique_id": "macro.dbt_expectations.test_expect_select_column_values_to_be_unique_within_record", "macro_sql": "{% test expect_select_column_values_to_be_unique_within_record(model,\n column_list,\n quote_columns=False,\n ignore_row_if=\"all_values_are_missing\",\n row_condition=None\n ) -%}\n {{ adapter.dispatch('test_expect_select_column_values_to_be_unique_within_record', 'dbt_expectations') (model, column_list, quote_columns, ignore_row_if, row_condition) }}\n{%- endtest %}", "depends_on": {"macros": ["macro.dbt_expectations.default__test_expect_select_column_values_to_be_unique_within_record"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.3359933, "supported_languages": null}, "macro.dbt_expectations.default__test_expect_select_column_values_to_be_unique_within_record": {"name": "default__test_expect_select_column_values_to_be_unique_within_record", "resource_type": "macro", "package_name": "dbt_expectations", "path": "macros/schema_tests/multi-column/expect_select_column_values_to_be_unique_within_record.sql", "original_file_path": "macros/schema_tests/multi-column/expect_select_column_values_to_be_unique_within_record.sql", "unique_id": "macro.dbt_expectations.default__test_expect_select_column_values_to_be_unique_within_record", "macro_sql": "{% macro default__test_expect_select_column_values_to_be_unique_within_record(model,\n column_list,\n quote_columns,\n ignore_row_if,\n row_condition\n ) %}\n\n{% if not quote_columns %}\n {%- set columns=column_list %}\n{% elif quote_columns %}\n {%- set columns=[] %}\n {% for column in column_list -%}\n {% set columns = columns.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_columns ~\"'.'\"\n ) }}\n{% endif %}\n\n{%- set row_condition_ext -%}\n\n {%- if row_condition %}\n {{ row_condition }} and\n {% endif -%}\n\n {{ dbt_expectations.ignore_row_if_expression(ignore_row_if, columns) }}\n\n{%- endset -%}\n\nwith column_values as (\n\n select\n row_number() over(order by {{ columns|join(', ') }}) as row_index,\n {% for column in columns -%}\n {{ column }}{% if not loop.last %},{% endif %}\n {%- endfor %}\n from {{ model }}\n where\n 1=1\n {%- if row_condition_ext %}\n and {{ row_condition_ext }}\n {% endif %}\n\n),\nunpivot_columns as (\n\n {% for column in columns %}\n select row_index, '{{ column }}' as column_name, {{ dbt_expectations.md5(column) }} as column_value from column_values\n {% if not loop.last %}union all{% endif %}\n {% endfor %}\n),\nvalidation_errors as (\n\n select\n row_index,\n count(distinct column_value) as column_values\n from unpivot_columns\n group by 1\n having count(distinct column_value) < {{ columns | length }}\n\n)\nselect * from validation_errors\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_expectations.ignore_row_if_expression", "macro.dbt_expectations.md5"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.338172, "supported_languages": null}, "macro.dbt_expectations.test_expect_column_value_lengths_to_be_between": {"name": "test_expect_column_value_lengths_to_be_between", "resource_type": "macro", "package_name": "dbt_expectations", "path": "macros/schema_tests/string_matching/expect_column_value_lengths_to_be_between.sql", "original_file_path": "macros/schema_tests/string_matching/expect_column_value_lengths_to_be_between.sql", "unique_id": "macro.dbt_expectations.test_expect_column_value_lengths_to_be_between", "macro_sql": "{% test expect_column_value_lengths_to_be_between(model, column_name,\n min_value=None,\n max_value=None,\n row_condition=None,\n strictly=False\n ) %}\n{% set expression %}\n{{ dbt.length(column_name) }}\n{% endset %}\n\n{{ dbt_expectations.expression_between(model,\n expression=expression,\n min_value=min_value,\n max_value=max_value,\n group_by_columns=None,\n row_condition=row_condition,\n strictly=strictly\n ) }}\n\n{% endtest %}", "depends_on": {"macros": ["macro.dbt.length", "macro.dbt_expectations.expression_between"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.3394344, "supported_languages": null}, "macro.dbt_expectations.test_expect_column_values_to_match_like_pattern_list": {"name": "test_expect_column_values_to_match_like_pattern_list", "resource_type": "macro", "package_name": "dbt_expectations", "path": "macros/schema_tests/string_matching/expect_column_values_to_match_like_pattern_list.sql", "original_file_path": "macros/schema_tests/string_matching/expect_column_values_to_match_like_pattern_list.sql", "unique_id": "macro.dbt_expectations.test_expect_column_values_to_match_like_pattern_list", "macro_sql": "{% test expect_column_values_to_match_like_pattern_list(model, column_name,\n like_pattern_list,\n match_on=\"any\",\n row_condition=None\n ) %}\n\n{% set expression %}\n {% for like_pattern in like_pattern_list %}\n {{ dbt_expectations._get_like_pattern_expression(column_name, like_pattern, positive=True) }}\n {%- if not loop.last %}\n {{ \" and \" if match_on == \"all\" else \" or \"}}\n {% endif -%}\n {% endfor %}\n{% endset %}\n\n{{ dbt_expectations.expression_is_true(model,\n expression=expression,\n group_by_columns=None,\n row_condition=row_condition\n )\n }}\n\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_expectations._get_like_pattern_expression", "macro.dbt_expectations.expression_is_true"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.3410907, "supported_languages": null}, "macro.dbt_expectations.test_expect_column_values_to_match_like_pattern": {"name": "test_expect_column_values_to_match_like_pattern", "resource_type": "macro", "package_name": "dbt_expectations", "path": "macros/schema_tests/string_matching/expect_column_values_to_match_like_pattern.sql", "original_file_path": "macros/schema_tests/string_matching/expect_column_values_to_match_like_pattern.sql", "unique_id": "macro.dbt_expectations.test_expect_column_values_to_match_like_pattern", "macro_sql": "{% test expect_column_values_to_match_like_pattern(model, column_name,\n like_pattern,\n row_condition=None\n ) %}\n\n{% set expression = dbt_expectations._get_like_pattern_expression(column_name, like_pattern, positive=True) %}\n\n{{ dbt_expectations.expression_is_true(model,\n expression=expression,\n group_by_columns=None,\n row_condition=row_condition\n )\n }}\n\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_expectations._get_like_pattern_expression", "macro.dbt_expectations.expression_is_true"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.341951, "supported_languages": null}, "macro.dbt_expectations.test_expect_column_values_to_not_match_like_pattern": {"name": "test_expect_column_values_to_not_match_like_pattern", "resource_type": "macro", "package_name": "dbt_expectations", "path": "macros/schema_tests/string_matching/expect_column_values_to_not_match_like_pattern.sql", "original_file_path": "macros/schema_tests/string_matching/expect_column_values_to_not_match_like_pattern.sql", "unique_id": "macro.dbt_expectations.test_expect_column_values_to_not_match_like_pattern", "macro_sql": "{% test expect_column_values_to_not_match_like_pattern(model, column_name,\n like_pattern,\n row_condition=None\n ) %}\n\n{% set expression = dbt_expectations._get_like_pattern_expression(column_name, like_pattern, positive=False) %}\n\n{{ dbt_expectations.expression_is_true(model,\n expression=expression,\n group_by_columns=None,\n row_condition=row_condition\n )\n }}\n\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_expectations._get_like_pattern_expression", "macro.dbt_expectations.expression_is_true"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.3427954, "supported_languages": null}, "macro.dbt_expectations.test_expect_column_values_to_match_regex": {"name": "test_expect_column_values_to_match_regex", "resource_type": "macro", "package_name": "dbt_expectations", "path": "macros/schema_tests/string_matching/expect_column_values_to_match_regex.sql", "original_file_path": "macros/schema_tests/string_matching/expect_column_values_to_match_regex.sql", "unique_id": "macro.dbt_expectations.test_expect_column_values_to_match_regex", "macro_sql": "{% test expect_column_values_to_match_regex(model, column_name,\n regex,\n row_condition=None,\n is_raw=False,\n flags=\"\"\n ) %}\n\n{% set expression %}\n{{ dbt_expectations.regexp_instr(column_name, regex, is_raw=is_raw, flags=flags) }} > 0\n{% endset %}\n\n{{ dbt_expectations.expression_is_true(model,\n expression=expression,\n group_by_columns=None,\n row_condition=row_condition\n )\n }}\n\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_expectations.regexp_instr", "macro.dbt_expectations.expression_is_true"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.343905, "supported_languages": null}, "macro.dbt_expectations.test_expect_column_value_lengths_to_equal": {"name": "test_expect_column_value_lengths_to_equal", "resource_type": "macro", "package_name": "dbt_expectations", "path": "macros/schema_tests/string_matching/expect_column_value_lengths_to_equal.sql", "original_file_path": "macros/schema_tests/string_matching/expect_column_value_lengths_to_equal.sql", "unique_id": "macro.dbt_expectations.test_expect_column_value_lengths_to_equal", "macro_sql": "{% test expect_column_value_lengths_to_equal(model, column_name,\n value,\n row_condition=None\n ) %}\n\n{% set expression = dbt.length(column_name) ~ \" = \" ~ value %}\n\n{{ dbt_expectations.expression_is_true(model,\n expression=expression,\n group_by_columns=None,\n row_condition=row_condition\n )\n }}\n\n{% endtest %}", "depends_on": {"macros": ["macro.dbt.length", "macro.dbt_expectations.expression_is_true"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.3447437, "supported_languages": null}, "macro.dbt_expectations.test_expect_column_values_to_not_match_regex_list": {"name": "test_expect_column_values_to_not_match_regex_list", "resource_type": "macro", "package_name": "dbt_expectations", "path": "macros/schema_tests/string_matching/expect_column_values_to_not_match_regex_list.sql", "original_file_path": "macros/schema_tests/string_matching/expect_column_values_to_not_match_regex_list.sql", "unique_id": "macro.dbt_expectations.test_expect_column_values_to_not_match_regex_list", "macro_sql": "{% test expect_column_values_to_not_match_regex_list(model, column_name,\n regex_list,\n match_on=\"any\",\n row_condition=None,\n is_raw=False,\n flags=\"\"\n ) %}\n\n{% set expression %}\n{% for regex in regex_list %}\n{{ dbt_expectations.regexp_instr(column_name, regex, is_raw=is_raw, flags=flags) }} = 0\n{%- if not loop.last %}\n{{ \" and \" if match_on == \"all\" else \" or \"}}\n{% endif -%}\n{% endfor %}\n{% endset %}\n\n{{ dbt_expectations.expression_is_true(model,\n expression=expression,\n group_by_columns=None,\n row_condition=row_condition\n )\n }}\n\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_expectations.regexp_instr", "macro.dbt_expectations.expression_is_true"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.3464663, "supported_languages": null}, "macro.dbt_expectations.test_expect_column_values_to_not_match_like_pattern_list": {"name": "test_expect_column_values_to_not_match_like_pattern_list", "resource_type": "macro", "package_name": "dbt_expectations", "path": "macros/schema_tests/string_matching/expect_column_values_to_not_match_like_pattern_list.sql", "original_file_path": "macros/schema_tests/string_matching/expect_column_values_to_not_match_like_pattern_list.sql", "unique_id": "macro.dbt_expectations.test_expect_column_values_to_not_match_like_pattern_list", "macro_sql": "{% test expect_column_values_to_not_match_like_pattern_list(model, column_name,\n like_pattern_list,\n match_on=\"any\",\n row_condition=None\n ) %}\n\n{% set expression %}\n {% for like_pattern in like_pattern_list %}\n {{ dbt_expectations._get_like_pattern_expression(column_name, like_pattern, positive=False) }}\n {%- if not loop.last %}\n {{ \" and \" if match_on == \"all\" else \" or \"}}\n {% endif -%}\n {% endfor %}\n{% endset %}\n\n{{ dbt_expectations.expression_is_true(model,\n expression=expression,\n group_by_columns=None,\n row_condition=row_condition\n )\n }}\n\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_expectations._get_like_pattern_expression", "macro.dbt_expectations.expression_is_true"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.3480763, "supported_languages": null}, "macro.dbt_expectations.test_expect_column_values_to_match_regex_list": {"name": "test_expect_column_values_to_match_regex_list", "resource_type": "macro", "package_name": "dbt_expectations", "path": "macros/schema_tests/string_matching/expect_column_values_to_match_regex_list.sql", "original_file_path": "macros/schema_tests/string_matching/expect_column_values_to_match_regex_list.sql", "unique_id": "macro.dbt_expectations.test_expect_column_values_to_match_regex_list", "macro_sql": "{% test expect_column_values_to_match_regex_list(model, column_name,\n regex_list,\n match_on=\"any\",\n row_condition=None,\n is_raw=False,\n flags=\"\"\n ) %}\n\n{% set expression %}\n {% for regex in regex_list %}\n {{ dbt_expectations.regexp_instr(column_name, regex, is_raw=is_raw, flags=flags) }} > 0\n {%- if not loop.last %}\n {{ \" and \" if match_on == \"all\" else \" or \"}}\n {% endif -%}\n {% endfor %}\n{% endset %}\n\n{{ dbt_expectations.expression_is_true(model,\n expression=expression,\n group_by_columns=None,\n row_condition=row_condition\n )\n }}\n\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_expectations.regexp_instr", "macro.dbt_expectations.expression_is_true"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.3498337, "supported_languages": null}, "macro.dbt_expectations.test_expect_column_values_to_not_match_regex": {"name": "test_expect_column_values_to_not_match_regex", "resource_type": "macro", "package_name": "dbt_expectations", "path": "macros/schema_tests/string_matching/expect_column_values_to_not_match_regex.sql", "original_file_path": "macros/schema_tests/string_matching/expect_column_values_to_not_match_regex.sql", "unique_id": "macro.dbt_expectations.test_expect_column_values_to_not_match_regex", "macro_sql": "{% test expect_column_values_to_not_match_regex(model, column_name,\n regex,\n row_condition=None,\n is_raw=False,\n flags=\"\"\n ) %}\n\n{% set expression %}\n{{ dbt_expectations.regexp_instr(column_name, regex, is_raw=is_raw, flags=flags) }} = 0\n{% endset %}\n\n{{ dbt_expectations.expression_is_true(model,\n expression=expression,\n group_by_columns=None,\n row_condition=row_condition\n )\n }}\n\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_expectations.regexp_instr", "macro.dbt_expectations.expression_is_true"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.3509538, "supported_languages": null}, "macro.dbt_expectations._get_like_pattern_expression": {"name": "_get_like_pattern_expression", "resource_type": "macro", "package_name": "dbt_expectations", "path": "macros/schema_tests/string_matching/_get_like_pattern_expression.sql", "original_file_path": "macros/schema_tests/string_matching/_get_like_pattern_expression.sql", "unique_id": "macro.dbt_expectations._get_like_pattern_expression", "macro_sql": "{% macro _get_like_pattern_expression(column_name, like_pattern, positive) %}\n{{ column_name }} {{ \"not\" if not positive else \"\" }} like '{{ like_pattern }}'\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.3513856, "supported_languages": null}, "macro.dbt_expectations.test_expression_between": {"name": "test_expression_between", "resource_type": "macro", "package_name": "dbt_expectations", "path": "macros/schema_tests/_generalized/expression_between.sql", "original_file_path": "macros/schema_tests/_generalized/expression_between.sql", "unique_id": "macro.dbt_expectations.test_expression_between", "macro_sql": "{% test expression_between(model,\n expression,\n min_value=None,\n max_value=None,\n group_by_columns=None,\n row_condition=None,\n strictly=False\n ) %}\n\n {{ dbt_expectations.expression_between(model, expression, min_value, max_value, group_by_columns, row_condition, strictly) }}\n\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_expectations.expression_between"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.3531537, "supported_languages": null}, "macro.dbt_expectations.expression_between": {"name": "expression_between", "resource_type": "macro", "package_name": "dbt_expectations", "path": "macros/schema_tests/_generalized/expression_between.sql", "original_file_path": "macros/schema_tests/_generalized/expression_between.sql", "unique_id": "macro.dbt_expectations.expression_between", "macro_sql": "{% macro expression_between(model,\n expression,\n min_value,\n max_value,\n group_by_columns,\n row_condition,\n strictly\n ) %}\n\n{%- if min_value is none and max_value is none -%}\n{{ exceptions.raise_compiler_error(\n \"You have to provide either a min_value, max_value or both.\"\n) }}\n{%- endif -%}\n\n{%- set strict_operator = \"\" if strictly else \"=\" -%}\n\n{% set expression_min_max %}\n( 1=1\n{%- if min_value is not none %} and {{ expression | trim }} >{{ strict_operator }} {{ min_value }}{% endif %}\n{%- if max_value is not none %} and {{ expression | trim }} <{{ strict_operator }} {{ max_value }}{% endif %}\n)\n{% endset %}\n\n{{ dbt_expectations.expression_is_true(model,\n expression=expression_min_max,\n group_by_columns=group_by_columns,\n row_condition=row_condition)\n }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_expectations.expression_is_true"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.3544164, "supported_languages": null}, "macro.dbt_expectations.get_select": {"name": "get_select", "resource_type": "macro", "package_name": "dbt_expectations", "path": "macros/schema_tests/_generalized/equal_expression.sql", "original_file_path": "macros/schema_tests/_generalized/equal_expression.sql", "unique_id": "macro.dbt_expectations.get_select", "macro_sql": "{% macro get_select(model, expression, row_condition, group_by) -%}\n {{ adapter.dispatch('get_select', 'dbt_expectations') (model, expression, row_condition, group_by) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_expectations.default__get_select"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.361799, "supported_languages": null}, "macro.dbt_expectations.default__get_select": {"name": "default__get_select", "resource_type": "macro", "package_name": "dbt_expectations", "path": "macros/schema_tests/_generalized/equal_expression.sql", "original_file_path": "macros/schema_tests/_generalized/equal_expression.sql", "unique_id": "macro.dbt_expectations.default__get_select", "macro_sql": "\n\n{%- macro default__get_select(model, expression, row_condition, group_by) %}\n select\n {% if group_by %}\n {% for g in group_by -%}\n {{ g }} as col_{{ loop.index }},\n {% endfor -%}\n {% endif %}\n {{ expression }} as expression\n from\n {{ model }}\n {%- if row_condition %}\n where\n {{ row_condition }}\n {% endif %}\n {% if group_by %}\n group by\n {% for g in group_by -%}\n {{ loop.index }}{% if not loop.last %},{% endif %}\n {% endfor %}\n {% endif %}\n{% endmacro -%}\n\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.3627322, "supported_languages": null}, "macro.dbt_expectations.test_equal_expression": {"name": "test_equal_expression", "resource_type": "macro", "package_name": "dbt_expectations", "path": "macros/schema_tests/_generalized/equal_expression.sql", "original_file_path": "macros/schema_tests/_generalized/equal_expression.sql", "unique_id": "macro.dbt_expectations.test_equal_expression", "macro_sql": "{% test equal_expression(model, expression,\n compare_model=None,\n compare_expression=None,\n group_by=None,\n compare_group_by=None,\n row_condition=None,\n compare_row_condition=None,\n tolerance=0.0,\n tolerance_percent=None\n ) -%}\n\n {{ adapter.dispatch('test_equal_expression', 'dbt_expectations') (\n model,\n expression,\n compare_model,\n compare_expression,\n group_by,\n compare_group_by,\n row_condition,\n compare_row_condition,\n tolerance,\n tolerance_percent) }}\n{%- endtest %}", "depends_on": {"macros": ["macro.dbt_expectations.default__test_equal_expression"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.3636966, "supported_languages": null}, "macro.dbt_expectations.default__test_equal_expression": {"name": "default__test_equal_expression", "resource_type": "macro", "package_name": "dbt_expectations", "path": "macros/schema_tests/_generalized/equal_expression.sql", "original_file_path": "macros/schema_tests/_generalized/equal_expression.sql", "unique_id": "macro.dbt_expectations.default__test_equal_expression", "macro_sql": "\n\n{%- macro default__test_equal_expression(\n model,\n expression,\n compare_model,\n compare_expression,\n group_by,\n compare_group_by,\n row_condition,\n compare_row_condition,\n tolerance,\n tolerance_percent) -%}\n\n {%- set compare_model = model if not compare_model else compare_model -%}\n {%- set compare_expression = expression if not compare_expression else compare_expression -%}\n {%- set compare_row_condition = row_condition if not compare_row_condition else compare_row_condition -%}\n {%- set compare_group_by = group_by if not compare_group_by else compare_group_by -%}\n\n {%- set n_cols = (group_by|length) if group_by else 0 %}\n with a as (\n {{ dbt_expectations.get_select(model, expression, row_condition, group_by) }}\n ),\n b as (\n {{ dbt_expectations.get_select(compare_model, compare_expression, compare_row_condition, compare_group_by) }}\n ),\n final as (\n\n select\n {% for i in range(1, n_cols + 1) -%}\n coalesce(a.col_{{ i }}, b.col_{{ i }}) as col_{{ i }},\n {% endfor %}\n a.expression,\n b.expression as compare_expression,\n abs(coalesce(a.expression, 0) - coalesce(b.expression, 0)) as expression_difference,\n abs(coalesce(a.expression, 0) - coalesce(b.expression, 0))/\n nullif(a.expression * 1.0, 0) as expression_difference_percent\n from\n {% if n_cols > 0 %}\n a\n full outer join\n b on\n {% for i in range(1, n_cols + 1) -%}\n a.col_{{ i }} = b.col_{{ i }} {% if not loop.last %}and{% endif %}\n {% endfor -%}\n {% else %}\n a cross join b\n {% endif %}\n )\n -- DEBUG:\n -- select * from final\n select\n *\n from final\n where\n {% if tolerance_percent %}\n expression_difference_percent > {{ tolerance_percent }}\n {% else %}\n expression_difference > {{ tolerance }}\n {% endif %}\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt_expectations.get_select"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.3658526, "supported_languages": null}, "macro.dbt_expectations.test_expression_is_true": {"name": "test_expression_is_true", "resource_type": "macro", "package_name": "dbt_expectations", "path": "macros/schema_tests/_generalized/expression_is_true.sql", "original_file_path": "macros/schema_tests/_generalized/expression_is_true.sql", "unique_id": "macro.dbt_expectations.test_expression_is_true", "macro_sql": "{% test expression_is_true(model,\n expression,\n test_condition=\"= true\",\n group_by_columns=None,\n row_condition=None\n ) %}\n\n {{ dbt_expectations.expression_is_true(model, expression, test_condition, group_by_columns, row_condition) }}\n\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_expectations.expression_is_true"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.3673034, "supported_languages": null}, "macro.dbt_expectations.expression_is_true": {"name": "expression_is_true", "resource_type": "macro", "package_name": "dbt_expectations", "path": "macros/schema_tests/_generalized/expression_is_true.sql", "original_file_path": "macros/schema_tests/_generalized/expression_is_true.sql", "unique_id": "macro.dbt_expectations.expression_is_true", "macro_sql": "{% macro expression_is_true(model,\n expression,\n test_condition=\"= true\",\n group_by_columns=None,\n row_condition=None\n ) %}\n {{ adapter.dispatch('expression_is_true', 'dbt_expectations') (model, expression, test_condition, group_by_columns, row_condition) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_expectations.default__expression_is_true"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.3677998, "supported_languages": null}, "macro.dbt_expectations.default__expression_is_true": {"name": "default__expression_is_true", "resource_type": "macro", "package_name": "dbt_expectations", "path": "macros/schema_tests/_generalized/expression_is_true.sql", "original_file_path": "macros/schema_tests/_generalized/expression_is_true.sql", "unique_id": "macro.dbt_expectations.default__expression_is_true", "macro_sql": "{% macro default__expression_is_true(model, expression, test_condition, group_by_columns, row_condition) -%}\nwith grouped_expression as (\n select\n {% if group_by_columns %}\n {% for group_by_column in group_by_columns -%}\n {{ group_by_column }} as col_{{ loop.index }},\n {% endfor -%}\n {% endif %}\n {{ dbt_expectations.truth_expression(expression) }}\n from {{ model }}\n {%- if row_condition %}\n where\n {{ row_condition }}\n {% endif %}\n {% if group_by_columns %}\n group by\n {% for group_by_column in group_by_columns -%}\n {{ group_by_column }}{% if not loop.last %},{% endif %}\n {% endfor %}\n {% endif %}\n\n),\nvalidation_errors as (\n\n select\n *\n from\n grouped_expression\n where\n not(expression {{ test_condition }})\n\n)\n\nselect *\nfrom validation_errors\n\n\n{% endmacro -%}", "depends_on": {"macros": ["macro.dbt_expectations.truth_expression"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.3688498, "supported_languages": null}, "macro.dbt_expectations.truth_expression": {"name": "truth_expression", "resource_type": "macro", "package_name": "dbt_expectations", "path": "macros/schema_tests/_generalized/_truth_expression.sql", "original_file_path": "macros/schema_tests/_generalized/_truth_expression.sql", "unique_id": "macro.dbt_expectations.truth_expression", "macro_sql": "{% macro truth_expression(expression) %}\n {{ adapter.dispatch('truth_expression', 'dbt_expectations') (expression) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_expectations.default__truth_expression"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.3692846, "supported_languages": null}, "macro.dbt_expectations.default__truth_expression": {"name": "default__truth_expression", "resource_type": "macro", "package_name": "dbt_expectations", "path": "macros/schema_tests/_generalized/_truth_expression.sql", "original_file_path": "macros/schema_tests/_generalized/_truth_expression.sql", "unique_id": "macro.dbt_expectations.default__truth_expression", "macro_sql": "{% macro default__truth_expression(expression) %}\n {{ expression }} as expression\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.3694701, "supported_languages": null}, "macro.dbt_expectations.ignore_row_if_expression": {"name": "ignore_row_if_expression", "resource_type": "macro", "package_name": "dbt_expectations", "path": "macros/schema_tests/_generalized/_ignore_row_if_expression.sql", "original_file_path": "macros/schema_tests/_generalized/_ignore_row_if_expression.sql", "unique_id": "macro.dbt_expectations.ignore_row_if_expression", "macro_sql": "{% macro ignore_row_if_expression(ignore_row_if, columns) %}\n {{ adapter.dispatch('ignore_row_if_expression', 'dbt_expectations') (ignore_row_if, columns) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_expectations.default__ignore_row_if_expression"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.3701944, "supported_languages": null}, "macro.dbt_expectations.default__ignore_row_if_expression": {"name": "default__ignore_row_if_expression", "resource_type": "macro", "package_name": "dbt_expectations", "path": "macros/schema_tests/_generalized/_ignore_row_if_expression.sql", "original_file_path": "macros/schema_tests/_generalized/_ignore_row_if_expression.sql", "unique_id": "macro.dbt_expectations.default__ignore_row_if_expression", "macro_sql": "{% macro default__ignore_row_if_expression(ignore_row_if, columns) %}\n {%- set ignore_row_if_values = [\"all_values_are_missing\", \"any_value_is_missing\"] -%}\n {% if ignore_row_if not in ignore_row_if_values %}\n {{ exceptions.raise_compiler_error(\n \"`ignore_row_if` must be one of \" ~ (ignore_row_if_values | join(\", \")) ~ \". Got: '\" ~ ignore_row_if ~\"'.'\"\n ) }}\n {% endif %}\n\n {%- set op = \"and\" if ignore_row_if == \"all_values_are_missing\" else \"or\" -%}\n not (\n {% for column in columns -%}\n {{ column }} is null{% if not loop.last %} {{ op }} {% endif %}\n {% endfor %}\n )\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.3711896, "supported_languages": null}, "macro.dbt_expectations.test_expect_column_values_to_not_be_in_set": {"name": "test_expect_column_values_to_not_be_in_set", "resource_type": "macro", "package_name": "dbt_expectations", "path": "macros/schema_tests/column_values_basic/expect_column_values_to_not_be_in_set.sql", "original_file_path": "macros/schema_tests/column_values_basic/expect_column_values_to_not_be_in_set.sql", "unique_id": "macro.dbt_expectations.test_expect_column_values_to_not_be_in_set", "macro_sql": "{% test expect_column_values_to_not_be_in_set(model, column_name,\n value_set,\n quote_values=True,\n row_condition=None\n ) %}\n\nwith all_values as (\n\n select\n {{ column_name }} as value_field\n\n from {{ model }}\n {% if row_condition %}\n where {{ row_condition }}\n {% endif %}\n\n),\nset_values as (\n\n {% for value in value_set -%}\n select\n {% if quote_values -%}\n cast('{{ value }}' as {{ dbt.type_string() }})\n {%- else -%}\n {{ value }}\n {%- endif %} as value_field\n {% if not loop.last %}union all{% endif %}\n {% endfor %}\n),\nvalidation_errors as (\n -- values from the model that match the set\n select\n v.value_field\n from\n all_values v\n join\n set_values s on v.value_field = s.value_field\n\n)\n\nselect *\nfrom validation_errors\n\n{% endtest %}", "depends_on": {"macros": ["macro.dbt.type_string"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.372611, "supported_languages": null}, "macro.dbt_expectations.test_expect_column_values_to_not_be_null": {"name": "test_expect_column_values_to_not_be_null", "resource_type": "macro", "package_name": "dbt_expectations", "path": "macros/schema_tests/column_values_basic/expect_column_values_to_not_be_null.sql", "original_file_path": "macros/schema_tests/column_values_basic/expect_column_values_to_not_be_null.sql", "unique_id": "macro.dbt_expectations.test_expect_column_values_to_not_be_null", "macro_sql": "{% test expect_column_values_to_not_be_null(model, column_name, row_condition=None) %}\n\n{% set expression = column_name ~ \" is not null\" %}\n\n{{ dbt_expectations.expression_is_true(model,\n expression=expression,\n group_by_columns=None,\n row_condition=row_condition\n )\n }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_expectations.expression_is_true"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.3733616, "supported_languages": null}, "macro.dbt_expectations.test_expect_column_values_to_be_decreasing": {"name": "test_expect_column_values_to_be_decreasing", "resource_type": "macro", "package_name": "dbt_expectations", "path": "macros/schema_tests/column_values_basic/expect_column_values_to_be_decreasing.sql", "original_file_path": "macros/schema_tests/column_values_basic/expect_column_values_to_be_decreasing.sql", "unique_id": "macro.dbt_expectations.test_expect_column_values_to_be_decreasing", "macro_sql": "{% test expect_column_values_to_be_decreasing(model, column_name,\n sort_column=None,\n strictly=True,\n row_condition=None,\n group_by=None) %}\n\n{%- set sort_column = column_name if not sort_column else sort_column -%}\n{%- set operator = \"<\" if strictly else \"<=\" %}\nwith all_values as (\n\n select\n {{ sort_column }} as sort_column,\n {%- if group_by -%}\n {{ group_by | join(\", \") }},\n {%- endif %}\n {{ column_name }} as value_field\n from {{ model }}\n {% if row_condition %}\n where {{ row_condition }}\n {% endif %}\n\n),\nadd_lag_values as (\n\n select\n sort_column,\n value_field,\n lag(value_field) over\n {%- if not group_by -%}\n (order by sort_column)\n {%- else -%}\n (partition by {{ group_by | join(\", \") }} order by sort_column)\n {%- endif %} as value_field_lag\n from\n all_values\n\n),\nvalidation_errors as (\n\n select\n *\n from\n add_lag_values\n where\n value_field_lag is not null\n and\n not (value_field {{ operator }} value_field_lag)\n\n)\nselect *\nfrom validation_errors\n{% endtest %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.375241, "supported_languages": null}, "macro.dbt_expectations.test_expect_column_values_to_be_in_set": {"name": "test_expect_column_values_to_be_in_set", "resource_type": "macro", "package_name": "dbt_expectations", "path": "macros/schema_tests/column_values_basic/expect_column_values_to_be_in_set.sql", "original_file_path": "macros/schema_tests/column_values_basic/expect_column_values_to_be_in_set.sql", "unique_id": "macro.dbt_expectations.test_expect_column_values_to_be_in_set", "macro_sql": "{% test expect_column_values_to_be_in_set(model, column_name,\n value_set,\n quote_values=True,\n row_condition=None\n ) %}\n\nwith all_values as (\n\n select\n {{ column_name }} as value_field\n\n from {{ model }}\n {% if row_condition %}\n where {{ row_condition }}\n {% endif %}\n\n),\nset_values as (\n\n {% for value in value_set -%}\n select\n {% if quote_values -%}\n cast('{{ value }}' as {{ dbt.type_string() }})\n {%- else -%}\n {{ value }}\n {%- endif %} as value_field\n {% if not loop.last %}union all{% endif %}\n {% endfor %}\n),\nvalidation_errors as (\n -- values from the model that are not in the set\n select\n v.value_field\n from\n all_values v\n left join\n set_values s on v.value_field = s.value_field\n where\n s.value_field is null\n\n)\n\nselect *\nfrom validation_errors\n\n{% endtest %}", "depends_on": {"macros": ["macro.dbt.type_string"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.3766892, "supported_languages": null}, "macro.dbt_expectations.test_expect_column_values_to_be_increasing": {"name": "test_expect_column_values_to_be_increasing", "resource_type": "macro", "package_name": "dbt_expectations", "path": "macros/schema_tests/column_values_basic/expect_column_values_to_be_increasing.sql", "original_file_path": "macros/schema_tests/column_values_basic/expect_column_values_to_be_increasing.sql", "unique_id": "macro.dbt_expectations.test_expect_column_values_to_be_increasing", "macro_sql": "{% test expect_column_values_to_be_increasing(model, column_name,\n sort_column=None,\n strictly=True,\n row_condition=None,\n group_by=None) %}\n\n{%- set sort_column = column_name if not sort_column else sort_column -%}\n{%- set operator = \">\" if strictly else \">=\" -%}\nwith all_values as (\n\n select\n {{ sort_column }} as sort_column,\n {%- if group_by -%}\n {{ group_by | join(\", \") }},\n {%- endif %}\n {{ column_name }} as value_field\n from {{ model }}\n {% if row_condition %}\n where {{ row_condition }}\n {% endif %}\n\n),\nadd_lag_values as (\n\n select\n sort_column,\n {%- if group_by -%}\n {{ group_by | join(\", \") }},\n {%- endif %}\n value_field,\n lag(value_field) over\n {%- if not group_by -%}\n (order by sort_column)\n {%- else -%}\n (partition by {{ group_by | join(\", \") }} order by sort_column)\n {%- endif %} as value_field_lag\n from\n all_values\n\n),\nvalidation_errors as (\n select\n *\n from\n add_lag_values\n where\n value_field_lag is not null\n and\n not (value_field {{ operator }} value_field_lag)\n\n)\nselect *\nfrom validation_errors\n{% endtest %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.3788958, "supported_languages": null}, "macro.dbt_expectations.test_expect_column_values_to_be_null": {"name": "test_expect_column_values_to_be_null", "resource_type": "macro", "package_name": "dbt_expectations", "path": "macros/schema_tests/column_values_basic/expect_column_values_to_be_null.sql", "original_file_path": "macros/schema_tests/column_values_basic/expect_column_values_to_be_null.sql", "unique_id": "macro.dbt_expectations.test_expect_column_values_to_be_null", "macro_sql": "{% test expect_column_values_to_be_null(model, column_name, row_condition=None) %}\n\n{% set expression = column_name ~ \" is null\" %}\n\n{{ dbt_expectations.expression_is_true(model,\n expression=expression,\n group_by_columns=None,\n row_condition=row_condition\n )\n }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_expectations.expression_is_true"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.3796232, "supported_languages": null}, "macro.dbt_expectations.test_expect_column_values_to_be_of_type": {"name": "test_expect_column_values_to_be_of_type", "resource_type": "macro", "package_name": "dbt_expectations", "path": "macros/schema_tests/column_values_basic/expect_column_values_to_be_of_type.sql", "original_file_path": "macros/schema_tests/column_values_basic/expect_column_values_to_be_of_type.sql", "unique_id": "macro.dbt_expectations.test_expect_column_values_to_be_of_type", "macro_sql": "{%- test expect_column_values_to_be_of_type(model, column_name, column_type) -%}\n{{ dbt_expectations.test_expect_column_values_to_be_in_type_list(model, column_name, [column_type]) }}\n{%- endtest -%}", "depends_on": {"macros": ["macro.dbt_expectations.test_expect_column_values_to_be_in_type_list"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.3800006, "supported_languages": null}, "macro.dbt_expectations.test_expect_column_values_to_have_consistent_casing": {"name": "test_expect_column_values_to_have_consistent_casing", "resource_type": "macro", "package_name": "dbt_expectations", "path": "macros/schema_tests/column_values_basic/expect_column_values_to_have_consistent_casing.sql", "original_file_path": "macros/schema_tests/column_values_basic/expect_column_values_to_have_consistent_casing.sql", "unique_id": "macro.dbt_expectations.test_expect_column_values_to_have_consistent_casing", "macro_sql": "{% test expect_column_values_to_have_consistent_casing(model, column_name, display_inconsistent_columns=False) %}\n\nwith test_data as (\n\n select\n distinct {{ column_name }} as distinct_values\n from\n {{ model }}\n\n ),\n {% if display_inconsistent_columns %}\n validation_errors as (\n\n select\n lower(distinct_values) as inconsistent_columns,\n count(distinct_values) as set_count_case_insensitive\n from\n test_data\n group by 1\n having\n count(distinct_values) > 1\n\n )\n select * from validation_errors\n {% else %}\n validation_errors as (\n\n select\n count(1) as set_count,\n count(distinct lower(distinct_values)) as set_count_case_insensitive\n from\n test_data\n\n )\n select *\n from\n validation_errors\n where\n set_count != set_count_case_insensitive\n {% endif %}\n {%- endtest -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.3806727, "supported_languages": null}, "macro.dbt_expectations.test_expect_column_values_to_be_between": {"name": "test_expect_column_values_to_be_between", "resource_type": "macro", "package_name": "dbt_expectations", "path": "macros/schema_tests/column_values_basic/expect_column_values_to_be_between.sql", "original_file_path": "macros/schema_tests/column_values_basic/expect_column_values_to_be_between.sql", "unique_id": "macro.dbt_expectations.test_expect_column_values_to_be_between", "macro_sql": "{% test expect_column_values_to_be_between(model, column_name,\n min_value=None,\n max_value=None,\n row_condition=None,\n strictly=False\n ) %}\n\n{% set expression %}\n{{ column_name }}\n{% endset %}\n\n{{ dbt_expectations.expression_between(model,\n expression=expression,\n min_value=min_value,\n max_value=max_value,\n group_by_columns=None,\n row_condition=row_condition,\n strictly=strictly\n ) }}\n\n\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_expectations.expression_between"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.3818343, "supported_languages": null}, "macro.dbt_expectations.test_expect_column_values_to_be_unique": {"name": "test_expect_column_values_to_be_unique", "resource_type": "macro", "package_name": "dbt_expectations", "path": "macros/schema_tests/column_values_basic/expect_column_values_to_be_unique.sql", "original_file_path": "macros/schema_tests/column_values_basic/expect_column_values_to_be_unique.sql", "unique_id": "macro.dbt_expectations.test_expect_column_values_to_be_unique", "macro_sql": "{% test expect_column_values_to_be_unique(model, column_name, row_condition=None) %}\n{{ dbt_expectations.test_expect_compound_columns_to_be_unique(model, [column_name], row_condition=row_condition) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_expectations.test_expect_compound_columns_to_be_unique"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.3822563, "supported_languages": null}, "macro.dbt_expectations.test_expect_column_values_to_be_in_type_list": {"name": "test_expect_column_values_to_be_in_type_list", "resource_type": "macro", "package_name": "dbt_expectations", "path": "macros/schema_tests/column_values_basic/expect_column_values_to_be_in_type_list.sql", "original_file_path": "macros/schema_tests/column_values_basic/expect_column_values_to_be_in_type_list.sql", "unique_id": "macro.dbt_expectations.test_expect_column_values_to_be_in_type_list", "macro_sql": "{%- test expect_column_values_to_be_in_type_list(model, column_name, column_type_list) -%}\n{%- if execute -%}\n\n {%- set column_name = column_name | upper -%}\n {%- set columns_in_relation = adapter.get_columns_in_relation(model) -%}\n {%- set column_type_list = column_type_list| map(\"upper\") | list -%}\n with relation_columns as (\n\n {% for column in columns_in_relation %}\n select\n cast('{{ escape_single_quotes(column.name | upper) }}' as {{ dbt.type_string() }}) as relation_column,\n cast('{{ column.dtype | upper }}' as {{ dbt.type_string() }}) as relation_column_type\n {% if not loop.last %}union all{% endif %}\n {% endfor %}\n ),\n test_data as (\n\n select\n *\n from\n relation_columns\n where\n relation_column = '{{ column_name }}'\n and\n relation_column_type not in ('{{ column_type_list | join(\"', '\") }}')\n\n )\n select *\n from test_data\n\n{%- endif -%}\n{%- endtest -%}", "depends_on": {"macros": ["macro.dbt.escape_single_quotes", "macro.dbt.type_string"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.3840804, "supported_languages": null}, "macro.dbt_expectations.test_expect_column_values_to_be_within_n_stdevs": {"name": "test_expect_column_values_to_be_within_n_stdevs", "resource_type": "macro", "package_name": "dbt_expectations", "path": "macros/schema_tests/distributional/expect_column_values_to_be_within_n_stdevs.sql", "original_file_path": "macros/schema_tests/distributional/expect_column_values_to_be_within_n_stdevs.sql", "unique_id": "macro.dbt_expectations.test_expect_column_values_to_be_within_n_stdevs", "macro_sql": "{% test expect_column_values_to_be_within_n_stdevs(model,\n column_name,\n group_by=None,\n sigma_threshold=3\n ) -%}\n {{\n adapter.dispatch('test_expect_column_values_to_be_within_n_stdevs', 'dbt_expectations') (\n model, column_name, group_by, sigma_threshold\n )\n }}\n{%- endtest %}", "depends_on": {"macros": ["macro.dbt_expectations.default__test_expect_column_values_to_be_within_n_stdevs"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.3854592, "supported_languages": null}, "macro.dbt_expectations.default__test_expect_column_values_to_be_within_n_stdevs": {"name": "default__test_expect_column_values_to_be_within_n_stdevs", "resource_type": "macro", "package_name": "dbt_expectations", "path": "macros/schema_tests/distributional/expect_column_values_to_be_within_n_stdevs.sql", "original_file_path": "macros/schema_tests/distributional/expect_column_values_to_be_within_n_stdevs.sql", "unique_id": "macro.dbt_expectations.default__test_expect_column_values_to_be_within_n_stdevs", "macro_sql": "{% macro default__test_expect_column_values_to_be_within_n_stdevs(model,\n column_name,\n group_by,\n sigma_threshold\n ) %}\n\nwith metric_values as (\n\n select\n {{ group_by | join(\",\") ~ \",\" if group_by }}\n sum({{ column_name }}) as {{ column_name }}\n from\n {{ model }}\n {% if group_by -%}\n {{ dbt_expectations.group_by(group_by | length) }}\n {%- endif %}\n\n),\nmetric_values_with_statistics as (\n\n select\n *,\n avg({{ column_name }}) over() as {{ column_name }}_average,\n stddev({{ column_name }}) over() as {{ column_name }}_stddev\n from\n metric_values\n\n),\nmetric_values_z_scores as (\n\n select\n *,\n ({{ column_name }} - {{ column_name }}_average)/\n nullif({{ column_name }}_stddev, 0) as {{ column_name }}_sigma\n from\n metric_values_with_statistics\n\n)\nselect\n *\nfrom\n metric_values_z_scores\nwhere\n abs({{ column_name }}_sigma) > {{ sigma_threshold }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_expectations.group_by"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.386437, "supported_languages": null}, "macro.dbt_expectations.test_expect_row_values_to_have_data_for_every_n_datepart": {"name": "test_expect_row_values_to_have_data_for_every_n_datepart", "resource_type": "macro", "package_name": "dbt_expectations", "path": "macros/schema_tests/distributional/expect_row_values_to_have_data_for_every_n_datepart.sql", "original_file_path": "macros/schema_tests/distributional/expect_row_values_to_have_data_for_every_n_datepart.sql", "unique_id": "macro.dbt_expectations.test_expect_row_values_to_have_data_for_every_n_datepart", "macro_sql": "{%- test expect_row_values_to_have_data_for_every_n_datepart(model,\n date_col,\n date_part=\"day\",\n interval=None,\n row_condition=None,\n exclusion_condition=None,\n test_start_date=None,\n test_end_date=None) -%}\n{% if not execute %}\n {{ return('') }}\n{% endif %}\n\n{% if not test_start_date or not test_end_date %}\n {% set sql %}\n\n select\n min(cast({{ date_col }} as date)) as start_{{ date_part }},\n max(cast({{ date_col }} as date)) as end_{{ date_part }}\n from {{ model }}\n {% if row_condition %}\n where {{ row_condition }}\n {% endif %}\n\n {% endset %}\n\n {%- set dr = run_query(sql) -%}\n\n {%- set db_start_date = dr.columns[0].values()[0] -%}\n {%- set db_end_date = dr.columns[1].values()[0] -%}\n\n {% if db_start_date is not string %}\n {%- set db_start_date = db_start_date.strftime('%Y-%m-%d') -%}\n {%- set db_end_date = db_end_date.strftime('%Y-%m-%d') -%}\n {% endif %}\n\n{% endif %}\n\n{% if not test_start_date %}\n{% set start_date = db_start_date %}\n{% else %}\n{% set start_date = test_start_date %}\n{% endif %}\n\n\n{% if not test_end_date %}\n{% set end_date = db_end_date %}\n{% else %}\n{% set end_date = test_end_date %}\n{% endif %}\n\nwith base_dates as (\n\n {{ dbt_date.get_base_dates(start_date=start_date, end_date=end_date, datepart=date_part) }}\n {% if interval %}\n {#\n Filter the date spine created above down to the interval granularity using a modulo operation.\n The number of date_parts after the start_date divided by the integer interval will produce no remainder for the desired intervals,\n e.g. for 2-day interval from a starting Jan 1, 2020:\n params: start_date = '2020-01-01', date_part = 'day', interval = 2\n date spine created above: [2020-01-01, 2020-01-02, 2020-01-03, 2020-01-04, 2020-01-05, ...]\n The first parameter to the `mod` function would be the number of days between the start_date and the spine date, i.e. [0, 1, 2, 3, 4 ...]\n The second parameter to the `mod` function would be the integer interval, i.e. 2\n This modulo operation produces the following remainders: [0, 1, 0, 1, 0, ...]\n Filtering the spine only where this remainder == 0 will return a spine with every other day as desired, i.e. [2020-01-01, 2020-01-03, 2020-01-05, ...]\n #}\n where mod(\n cast({{ dbt.datediff(\"'\" ~ start_date ~ \"'\", 'date_' ~ date_part, date_part) }} as {{ dbt.type_int() }}),\n cast({{interval}} as {{ dbt.type_int() }})\n ) = 0\n {% endif %}\n\n),\nmodel_data as (\n\n select\n {% if not interval %}\n\n cast({{ dbt.date_trunc(date_part, date_col) }} as {{ dbt_expectations.type_datetime() }}) as date_{{ date_part }},\n\n {% else %}\n {#\n Use a modulo operator to determine the number of intervals that a date_col is away from the interval-date spine\n and subtracts that amount to effectively slice each date_col record into its corresponding spine bucket,\n e.g. given a date_col of with records [2020-01-01, 2020-01-02, 2020-01-03, 2020-01-11, 2020-01-12]\n if we want to slice these dates into their 2-day buckets starting Jan 1, 2020 (start_date = '2020-01-01', date_part='day', interval=2),\n the modulo operation described above will produce these remainders: [0, 1, 0, 0, 1]\n subtracting that number of days from the observations will produce records [2020-01-01, 2020-01-01, 2020-01-03, 2020-01-11, 2020-01-11],\n all of which align with records from the interval-date spine\n #}\n {{ dbt.dateadd(\n date_part,\n \"mod(\n cast(\" ~ dbt.datediff(\"'\" ~ start_date ~ \"'\", date_col, date_part) ~ \" as \" ~ dbt.type_int() ~ \" ),\n cast(\" ~ interval ~ \" as \" ~ dbt.type_int() ~ \" )\n ) * (-1)\",\n \"cast( \" ~ dbt.date_trunc(date_part, date_col) ~ \" as \" ~ dbt_expectations.type_datetime() ~ \")\"\n )}} as date_{{ date_part }},\n\n {% endif %}\n\n count(*) as row_cnt\n from\n {{ model }} f\n {% if row_condition %}\n where {{ row_condition }}\n {% endif %}\n group by\n date_{{date_part}}\n\n),\n\nfinal as (\n\n select\n cast(d.date_{{ date_part }} as {{ dbt_expectations.type_datetime() }}) as date_{{ date_part }},\n case when f.date_{{ date_part }} is null then true else false end as is_missing,\n coalesce(f.row_cnt, 0) as row_cnt\n from\n base_dates d\n left join\n model_data f on cast(d.date_{{ date_part }} as {{ dbt_expectations.type_datetime() }}) = f.date_{{ date_part }}\n)\nselect\n *\nfrom final\nwhere row_cnt = 0\n{% if exclusion_condition %}\n and {{ exclusion_condition }}\n{% endif %}\n{%- endtest -%}", "depends_on": {"macros": ["macro.elementary.run_query", "macro.dbt_date.get_base_dates", "macro.dbt.datediff", "macro.dbt.type_int", "macro.dbt.date_trunc", "macro.dbt_expectations.type_datetime", "macro.dbt.dateadd"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.3931832, "supported_languages": null}, "macro.dbt_expectations._get_metric_expression": {"name": "_get_metric_expression", "resource_type": "macro", "package_name": "dbt_expectations", "path": "macros/schema_tests/distributional/expect_column_values_to_be_within_n_moving_stdevs.sql", "original_file_path": "macros/schema_tests/distributional/expect_column_values_to_be_within_n_moving_stdevs.sql", "unique_id": "macro.dbt_expectations._get_metric_expression", "macro_sql": "{%- macro _get_metric_expression(metric_column, take_logs) -%}\n\n{%- if take_logs %}\n{%- set expr = \"nullif(\" ~ metric_column ~ \", 0)\" -%}\ncoalesce({{ dbt_expectations.log_natural(expr) }}, 0)\n{%- else -%}\ncoalesce({{ metric_column }}, 0)\n{%- endif %}\n\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt_expectations.log_natural"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.3987525, "supported_languages": null}, "macro.dbt_expectations.test_expect_column_values_to_be_within_n_moving_stdevs": {"name": "test_expect_column_values_to_be_within_n_moving_stdevs", "resource_type": "macro", "package_name": "dbt_expectations", "path": "macros/schema_tests/distributional/expect_column_values_to_be_within_n_moving_stdevs.sql", "original_file_path": "macros/schema_tests/distributional/expect_column_values_to_be_within_n_moving_stdevs.sql", "unique_id": "macro.dbt_expectations.test_expect_column_values_to_be_within_n_moving_stdevs", "macro_sql": "{% test expect_column_values_to_be_within_n_moving_stdevs(model,\n column_name,\n date_column_name,\n group_by=None,\n period='day',\n lookback_periods=1,\n trend_periods=7,\n test_periods=14,\n sigma_threshold=3,\n sigma_threshold_upper=None,\n sigma_threshold_lower=None,\n take_diffs=true,\n take_logs=true\n ) -%}\n {{ adapter.dispatch('test_expect_column_values_to_be_within_n_moving_stdevs', 'dbt_expectations') (model,\n column_name,\n date_column_name,\n group_by,\n period,\n lookback_periods,\n trend_periods,\n test_periods,\n sigma_threshold,\n sigma_threshold_upper,\n sigma_threshold_lower,\n take_diffs,\n take_logs\n ) }}\n{%- endtest %}", "depends_on": {"macros": ["macro.dbt_expectations.default__test_expect_column_values_to_be_within_n_moving_stdevs"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.3996563, "supported_languages": null}, "macro.dbt_expectations.default__test_expect_column_values_to_be_within_n_moving_stdevs": {"name": "default__test_expect_column_values_to_be_within_n_moving_stdevs", "resource_type": "macro", "package_name": "dbt_expectations", "path": "macros/schema_tests/distributional/expect_column_values_to_be_within_n_moving_stdevs.sql", "original_file_path": "macros/schema_tests/distributional/expect_column_values_to_be_within_n_moving_stdevs.sql", "unique_id": "macro.dbt_expectations.default__test_expect_column_values_to_be_within_n_moving_stdevs", "macro_sql": "{% macro default__test_expect_column_values_to_be_within_n_moving_stdevs(model,\n column_name,\n date_column_name,\n group_by,\n period,\n lookback_periods,\n trend_periods,\n test_periods,\n sigma_threshold,\n sigma_threshold_upper,\n sigma_threshold_lower,\n take_diffs,\n take_logs\n ) %}\n\n{%- set sigma_threshold_upper = sigma_threshold_upper if sigma_threshold_upper else sigma_threshold -%}\n{%- set sigma_threshold_lower = sigma_threshold_lower if sigma_threshold_lower else -1 * sigma_threshold -%}\n{%- set partition_by = \"partition by \" ~ (group_by | join(\",\")) if group_by -%}\n{%- set group_by_length = (group_by | length ) if group_by else 0 -%}\n\nwith metric_values as (\n\n with grouped_metric_values as (\n\n select\n {{ dbt.date_trunc(period, date_column_name) }} as metric_period,\n {{ group_by | join(\",\") ~ \",\" if group_by }}\n sum({{ column_name }}) as agg_metric_value\n from\n {{ model }}\n {{ dbt_expectations.group_by(1 + group_by_length) }}\n\n )\n {%- if take_diffs %}\n , grouped_metric_values_with_priors as (\n\n select\n *,\n lag(agg_metric_value, {{ lookback_periods }}) over(\n {{ partition_by }}\n order by metric_period) as prior_agg_metric_value\n from\n grouped_metric_values d\n\n )\n select\n *,\n {{ dbt_expectations._get_metric_expression(\"agg_metric_value\", take_logs) }}\n -\n {{ dbt_expectations._get_metric_expression(\"prior_agg_metric_value\", take_logs) }}\n as metric_test_value\n from\n grouped_metric_values_with_priors d\n\n {%- else %}\n\n select\n *,\n {{ dbt_expectations._get_metric_expression(\"agg_metric_value\", take_logs) }}\n as metric_test_value\n from\n grouped_metric_values\n\n {%- endif %}\n\n),\nmetric_moving_calcs as (\n\n select\n *,\n avg(metric_test_value)\n over({{ partition_by }}\n order by metric_period rows\n between {{ trend_periods }} preceding and 1 preceding) as metric_test_rolling_average,\n stddev(metric_test_value)\n over({{ partition_by }}\n order by metric_period rows\n between {{ trend_periods }} preceding and 1 preceding) as metric_test_rolling_stddev\n from\n metric_values\n\n),\nmetric_sigma as (\n\n select\n *,\n (metric_test_value - metric_test_rolling_average) as metric_test_delta,\n (metric_test_value - metric_test_rolling_average)/\n nullif(metric_test_rolling_stddev, 0) as metric_test_sigma\n from\n metric_moving_calcs\n\n)\nselect\n *\nfrom\n metric_sigma\nwhere\n\n metric_period >= cast(\n {{ dbt.dateadd(period, -test_periods, dbt.date_trunc(period, dbt_date.now())) }}\n as {{ dbt_expectations.type_timestamp() }})\n and\n metric_period < {{ dbt.date_trunc(period, dbt_date.now()) }}\n and\n\n not (\n metric_test_sigma >= {{ sigma_threshold_lower }} and\n metric_test_sigma <= {{ sigma_threshold_upper }}\n )\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt.date_trunc", "macro.dbt_expectations.group_by", "macro.dbt_expectations._get_metric_expression", "macro.dbt.dateadd", "macro.dbt_date.now", "macro.dbt_expectations.type_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.4021523, "supported_languages": null}, "macro.dbt_expectations.regexp_instr": {"name": "regexp_instr", "resource_type": "macro", "package_name": "dbt_expectations", "path": "macros/regex/regexp_instr.sql", "original_file_path": "macros/regex/regexp_instr.sql", "unique_id": "macro.dbt_expectations.regexp_instr", "macro_sql": "{% macro regexp_instr(source_value, regexp, position=1, occurrence=1, is_raw=False, flags=\"\") %}\n\n {{ adapter.dispatch('regexp_instr', 'dbt_expectations')(\n source_value, regexp, position, occurrence, is_raw, flags\n ) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_expectations.postgres__regexp_instr"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.4047263, "supported_languages": null}, "macro.dbt_expectations.default__regexp_instr": {"name": "default__regexp_instr", "resource_type": "macro", "package_name": "dbt_expectations", "path": "macros/regex/regexp_instr.sql", "original_file_path": "macros/regex/regexp_instr.sql", "unique_id": "macro.dbt_expectations.default__regexp_instr", "macro_sql": "{% macro default__regexp_instr(source_value, regexp, position, occurrence, is_raw, flags) %}\n{# unclear if other databases support raw strings or flags #}\n{% if is_raw or flags %}\n {{ exceptions.warn(\n \"is_raw and flags options are not supported for this adapter \"\n ~ \"and are being ignored.\"\n ) }}\n{% endif %}\nregexp_instr({{ source_value }}, '{{ regexp }}', {{ position }}, {{ occurrence }})\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.4053316, "supported_languages": null}, "macro.dbt_expectations.snowflake__regexp_instr": {"name": "snowflake__regexp_instr", "resource_type": "macro", "package_name": "dbt_expectations", "path": "macros/regex/regexp_instr.sql", "original_file_path": "macros/regex/regexp_instr.sql", "unique_id": "macro.dbt_expectations.snowflake__regexp_instr", "macro_sql": "{% macro snowflake__regexp_instr(source_value, regexp, position, occurrence, is_raw, flags) %}\n{%- set regexp = \"$$\" ~ regexp ~ \"$$\" if is_raw else \"'\" ~ regexp ~ \"'\" -%}\n{% if flags %}{{ dbt_expectations._validate_flags(flags, 'cimes') }}{% endif %}\nregexp_instr({{ source_value }}, {{ regexp }}, {{ position }}, {{ occurrence }}, 0, '{{ flags }}')\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_expectations._validate_flags"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.4060793, "supported_languages": null}, "macro.dbt_expectations.bigquery__regexp_instr": {"name": "bigquery__regexp_instr", "resource_type": "macro", "package_name": "dbt_expectations", "path": "macros/regex/regexp_instr.sql", "original_file_path": "macros/regex/regexp_instr.sql", "unique_id": "macro.dbt_expectations.bigquery__regexp_instr", "macro_sql": "{% macro bigquery__regexp_instr(source_value, regexp, position, occurrence, is_raw, flags) %}\n{% if flags %}\n {{ dbt_expectations._validate_re2_flags(flags) }}\n {# BigQuery prepends \"(?flags)\" to set flags for current group #}\n {%- set regexp = \"(?\" ~ flags ~ \")\" ~ regexp -%}\n{% endif %}\n{%- set regexp = \"r'\" ~ regexp ~ \"'\" if is_raw else \"'\" ~ regexp ~ \"'\" -%}\nregexp_instr({{ source_value }}, {{ regexp }}, {{ position }}, {{ occurrence }})\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_expectations._validate_re2_flags"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.4069078, "supported_languages": null}, "macro.dbt_expectations.postgres__regexp_instr": {"name": "postgres__regexp_instr", "resource_type": "macro", "package_name": "dbt_expectations", "path": "macros/regex/regexp_instr.sql", "original_file_path": "macros/regex/regexp_instr.sql", "unique_id": "macro.dbt_expectations.postgres__regexp_instr", "macro_sql": "{% macro postgres__regexp_instr(source_value, regexp, position, occurrence, is_raw, flags) %}\n{% if flags %}{{ dbt_expectations._validate_flags(flags, 'bcegimnpqstwx') }}{% endif %}\ncoalesce(array_length((select regexp_matches({{ source_value }}, '{{ regexp }}', '{{ flags }}')), 1), 0)\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_expectations._validate_flags"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.4074156, "supported_languages": null}, "macro.dbt_expectations.redshift__regexp_instr": {"name": "redshift__regexp_instr", "resource_type": "macro", "package_name": "dbt_expectations", "path": "macros/regex/regexp_instr.sql", "original_file_path": "macros/regex/regexp_instr.sql", "unique_id": "macro.dbt_expectations.redshift__regexp_instr", "macro_sql": "{% macro redshift__regexp_instr(source_value, regexp, position, occurrence, is_raw, flags) %}\n{% if flags %}{{ dbt_expectations._validate_flags(flags, 'ciep') }}{% endif %}\nregexp_instr({{ source_value }}, '{{ regexp }}', {{ position }}, {{ occurrence }}, 0, '{{ flags }}')\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_expectations._validate_flags"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.4079754, "supported_languages": null}, "macro.dbt_expectations.duckdb__regexp_instr": {"name": "duckdb__regexp_instr", "resource_type": "macro", "package_name": "dbt_expectations", "path": "macros/regex/regexp_instr.sql", "original_file_path": "macros/regex/regexp_instr.sql", "unique_id": "macro.dbt_expectations.duckdb__regexp_instr", "macro_sql": "{% macro duckdb__regexp_instr(source_value, regexp, position, occurrence, is_raw, flags) %}\n{% if flags %}{{ dbt_expectations._validate_flags(flags, 'ciep') }}{% endif %}\nregexp_matches({{ source_value }}, '{{ regexp }}', '{{ flags }}')\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_expectations._validate_flags"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.40847, "supported_languages": null}, "macro.dbt_expectations.spark__regexp_instr": {"name": "spark__regexp_instr", "resource_type": "macro", "package_name": "dbt_expectations", "path": "macros/regex/regexp_instr.sql", "original_file_path": "macros/regex/regexp_instr.sql", "unique_id": "macro.dbt_expectations.spark__regexp_instr", "macro_sql": "{% macro spark__regexp_instr(source_value, regexp, position, occurrence, is_raw, flags) %}\n{% if is_raw or flags %}\n {{ exceptions.warn(\n \"is_raw and flags options are not supported for this adapter \"\n ~ \"and are being ignored.\"\n ) }}\n{% endif %}\nlength(regexp_extract({{ source_value }}, '{{ regexp }}', 0))\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.408999, "supported_languages": null}, "macro.dbt_expectations.trino__regexp_instr": {"name": "trino__regexp_instr", "resource_type": "macro", "package_name": "dbt_expectations", "path": "macros/regex/regexp_instr.sql", "original_file_path": "macros/regex/regexp_instr.sql", "unique_id": "macro.dbt_expectations.trino__regexp_instr", "macro_sql": "{% macro trino__regexp_instr(source_value, regexp, position, occurrence, is_raw, flags) %}\n {% if flags %}\n {{ dbt_expectations._validate_re2_flags(flags) }}\n {# Trino prepends \"(?flags)\" to set flags for current group #}\n {%- set regexp = \"(?\" ~ flags ~ \")\" ~ regexp -%}\n {% endif %}\n {% if is_raw %}\n {{ exceptions.warn(\n \"is_raw option is not supported for this adapter \"\n ~ \"and is being ignored.\"\n ) }}\n {% endif %}\n {%- set regexp_query = \"regexp_position(\" ~ source_value ~ \", '\" ~ regexp ~ \"', \" ~ position ~ \", \" ~ occurrence ~ \")\" -%}\n {# Trino regexp_position returns -1 if not found. Change it to 0, to be consistent with other adapters #}\n if({{ regexp_query}} = -1, 0, {{ regexp_query}})\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_expectations._validate_re2_flags"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.4102137, "supported_languages": null}, "macro.dbt_expectations._validate_flags": {"name": "_validate_flags", "resource_type": "macro", "package_name": "dbt_expectations", "path": "macros/regex/regexp_instr.sql", "original_file_path": "macros/regex/regexp_instr.sql", "unique_id": "macro.dbt_expectations._validate_flags", "macro_sql": "{% macro _validate_flags(flags, alphabet) %}\n{% for flag in flags %}\n {% if flag not in alphabet %}\n {# Using raise_compiler_error causes disabled tests with invalid flags to fail compilation #}\n {{ exceptions.warn(\n \"flag \" ~ flag ~ \" not in list of allowed flags for this adapter: \" ~ alphabet | join(\", \")\n ) }}\n {% endif %}\n{% endfor %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.410809, "supported_languages": null}, "macro.dbt_expectations._validate_re2_flags": {"name": "_validate_re2_flags", "resource_type": "macro", "package_name": "dbt_expectations", "path": "macros/regex/regexp_instr.sql", "original_file_path": "macros/regex/regexp_instr.sql", "unique_id": "macro.dbt_expectations._validate_re2_flags", "macro_sql": "{% macro _validate_re2_flags(flags) %}\n{# Re2 supports following flags: #}\n{# i : case-insensitive (default fault) #}\n{# m : multi-line mode: ^ and $ match begin/end line in addition to begin/end text (default false) #}\n{# s : let . match \\n (default false) #}\n{# U : ungreedy: swap meaning of x* and x*?, x+ and x+?, etc (default false) #}\n{# Flag syntax is xyz (set) or -xyz (clear) or xy-z (set xy, clear z). #}\n\n{# Regex explanation: do not allow consecutive dashes, accept all re2 flags and clear operator, do not end with a dash #}\n{% set re2_flags_pattern = '^(?!.*--)[-imsU]*(? 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 {%- set dbt_command = flags.WHICH -%}\n\n\n {% if dbt_command in ['run', 'build'] %}\n {% if (include | length > 0 or exclude | length > 0) and not column_superset.keys() %}\n {%- set relations_string -%}\n {%- for relation in relations -%}\n {{ relation.name }}\n {%- if not loop.last %}, {% endif -%}\n {%- endfor -%}\n {%- endset -%}\n\n {%- set error_message -%}\n There were no columns found to union for relations {{ relations_string }}\n {%- endset -%}\n\n {{ exceptions.raise_compiler_error(error_message) }}\n {%- endif -%}\n {%- endif -%}\n\n {%- for relation in relations %}\n\n (\n select\n\n {%- if source_column_name is not none %}\n cast({{ dbt.string_literal(relation) }} as {{ dbt.type_string() }}) as {{ source_column_name }},\n {%- endif %}\n\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 {% if where -%}\n where {{ where }}\n {%- endif %}\n )\n\n {% if not loop.last -%}\n union all\n {% endif -%}\n\n {%- endfor -%}\n\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt_utils._is_relation", "macro.dbt_utils._is_ephemeral", "macro.dbt.string_literal", "macro.dbt.type_string"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.547585, "supported_languages": null}, "macro.dbt_utils.deduplicate": {"name": "deduplicate", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/deduplicate.sql", "original_file_path": "macros/sql/deduplicate.sql", "unique_id": "macro.dbt_utils.deduplicate", "macro_sql": "{%- macro deduplicate(relation, partition_by, order_by) -%}\n {{ return(adapter.dispatch('deduplicate', 'dbt_utils')(relation, partition_by, order_by)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.postgres__deduplicate"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.5487876, "supported_languages": null}, "macro.dbt_utils.default__deduplicate": {"name": "default__deduplicate", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/deduplicate.sql", "original_file_path": "macros/sql/deduplicate.sql", "unique_id": "macro.dbt_utils.default__deduplicate", "macro_sql": "\n\n{%- macro default__deduplicate(relation, partition_by, order_by) -%}\n\n with row_numbered as (\n select\n _inner.*,\n row_number() over (\n partition by {{ partition_by }}\n order by {{ order_by }}\n ) as rn\n from {{ relation }} as _inner\n )\n\n select\n distinct data.*\n from {{ relation }} as data\n {#\n -- Not all DBs will support natural joins but the ones that do include:\n -- Oracle, MySQL, SQLite, Redshift, Teradata, Materialize, Databricks\n -- Apache Spark, SingleStore, Vertica\n -- Those that do not appear to support natural joins include:\n -- SQLServer, Trino, Presto, Rockset, Athena\n #}\n natural join row_numbered\n where row_numbered.rn = 1\n\n{%- endmacro -%}\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.5491843, "supported_languages": null}, "macro.dbt_utils.redshift__deduplicate": {"name": "redshift__deduplicate", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/deduplicate.sql", "original_file_path": "macros/sql/deduplicate.sql", "unique_id": "macro.dbt_utils.redshift__deduplicate", "macro_sql": "{% macro redshift__deduplicate(relation, partition_by, order_by) -%}\n\n {{ return(dbt_utils.default__deduplicate(relation, partition_by, order_by=order_by)) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__deduplicate"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.5495346, "supported_languages": null}, "macro.dbt_utils.postgres__deduplicate": {"name": "postgres__deduplicate", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/deduplicate.sql", "original_file_path": "macros/sql/deduplicate.sql", "unique_id": "macro.dbt_utils.postgres__deduplicate", "macro_sql": "\n{%- macro postgres__deduplicate(relation, partition_by, order_by) -%}\n\n select\n distinct on ({{ partition_by }}) *\n from {{ relation }}\n order by {{ partition_by }}{{ ',' ~ order_by }}\n\n{%- endmacro -%}\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.5498676, "supported_languages": null}, "macro.dbt_utils.snowflake__deduplicate": {"name": "snowflake__deduplicate", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/deduplicate.sql", "original_file_path": "macros/sql/deduplicate.sql", "unique_id": "macro.dbt_utils.snowflake__deduplicate", "macro_sql": "\n{%- macro snowflake__deduplicate(relation, partition_by, order_by) -%}\n\n select *\n from {{ relation }}\n qualify\n row_number() over (\n partition by {{ partition_by }}\n order by {{ order_by }}\n ) = 1\n\n{%- endmacro -%}\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.5501587, "supported_languages": null}, "macro.dbt_utils.bigquery__deduplicate": {"name": "bigquery__deduplicate", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/deduplicate.sql", "original_file_path": "macros/sql/deduplicate.sql", "unique_id": "macro.dbt_utils.bigquery__deduplicate", "macro_sql": "\n{%- macro bigquery__deduplicate(relation, partition_by, order_by) -%}\n\n select unique.*\n from (\n select\n array_agg (\n original\n order by {{ order_by }}\n limit 1\n )[offset(0)] unique\n from {{ relation }} original\n group by {{ partition_by }}\n )\n\n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.5504563, "supported_languages": null}, "macro.dbt_utils.get_tables_by_prefix_sql": {"name": "get_tables_by_prefix_sql", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_tables_by_prefix_sql.sql", "original_file_path": "macros/sql/get_tables_by_prefix_sql.sql", "unique_id": "macro.dbt_utils.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', 'dbt_utils')(schema, prefix, exclude, database)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__get_tables_by_prefix_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.5511181, "supported_languages": null}, "macro.dbt_utils.default__get_tables_by_prefix_sql": {"name": "default__get_tables_by_prefix_sql", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_tables_by_prefix_sql.sql", "original_file_path": "macros/sql/get_tables_by_prefix_sql.sql", "unique_id": "macro.dbt_utils.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 %}", "depends_on": {"macros": ["macro.dbt_utils.get_tables_by_pattern_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.5515983, "supported_languages": null}, "macro.dbt_utils.get_single_value": {"name": "get_single_value", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_single_value.sql", "original_file_path": "macros/sql/get_single_value.sql", "unique_id": "macro.dbt_utils.get_single_value", "macro_sql": "{% macro get_single_value(query, default=none) %}\n {{ return(adapter.dispatch('get_single_value', 'dbt_utils')(query, default)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__get_single_value"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.5524127, "supported_languages": null}, "macro.dbt_utils.default__get_single_value": {"name": "default__get_single_value", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_single_value.sql", "original_file_path": "macros/sql/get_single_value.sql", "unique_id": "macro.dbt_utils.default__get_single_value", "macro_sql": "{% macro default__get_single_value(query, default) %}\n\n{# This macro returns the (0, 0) record in a query, i.e. the first row of the first column #}\n\n {%- call statement('get_query_result', fetch_result=True, auto_begin=false) -%}\n\n {{ query }}\n\n {%- endcall -%}\n\n {%- if execute -%}\n\n {% set r = load_result('get_query_result').table.columns[0].values() %}\n {% if r | length == 0 %}\n {% do print('Query `' ~ query ~ '` returned no rows. Using the default value: ' ~ default) %}\n {% set sql_result = default %}\n {% else %}\n {% set sql_result = r[0] %}\n {% endif %}\n \n {%- else -%}\n \n {% set sql_result = default %}\n \n {%- endif -%}\n\n {% do return(sql_result) %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.5537124, "supported_languages": null}, "macro.dbt_utils.safe_subtract": {"name": "safe_subtract", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/safe_subtract.sql", "original_file_path": "macros/sql/safe_subtract.sql", "unique_id": "macro.dbt_utils.safe_subtract", "macro_sql": "{%- macro safe_subtract(field_list) -%}\n {{ return(adapter.dispatch('safe_subtract', 'dbt_utils')(field_list)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__safe_subtract"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.5543547, "supported_languages": null}, "macro.dbt_utils.default__safe_subtract": {"name": "default__safe_subtract", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/safe_subtract.sql", "original_file_path": "macros/sql/safe_subtract.sql", "unique_id": "macro.dbt_utils.default__safe_subtract", "macro_sql": "\n\n{%- macro default__safe_subtract(field_list) -%}\n\n{%- if field_list is not iterable or field_list is string or field_list is mapping -%}\n\n{%- set error_message = '\nWarning: the `safe_subtract` macro takes a single list argument instead of \\\nstring arguments. The {}.{} model triggered this warning. \\\n'.format(model.package_name, model.name) -%}\n\n{%- do exceptions.raise_compiler_error(error_message) -%}\n\n{%- endif -%}\n\n{% set fields = [] %}\n\n{%- for field in field_list -%}\n\n {% do fields.append(\"coalesce(\" ~ field ~ \", 0)\") %}\n\n{%- endfor -%}\n\n{{ fields|join(' -\\n ') }}\n\n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.555291, "supported_languages": null}, "macro.dbt_utils.get_relations_by_pattern": {"name": "get_relations_by_pattern", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_relations_by_pattern.sql", "original_file_path": "macros/sql/get_relations_by_pattern.sql", "unique_id": "macro.dbt_utils.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', 'dbt_utils')(schema_pattern, table_pattern, exclude, database)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__get_relations_by_pattern"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.5563745, "supported_languages": null}, "macro.dbt_utils.default__get_relations_by_pattern": {"name": "default__get_relations_by_pattern", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_relations_by_pattern.sql", "original_file_path": "macros/sql/get_relations_by_pattern.sql", "unique_id": "macro.dbt_utils.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 %}", "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt_utils.get_tables_by_pattern_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.5578482, "supported_languages": null}, "macro.dbt_utils.surrogate_key": {"name": "surrogate_key", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/surrogate_key.sql", "original_file_path": "macros/sql/surrogate_key.sql", "unique_id": "macro.dbt_utils.surrogate_key", "macro_sql": "{%- macro surrogate_key(field_list) -%}\n {% set frustrating_jinja_feature = varargs %}\n {{ return(adapter.dispatch('surrogate_key', 'dbt_utils')(field_list, *varargs)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__surrogate_key"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.558502, "supported_languages": null}, "macro.dbt_utils.default__surrogate_key": {"name": "default__surrogate_key", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/surrogate_key.sql", "original_file_path": "macros/sql/surrogate_key.sql", "unique_id": "macro.dbt_utils.default__surrogate_key", "macro_sql": "\n\n{%- macro default__surrogate_key(field_list) -%}\n\n{%- set error_message = '\nWarning: `dbt_utils.surrogate_key` has been replaced by \\\n`dbt_utils.generate_surrogate_key`. The new macro treats null values \\\ndifferently to empty strings. To restore the behaviour of the original \\\nmacro, add a global variable in dbt_project.yml called \\\n`surrogate_key_treat_nulls_as_empty_strings` to your \\\ndbt_project.yml file with a value of True. \\\nThe {}.{} model triggered this warning. \\\n'.format(model.package_name, model.name) -%}\n\n{%- do exceptions.raise_compiler_error(error_message) -%}\n\n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.5589085, "supported_languages": null}, "macro.dbt_utils.nullcheck": {"name": "nullcheck", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/nullcheck.sql", "original_file_path": "macros/sql/nullcheck.sql", "unique_id": "macro.dbt_utils.nullcheck", "macro_sql": "{% macro nullcheck(cols) %}\n {{ return(adapter.dispatch('nullcheck', 'dbt_utils')(cols)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__nullcheck"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.5594647, "supported_languages": null}, "macro.dbt_utils.default__nullcheck": {"name": "default__nullcheck", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/nullcheck.sql", "original_file_path": "macros/sql/nullcheck.sql", "unique_id": "macro.dbt_utils.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 %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.5603151, "supported_languages": null}, "macro.dbt_utils.get_intervals_between": {"name": "get_intervals_between", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/date_spine.sql", "original_file_path": "macros/sql/date_spine.sql", "unique_id": "macro.dbt_utils.get_intervals_between", "macro_sql": "{% macro get_intervals_between(start_date, end_date, datepart) -%}\n {{ return(adapter.dispatch('get_intervals_between', 'dbt_utils')(start_date, end_date, datepart)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__get_intervals_between"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.5614042, "supported_languages": null}, "macro.dbt_utils.default__get_intervals_between": {"name": "default__get_intervals_between", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/date_spine.sql", "original_file_path": "macros/sql/date_spine.sql", "unique_id": "macro.dbt_utils.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.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 %}", "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt.datediff"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.5624118, "supported_languages": null}, "macro.dbt_utils.date_spine": {"name": "date_spine", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/date_spine.sql", "original_file_path": "macros/sql/date_spine.sql", "unique_id": "macro.dbt_utils.date_spine", "macro_sql": "{% macro date_spine(datepart, start_date, end_date) %}\n {{ return(adapter.dispatch('date_spine', 'dbt_utils')(datepart, start_date, end_date)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__date_spine"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.5628045, "supported_languages": null}, "macro.dbt_utils.default__date_spine": {"name": "default__date_spine", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/date_spine.sql", "original_file_path": "macros/sql/date_spine.sql", "unique_id": "macro.dbt_utils.default__date_spine", "macro_sql": "{% macro default__date_spine(datepart, start_date, end_date) %}\n\n\n{# call as follows:\n\ndate_spine(\n \"day\",\n \"to_date('01/01/2016', 'mm/dd/yyyy')\",\n \"dbt.dateadd(week, 1, current_date)\"\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.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 %}", "depends_on": {"macros": ["macro.dbt_utils.generate_series", "macro.dbt_utils.get_intervals_between", "macro.dbt.dateadd"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.5634108, "supported_languages": null}, "macro.dbt_utils.get_relations_by_prefix": {"name": "get_relations_by_prefix", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_relations_by_prefix.sql", "original_file_path": "macros/sql/get_relations_by_prefix.sql", "unique_id": "macro.dbt_utils.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', 'dbt_utils')(schema, prefix, exclude, database)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__get_relations_by_prefix"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.5644424, "supported_languages": null}, "macro.dbt_utils.default__get_relations_by_prefix": {"name": "default__get_relations_by_prefix", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_relations_by_prefix.sql", "original_file_path": "macros/sql/get_relations_by_prefix.sql", "unique_id": "macro.dbt_utils.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 %}", "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt_utils.get_tables_by_prefix_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.5659156, "supported_languages": null}, "macro.dbt_utils.generate_surrogate_key": {"name": "generate_surrogate_key", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/generate_surrogate_key.sql", "original_file_path": "macros/sql/generate_surrogate_key.sql", "unique_id": "macro.dbt_utils.generate_surrogate_key", "macro_sql": "{%- macro generate_surrogate_key(field_list) -%}\n {{ return(adapter.dispatch('generate_surrogate_key', 'dbt_utils')(field_list)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__generate_surrogate_key"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.5666666, "supported_languages": null}, "macro.dbt_utils.default__generate_surrogate_key": {"name": "default__generate_surrogate_key", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/generate_surrogate_key.sql", "original_file_path": "macros/sql/generate_surrogate_key.sql", "unique_id": "macro.dbt_utils.default__generate_surrogate_key", "macro_sql": "\n\n{%- macro default__generate_surrogate_key(field_list) -%}\n\n{%- if var('surrogate_key_treat_nulls_as_empty_strings', False) -%}\n {%- set default_null_value = \"\" -%}\n{%- else -%}\n {%- set default_null_value = '_dbt_utils_surrogate_key_null_' -%}\n{%- endif -%}\n\n{%- set fields = [] -%}\n\n{%- for field in field_list -%}\n\n {%- do fields.append(\n \"coalesce(cast(\" ~ field ~ \" as \" ~ dbt.type_string() ~ \"), '\" ~ default_null_value ~\"')\"\n ) -%}\n\n {%- if not loop.last %}\n {%- do fields.append(\"'-'\") -%}\n {%- endif -%}\n\n{%- endfor -%}\n\n{{ dbt.hash(dbt.concat(fields)) }}\n\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt.type_string", "macro.dbt.hash", "macro.dbt.concat"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.567752, "supported_languages": null}, "macro.dbt_utils.star": {"name": "star", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/star.sql", "original_file_path": "macros/sql/star.sql", "unique_id": "macro.dbt_utils.star", "macro_sql": "{% macro star(from, relation_alias=False, except=[], prefix='', suffix='', quote_identifiers=True) -%}\r\n {{ return(adapter.dispatch('star', 'dbt_utils')(from, relation_alias, except, prefix, suffix, quote_identifiers)) }}\r\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__star"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.5696359, "supported_languages": null}, "macro.dbt_utils.default__star": {"name": "default__star", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/star.sql", "original_file_path": "macros/sql/star.sql", "unique_id": "macro.dbt_utils.default__star", "macro_sql": "{% macro default__star(from, relation_alias=False, except=[], prefix='', suffix='', quote_identifiers=True) -%}\r\n {%- do dbt_utils._is_relation(from, 'star') -%}\r\n {%- do dbt_utils._is_ephemeral(from, 'star') -%}\r\n\r\n {#-- Prevent querying of db in parsing mode. This works because this macro does not create any new refs. #}\r\n {%- if not execute -%}\r\n {% do return('*') %}\r\n {%- endif -%}\r\n\r\n {% set cols = dbt_utils.get_filtered_columns_in_relation(from, except) %}\r\n\r\n {%- if cols|length <= 0 -%}\r\n {% if flags.WHICH == 'compile' %}\r\n {% set response %}\r\n*\r\n/* No columns were returned. Maybe the relation doesn't exist yet \r\nor all columns were excluded. This star is only output during \r\ndbt compile, and exists to keep SQLFluff happy. */\r\n {% endset %}\r\n {% do return(response) %}\r\n {% else %}\r\n {% do return(\"/* no columns returned from star() macro */\") %}\r\n {% endif %}\r\n {%- else -%}\r\n {%- for col in cols %}\r\n {%- if relation_alias %}{{ relation_alias }}.{% else %}{%- endif -%}\r\n {%- if quote_identifiers -%}\r\n {{ adapter.quote(col)|trim }} {%- if prefix!='' or suffix!='' %} as {{ adapter.quote(prefix ~ col ~ suffix)|trim }} {%- endif -%}\r\n {%- else -%}\r\n {{ col|trim }} {%- if prefix!='' or suffix!='' %} as {{ (prefix ~ col ~ suffix)|trim }} {%- endif -%}\r\n {% endif %}\r\n {%- if not loop.last %},{{ '\\n ' }}{%- endif -%}\r\n {%- endfor -%}\r\n {% endif %}\r\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_utils._is_relation", "macro.dbt_utils._is_ephemeral", "macro.dbt_utils.get_filtered_columns_in_relation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.6180522, "supported_languages": null}, "macro.dbt_utils.unpivot": {"name": "unpivot", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/unpivot.sql", "original_file_path": "macros/sql/unpivot.sql", "unique_id": "macro.dbt_utils.unpivot", "macro_sql": "{% macro unpivot(relation=none, cast_to='varchar', exclude=none, remove=none, field_name='field_name', value_name='value') -%}\n {{ return(adapter.dispatch('unpivot', 'dbt_utils')(relation, cast_to, exclude, remove, field_name, value_name)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__unpivot"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.6203206, "supported_languages": null}, "macro.dbt_utils.default__unpivot": {"name": "default__unpivot", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/unpivot.sql", "original_file_path": "macros/sql/unpivot.sql", "unique_id": "macro.dbt_utils.default__unpivot", "macro_sql": "{% macro default__unpivot(relation=none, cast_to='varchar', exclude=none, remove=none, field_name='field_name', value_name='value') -%}\n\n {% if not relation %}\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.type_string() }}) as {{ field_name }},\n cast( {% if col.data_type == 'boolean' %}\n {{ dbt.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 %}", "depends_on": {"macros": ["macro.dbt_utils._is_relation", "macro.dbt_utils._is_ephemeral", "macro.dbt.type_string", "macro.dbt.cast_bool_to_text"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.6231368, "supported_languages": null}, "macro.dbt_utils.width_bucket": {"name": "width_bucket", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/width_bucket.sql", "original_file_path": "macros/sql/width_bucket.sql", "unique_id": "macro.dbt_utils.width_bucket", "macro_sql": "{% macro width_bucket(expr, min_value, max_value, num_buckets) %}\n {{ return(adapter.dispatch('width_bucket', 'dbt_utils') (expr, min_value, max_value, num_buckets)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__width_bucket"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.6243172, "supported_languages": null}, "macro.dbt_utils.default__width_bucket": {"name": "default__width_bucket", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/width_bucket.sql", "original_file_path": "macros/sql/width_bucket.sql", "unique_id": "macro.dbt_utils.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.safe_cast(expr, dbt.type_numeric() ) }},\n {{ dbt.safe_cast(bin_size, dbt.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 %}", "depends_on": {"macros": ["macro.dbt.safe_cast", "macro.dbt.type_numeric"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.625181, "supported_languages": null}, "macro.dbt_utils.snowflake__width_bucket": {"name": "snowflake__width_bucket", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/width_bucket.sql", "original_file_path": "macros/sql/width_bucket.sql", "unique_id": "macro.dbt_utils.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 %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.6255252, "supported_languages": null}, "macro.dbt_utils.pivot": {"name": "pivot", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/pivot.sql", "original_file_path": "macros/sql/pivot.sql", "unique_id": "macro.dbt_utils.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', 'dbt_utils')(column, values, alias, agg, cmp, prefix, suffix, then_value, else_value, quote_identifiers, distinct)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__pivot"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.6271405, "supported_languages": null}, "macro.dbt_utils.default__pivot": {"name": "default__pivot", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/pivot.sql", "original_file_path": "macros/sql/pivot.sql", "unique_id": "macro.dbt_utils.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 value in values %}\n {{ agg }}(\n {% if distinct %} distinct {% endif %}\n case\n when {{ column }} {{ cmp }} '{{ dbt.escape_single_quotes(value) }}'\n then {{ then_value }}\n else {{ else_value }}\n end\n )\n {% if alias %}\n {% if quote_identifiers %}\n as {{ adapter.quote(prefix ~ value ~ suffix) }}\n {% else %}\n as {{ dbt_utils.slugify(prefix ~ value ~ suffix) }}\n {% endif %}\n {% endif %}\n {% if not loop.last %},{% endif %}\n {% endfor %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.escape_single_quotes", "macro.dbt_utils.slugify"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.6285913, "supported_languages": null}, "macro.dbt_utils.test_equal_rowcount": {"name": "test_equal_rowcount", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/equal_rowcount.sql", "original_file_path": "macros/generic_tests/equal_rowcount.sql", "unique_id": "macro.dbt_utils.test_equal_rowcount", "macro_sql": "{% test equal_rowcount(model, compare_model, group_by_columns = []) %}\n {{ return(adapter.dispatch('test_equal_rowcount', 'dbt_utils')(model, compare_model, group_by_columns)) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_utils.default__test_equal_rowcount"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.6299193, "supported_languages": null}, "macro.dbt_utils.default__test_equal_rowcount": {"name": "default__test_equal_rowcount", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/equal_rowcount.sql", "original_file_path": "macros/generic_tests/equal_rowcount.sql", "unique_id": "macro.dbt_utils.default__test_equal_rowcount", "macro_sql": "{% macro default__test_equal_rowcount(model, compare_model, group_by_columns) %}\n\n{#-- Needs to be set at parse time, before we return '' below --#}\n{{ config(fail_calc = 'sum(coalesce(diff_count, 0))') }}\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{% if group_by_columns|length() > 0 %}\n {% set select_gb_cols = group_by_columns|join(', ') + ', ' %}\n {% set join_gb_cols %}\n {% for c in group_by_columns %}\n and a.{{c}} = b.{{c}}\n {% endfor %}\n {% endset %}\n {% set groupby_gb_cols = 'group by ' + group_by_columns|join(',') %}\n{% endif %}\n\n{#-- We must add a fake join key in case additional grouping variables are not provided --#}\n{#-- Redshift does not allow for dynamically created join conditions (e.g. full join on 1 = 1 --#}\n{#-- The same logic is used in fewer_rows_than. In case of changes, maintain consistent logic --#}\n{% set group_by_columns = ['id_dbtutils_test_equal_rowcount'] + group_by_columns %}\n{% set groupby_gb_cols = 'group by ' + group_by_columns|join(',') %}\n\nwith a as (\n\n select \n {{select_gb_cols}}\n 1 as id_dbtutils_test_equal_rowcount,\n count(*) as count_a \n from {{ model }}\n {{groupby_gb_cols}}\n\n\n),\nb as (\n\n select \n {{select_gb_cols}}\n 1 as id_dbtutils_test_equal_rowcount,\n count(*) as count_b \n from {{ compare_model }}\n {{groupby_gb_cols}}\n\n),\nfinal as (\n\n select\n \n {% for c in group_by_columns -%}\n a.{{c}} as {{c}}_a,\n b.{{c}} as {{c}}_b,\n {% endfor %}\n\n count_a,\n count_b,\n abs(count_a - count_b) as diff_count\n\n from a\n full join b\n on\n a.id_dbtutils_test_equal_rowcount = b.id_dbtutils_test_equal_rowcount\n {{join_gb_cols}}\n\n\n)\n\nselect * from final\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.6317842, "supported_languages": null}, "macro.dbt_utils.test_recency": {"name": "test_recency", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/recency.sql", "original_file_path": "macros/generic_tests/recency.sql", "unique_id": "macro.dbt_utils.test_recency", "macro_sql": "{% test recency(model, field, datepart, interval, ignore_time_component=False, group_by_columns = []) %}\n {{ return(adapter.dispatch('test_recency', 'dbt_utils')(model, field, datepart, interval, ignore_time_component, group_by_columns)) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_utils.default__test_recency"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.6329398, "supported_languages": null}, "macro.dbt_utils.default__test_recency": {"name": "default__test_recency", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/recency.sql", "original_file_path": "macros/generic_tests/recency.sql", "unique_id": "macro.dbt_utils.default__test_recency", "macro_sql": "{% macro default__test_recency(model, field, datepart, interval, ignore_time_component, group_by_columns) %}\n\n{% set threshold = 'cast(' ~ dbt.dateadd(datepart, interval * -1, dbt.current_timestamp()) ~ ' as ' ~ ('date' if ignore_time_component else dbt.type_timestamp()) ~ ')' %}\n\n{% if group_by_columns|length() > 0 %}\n {% set select_gb_cols = group_by_columns|join(' ,') + ', ' %}\n {% set groupby_gb_cols = 'group by ' + group_by_columns|join(',') %}\n{% endif %}\n\n\nwith recency as (\n\n select \n\n {{ select_gb_cols }}\n {% if ignore_time_component %}\n cast(max({{ field }}) as date) as most_recent\n {%- else %}\n max({{ field }}) as most_recent\n {%- endif %}\n\n from {{ model }}\n\n {{ groupby_gb_cols }}\n\n)\n\nselect\n\n {{ select_gb_cols }}\n most_recent,\n {{ threshold }} as threshold\n\nfrom recency\nwhere most_recent < {{ threshold }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.dateadd", "macro.dbt.current_timestamp", "macro.dbt.type_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.6343892, "supported_languages": null}, "macro.dbt_utils.test_mutually_exclusive_ranges": {"name": "test_mutually_exclusive_ranges", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/mutually_exclusive_ranges.sql", "original_file_path": "macros/generic_tests/mutually_exclusive_ranges.sql", "unique_id": "macro.dbt_utils.test_mutually_exclusive_ranges", "macro_sql": "{% 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', 'dbt_utils')(model, lower_bound_column, upper_bound_column, partition_by, gaps, zero_length_range_allowed)) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_utils.default__test_mutually_exclusive_ranges"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.6390073, "supported_languages": null}, "macro.dbt_utils.default__test_mutually_exclusive_ranges": {"name": "default__test_mutually_exclusive_ranges", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/mutually_exclusive_ranges.sql", "original_file_path": "macros/generic_tests/mutually_exclusive_ranges.sql", "unique_id": "macro.dbt_utils.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 }} as partition_by_col,\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 }}, {{ upper_bound_column }}\n ) as next_lower_bound,\n\n row_number() over (\n {{ partition_clause }}\n order by {{ lower_bound_column }} desc, {{ upper_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 more 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 * from validation_errors\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.6417968, "supported_languages": null}, "macro.dbt_utils.test_sequential_values": {"name": "test_sequential_values", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/sequential_values.sql", "original_file_path": "macros/generic_tests/sequential_values.sql", "unique_id": "macro.dbt_utils.test_sequential_values", "macro_sql": "{% test sequential_values(model, column_name, interval=1, datepart=None, group_by_columns = []) %}\n\n {{ return(adapter.dispatch('test_sequential_values', 'dbt_utils')(model, column_name, interval, datepart, group_by_columns)) }}\n\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_utils.default__test_sequential_values"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.6432188, "supported_languages": null}, "macro.dbt_utils.default__test_sequential_values": {"name": "default__test_sequential_values", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/sequential_values.sql", "original_file_path": "macros/generic_tests/sequential_values.sql", "unique_id": "macro.dbt_utils.default__test_sequential_values", "macro_sql": "{% macro default__test_sequential_values(model, column_name, interval=1, datepart=None, group_by_columns = []) %}\n\n{% set previous_column_name = \"previous_\" ~ dbt_utils.slugify(column_name) %}\n\n{% if group_by_columns|length() > 0 %}\n {% set select_gb_cols = group_by_columns|join(',') + ', ' %}\n {% set partition_gb_cols = 'partition by ' + group_by_columns|join(',') %}\n{% endif %}\n\nwith windowed as (\n\n select\n {{ select_gb_cols }}\n {{ column_name }},\n lag({{ column_name }}) over (\n {{partition_gb_cols}}\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.type_timestamp() }})= cast({{ dbt.dateadd(datepart, interval, previous_column_name) }} as {{ dbt.type_timestamp() }}))\n {% else %}\n where not({{ column_name }} = {{ previous_column_name }} + {{ interval }})\n {% endif %}\n)\n\nselect *\nfrom validation_errors\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.slugify", "macro.dbt.type_timestamp", "macro.dbt.dateadd"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.6447918, "supported_languages": null}, "macro.dbt_utils.test_unique_combination_of_columns": {"name": "test_unique_combination_of_columns", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/unique_combination_of_columns.sql", "original_file_path": "macros/generic_tests/unique_combination_of_columns.sql", "unique_id": "macro.dbt_utils.test_unique_combination_of_columns", "macro_sql": "{% test unique_combination_of_columns(model, combination_of_columns, quote_columns=false) %}\n {{ return(adapter.dispatch('test_unique_combination_of_columns', 'dbt_utils')(model, combination_of_columns, quote_columns)) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_utils.default__test_unique_combination_of_columns"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.645817, "supported_languages": null}, "macro.dbt_utils.default__test_unique_combination_of_columns": {"name": "default__test_unique_combination_of_columns", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/unique_combination_of_columns.sql", "original_file_path": "macros/generic_tests/unique_combination_of_columns.sql", "unique_id": "macro.dbt_utils.default__test_unique_combination_of_columns", "macro_sql": "{% macro default__test_unique_combination_of_columns(model, combination_of_columns, quote_columns=false) %}\n\n{% if not quote_columns %}\n {%- set column_list=combination_of_columns %}\n{% elif quote_columns %}\n {%- set column_list=[] %}\n {% for column in combination_of_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 group by {{ columns_csv }}\n having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.646937, "supported_languages": null}, "macro.dbt_utils.test_expression_is_true": {"name": "test_expression_is_true", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/expression_is_true.sql", "original_file_path": "macros/generic_tests/expression_is_true.sql", "unique_id": "macro.dbt_utils.test_expression_is_true", "macro_sql": "{% test expression_is_true(model, expression, column_name=None) %}\n {{ return(adapter.dispatch('test_expression_is_true', 'dbt_utils')(model, expression, column_name)) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_utils.default__test_expression_is_true"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.6476116, "supported_languages": null}, "macro.dbt_utils.default__test_expression_is_true": {"name": "default__test_expression_is_true", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/expression_is_true.sql", "original_file_path": "macros/generic_tests/expression_is_true.sql", "unique_id": "macro.dbt_utils.default__test_expression_is_true", "macro_sql": "{% macro default__test_expression_is_true(model, expression, column_name) %}\n\n{% set column_list = '*' if should_store_failures() else \"1\" %}\n\nselect\n {{ column_list }}\nfrom {{ model }}\n{% if column_name is none %}\nwhere not({{ expression }})\n{%- else %}\nwhere not({{ column_name }} {{ expression }})\n{%- endif %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.should_store_failures"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.6482406, "supported_languages": null}, "macro.dbt_utils.test_equality": {"name": "test_equality", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/equality.sql", "original_file_path": "macros/generic_tests/equality.sql", "unique_id": "macro.dbt_utils.test_equality", "macro_sql": "{% test equality(model, compare_model, compare_columns=None) %}\n {{ return(adapter.dispatch('test_equality', 'dbt_utils')(model, compare_model, compare_columns)) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_utils.default__test_equality"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.6494408, "supported_languages": null}, "macro.dbt_utils.default__test_equality": {"name": "default__test_equality", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/equality.sql", "original_file_path": "macros/generic_tests/equality.sql", "unique_id": "macro.dbt_utils.default__test_equality", "macro_sql": "{% macro default__test_equality(model, compare_model, compare_columns=None) %}\n\n{% set set_diff %}\n count(*) + coalesce(abs(\n sum(case when which_diff = 'a_minus_b' then 1 else 0 end) -\n sum(case when which_diff = 'b_minus_a' then 1 else 0 end)\n ), 0)\n{% endset %}\n\n{#-- Needs to be set at parse time, before we return '' below --#}\n{{ config(fail_calc = set_diff) }}\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\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_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.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.except() }}\n select {{compare_cols_csv}} from a\n\n),\n\nunioned as (\n\n select 'a_minus_b' as which_diff, a_minus_b.* from a_minus_b\n union all\n select 'b_minus_a' as which_diff, b_minus_a.* from b_minus_a\n\n)\n\nselect * from unioned\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils._is_relation", "macro.dbt_utils._is_ephemeral", "macro.dbt.except"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.6510391, "supported_languages": null}, "macro.dbt_utils.test_accepted_range": {"name": "test_accepted_range", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/accepted_range.sql", "original_file_path": "macros/generic_tests/accepted_range.sql", "unique_id": "macro.dbt_utils.test_accepted_range", "macro_sql": "{% test accepted_range(model, column_name, min_value=none, max_value=none, inclusive=true) %}\n {{ return(adapter.dispatch('test_accepted_range', 'dbt_utils')(model, column_name, min_value, max_value, inclusive)) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_utils.default__test_accepted_range"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.6520479, "supported_languages": null}, "macro.dbt_utils.default__test_accepted_range": {"name": "default__test_accepted_range", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/accepted_range.sql", "original_file_path": "macros/generic_tests/accepted_range.sql", "unique_id": "macro.dbt_utils.default__test_accepted_range", "macro_sql": "{% macro default__test_accepted_range(model, column_name, min_value=none, max_value=none, inclusive=true) %}\n\nwith meet_condition as(\n select *\n from {{ model }}\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 *\nfrom validation_errors\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.652889, "supported_languages": null}, "macro.dbt_utils.test_at_least_one": {"name": "test_at_least_one", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/at_least_one.sql", "original_file_path": "macros/generic_tests/at_least_one.sql", "unique_id": "macro.dbt_utils.test_at_least_one", "macro_sql": "{% test at_least_one(model, column_name, group_by_columns = []) %}\n {{ return(adapter.dispatch('test_at_least_one', 'dbt_utils')(model, column_name, group_by_columns)) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_utils.default__test_at_least_one"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.653944, "supported_languages": null}, "macro.dbt_utils.default__test_at_least_one": {"name": "default__test_at_least_one", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/at_least_one.sql", "original_file_path": "macros/generic_tests/at_least_one.sql", "unique_id": "macro.dbt_utils.default__test_at_least_one", "macro_sql": "{% macro default__test_at_least_one(model, column_name, group_by_columns) %}\n\n{% set pruned_cols = [column_name] %}\n\n{% if group_by_columns|length() > 0 %}\n\n {% set select_gb_cols = group_by_columns|join(' ,') + ', ' %}\n {% set groupby_gb_cols = 'group by ' + group_by_columns|join(',') %}\n {% set pruned_cols = group_by_columns %}\n\n {% if column_name not in pruned_cols %}\n {% do pruned_cols.append(column_name) %}\n {% endif %}\n\n{% endif %}\n\n{% set select_pruned_cols = pruned_cols|join(' ,') %}\n\nselect *\nfrom (\n with pruned_rows as (\n select\n {{ select_pruned_cols }}\n from {{ model }}\n where {{ column_name }} is not null\n limit 1\n )\n select\n {# In TSQL, subquery aggregate columns need aliases #}\n {# thus: a filler col name, 'filler_column' #}\n {{select_gb_cols}}\n count({{ column_name }}) as filler_column\n\n from pruned_rows\n\n {{groupby_gb_cols}}\n\n having count({{ column_name }}) = 0\n\n) validation_errors\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.6553385, "supported_languages": null}, "macro.dbt_utils.test_relationships_where": {"name": "test_relationships_where", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/relationships_where.sql", "original_file_path": "macros/generic_tests/relationships_where.sql", "unique_id": "macro.dbt_utils.test_relationships_where", "macro_sql": "{% test relationships_where(model, column_name, to, field, from_condition=\"1=1\", to_condition=\"1=1\") %}\n {{ return(adapter.dispatch('test_relationships_where', 'dbt_utils')(model, column_name, to, field, from_condition, to_condition)) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_utils.default__test_relationships_where"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.656388, "supported_languages": null}, "macro.dbt_utils.default__test_relationships_where": {"name": "default__test_relationships_where", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/relationships_where.sql", "original_file_path": "macros/generic_tests/relationships_where.sql", "unique_id": "macro.dbt_utils.default__test_relationships_where", "macro_sql": "{% macro default__test_relationships_where(model, column_name, to, field, from_condition=\"1=1\", to_condition=\"1=1\") %}\n\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\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 * from exceptions\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.6570003, "supported_languages": null}, "macro.dbt_utils.test_not_accepted_values": {"name": "test_not_accepted_values", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/not_accepted_values.sql", "original_file_path": "macros/generic_tests/not_accepted_values.sql", "unique_id": "macro.dbt_utils.test_not_accepted_values", "macro_sql": "{% test not_accepted_values(model, column_name, values, quote=True) %}\n {{ return(adapter.dispatch('test_not_accepted_values', 'dbt_utils')(model, column_name, values, quote)) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_utils.default__test_not_accepted_values"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.6578841, "supported_languages": null}, "macro.dbt_utils.default__test_not_accepted_values": {"name": "default__test_not_accepted_values", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/not_accepted_values.sql", "original_file_path": "macros/generic_tests/not_accepted_values.sql", "unique_id": "macro.dbt_utils.default__test_not_accepted_values", "macro_sql": "{% macro default__test_not_accepted_values(model, column_name, values, quote=True) %}\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 -%}\n '{{ value }}'\n {%- else -%}\n {{ value }}\n {%- endif -%}\n {%- if not loop.last -%},{%- endif %}\n {%- endfor %}\n )\n\n)\n\nselect *\nfrom validation_errors\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.6585572, "supported_languages": null}, "macro.dbt_utils.test_cardinality_equality": {"name": "test_cardinality_equality", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/cardinality_equality.sql", "original_file_path": "macros/generic_tests/cardinality_equality.sql", "unique_id": "macro.dbt_utils.test_cardinality_equality", "macro_sql": "{% test cardinality_equality(model, column_name, to, field) %}\n {{ return(adapter.dispatch('test_cardinality_equality', 'dbt_utils')(model, column_name, to, field)) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_utils.default__test_cardinality_equality"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.6594214, "supported_languages": null}, "macro.dbt_utils.default__test_cardinality_equality": {"name": "default__test_cardinality_equality", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/cardinality_equality.sql", "original_file_path": "macros/generic_tests/cardinality_equality.sql", "unique_id": "macro.dbt_utils.default__test_cardinality_equality", "macro_sql": "{% macro default__test_cardinality_equality(model, column_name, to, field) %}\n\n{# T-SQL does not let you use numbers as aliases for columns #}\n{# Thus, no \"GROUP BY 1\" #}\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.except() }}\n select *\n from table_b\n),\n\nexcept_b as (\n select *\n from table_b\n {{ dbt.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 *\nfrom unioned\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.except"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.6601222, "supported_languages": null}, "macro.dbt_utils.test_not_null_proportion": {"name": "test_not_null_proportion", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/not_null_proportion.sql", "original_file_path": "macros/generic_tests/not_null_proportion.sql", "unique_id": "macro.dbt_utils.test_not_null_proportion", "macro_sql": "{% macro test_not_null_proportion(model, group_by_columns = []) %}\n {{ return(adapter.dispatch('test_not_null_proportion', 'dbt_utils')(model, group_by_columns, **kwargs)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__test_not_null_proportion"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.6611724, "supported_languages": null}, "macro.dbt_utils.default__test_not_null_proportion": {"name": "default__test_not_null_proportion", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/not_null_proportion.sql", "original_file_path": "macros/generic_tests/not_null_proportion.sql", "unique_id": "macro.dbt_utils.default__test_not_null_proportion", "macro_sql": "{% macro default__test_not_null_proportion(model, group_by_columns) %}\n\n{% set column_name = kwargs.get('column_name', kwargs.get('arg')) %}\n{% set at_least = kwargs.get('at_least', kwargs.get('arg')) %}\n{% set at_most = kwargs.get('at_most', kwargs.get('arg', 1)) %}\n\n{% if group_by_columns|length() > 0 %}\n {% set select_gb_cols = group_by_columns|join(' ,') + ', ' %}\n {% set groupby_gb_cols = 'group by ' + group_by_columns|join(',') %}\n{% endif %}\n\nwith validation as (\n select\n {{select_gb_cols}}\n sum(case when {{ column_name }} is null then 0 else 1 end) / cast(count(*) as numeric) as not_null_proportion\n from {{ model }}\n {{groupby_gb_cols}}\n),\nvalidation_errors as (\n select\n {{select_gb_cols}}\n not_null_proportion\n from validation\n where not_null_proportion < {{ at_least }} or not_null_proportion > {{ at_most }}\n)\nselect\n *\nfrom validation_errors\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.6625862, "supported_languages": null}, "macro.dbt_utils.test_not_empty_string": {"name": "test_not_empty_string", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/not_empty_string.sql", "original_file_path": "macros/generic_tests/not_empty_string.sql", "unique_id": "macro.dbt_utils.test_not_empty_string", "macro_sql": "{% test not_empty_string(model, column_name, trim_whitespace=true) %}\n\n {{ return(adapter.dispatch('test_not_empty_string', 'dbt_utils')(model, column_name, trim_whitespace)) }}\n\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_utils.default__test_not_empty_string"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.663399, "supported_languages": null}, "macro.dbt_utils.default__test_not_empty_string": {"name": "default__test_not_empty_string", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/not_empty_string.sql", "original_file_path": "macros/generic_tests/not_empty_string.sql", "unique_id": "macro.dbt_utils.default__test_not_empty_string", "macro_sql": "{% macro default__test_not_empty_string(model, column_name, trim_whitespace=true) %}\n\n with\n \n all_values as (\n\n select \n\n\n {% if trim_whitespace == true -%}\n\n trim({{ column_name }}) as {{ column_name }}\n\n {%- else -%}\n\n {{ column_name }}\n\n {%- endif %}\n \n from {{ model }}\n\n ),\n\n errors as (\n\n select * from all_values\n where {{ column_name }} = ''\n\n )\n\n select * from errors\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.6639233, "supported_languages": null}, "macro.dbt_utils.test_not_constant": {"name": "test_not_constant", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/not_constant.sql", "original_file_path": "macros/generic_tests/not_constant.sql", "unique_id": "macro.dbt_utils.test_not_constant", "macro_sql": "{% test not_constant(model, column_name, group_by_columns = []) %}\n {{ return(adapter.dispatch('test_not_constant', 'dbt_utils')(model, column_name, group_by_columns)) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_utils.default__test_not_constant"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.6646504, "supported_languages": null}, "macro.dbt_utils.default__test_not_constant": {"name": "default__test_not_constant", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/not_constant.sql", "original_file_path": "macros/generic_tests/not_constant.sql", "unique_id": "macro.dbt_utils.default__test_not_constant", "macro_sql": "{% macro default__test_not_constant(model, column_name, group_by_columns) %}\n\n{% if group_by_columns|length() > 0 %}\n {% set select_gb_cols = group_by_columns|join(' ,') + ', ' %}\n {% set groupby_gb_cols = 'group by ' + group_by_columns|join(',') %}\n{% endif %}\n\n\nselect\n {# In TSQL, subquery aggregate columns need aliases #}\n {# thus: a filler col name, 'filler_column' #}\n {{select_gb_cols}}\n count(distinct {{ column_name }}) as filler_column\n\nfrom {{ model }}\n\n {{groupby_gb_cols}}\n\nhaving count(distinct {{ column_name }}) = 1\n\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.6654835, "supported_languages": null}, "macro.dbt_utils.test_fewer_rows_than": {"name": "test_fewer_rows_than", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/fewer_rows_than.sql", "original_file_path": "macros/generic_tests/fewer_rows_than.sql", "unique_id": "macro.dbt_utils.test_fewer_rows_than", "macro_sql": "{% test fewer_rows_than(model, compare_model, group_by_columns = []) %}\n {{ return(adapter.dispatch('test_fewer_rows_than', 'dbt_utils')(model, compare_model, group_by_columns)) }}\n{% endtest %}", "depends_on": {"macros": ["macro.dbt_utils.default__test_fewer_rows_than"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.6671307, "supported_languages": null}, "macro.dbt_utils.default__test_fewer_rows_than": {"name": "default__test_fewer_rows_than", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/generic_tests/fewer_rows_than.sql", "original_file_path": "macros/generic_tests/fewer_rows_than.sql", "unique_id": "macro.dbt_utils.default__test_fewer_rows_than", "macro_sql": "{% macro default__test_fewer_rows_than(model, compare_model, group_by_columns) %}\n\n{{ config(fail_calc = 'sum(coalesce(row_count_delta, 0))') }}\n\n{% if group_by_columns|length() > 0 %}\n {% set select_gb_cols = group_by_columns|join(' ,') + ', ' %}\n {% set join_gb_cols %}\n {% for c in group_by_columns %}\n and a.{{c}} = b.{{c}}\n {% endfor %}\n {% endset %}\n {% set groupby_gb_cols = 'group by ' + group_by_columns|join(',') %}\n{% endif %}\n\n{#-- We must add a fake join key in case additional grouping variables are not provided --#}\n{#-- Redshift does not allow for dynamically created join conditions (e.g. full join on 1 = 1 --#}\n{#-- The same logic is used in equal_rowcount. In case of changes, maintain consistent logic --#}\n{% set group_by_columns = ['id_dbtutils_test_fewer_rows_than'] + group_by_columns %}\n{% set groupby_gb_cols = 'group by ' + group_by_columns|join(',') %}\n\n\nwith a as (\n\n select \n {{select_gb_cols}}\n 1 as id_dbtutils_test_fewer_rows_than,\n count(*) as count_our_model \n from {{ model }}\n {{ groupby_gb_cols }}\n\n),\nb as (\n\n select \n {{select_gb_cols}}\n 1 as id_dbtutils_test_fewer_rows_than,\n count(*) as count_comparison_model \n from {{ compare_model }}\n {{ groupby_gb_cols }}\n\n),\ncounts as (\n\n select\n\n {% for c in group_by_columns -%}\n a.{{c}} as {{c}}_a,\n b.{{c}} as {{c}}_b,\n {% endfor %}\n\n count_our_model,\n count_comparison_model\n from a\n full join b on \n a.id_dbtutils_test_fewer_rows_than = b.id_dbtutils_test_fewer_rows_than\n {{ join_gb_cols }}\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_our_model > count_comparison_model then (count_our_model - count_comparison_model)\n -- fail the test if they are the same number\n when count_our_model = count_comparison_model 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 * from final\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.6689088, "supported_languages": null}, "macro.dbt_utils.log_info": {"name": "log_info", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/jinja_helpers/log_info.sql", "original_file_path": "macros/jinja_helpers/log_info.sql", "unique_id": "macro.dbt_utils.log_info", "macro_sql": "{% macro log_info(message) %}\n {{ return(adapter.dispatch('log_info', 'dbt_utils')(message)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__log_info"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.669377, "supported_languages": null}, "macro.dbt_utils.default__log_info": {"name": "default__log_info", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/jinja_helpers/log_info.sql", "original_file_path": "macros/jinja_helpers/log_info.sql", "unique_id": "macro.dbt_utils.default__log_info", "macro_sql": "{% macro default__log_info(message) %}\n {{ log(dbt_utils.pretty_log_format(message), info=True) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.pretty_log_format"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.669684, "supported_languages": null}, "macro.dbt_utils.pretty_log_format": {"name": "pretty_log_format", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/jinja_helpers/pretty_log_format.sql", "original_file_path": "macros/jinja_helpers/pretty_log_format.sql", "unique_id": "macro.dbt_utils.pretty_log_format", "macro_sql": "{% macro pretty_log_format(message) %}\n {{ return(adapter.dispatch('pretty_log_format', 'dbt_utils')(message)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__pretty_log_format"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.6701274, "supported_languages": null}, "macro.dbt_utils.default__pretty_log_format": {"name": "default__pretty_log_format", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/jinja_helpers/pretty_log_format.sql", "original_file_path": "macros/jinja_helpers/pretty_log_format.sql", "unique_id": "macro.dbt_utils.default__pretty_log_format", "macro_sql": "{% macro default__pretty_log_format(message) %}\n {{ return( dbt_utils.pretty_time() ~ ' + ' ~ message) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.pretty_time"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.6704204, "supported_languages": null}, "macro.dbt_utils._is_relation": {"name": "_is_relation", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/jinja_helpers/_is_relation.sql", "original_file_path": "macros/jinja_helpers/_is_relation.sql", "unique_id": "macro.dbt_utils._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 %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.6711664, "supported_languages": null}, "macro.dbt_utils.slugify": {"name": "slugify", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/jinja_helpers/slugify.sql", "original_file_path": "macros/jinja_helpers/slugify.sql", "unique_id": "macro.dbt_utils.slugify", "macro_sql": "{% macro slugify(string) %}\n\n{#- Lower case the string -#}\n{% set string = string | lower %}\n{#- Replace spaces and dashes with underscores -#}\n{% set string = modules.re.sub('[ -]+', '_', string) %}\n{#- Only take letters, numbers, and underscores -#}\n{% set string = modules.re.sub('[^a-z0-9_]+', '', string) %}\n{#- Prepends \"_\" if string begins with a number -#}\n{% set string = modules.re.sub('^[0-9]', '_' + string[0], string) %}\n\n{{ return(string) }}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.6722085, "supported_languages": null}, "macro.dbt_utils.pretty_time": {"name": "pretty_time", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/jinja_helpers/pretty_time.sql", "original_file_path": "macros/jinja_helpers/pretty_time.sql", "unique_id": "macro.dbt_utils.pretty_time", "macro_sql": "{% macro pretty_time(format='%H:%M:%S') %}\n {{ return(adapter.dispatch('pretty_time', 'dbt_utils')(format)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__pretty_time"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.6726844, "supported_languages": null}, "macro.dbt_utils.default__pretty_time": {"name": "default__pretty_time", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/jinja_helpers/pretty_time.sql", "original_file_path": "macros/jinja_helpers/pretty_time.sql", "unique_id": "macro.dbt_utils.default__pretty_time", "macro_sql": "{% macro default__pretty_time(format='%H:%M:%S') %}\n {{ return(modules.datetime.datetime.now().strftime(format)) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.6730545, "supported_languages": null}, "macro.dbt_utils._is_ephemeral": {"name": "_is_ephemeral", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/jinja_helpers/_is_ephemeral.sql", "original_file_path": "macros/jinja_helpers/_is_ephemeral.sql", "unique_id": "macro.dbt_utils._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 %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.6745484, "supported_languages": null}, "macro.dbt_utils.get_url_path": {"name": "get_url_path", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/web/get_url_path.sql", "original_file_path": "macros/web/get_url_path.sql", "unique_id": "macro.dbt_utils.get_url_path", "macro_sql": "{% macro get_url_path(field) -%}\n {{ return(adapter.dispatch('get_url_path', 'dbt_utils')(field)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__get_url_path"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.6752937, "supported_languages": null}, "macro.dbt_utils.default__get_url_path": {"name": "default__get_url_path", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/web/get_url_path.sql", "original_file_path": "macros/web/get_url_path.sql", "unique_id": "macro.dbt_utils.default__get_url_path", "macro_sql": "{% macro default__get_url_path(field) -%}\n\n {%- set stripped_url =\n dbt.replace(\n dbt.replace(field, \"'http://'\", \"''\"), \"'https://'\", \"''\")\n -%}\n\n {%- set first_slash_pos -%}\n coalesce(\n nullif({{ dbt.position(\"'/'\", stripped_url) }}, 0),\n {{ dbt.position(\"'?'\", stripped_url) }} - 1\n )\n {%- endset -%}\n\n {%- set parsed_path =\n dbt.split_part(\n dbt.right(\n stripped_url,\n dbt.length(stripped_url) ~ \"-\" ~ first_slash_pos\n ),\n \"'?'\", 1\n )\n -%}\n\n {{ dbt.safe_cast(\n parsed_path,\n dbt.type_string()\n )}}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.replace", "macro.dbt.position", "macro.dbt.split_part", "macro.dbt.right", "macro.dbt.length", "macro.dbt.safe_cast", "macro.dbt.type_string"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.676397, "supported_languages": null}, "macro.dbt_utils.get_url_host": {"name": "get_url_host", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/web/get_url_host.sql", "original_file_path": "macros/web/get_url_host.sql", "unique_id": "macro.dbt_utils.get_url_host", "macro_sql": "{% macro get_url_host(field) -%}\n {{ return(adapter.dispatch('get_url_host', 'dbt_utils')(field)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__get_url_host"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.6769938, "supported_languages": null}, "macro.dbt_utils.default__get_url_host": {"name": "default__get_url_host", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/web/get_url_host.sql", "original_file_path": "macros/web/get_url_host.sql", "unique_id": "macro.dbt_utils.default__get_url_host", "macro_sql": "{% macro default__get_url_host(field) -%}\n\n{%- set parsed =\n dbt.split_part(\n dbt.split_part(\n dbt.replace(\n dbt.replace(\n dbt.replace(field, \"'android-app://'\", \"''\"\n ), \"'http://'\", \"''\"\n ), \"'https://'\", \"''\"\n ), \"'/'\", 1\n ), \"'?'\", 1\n )\n\n-%}\n\n\n {{ dbt.safe_cast(\n parsed,\n dbt.type_string()\n )}}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.split_part", "macro.dbt.replace", "macro.dbt.safe_cast", "macro.dbt.type_string"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.6777766, "supported_languages": null}, "macro.dbt_utils.get_url_parameter": {"name": "get_url_parameter", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/web/get_url_parameter.sql", "original_file_path": "macros/web/get_url_parameter.sql", "unique_id": "macro.dbt_utils.get_url_parameter", "macro_sql": "{% macro get_url_parameter(field, url_parameter) -%}\n {{ return(adapter.dispatch('get_url_parameter', 'dbt_utils')(field, url_parameter)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__get_url_parameter"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.678315, "supported_languages": null}, "macro.dbt_utils.default__get_url_parameter": {"name": "default__get_url_parameter", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/web/get_url_parameter.sql", "original_file_path": "macros/web/get_url_parameter.sql", "unique_id": "macro.dbt_utils.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.split_part(dbt.split_part(field, formatted_url_parameter, 2), \"'&'\", 1) -%}\n\nnullif({{ split }},'')\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.split_part"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.6788719, "supported_languages": null}, "macro.dbt_unit_testing.build_input_values_sql": {"name": "build_input_values_sql", "resource_type": "macro", "package_name": "dbt_unit_testing", "path": "macros/input_parsing.sql", "original_file_path": "macros/input_parsing.sql", "unique_id": "macro.dbt_unit_testing.build_input_values_sql", "macro_sql": "{% macro build_input_values_sql(input_values, options) %}\n {% set input_values_sql = input_values %}\n\n {% if options.input_format | lower == \"csv\" %}\n {% set input_values_sql = dbt_unit_testing.sql_from_csv_input(input_values, options) %}\n {%- endif -%}\n\n {{ return (input_values_sql) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_unit_testing.sql_from_csv_input"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.681268, "supported_languages": null}, "macro.dbt_unit_testing.sql_from_csv": {"name": "sql_from_csv", "resource_type": "macro", "package_name": "dbt_unit_testing", "path": "macros/input_parsing.sql", "original_file_path": "macros/input_parsing.sql", "unique_id": "macro.dbt_unit_testing.sql_from_csv", "macro_sql": "{% macro sql_from_csv(options={}) %}\n {{ return (sql_from_csv_input(caller(), options)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_unit_testing.sql_from_csv_input"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.6815994, "supported_languages": null}, "macro.dbt_unit_testing.sql_from_csv_input": {"name": "sql_from_csv_input", "resource_type": "macro", "package_name": "dbt_unit_testing", "path": "macros/input_parsing.sql", "original_file_path": "macros/input_parsing.sql", "unique_id": "macro.dbt_unit_testing.sql_from_csv_input", "macro_sql": "{% macro sql_from_csv_input(csv_table, options) %}\n {% set column_separator = options.column_separator | default(\",\") %}\n {% set line_separator = options.line_separator | default(\"\\n\") %}\n {% set type_separator = options.type_separator | default(\"::\") %}\n {% set ns = namespace(col_names=[], col_types = [], col_values = [], row_values=[]) %}\n\n {% set rows = csv_table.split(line_separator) | map('trim') | reject('==', '') | list %}\n {% set cols = rows[0].split(column_separator) | map('trim') %}\n {% for col in cols %}\n {% set c = col.split(type_separator) | list %}\n {% set col_name = c[0] %}\n {% set col_type = c[1] %}\n {% set ns.col_names = ns.col_names + [col_name] %}\n {% set ns.col_types = ns.col_types + [col_type] %}\n {% endfor %}\n\n {% for row in rows[1:] %}\n {% set cols = row.split(column_separator) | map('trim') | list %}\n {% set ns.col_values = [] %}\n {% for col in cols %}\n {% set col_value = col %}\n {% set col_type = ns.col_types[loop.index-1] %}\n {% if col_type is defined %}\n {% set col_value = \"CAST(\" ~ col_value ~ \" as \" ~ col_type ~ \")\" %}\n {% endif %}\n {% set col_value = col_value ~ \" as \" ~ ns.col_names[loop.index-1] %}\n {% set ns.col_values = ns.col_values + [col_value] %}\n {% endfor %}\n\n {% set col_values = ns.col_values | join(\",\") %}\n {% set sql_row = \"select \" ~ col_values %}\n {% set ns.row_values = ns.row_values + [sql_row] %}\n {% endfor %}\n\n {% set sql = ns.row_values | join(\"\\n union all\\n\") %}\n\n {{ return (sql) }}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.685486, "supported_languages": null}, "macro.dbt_unit_testing.print_table": {"name": "print_table", "resource_type": "macro", "package_name": "dbt_unit_testing", "path": "macros/output.sql", "original_file_path": "macros/output.sql", "unique_id": "macro.dbt_unit_testing.print_table", "macro_sql": "{% macro print_table(agate_table, options={}) %}\n {% set columns_start_index = 2 %}\n {% set columns_info = [] %}\n {% for col_name in agate_table.column_names %}\n {% set col_index = loop.index0 %}\n {% set column_info = {\"max_length\": col_name | length, \"is_string\": false, \"has_differences\": false} %}\n {% for row in agate_table.rows %}\n {% set cell_value = row[col_name] %}\n {% set l = cell_value | string | length %}\n {% if l > column_info.max_length %}\n {% do column_info.update({\"max_length\": l}) %}\n {% endif %}\n {% do column_info.update({\"is_string\": column_info.is_string or cell_value is string}) %}\n\n {% if col_index >= columns_start_index %}\n {% if column_info.previous_value is defined and column_info.previous_value != cell_value %}\n {% do column_info.update({\"has_differences\": true}) %}\n {% endif %}\n {% do column_info.update({\"previous_value\": cell_value}) %}\n {% endif %}\n\n {% endfor %} \n {% set columns_info = columns_info.append(column_info) %}\n {% endfor %}\n\n {% set cells = [] %}\n {% for col_name in agate_table.column_names %}\n {% set col_index = loop.index0 %}\n {% set padded = dbt_unit_testing.pad(col_name, columns_info[col_index].max_length, pad_right=columns_info[col_index].is_string) %}\n {% if columns_info[col_index].has_differences %}\n {% do cells.append(\"{RED}\" ~ padded ~ \"{RESET}\") %}\n {% else %}\n {% do cells.append(padded) %}\n {% endif %}\n {% endfor %}\n {{ dbt_unit_testing.println(\"| \" ~ cells | join(\" | \") ~ \" |\")}}\n\n {% set cells = [] %}\n {% for col_name in agate_table.column_names %}\n {% set col_index = loop.index0 %}\n {% set line = dbt_unit_testing.pad(\"\", columns_info[col_index].max_length, c=\"-\") %}\n {% if columns_info[col_index].has_differences %}\n {% do cells.append(\"{RED}\" ~ line ~ \"{RESET}\") %}\n {% else %}\n {% do cells.append(line) %}\n {% endif %}\n {% endfor %}\n {{ dbt_unit_testing.println(\"| \" ~ cells | join(\" | \") ~ \" |\")}}\n\n {% set last_spaces_replace_char = options.last_spaces_replace_char | default(\" \") %}\n {% for row in agate_table.rows %}\n {% set cells = [] %}\n {% for cell_value in row %}\n {% set col_index = loop.index0 %}\n {% if cell_value is string %}\n {% set cell_value = dbt_unit_testing.replace_last_spaces_with(last_spaces_replace_char, cell_value) %}\n {% endif %}\n {% set padded = dbt_unit_testing.pad(cell_value, columns_info[col_index].max_length, pad_right=cell_value is string) %}\n {% if columns_info[col_index].has_differences %}\n {% do cells.append(\"{RED}\" ~ padded ~ \"{RESET}\") %}\n {% else %}\n {% do cells.append(padded) %}\n {% endif %}\n {% endfor %}\n {{ dbt_unit_testing.println(\"| \" ~ cells | join(\" | \") ~ \" |\")}}\n {% endfor %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_unit_testing.pad", "macro.dbt_unit_testing.println", "macro.dbt_unit_testing.replace_last_spaces_with"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.6980503, "supported_languages": null}, "macro.dbt_unit_testing.replace_last_spaces_with": {"name": "replace_last_spaces_with", "resource_type": "macro", "package_name": "dbt_unit_testing", "path": "macros/output.sql", "original_file_path": "macros/output.sql", "unique_id": "macro.dbt_unit_testing.replace_last_spaces_with", "macro_sql": "{% macro replace_last_spaces_with(replacement, s) %}\n {% set rs = s | reverse %}\n {% set replaced = namespace(value=\"\", stop=false) %}\n {% for i in range(0, rs | length) %}\n {% if rs[i] == ' ' and not replaced.stop %}\n {% set replaced.value = replaced.value ~ replacement %}\n {% else %}\n {% set replaced.value = replaced.value ~ rs[i] %}\n {% set replaced.stop = true %}\n {% endif %}\n {% endfor %}\n {{ return(replaced.value | reverse) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.699306, "supported_languages": null}, "macro.dbt_unit_testing.pad": {"name": "pad", "resource_type": "macro", "package_name": "dbt_unit_testing", "path": "macros/output.sql", "original_file_path": "macros/output.sql", "unique_id": "macro.dbt_unit_testing.pad", "macro_sql": "{% macro pad(v, pad, pad_right=false, c=\" \") %}\n {% set padding = c * (pad - v | string | length) %}\n {% if pad_right %}\n {{ return (v ~ padding) }}\n {% else %}\n {{ return (padding ~ v) }}\n {% endif %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.6999915, "supported_languages": null}, "macro.dbt_unit_testing.parse_colors": {"name": "parse_colors", "resource_type": "macro", "package_name": "dbt_unit_testing", "path": "macros/output.sql", "original_file_path": "macros/output.sql", "unique_id": "macro.dbt_unit_testing.parse_colors", "macro_sql": "{% macro parse_colors(s) %}\n {{ return (s\n .replace(\"{RED}\", \"\\x1b[0m\\x1b[31m\")\n .replace(\"{GREEN}\", \"\\x1b[0m\\x1b[32m\")\n .replace(\"{YELLOW}\", \"\\x1b[0m\\x1b[33m\")\n .replace(\"{BG_YELLOW}\", \"\\x1b[0m\\x1b[43m\")\n .replace(\"{RESET}\", \"\\x1b[0m\")) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.replace"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.700556, "supported_languages": null}, "macro.dbt_unit_testing.println": {"name": "println", "resource_type": "macro", "package_name": "dbt_unit_testing", "path": "macros/output.sql", "original_file_path": "macros/output.sql", "unique_id": "macro.dbt_unit_testing.println", "macro_sql": "{% macro println(s) %}\n {% do log(dbt_unit_testing.parse_colors(s ~ \"{RESET}\"), info=true) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_unit_testing.parse_colors"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.700914, "supported_languages": null}, "macro.dbt_unit_testing.print_warning": {"name": "print_warning", "resource_type": "macro", "package_name": "dbt_unit_testing", "path": "macros/output.sql", "original_file_path": "macros/output.sql", "unique_id": "macro.dbt_unit_testing.print_warning", "macro_sql": "{% macro print_warning(s) %}\n {% do log(dbt_unit_testing.parse_colors(\"{YELLOW}\" ~ s ~ \"{RESET}\"), info=true) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_unit_testing.parse_colors"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.7012763, "supported_languages": null}, "macro.dbt_unit_testing.build_model_complete_sql": {"name": "build_model_complete_sql", "resource_type": "macro", "package_name": "dbt_unit_testing", "path": "macros/sql_builders.sql", "original_file_path": "macros/sql_builders.sql", "unique_id": "macro.dbt_unit_testing.build_model_complete_sql", "macro_sql": "{% macro build_model_complete_sql(model_node, mocks=[], options={}) %}\n {% set mock_ids = mocks | rejectattr(\"options.include_missing_columns\", \"==\", true) | map(attribute=\"unique_id\") | list %}\n {% set only_direct_dependencies = options.use_database_models %}\n {% set model_dependencies = dbt_unit_testing.build_model_dependencies(model_node, mock_ids, only_direct_dependencies) %}\n -- {# add mocks that are not in model dependencies (to allow for mocking the model itself, when testing incremental models) #}\n {% set model_dependencies = model_dependencies + mocks | map(attribute=\"unique_id\") | reject('in', model_dependencies) | list %}\n\n {% set cte_dependencies = [] %}\n {% for node_id in model_dependencies %}\n {% set node = dbt_unit_testing.node_by_id(node_id) %}\n {% set existing_mock = mocks | selectattr(\"unique_id\", \"==\", node_id) | first %}\n {% set cte_sql = existing_mock.input_values if existing_mock else dbt_unit_testing.build_node_sql(node, options.use_database_models) %}\n {% set cte_name = dbt_unit_testing.cte_name(existing_mock if existing_mock else node) %}\n {% set cte = dbt_unit_testing.quote_identifier(cte_name) ~ \" as (\" ~ cte_sql ~ \")\" %}\n {% set cte_dependencies = cte_dependencies.append(cte) %}\n {%- endfor -%}\n\n {% set rendered_node = dbt_unit_testing.render_node_for_model_being_tested(model_node) %}\n {%- set model_complete_sql -%}\n {% if cte_dependencies %}\n with\n {{ cte_dependencies | join(\",\\n\") }}\n {%- endif -%}\n {{ \"\\n\" }}\n select * from ({{ rendered_node }} {{ \"\\n\" }} ) as t\n {%- endset -%}\n\n {{ return(model_complete_sql) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_unit_testing.build_model_dependencies", "macro.dbt_unit_testing.node_by_id", "macro.dbt_unit_testing.build_node_sql", "macro.dbt_unit_testing.cte_name", "macro.dbt_unit_testing.quote_identifier", "macro.dbt_unit_testing.render_node_for_model_being_tested"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.711419, "supported_languages": null}, "macro.dbt_unit_testing.cte_name": {"name": "cte_name", "resource_type": "macro", "package_name": "dbt_unit_testing", "path": "macros/sql_builders.sql", "original_file_path": "macros/sql_builders.sql", "unique_id": "macro.dbt_unit_testing.cte_name", "macro_sql": "{% macro cte_name(node) %}\n {% if node.resource_type in ('source') %}\n {{ return (dbt_unit_testing.source_cte_name(node)) }}\n {% else %}\n {{ return (dbt_unit_testing.ref_cte_name(node)) }}\n {% endif %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_unit_testing.source_cte_name", "macro.dbt_unit_testing.ref_cte_name"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.7119982, "supported_languages": null}, "macro.dbt_unit_testing.ref_cte_name": {"name": "ref_cte_name", "resource_type": "macro", "package_name": "dbt_unit_testing", "path": "macros/sql_builders.sql", "original_file_path": "macros/sql_builders.sql", "unique_id": "macro.dbt_unit_testing.ref_cte_name", "macro_sql": "{% macro ref_cte_name(node) %}\n {% set node = dbt_unit_testing.model_node(node) %}\n {% set parts = [\"DBT_CTE\", node.name] %}\n {% if node.package_name != model.package_name %}\n {% set parts = [node.package_name] + parts %}\n {% endif %}\n {% if dbt_unit_testing.has_value(node.version)%}\n {% set parts = parts + [node.version] %}\n {% endif %}\n {{ return (dbt_unit_testing.quote_identifier(parts | join(\"__\"))) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_unit_testing.model_node", "macro.dbt_unit_testing.has_value", "macro.dbt_unit_testing.quote_identifier"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.7131546, "supported_languages": null}, "macro.dbt_unit_testing.source_cte_name": {"name": "source_cte_name", "resource_type": "macro", "package_name": "dbt_unit_testing", "path": "macros/sql_builders.sql", "original_file_path": "macros/sql_builders.sql", "unique_id": "macro.dbt_unit_testing.source_cte_name", "macro_sql": "{% macro source_cte_name(node) %}\n {%- set cte_name -%}\n {%- if dbt_unit_testing.config_is_true(\"use_qualified_sources\") -%}\n {%- set source_node = dbt_unit_testing.source_node(node) -%}\n {{ [source_node.source_name, source_node.name] | join(\"__\") }}\n {%- else -%}\n {{ node.name }}\n {%- endif -%}\n {%- endset -%}\n {{ return (dbt_unit_testing.quote_identifier(cte_name)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_unit_testing.config_is_true", "macro.dbt_unit_testing.source_node", "macro.dbt_unit_testing.quote_identifier"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.7139277, "supported_languages": null}, "macro.dbt_unit_testing.build_model_dependencies": {"name": "build_model_dependencies", "resource_type": "macro", "package_name": "dbt_unit_testing", "path": "macros/sql_builders.sql", "original_file_path": "macros/sql_builders.sql", "unique_id": "macro.dbt_unit_testing.build_model_dependencies", "macro_sql": "{% macro build_model_dependencies(node, stop_recursion_at_these_dependencies, only_direct_dependencies=False) %}\n {% set model_dependencies = [] %}\n {% for node_id in node.depends_on.nodes %}\n {% set node = dbt_unit_testing.node_by_id(node_id) %}\n {% if node.resource_type in ('model','snapshot') and node.unique_id not in stop_recursion_at_these_dependencies and not only_direct_dependencies%}\n {% set child_model_dependencies = dbt_unit_testing.build_model_dependencies(node, stop_recursion_at_these_dependencies, only_direct_dependencies) %}\n {% for dependency_node_id in child_model_dependencies %}\n {{ model_dependencies.append(dependency_node_id) }}\n {% endfor %}\n {% endif %}\n {{ model_dependencies.append(node_id) }}\n {% endfor %}\n\n {{ return (model_dependencies | unique | list) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_unit_testing.node_by_id", "macro.dbt_unit_testing.build_model_dependencies"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.7152908, "supported_languages": null}, "macro.dbt_unit_testing.build_node_sql": {"name": "build_node_sql", "resource_type": "macro", "package_name": "dbt_unit_testing", "path": "macros/sql_builders.sql", "original_file_path": "macros/sql_builders.sql", "unique_id": "macro.dbt_unit_testing.build_node_sql", "macro_sql": "{% macro build_node_sql(node, use_database_models=false, complete=false) %}\n {%- if use_database_models or node.resource_type in ('source', 'seed') -%}\n {%- if node.resource_type == \"source\" %}\n {% set name = node.identifier %}\n {%- elif node.resource_type == \"snapshot\" %}\n {%- if dbt_unit_testing.has_value(node.config.alias) %}\n {% set name = node.config.alias %}\n {%- else %}\n {% set name = node.name %}\n {%- endif %}\n {%- else %}\n {% set name = node.name %}\n {%- endif %}\n\n {% set name_parts = dbt_unit_testing.map([node.database, node.schema, name], dbt_unit_testing.quote_identifier) %}\n select * from {{ name_parts | join('.') }} where 1 = 0\n {%- else -%}\n {% if complete %}\n {{ dbt_unit_testing.build_model_complete_sql(node) }}\n {%- else -%}\n {{ dbt_unit_testing.render_node(node) ~ \"\\n\"}}\n {%- endif -%}\n {%- endif -%}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_unit_testing.has_value", "macro.dbt_unit_testing.map", "macro.dbt_unit_testing.build_model_complete_sql", "macro.dbt_unit_testing.render_node"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.7170393, "supported_languages": null}, "macro.dbt_unit_testing.render_node": {"name": "render_node", "resource_type": "macro", "package_name": "dbt_unit_testing", "path": "macros/sql_builders.sql", "original_file_path": "macros/sql_builders.sql", "unique_id": "macro.dbt_unit_testing.render_node", "macro_sql": "{% macro render_node(node) %}\n {% set model_sql = node.raw_sql if node.raw_sql is defined else node.raw_code %}\n {{ return (render(model_sql)) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.7174835, "supported_languages": null}, "macro.dbt_unit_testing.render_node_for_model_being_tested": {"name": "render_node_for_model_being_tested", "resource_type": "macro", "package_name": "dbt_unit_testing", "path": "macros/sql_builders.sql", "original_file_path": "macros/sql_builders.sql", "unique_id": "macro.dbt_unit_testing.render_node_for_model_being_tested", "macro_sql": "{% macro render_node_for_model_being_tested(node) %}\n {% set model_sql = node.raw_sql if node.raw_sql is defined else node.raw_code %}\n {% set model_name = dbt_unit_testing.cte_name(node) %}\n {% set this_name = this | string %}\n -- {# If the model contains a 'this' property, we will replace its result with the name of the model being tested #}\n -- {# but first we mask previous occurrences that could be there before the render (very unlikely to happen) #}\n -- {# This way we 'ensure' that we only replace stuff produced after the render #}\n {% set replace_mask = '######################' %}\n {% set model_sql = model_sql.replace(this_name, replace_mask) %}\n {{ dbt_unit_testing.set_test_context(\"model_being_rendered\", model_name) }}\n {% set rendered_sql = render(model_sql) %}\n {{ dbt_unit_testing.set_test_context(\"model_being_rendered\", \"\") }}\n {% set rendered_sql = rendered_sql.replace(this_name, model_name) %}\n {% set rendered_sql = rendered_sql.replace(replace_mask, this_name) %}\n {{ return (rendered_sql) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_unit_testing.cte_name", "macro.dbt.replace", "macro.dbt_unit_testing.set_test_context"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.7189174, "supported_languages": null}, "macro.dbt_unit_testing.mock_ref": {"name": "mock_ref", "resource_type": "macro", "package_name": "dbt_unit_testing", "path": "macros/mock_builders.sql", "original_file_path": "macros/mock_builders.sql", "unique_id": "macro.dbt_unit_testing.mock_ref", "macro_sql": "{% macro mock_ref(project_or_package, model_name, options={}) %}\n {% if model_name is mapping %}\n {% set options = model_name %}\n {% set model_name = project_or_package %}\n {% set project_or_package = model.package_name %}\n {{ dbt_unit_testing.print_warning(\"Use keyword 'options' when passing options to mock_ref\" ~ \" (in \" ~ model_name ~ \")\") }}\n {% else %}\n {% set project_or_package, model_name = dbt_unit_testing.setup_project_and_model_name(project_or_package, model_name) %}\n {% endif %}\n {% if model_name is undefined %}\n {{ dbt_unit_testing.raise_error('model_name must be provided for mock_ref') }}\n {% endif %}\n {% set node_version = kwargs[\"version\"] | default(kwargs[\"v\"]) | default(none) %}\n {% set mock = {\n \"type\": 'mock',\n \"resource_type\": 'model',\n \"name\": model_name,\n \"package_name\": project_or_package,\n \"version\": node_version,\n \"options\": options,\n \"input_values\": caller(),\n }\n %} \n {{ return (dbt_unit_testing.append_json(mock)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_unit_testing.print_warning", "macro.dbt_unit_testing.setup_project_and_model_name", "macro.dbt_unit_testing.raise_error", "macro.dbt_unit_testing.append_json"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.7255871, "supported_languages": null}, "macro.dbt_unit_testing.mock_source": {"name": "mock_source", "resource_type": "macro", "package_name": "dbt_unit_testing", "path": "macros/mock_builders.sql", "original_file_path": "macros/mock_builders.sql", "unique_id": "macro.dbt_unit_testing.mock_source", "macro_sql": "{% macro mock_source(source_name, table_name, options={}) %}\n {% if source_name is undefined %}\n {{ dbt_unit_testing.raise_error('source_name must be provided for mock_source') }}\n {% endif %}\n {% if table_name is undefined %}\n {{ dbt_unit_testing.raise_error('table_name must be provided for mock_source') }}\n {% endif %}\n {% set mock = {\n \"type\": 'mock',\n \"resource_type\": 'source',\n \"name\": table_name,\n \"source_name\": source_name,\n \"options\": options,\n \"input_values\": caller(),\n }\n %} \n {{ return (dbt_unit_testing.append_json(mock)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_unit_testing.raise_error", "macro.dbt_unit_testing.append_json"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.7267635, "supported_languages": null}, "macro.dbt_unit_testing.expect": {"name": "expect", "resource_type": "macro", "package_name": "dbt_unit_testing", "path": "macros/mock_builders.sql", "original_file_path": "macros/mock_builders.sql", "unique_id": "macro.dbt_unit_testing.expect", "macro_sql": "{% macro expect(options={}) %}\n {% set expectations = {\n \"type\": \"expectations\",\n \"options\": options,\n \"input_values\": caller(),\n }\n %} \n {{ return (dbt_unit_testing.append_json(expectations)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_unit_testing.append_json"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.727295, "supported_languages": null}, "macro.dbt_unit_testing.expect_no_rows": {"name": "expect_no_rows", "resource_type": "macro", "package_name": "dbt_unit_testing", "path": "macros/mock_builders.sql", "original_file_path": "macros/mock_builders.sql", "unique_id": "macro.dbt_unit_testing.expect_no_rows", "macro_sql": "{% macro expect_no_rows(options={}) %}\n {% set dummy = caller() %}\n {% set expectations = {\n \"type\": \"expectations\",\n \"options\": options,\n \"input_values\": \"select * from (select 1) as t where 1 = 0\",\n \"no_rows\": true,\n }\n %} \n {{ return (dbt_unit_testing.append_json(expectations)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_unit_testing.append_json"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.7279172, "supported_languages": null}, "macro.dbt_unit_testing.append_json": {"name": "append_json", "resource_type": "macro", "package_name": "dbt_unit_testing", "path": "macros/mock_builders.sql", "original_file_path": "macros/mock_builders.sql", "unique_id": "macro.dbt_unit_testing.append_json", "macro_sql": "{% macro append_json(json) %}\n {{ return (json | tojson() ~ '####_JSON_LINE_DELIMITER_####') }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.7282078, "supported_languages": null}, "macro.dbt_unit_testing.split_json_str": {"name": "split_json_str", "resource_type": "macro", "package_name": "dbt_unit_testing", "path": "macros/mock_builders.sql", "original_file_path": "macros/mock_builders.sql", "unique_id": "macro.dbt_unit_testing.split_json_str", "macro_sql": "{% macro split_json_str(json_str) %}\n {% set lines = json_str.split('####_JSON_LINE_DELIMITER_####') | map('trim') | reject('==', '') | list %}\n {{ return (dbt_unit_testing.map(lines, fromjson)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_unit_testing.map"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.7287378, "supported_languages": null}, "macro.dbt_unit_testing.enrich_mock_sql_with_missing_columns": {"name": "enrich_mock_sql_with_missing_columns", "resource_type": "macro", "package_name": "dbt_unit_testing", "path": "macros/mock_builders.sql", "original_file_path": "macros/mock_builders.sql", "unique_id": "macro.dbt_unit_testing.enrich_mock_sql_with_missing_columns", "macro_sql": "{% macro enrich_mock_sql_with_missing_columns(mock, options) %}\n {% set model_node = dbt_unit_testing.node_by_id(mock.unique_id) %}\n {% set model_name = model_node.name %}\n {% set input_values_sql = mock.input_values %}\n\n {% set model_columns = dbt_unit_testing.get_from_cache(\"COLUMNS\", model_node.name) %}\n {% if not model_columns %}\n {% set model_sql = dbt_unit_testing.build_node_sql(model_node, options.use_database_models, complete=true) %}\n {% set model_columns = dbt_unit_testing.extract_columns_list(model_sql) %}\n {{ dbt_unit_testing.cache(\"COLUMNS\", model_node.name, model_columns)}}\n {% else %}\n {{ dbt_unit_testing.verbose(\"CACHE HIT for \" ~ model_node.name ~ \" COLUMNS\") }}\n {% endif %}\n \n {% set input_columns = dbt_unit_testing.extract_columns_list(input_values_sql) %}\n {% set missing_columns = dbt_unit_testing.extract_columns_difference(model_columns, input_columns) %}\n\n {%- if missing_columns -%}\n {% set input_values_sql %}\n {% set node_sql = dbt_unit_testing.build_node_sql(model_node, options.use_database_models) %}\n select * from ({{ input_values_sql }}) as m1\n left join (select {{ dbt_unit_testing.quote_and_join_columns(missing_columns)}}\n from ({{ node_sql }}) as m2) as m3 on false\n {%- endset -%}\n {%- endif -%}\n {% do mock.update({\"input_values\": input_values_sql}) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_unit_testing.node_by_id", "macro.dbt_unit_testing.get_from_cache", "macro.dbt_unit_testing.build_node_sql", "macro.dbt_unit_testing.extract_columns_list", "macro.dbt_unit_testing.cache", "macro.dbt_unit_testing.verbose", "macro.dbt_unit_testing.extract_columns_difference", "macro.dbt_unit_testing.quote_and_join_columns"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.7308857, "supported_languages": null}, "macro.dbt_unit_testing.ref": {"name": "ref", "resource_type": "macro", "package_name": "dbt_unit_testing", "path": "macros/overrides.sql", "original_file_path": "macros/overrides.sql", "unique_id": "macro.dbt_unit_testing.ref", "macro_sql": "{% macro ref(project_or_package, model_name) %}\n {% if dbt_unit_testing.running_unit_test() %}\n {% set project_or_package, model_name = dbt_unit_testing.setup_project_and_model_name(project_or_package, model_name) %}\n {% set node_version = kwargs[\"version\"] | default (kwargs[\"v\"]) %}\n {% set node = {\"package_name\": project_or_package, \"name\": model_name, \"version\": node_version} %}\n {{ return (dbt_unit_testing.ref_cte_name(node)) }}\n {% else %}\n {% if model_name is undefined %}\n {{ return (builtins.ref(project_or_package, **kwargs)) }}\n {% else %}\n {{ return (builtins.ref(project_or_package, model_name, **kwargs)) }}\n {% endif %}\n {% endif %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_unit_testing.running_unit_test", "macro.dbt_unit_testing.setup_project_and_model_name", "macro.dbt_unit_testing.ref_cte_name", "macro.dbt_testing_example.ref"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.734114, "supported_languages": null}, "macro.dbt_unit_testing.source": {"name": "source", "resource_type": "macro", "package_name": "dbt_unit_testing", "path": "macros/overrides.sql", "original_file_path": "macros/overrides.sql", "unique_id": "macro.dbt_unit_testing.source", "macro_sql": "{% macro source(source, table_name) %}\n {% if dbt_unit_testing.running_unit_test() %}\n {{ return (dbt_unit_testing.source_cte_name({\"source_name\": source, \"name\": table_name})) }}\n {% else %}\n {{ return (builtins.source(source, table_name)) }}\n {% endif %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_unit_testing.running_unit_test", "macro.dbt_unit_testing.source_cte_name", "macro.dbt_testing_example.source"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.7347775, "supported_languages": null}, "macro.dbt_unit_testing.is_incremental": {"name": "is_incremental", "resource_type": "macro", "package_name": "dbt_unit_testing", "path": "macros/overrides.sql", "original_file_path": "macros/overrides.sql", "unique_id": "macro.dbt_unit_testing.is_incremental", "macro_sql": "{% macro is_incremental() %}\n {% if dbt_unit_testing.running_unit_test() %}\n {% set options = dbt_unit_testing.get_test_context(\"options\", {}) %}\n {% set is_incremental_should_be_true_for_this_model = dbt_unit_testing.get_test_context(\"is_incremental_should_be_true_for_this_model\", \"\") %}\n {% set model_being_rendered = dbt_unit_testing.get_test_context(\"model_being_rendered\", \"\") %}\n {{ return (options.get(\"run_as_incremental\", False) and model_being_rendered == is_incremental_should_be_true_for_this_model and model_being_rendered != \"\") }}\n {% else %}\n {{ return (dbt.is_incremental())}}\n {% endif %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_unit_testing.running_unit_test", "macro.dbt_unit_testing.get_test_context", "macro.dbt.is_incremental"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.7358282, "supported_languages": null}, "macro.dbt_unit_testing.running_unit_test": {"name": "running_unit_test", "resource_type": "macro", "package_name": "dbt_unit_testing", "path": "macros/overrides.sql", "original_file_path": "macros/overrides.sql", "unique_id": "macro.dbt_unit_testing.running_unit_test", "macro_sql": "{% macro running_unit_test() %}\n {{ return ('unit-test' in config.get('tags', {})) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.736143, "supported_languages": null}, "macro.dbt_unit_testing.setup_project_and_model_name": {"name": "setup_project_and_model_name", "resource_type": "macro", "package_name": "dbt_unit_testing", "path": "macros/overrides.sql", "original_file_path": "macros/overrides.sql", "unique_id": "macro.dbt_unit_testing.setup_project_and_model_name", "macro_sql": "{% macro setup_project_and_model_name(project_or_package, model_name) %}\n {% set updated_project_or_package = project_or_package if model_name is defined else model.package_name %}\n {% set updated_model_name = model_name if model_name is defined else project_or_package %}\n {{ return((updated_project_or_package, updated_model_name)) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.7366984, "supported_languages": null}, "macro.dbt_unit_testing.test": {"name": "test", "resource_type": "macro", "package_name": "dbt_unit_testing", "path": "macros/tests.sql", "original_file_path": "macros/tests.sql", "unique_id": "macro.dbt_unit_testing.test", "macro_sql": "{% macro test(model_name, test_description='(no description)', options={}) %}\n {{ dbt_unit_testing.ref_tested_model(model_name) }}\n\n {% if execute %}\n {% if flags.WHICH in ('test', 'build') %}\n {{ dbt_unit_testing.set_test_context(\"is_incremental_should_be_true_for_this_model\", \"\") }}\n {% set mocks_and_expectations_json_str = caller() %}\n {% set model_version = kwargs[\"version\"] | default(kwargs[\"v\"]) | default(none) %}\n {% set model_node = {\"package_name\": model.package_name, \"name\": model_name, \"version\": model_version} %}\n {% set test_configuration, test_queries = dbt_unit_testing.build_configuration_and_test_queries(model_node, test_description, options, mocks_and_expectations_json_str) %}\n {% set test_report = dbt_unit_testing.build_test_report(test_configuration, test_queries) %}\n\n {% if not test_report.succeeded %}\n {{ dbt_unit_testing.show_test_report(test_configuration, test_report) }}\n {% endif %}\n \n select * from (select 1) as t where {{ not test_report.succeeded }} \n {{ dbt_unit_testing.clear_test_context() }}\n {% else %}\n select * from (select 1) as t where 1 = 0\n {% endif %}\n {% endif %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_unit_testing.ref_tested_model", "macro.dbt_unit_testing.set_test_context", "macro.dbt_unit_testing.build_configuration_and_test_queries", "macro.dbt_unit_testing.build_test_report", "macro.dbt_unit_testing.show_test_report", "macro.dbt_unit_testing.clear_test_context"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.7627559, "supported_languages": null}, "macro.dbt_unit_testing.build_configuration_and_test_queries": {"name": "build_configuration_and_test_queries", "resource_type": "macro", "package_name": "dbt_unit_testing", "path": "macros/tests.sql", "original_file_path": "macros/tests.sql", "unique_id": "macro.dbt_unit_testing.build_configuration_and_test_queries", "macro_sql": "{% macro build_configuration_and_test_queries(model_node, test_description, options, mocks_and_expectations_json_str) %}\n {% set model_name = model_node.name %}\n {% do options.update({\"column_transformations\": {model_name: options.get(\"column_transformations\", {})}}) %}\n {% set test_configuration = {\n \"model_name\": model_node.name, \n \"description\": test_description, \n \"model_node\": model_node,\n \"options\": dbt_unit_testing.merge_configs([options])} \n %}\n {{ dbt_unit_testing.set_test_context(\"options\", test_configuration.options) }}\n\n {{ dbt_unit_testing.verbose(\"CONFIG: \" ~ test_configuration) }}\n \n {% do test_configuration.update (dbt_unit_testing.build_mocks_and_expectations(test_configuration, mocks_and_expectations_json_str)) %}\n {{ dbt_unit_testing.set_test_context(\"is_incremental_should_be_true_for_this_model\", dbt_unit_testing.ref_cte_name(model_node)) }}\n {% set test_queries = dbt_unit_testing.build_test_queries(test_configuration) %}\n\n {{ return ((test_configuration, test_queries)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_unit_testing.merge_configs", "macro.dbt_unit_testing.set_test_context", "macro.dbt_unit_testing.verbose", "macro.dbt_unit_testing.build_mocks_and_expectations", "macro.dbt_unit_testing.ref_cte_name", "macro.dbt_unit_testing.build_test_queries"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.7646637, "supported_languages": null}, "macro.dbt_unit_testing.build_mocks_and_expectations": {"name": "build_mocks_and_expectations", "resource_type": "macro", "package_name": "dbt_unit_testing", "path": "macros/tests.sql", "original_file_path": "macros/tests.sql", "unique_id": "macro.dbt_unit_testing.build_mocks_and_expectations", "macro_sql": "{% macro build_mocks_and_expectations(test_configuration, mocks_and_expectations_json_str) %}\n {% set mocks_and_expectations = dbt_unit_testing.split_json_str(mocks_and_expectations_json_str) %}\n\n {% for mock_or_expectation in mocks_and_expectations %}\n {% do mock_or_expectation.update( {\"options\": dbt_unit_testing.merge_configs([test_configuration.options, mock_or_expectation.options])}) %}\n {% set input_values = dbt_unit_testing.build_input_values_sql(mock_or_expectation.input_values, mock_or_expectation.options) %}\n {% do mock_or_expectation.update({\"input_values\": input_values}) %}\n {% endfor %}\n\n {% set mocks = mocks_and_expectations | selectattr(\"type\", \"==\", \"mock\") | list %}\n {% set expectations = mocks_and_expectations | selectattr(\"type\", \"==\", \"expectations\") | first %}\n\n {% for mock in mocks %}\n {% do mock.update({\"unique_id\": dbt_unit_testing.graph_node(mock).unique_id}) %}\n {% if mock.options.include_missing_columns %}\n {% do dbt_unit_testing.enrich_mock_sql_with_missing_columns(mock, test_configuration.options) %}\n {% endif %}\n {% endfor %}\n\n {% set mocks_and_expectations_json = {\n \"mocks\": mocks,\n \"expectations\": expectations\n }\n %}\n\n {{ return (mocks_and_expectations_json) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_unit_testing.split_json_str", "macro.dbt_unit_testing.merge_configs", "macro.dbt_unit_testing.build_input_values_sql", "macro.dbt_unit_testing.graph_node", "macro.dbt_unit_testing.enrich_mock_sql_with_missing_columns"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.7668285, "supported_languages": null}, "macro.dbt_unit_testing.build_test_report": {"name": "build_test_report", "resource_type": "macro", "package_name": "dbt_unit_testing", "path": "macros/tests.sql", "original_file_path": "macros/tests.sql", "unique_id": "macro.dbt_unit_testing.build_test_report", "macro_sql": "{% macro build_test_report(test_configuration, test_queries) %}\n\n {% set test_report = dbt_unit_testing.run_test_query(test_configuration, test_queries) %}\n\n {{ dbt_unit_testing.verbose(\"-------------------- \" ~ test_configuration.model_name ~ \" --------------------\" ) }}\n {{ dbt_unit_testing.verbose(test_queries.test_query) }}\n {{ dbt_unit_testing.verbose(\"----------------------------------------\" ) }}\n\n {{ return (test_report) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_unit_testing.run_test_query", "macro.dbt_unit_testing.verbose"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.7675312, "supported_languages": null}, "macro.dbt_unit_testing.build_test_queries": {"name": "build_test_queries", "resource_type": "macro", "package_name": "dbt_unit_testing", "path": "macros/tests.sql", "original_file_path": "macros/tests.sql", "unique_id": "macro.dbt_unit_testing.build_test_queries", "macro_sql": "{% macro build_test_queries(test_configuration) %}\n {% set expectations = test_configuration.expectations %}\n {% set model_node = dbt_unit_testing.model_node(test_configuration.model_node) %}\n {%- set model_complete_sql = dbt_unit_testing.build_model_complete_sql(model_node, test_configuration.mocks, test_configuration.options) -%}\n\n {% if expectations.no_rows %}\n {% set expectations_sql = \"select * from (\" ~ model_complete_sql ~ \") as t where 1 = 0\" %}\n {% else %}\n {% set expectations_sql = expectations.input_values %}\n {% endif %}\n\n {% set column_transformations = test_configuration.options.column_transformations[test_configuration.model_name] | default({}) %}\n {% set columns_list = dbt_unit_testing.extract_columns_list(expectations_sql) %}\n {% set columns_list_str = dbt_unit_testing.quote_and_join_columns(columns_list) %}\n {% set transformed_columns_list_str = dbt_unit_testing.apply_transformations_to_columns(columns_list, column_transformations, use_alias=true) | join(\", \") %}\n {% set transformed_columns_list_for_grouping_str = dbt_unit_testing.apply_transformations_to_columns(columns_list, column_transformations, use_alias=false) | join(\", \") %}\n\n {% set diff_column = test_configuration.options.diff_column | default(\"diff\") %}\n {% set count_column = test_configuration.options.count_column | default(\"count\") %}\n\n {%- set actual_query -%}\n select count(1) as {{ count_column }}, {{ transformed_columns_list_str }} from ( {{ model_complete_sql }} ) as s group by {{ transformed_columns_list_for_grouping_str }}\n {% endset %}\n\n {%- set expectations_query -%}\n select count(1) as {{ count_column }}, {{ transformed_columns_list_str }} from ({{ expectations_sql }}) as s group by {{ transformed_columns_list_for_grouping_str }}\n {% endset %}\n\n {%- set test_query -%}\n with expectations as (\n {{ expectations_query }}\n ),\n actual as (\n {{ actual_query }}\n ),\n\n extra_entries as (\n select '+' as {{ diff_column }}, {{ count_column }}, {{ columns_list_str }} from actual\n {{ except() }}\n select '+' as {{ diff_column }}, {{ count_column }}, {{ columns_list_str }} from expectations),\n\n missing_entries as (\n select '-' as {{ diff_column }}, {{ count_column }}, {{ columns_list_str }} from expectations\n {{ except() }}\n select '-' as {{ diff_column }}, {{ count_column }}, {{ columns_list_str }} from actual)\n \n select * from extra_entries\n UNION ALL\n select * from missing_entries\n\n {% set sort_field = test_configuration.options.get(\"output_sort_field\") %}\n {% if sort_field %}\n ORDER BY {{ sort_field }}\n {% endif %}\n {%- endset -%}\n\n {% set test_queries = {\n \"model_query\": model_complete_sql,\n \"actual_query\": actual_query,\n \"expectations_query\": expectations_query,\n \"test_query\": test_query\n } %}\n\n {{ return (test_queries) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_unit_testing.model_node", "macro.dbt_unit_testing.build_model_complete_sql", "macro.dbt_unit_testing.extract_columns_list", "macro.dbt_unit_testing.quote_and_join_columns", "macro.dbt_unit_testing.apply_transformations_to_columns", "macro.dbt.except"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.7712057, "supported_languages": null}, "macro.dbt_unit_testing.show_test_report": {"name": "show_test_report", "resource_type": "macro", "package_name": "dbt_unit_testing", "path": "macros/tests.sql", "original_file_path": "macros/tests.sql", "unique_id": "macro.dbt_unit_testing.show_test_report", "macro_sql": "{% macro show_test_report(test_configuration, test_report) %}\n {% set model_name = test_configuration.model_name %}\n {% set test_description = test_configuration.description %}\n\n {{ dbt_unit_testing.println('{RED}MODEL: {YELLOW}' ~ model_name) }}\n {{ dbt_unit_testing.println('{RED}TEST: {YELLOW}' ~ test_description) }}\n {% if test_report.expectations_row_count != test_report.actual_row_count %}\n {{ dbt_unit_testing.println('{RED}ERROR: {YELLOW}Number of Rows do not match! (Expected: ' ~ test_report.expectations_row_count ~ ', Actual: ' ~ test_report.actual_row_count ~ ')') }}\n {% endif %}\n {% if test_report.different_rows_count > 0 %}\n {{ dbt_unit_testing.println('{RED}ERROR: {YELLOW}Rows mismatch:') }}\n {{ dbt_unit_testing.print_table(test_report.test_differences, options=test_configuration.options) }}\n {% endif %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_unit_testing.println", "macro.dbt_unit_testing.print_table"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.7724316, "supported_languages": null}, "macro.dbt_unit_testing.run_test_query": {"name": "run_test_query", "resource_type": "macro", "package_name": "dbt_unit_testing", "path": "macros/tests.sql", "original_file_path": "macros/tests.sql", "unique_id": "macro.dbt_unit_testing.run_test_query", "macro_sql": "{% macro run_test_query(test_configuration, test_queries) %}\n {% set model_name = test_configuration.model_name %}\n {% set test_description = test_configuration.description %}\n {% set actual_query = test_queries.actual_query %}\n {% set expectations_query = test_queries.expectations_query %}\n {% set test_query = test_queries.test_query %}\n\n {%- set count_query -%}\n select * FROM \n (select count(1) as expectation_count from (\n {{ expectations_query }}\n ) as exp) as exp_count,\n (select count(1) as actual_count from (\n {{ actual_query }}\n ) as act) as act_count\n {%- endset -%}\n {% set r1 = dbt_unit_testing.run_query(count_query) %}\n {% set expectations_row_count = r1.columns[0].values() | first %}\n {% set actual_row_count = r1.columns[1].values() | first %}\n\n {% set test_differences = dbt_unit_testing.run_query(test_query) %}\n {% set different_rows_count = test_differences.rows | length %}\n {% set succeeded = different_rows_count == 0 and (expectations_row_count == actual_row_count) %}\n\n {% set test_report = {\n \"expectations_row_count\": expectations_row_count,\n \"actual_row_count\": actual_row_count,\n \"different_rows_count\": different_rows_count,\n \"test_differences\": test_differences,\n \"succeeded\": succeeded,\n } %}\n {{ return (test_report) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_unit_testing.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.77443, "supported_languages": null}, "macro.dbt_unit_testing.ref_tested_model": {"name": "ref_tested_model", "resource_type": "macro", "package_name": "dbt_unit_testing", "path": "macros/tests.sql", "original_file_path": "macros/tests.sql", "unique_id": "macro.dbt_unit_testing.ref_tested_model", "macro_sql": "{% macro ref_tested_model(model_name) %}\n {% set ref_tested_model %}\n -- We add an (unused) reference to the tested model,\n -- so that DBT includes the model as a dependency of the test in the DAG\n select * from {{ ref(model_name) }}\n {% endset %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.7747903, "supported_languages": null}, "macro.dbt_unit_testing.run_query": {"name": "run_query", "resource_type": "macro", "package_name": "dbt_unit_testing", "path": "macros/utils.sql", "original_file_path": "macros/utils.sql", "unique_id": "macro.dbt_unit_testing.run_query", "macro_sql": "{% macro run_query(query) %}\n {% set start_time = modules.datetime.datetime.now() %}\n {{ dbt_unit_testing.verbose('Running query => ' ~ dbt_unit_testing.sanitize(query)) }}\n {% set results = dbt.run_query(query) %}\n {% set end_time = modules.datetime.datetime.now() - start_time %}\n {{ dbt_unit_testing.verbose('Execution time => ' ~ end_time) }}\n {{ dbt_unit_testing.verbose('==============================================================') }}\n {{ return (results) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_unit_testing.verbose", "macro.dbt_unit_testing.sanitize", "macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.8085039, "supported_languages": null}, "macro.dbt_unit_testing.sanitize": {"name": "sanitize", "resource_type": "macro", "package_name": "dbt_unit_testing", "path": "macros/utils.sql", "original_file_path": "macros/utils.sql", "unique_id": "macro.dbt_unit_testing.sanitize", "macro_sql": "{% macro sanitize(s) %}\n {{ return (\" \".join(s.split())) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.8088717, "supported_languages": null}, "macro.dbt_unit_testing.extract_columns_list": {"name": "extract_columns_list", "resource_type": "macro", "package_name": "dbt_unit_testing", "path": "macros/utils.sql", "original_file_path": "macros/utils.sql", "unique_id": "macro.dbt_unit_testing.extract_columns_list", "macro_sql": "{% macro extract_columns_list(query) %}\n {% set results = dbt_unit_testing.run_query(query) %}\n {% set columns = results.columns | map(attribute='name') | list %}\n {{ return (columns) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_unit_testing.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.8094058, "supported_languages": null}, "macro.dbt_unit_testing.extract_columns_difference": {"name": "extract_columns_difference", "resource_type": "macro", "package_name": "dbt_unit_testing", "path": "macros/utils.sql", "original_file_path": "macros/utils.sql", "unique_id": "macro.dbt_unit_testing.extract_columns_difference", "macro_sql": "{% macro extract_columns_difference(cl1, cl2) %}\n !! WRONG !!\n {% set columns = cl1 | reject('in', cl2) | list %}\n {{ return(columns) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.8098135, "supported_languages": null}, "macro.dbt_unit_testing.quote_and_join_columns": {"name": "quote_and_join_columns", "resource_type": "macro", "package_name": "dbt_unit_testing", "path": "macros/utils.sql", "original_file_path": "macros/utils.sql", "unique_id": "macro.dbt_unit_testing.quote_and_join_columns", "macro_sql": "{% macro quote_and_join_columns(columns) %}\n {% set columns = dbt_unit_testing.map(columns, dbt_unit_testing.quote_identifier) | join(\", \") %}\n {{ return (columns) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_unit_testing.map"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.810239, "supported_languages": null}, "macro.dbt_unit_testing.apply_transformations_to_columns": {"name": "apply_transformations_to_columns", "resource_type": "macro", "package_name": "dbt_unit_testing", "path": "macros/utils.sql", "original_file_path": "macros/utils.sql", "unique_id": "macro.dbt_unit_testing.apply_transformations_to_columns", "macro_sql": "{% macro apply_transformations_to_columns(columns, column_transformations, use_alias=true) %}\n {% set transformed_columns = [] %}\n {% for column in columns %}\n {% set transformed_column = dbt_unit_testing.apply_transformations_to_column(column, column_transformations, use_alias) %}\n {% do transformed_columns.append(transformed_column) %}\n {% endfor %}\n {{ return (transformed_columns) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_unit_testing.apply_transformations_to_column"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.8109694, "supported_languages": null}, "macro.dbt_unit_testing.apply_transformations_to_column": {"name": "apply_transformations_to_column", "resource_type": "macro", "package_name": "dbt_unit_testing", "path": "macros/utils.sql", "original_file_path": "macros/utils.sql", "unique_id": "macro.dbt_unit_testing.apply_transformations_to_column", "macro_sql": "{% macro apply_transformations_to_column(column, column_transformations, use_alias) %}\n {% set quoted_column = dbt_unit_testing.quote_identifier(column) %}\n {% set transformation = column_transformations.get(column, \"\") %}\n {% if transformation != \"\" %}\n {% set transformation = transformation | replace(\"##column##\", quoted_column) %}\n {% if use_alias %}\n {% set transformation = transformation ~ \" as \" ~ quoted_column %}\n {% endif %}\n {% else %}\n {% set transformation = quoted_column %}\n {% endif %}\n {{ return (transformation) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_unit_testing.quote_identifier"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.8120546, "supported_languages": null}, "macro.dbt_unit_testing.sql_encode": {"name": "sql_encode", "resource_type": "macro", "package_name": "dbt_unit_testing", "path": "macros/utils.sql", "original_file_path": "macros/utils.sql", "unique_id": "macro.dbt_unit_testing.sql_encode", "macro_sql": "{% macro sql_encode(s) %}\n {{ return (s.replace('\"', '####_quote_####').replace('\\n', '####_cr_####').replace('\\t', '####_tab_####')) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.replace"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.8124964, "supported_languages": null}, "macro.dbt_unit_testing.sql_decode": {"name": "sql_decode", "resource_type": "macro", "package_name": "dbt_unit_testing", "path": "macros/utils.sql", "original_file_path": "macros/utils.sql", "unique_id": "macro.dbt_unit_testing.sql_decode", "macro_sql": "{% macro sql_decode(s) %}\n {{ return (s.replace('####_quote_####', '\"').replace('####_cr_####', '\\n').replace('####_tab_####', '\\t')) -}}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.replace"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.812937, "supported_languages": null}, "macro.dbt_unit_testing.log_info": {"name": "log_info", "resource_type": "macro", "package_name": "dbt_unit_testing", "path": "macros/utils.sql", "original_file_path": "macros/utils.sql", "unique_id": "macro.dbt_unit_testing.log_info", "macro_sql": "{% macro log_info(s, only_on_execute=false) %}\n {% if not only_on_execute or execute %}\n {% do log (s, info=true) %}\n {% endif %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.8133755, "supported_languages": null}, "macro.dbt_unit_testing.debug": {"name": "debug", "resource_type": "macro", "package_name": "dbt_unit_testing", "path": "macros/utils.sql", "original_file_path": "macros/utils.sql", "unique_id": "macro.dbt_unit_testing.debug", "macro_sql": "{% macro debug(s) %}\n {% if var('debug', dbt_unit_testing.config_is_true('debug')) %}\n {{ dbt_unit_testing.log_info (s, only_on_execute=true) }}\n {% endif %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_unit_testing.config_is_true", "macro.dbt_unit_testing.log_info"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.8138306, "supported_languages": null}, "macro.dbt_unit_testing.verbose": {"name": "verbose", "resource_type": "macro", "package_name": "dbt_unit_testing", "path": "macros/utils.sql", "original_file_path": "macros/utils.sql", "unique_id": "macro.dbt_unit_testing.verbose", "macro_sql": "{% macro verbose(s) %}\n {% if var('verbose', dbt_unit_testing.config_is_true('verbose')) %}\n {{ dbt_unit_testing.log_info (s, only_on_execute=true) }}\n {% endif %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_unit_testing.config_is_true", "macro.dbt_unit_testing.log_info"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.8142784, "supported_languages": null}, "macro.dbt_unit_testing.map": {"name": "map", "resource_type": "macro", "package_name": "dbt_unit_testing", "path": "macros/utils.sql", "original_file_path": "macros/utils.sql", "unique_id": "macro.dbt_unit_testing.map", "macro_sql": "{% macro map(items, f) %}\n {% set mapped_items=[] %}\n {% for item in items %}\n {% do mapped_items.append(f(item)) %}\n {% endfor %}\n {{ return (mapped_items) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.814816, "supported_languages": null}, "macro.dbt_unit_testing.node_by_id": {"name": "node_by_id", "resource_type": "macro", "package_name": "dbt_unit_testing", "path": "macros/utils.sql", "original_file_path": "macros/utils.sql", "unique_id": "macro.dbt_unit_testing.node_by_id", "macro_sql": "{% macro node_by_id (node_id) %}\n {{ return (graph.nodes[node_id] if node_id in graph.nodes else graph.sources[node_id]) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.815333, "supported_languages": null}, "macro.dbt_unit_testing.has_value": {"name": "has_value", "resource_type": "macro", "package_name": "dbt_unit_testing", "path": "macros/utils.sql", "original_file_path": "macros/utils.sql", "unique_id": "macro.dbt_unit_testing.has_value", "macro_sql": "{% macro has_value(v) %}\n {{ return (v is defined and v is not none) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.815621, "supported_languages": null}, "macro.dbt_unit_testing.model_node": {"name": "model_node", "resource_type": "macro", "package_name": "dbt_unit_testing", "path": "macros/utils.sql", "original_file_path": "macros/utils.sql", "unique_id": "macro.dbt_unit_testing.model_node", "macro_sql": "{% macro model_node (node) %}\n {% set graph_nodes = graph.nodes.values() | \n selectattr('resource_type', 'in', ['model', 'snapshot', 'seed']) | \n selectattr('package_name', 'in', [node.package_name, project_name]) | \n selectattr('name', 'equalto', node.name) | \n list %}\n {% if graph_nodes | length > 0 %}\n {% if dbt_unit_testing.has_value(node.version) %}\n {% set graph_nodes = graph_nodes | selectattr('version', 'equalto', node.version) | list %}\n {% else %}\n {% set latest_version = graph_nodes[0].latest_version %}\n {% if dbt_unit_testing.has_value(latest_version) %}\n {% set graph_nodes = graph_nodes | selectattr('version', 'equalto', latest_version) | list %}\n {% endif %}\n {% endif %}\n {% endif %}\n {% if graph_nodes | length == 0 %}\n {% set node_version = '_v' ~ node.version if dbt_unit_testing.has_value(node.version) else '' %}\n {{ dbt_unit_testing.raise_error(\"Node \" ~ node.package_name ~ \".\" ~ node.name ~ node_version ~ \" not found.\") }}\n {% endif %}\n {% set graph_node = graph_nodes[0] %}\n {{ return (graph_node) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_unit_testing.has_value", "macro.dbt_unit_testing.raise_error"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.8178618, "supported_languages": null}, "macro.dbt_unit_testing.source_node": {"name": "source_node", "resource_type": "macro", "package_name": "dbt_unit_testing", "path": "macros/utils.sql", "original_file_path": "macros/utils.sql", "unique_id": "macro.dbt_unit_testing.source_node", "macro_sql": "{% macro source_node(node) %}\n {{ return (graph.sources[\"source.\" ~ model.package_name ~ \".\" ~ node.source_name ~ \".\" ~ node.name]) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.8182714, "supported_languages": null}, "macro.dbt_unit_testing.graph_node": {"name": "graph_node", "resource_type": "macro", "package_name": "dbt_unit_testing", "path": "macros/utils.sql", "original_file_path": "macros/utils.sql", "unique_id": "macro.dbt_unit_testing.graph_node", "macro_sql": "{% macro graph_node(node) %}\n {% if node.resource_type in ('source') %}\n {{ return (dbt_unit_testing.source_node(node)) }}\n {% else %}\n {{ return (dbt_unit_testing.model_node(node)) }}\n {% endif %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_unit_testing.source_node", "macro.dbt_unit_testing.model_node"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.8188124, "supported_languages": null}, "macro.dbt_unit_testing.deep_merge_2_jsons": {"name": "deep_merge_2_jsons", "resource_type": "macro", "package_name": "dbt_unit_testing", "path": "macros/utils.sql", "original_file_path": "macros/utils.sql", "unique_id": "macro.dbt_unit_testing.deep_merge_2_jsons", "macro_sql": "{% macro deep_merge_2_jsons(json1, json2) %}\n {% set json = dbt_unit_testing.merge_json_left(json1, json2) %}\n {% do json.update(dbt_unit_testing.merge_json_left(json2, json1)) %}\n {{ return (json) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_unit_testing.merge_json_left"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.8193386, "supported_languages": null}, "macro.dbt_unit_testing.merge_json_left": {"name": "merge_json_left", "resource_type": "macro", "package_name": "dbt_unit_testing", "path": "macros/utils.sql", "original_file_path": "macros/utils.sql", "unique_id": "macro.dbt_unit_testing.merge_json_left", "macro_sql": "{% macro merge_json_left(json1, json2) %}\n {% set json = {} %}\n {% for k,v in json1.items() %}\n {% if v is mapping %}\n {% set other = json2.get(k, {}) %}\n {% if other is mapping %}\n {% set v = dbt_unit_testing.deep_merge_2_jsons(v, other) %}\n {% endif %}\n {% elif v is sequence and v is not string %}\n {% set other = json2.get(k, []) %}\n {% if other is sequence and other is not string %}\n {% set v = dbt_unit_testing.map((v + other) | map(\"tojson\") | unique, fromjson) %}\n {% endif %}\n {% endif %}\n {% do json.update({k: v}) %}\n {% endfor %}\n {{ return (json) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_unit_testing.deep_merge_2_jsons", "macro.dbt_unit_testing.map"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.8210924, "supported_languages": null}, "macro.dbt_unit_testing.deep_merge_jsons": {"name": "deep_merge_jsons", "resource_type": "macro", "package_name": "dbt_unit_testing", "path": "macros/utils.sql", "original_file_path": "macros/utils.sql", "unique_id": "macro.dbt_unit_testing.deep_merge_jsons", "macro_sql": "{% macro deep_merge_jsons(jsons) %}\n {% set json = {} %}\n {% for j in jsons %}\n {% do json.update(dbt_unit_testing.deep_merge_2_jsons(json, j)) %}\n {% endfor %}\n {{ return (json) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_unit_testing.deep_merge_2_jsons"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.8216798, "supported_languages": null}, "macro.dbt_unit_testing.get_config": {"name": "get_config", "resource_type": "macro", "package_name": "dbt_unit_testing", "path": "macros/utils.sql", "original_file_path": "macros/utils.sql", "unique_id": "macro.dbt_unit_testing.get_config", "macro_sql": "{% macro get_config(config_name, default_value) %}\n {% set unit_tests_config = var(\"unit_tests_config\", {}) %}\n {% set unit_tests_config = {} if unit_tests_config is none else unit_tests_config %}\n {{ return (unit_tests_config.get(config_name, default_value))}}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.822258, "supported_languages": null}, "macro.dbt_unit_testing.config_is_true": {"name": "config_is_true", "resource_type": "macro", "package_name": "dbt_unit_testing", "path": "macros/utils.sql", "original_file_path": "macros/utils.sql", "unique_id": "macro.dbt_unit_testing.config_is_true", "macro_sql": "{% macro config_is_true(config_name) %}\n {{ return (dbt_unit_testing.get_config(config_name, default_value=false))}}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_unit_testing.get_config"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.822558, "supported_languages": null}, "macro.dbt_unit_testing.merge_configs": {"name": "merge_configs", "resource_type": "macro", "package_name": "dbt_unit_testing", "path": "macros/utils.sql", "original_file_path": "macros/utils.sql", "unique_id": "macro.dbt_unit_testing.merge_configs", "macro_sql": "{% macro merge_configs(configs) %}\n {% set unit_tests_config = var(\"unit_tests_config\", {}) %}\n {% set unit_tests_config = {} if unit_tests_config is none else unit_tests_config %}\n {{ return (dbt_unit_testing.deep_merge_jsons([unit_tests_config] + configs)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_unit_testing.deep_merge_jsons"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.8231306, "supported_languages": null}, "macro.dbt_unit_testing.quote_identifier": {"name": "quote_identifier", "resource_type": "macro", "package_name": "dbt_unit_testing", "path": "macros/utils.sql", "original_file_path": "macros/utils.sql", "unique_id": "macro.dbt_unit_testing.quote_identifier", "macro_sql": "{% macro quote_identifier(identifier) %}\n {{ return(adapter.dispatch('quote_identifier','dbt_unit_testing')(identifier)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_unit_testing.default__quote_identifier"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.82345, "supported_languages": null}, "macro.dbt_unit_testing.default__quote_identifier": {"name": "default__quote_identifier", "resource_type": "macro", "package_name": "dbt_unit_testing", "path": "macros/utils.sql", "original_file_path": "macros/utils.sql", "unique_id": "macro.dbt_unit_testing.default__quote_identifier", "macro_sql": "{% macro default__quote_identifier(identifier) -%}\n {% if identifier.startswith('\"') %}\n {{ return(identifier) }}\n {% else %}\n {{ return('\"' ~ identifier ~ '\"') }}\n {% endif %}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.8239708, "supported_languages": null}, "macro.dbt_unit_testing.bigquery__quote_identifier": {"name": "bigquery__quote_identifier", "resource_type": "macro", "package_name": "dbt_unit_testing", "path": "macros/utils.sql", "original_file_path": "macros/utils.sql", "unique_id": "macro.dbt_unit_testing.bigquery__quote_identifier", "macro_sql": "{% macro bigquery__quote_identifier(identifier) %}\n {% if identifier.startswith('`') %}\n {{ return(identifier) }}\n {% else %}\n {{ return('`' ~ identifier ~ '`') }}\n {% endif %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.824462, "supported_languages": null}, "macro.dbt_unit_testing.snowflake__quote_identifier": {"name": "snowflake__quote_identifier", "resource_type": "macro", "package_name": "dbt_unit_testing", "path": "macros/utils.sql", "original_file_path": "macros/utils.sql", "unique_id": "macro.dbt_unit_testing.snowflake__quote_identifier", "macro_sql": "{% macro snowflake__quote_identifier(identifier) %}\n {% if identifier.startswith('\"') %}\n {{ return(identifier) }}\n {% else %}\n {{ return('\"' ~ identifier | upper ~ '\"') }}\n {% endif %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.8249907, "supported_languages": null}, "macro.dbt_unit_testing.cache": {"name": "cache", "resource_type": "macro", "package_name": "dbt_unit_testing", "path": "macros/utils.sql", "original_file_path": "macros/utils.sql", "unique_id": "macro.dbt_unit_testing.cache", "macro_sql": "{% macro cache(scope_key, key, value) %}\n {% if dbt_unit_testing.config_is_true('disable_cache') %}\n {{ return (nil) }}\n {% else %}\n {% set cache = context.get(\"__DUT_CACHE__\", {}) %}\n {% set scope = cache.get(scope_key, {}) %}\n {% do scope.update({key: value}) %}\n {% do cache.update({scope_key: scope}) %}\n {% do context.update({\"__DUT_CACHE__\": cache}) %}\n {% endif %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_unit_testing.config_is_true"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.8261013, "supported_languages": null}, "macro.dbt_unit_testing.get_from_cache": {"name": "get_from_cache", "resource_type": "macro", "package_name": "dbt_unit_testing", "path": "macros/utils.sql", "original_file_path": "macros/utils.sql", "unique_id": "macro.dbt_unit_testing.get_from_cache", "macro_sql": "{% macro get_from_cache(scope, key) %}\n {% set cache = context.get(\"__DUT_CACHE__\", {}).get(scope, {}) %}\n {{ return (cache[key]) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.8266866, "supported_languages": null}, "macro.dbt_unit_testing.raise_error": {"name": "raise_error", "resource_type": "macro", "package_name": "dbt_unit_testing", "path": "macros/utils.sql", "original_file_path": "macros/utils.sql", "unique_id": "macro.dbt_unit_testing.raise_error", "macro_sql": "{% macro raise_error(error_message) %}\n {{ exceptions.raise_compiler_error('\\x1b[31m' ~ error_message ~ '\\x1b[0m') }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.8269608, "supported_languages": null}, "macro.dbt_unit_testing.set_test_context": {"name": "set_test_context", "resource_type": "macro", "package_name": "dbt_unit_testing", "path": "macros/utils.sql", "original_file_path": "macros/utils.sql", "unique_id": "macro.dbt_unit_testing.set_test_context", "macro_sql": "{% macro set_test_context(key, value) %}\n {% set test_context = context.get(\"__DUT_TEST_CONTEXT__\", {}) %}\n {% set test_key = this.name %}\n {% set test_scope = test_context.get(test_key, {}) %}\n {% do test_scope.update({key: value | default(\"\")}) %}\n {% do test_context.update({test_key: test_scope}) %}\n {% do context.update({\"__DUT_TEST_CONTEXT__\": test_context}) %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.827925, "supported_languages": null}, "macro.dbt_unit_testing.get_test_context": {"name": "get_test_context", "resource_type": "macro", "package_name": "dbt_unit_testing", "path": "macros/utils.sql", "original_file_path": "macros/utils.sql", "unique_id": "macro.dbt_unit_testing.get_test_context", "macro_sql": "{% macro get_test_context(key, default_value) %}\n {% set test_context = context.get(\"__DUT_TEST_CONTEXT__\", {}) %}\n {% set test_key = this.name %}\n {% set test_scope = test_context.get(test_key, {}) %}\n {{ return (test_scope.get(key, default_value)) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.82859, "supported_languages": null}, "macro.dbt_unit_testing.clear_test_context": {"name": "clear_test_context", "resource_type": "macro", "package_name": "dbt_unit_testing", "path": "macros/utils.sql", "original_file_path": "macros/utils.sql", "unique_id": "macro.dbt_unit_testing.clear_test_context", "macro_sql": "{% macro clear_test_context(key, default_value) %}\n {% set test_context = context.get(\"__DUT_TEST_CONTEXT__\", {}) %}\n {% set test_key = this.name %}\n {% do context.update({test_key: {}}) %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.8291488, "supported_languages": null}, "macro.dbt_unit_testing.split_and_pad_and_join": {"name": "split_and_pad_and_join", "resource_type": "macro", "package_name": "dbt_unit_testing", "path": "macros/utils.sql", "original_file_path": "macros/utils.sql", "unique_id": "macro.dbt_unit_testing.split_and_pad_and_join", "macro_sql": "{% macro split_and_pad_and_join(s, pad) %}\n {% set parts = s.split('.') %}\n {% set parts_2 = [] %}\n {% for p in parts %}\n {% do parts_2.append(dbt_unit_testing.pad(parts[loop.index-1], pad, pad_right=true)) %}\n {% endfor %}\n {{ return (parts_2 | join('.')) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_unit_testing.pad"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.8299897, "supported_languages": null}, "macro.dbt_unit_testing.version_bigger_or_equal_to": {"name": "version_bigger_or_equal_to", "resource_type": "macro", "package_name": "dbt_unit_testing", "path": "macros/utils.sql", "original_file_path": "macros/utils.sql", "unique_id": "macro.dbt_unit_testing.version_bigger_or_equal_to", "macro_sql": "{% macro version_bigger_or_equal_to(v) %}\n {{ return (dbt_unit_testing.split_and_pad_and_join(dbt_version, 5) >= dbt_unit_testing.split_and_pad_and_join(v, 5)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_unit_testing.split_and_pad_and_join"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.8303673, "supported_languages": null}, "macro.elementary.materialization_non_dbt_default": {"name": "materialization_non_dbt_default", "resource_type": "macro", "package_name": "elementary", "path": "macros/materializations/non_dbt.sql", "original_file_path": "macros/materializations/non_dbt.sql", "unique_id": "macro.elementary.materialization_non_dbt_default", "macro_sql": "{% materialization non_dbt, default -%}\n {# The main statement executes the model, but does not create any table / view on the DWH #}\n {% call statement('main') -%}\n {{ sql }}\n {%- endcall %}\n {{ adapter.commit() }}\n {{ return({'relations': []}) }}\n{% endmaterialization %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.8311012, "supported_languages": ["sql"]}, "macro.elementary.get_tables_from_information_schema": {"name": "get_tables_from_information_schema", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/metadata_collection/get_tables_from_information_schema.sql", "original_file_path": "macros/edr/metadata_collection/get_tables_from_information_schema.sql", "unique_id": "macro.elementary.get_tables_from_information_schema", "macro_sql": "{% macro get_tables_from_information_schema(schema_tuple) %}\n {{ return(adapter.dispatch('get_tables_from_information_schema','elementary')(schema_tuple)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.postgres__get_tables_from_information_schema"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.834073, "supported_languages": null}, "macro.elementary.default__get_tables_from_information_schema": {"name": "default__get_tables_from_information_schema", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/metadata_collection/get_tables_from_information_schema.sql", "original_file_path": "macros/edr/metadata_collection/get_tables_from_information_schema.sql", "unique_id": "macro.elementary.default__get_tables_from_information_schema", "macro_sql": "{% macro default__get_tables_from_information_schema(schema_tuple) %}\n {%- set database_name, schema_name = schema_tuple %}\n {% set schema_relation = api.Relation.create(database=database_name, schema=schema_name).without_identifier() %}\n\n with information_schema_tables as (\n\n select\n upper(table_catalog) as database_name,\n upper(table_schema) as schema_name,\n upper(table_name) as table_name\n from {{ schema_relation.information_schema('TABLES') }}\n where upper(table_schema) = upper('{{ schema_name }}')\n\n ),\n\n information_schema_schemata as (\n\n select\n upper(catalog_name) as database_name,\n upper(schema_name) as schema_name\n from {{ schema_relation.information_schema('SCHEMATA') }}\n where upper(schema_name) = upper('{{ schema_name }}')\n\n )\n\n select\n case when tables.table_name is not null\n then {{ elementary.full_table_name('TABLES') }}\n else null end as full_table_name,\n upper(schemas.database_name || '.' || schemas.schema_name) as full_schema_name,\n schemas.database_name as database_name,\n schemas.schema_name as schema_name,\n tables.table_name\n from information_schema_tables as tables\n full outer join information_schema_schemata as schemas\n on (tables.database_name = schemas.database_name and tables.schema_name = schemas.schema_name)\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.full_table_name"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.8349347, "supported_languages": null}, "macro.elementary.redshift__get_tables_from_information_schema": {"name": "redshift__get_tables_from_information_schema", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/metadata_collection/get_tables_from_information_schema.sql", "original_file_path": "macros/edr/metadata_collection/get_tables_from_information_schema.sql", "unique_id": "macro.elementary.redshift__get_tables_from_information_schema", "macro_sql": "{% macro redshift__get_tables_from_information_schema(schema_tuple) %}\n {%- set database_name, schema_name = schema_tuple %}\n\n with information_schema_tables as (\n\n select\n upper(table_catalog) as database_name,\n upper(table_schema) as schema_name,\n upper(table_name) as table_name\n from pg_catalog.svv_tables\n where upper(table_schema) = upper('{{ schema_name }}') and upper(table_catalog) = upper('{{ database_name }}')\n\n )\n\n select\n {{ elementary.full_table_name() }} as full_table_name,\n upper(database_name || '.' || schema_name) as full_schema_name,\n database_name,\n schema_name,\n table_name\n from information_schema_tables\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.full_table_name"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.835364, "supported_languages": null}, "macro.elementary.postgres__get_tables_from_information_schema": {"name": "postgres__get_tables_from_information_schema", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/metadata_collection/get_tables_from_information_schema.sql", "original_file_path": "macros/edr/metadata_collection/get_tables_from_information_schema.sql", "unique_id": "macro.elementary.postgres__get_tables_from_information_schema", "macro_sql": "{% macro postgres__get_tables_from_information_schema(schema_tuple) %}\n {%- set database_name, schema_name = schema_tuple %}\n\n with information_schema_tables as (\n\n select\n upper(table_catalog) as database_name,\n upper(table_schema) as schema_name,\n upper(table_name) as table_name\n from information_schema.tables\n where upper(table_schema) = upper('{{ schema_name }}') and upper(table_catalog) = upper('{{ database_name }}')\n\n )\n\n select\n {{ elementary.full_table_name() }} as full_table_name,\n upper(database_name || '.' || schema_name) as full_schema_name,\n database_name,\n schema_name,\n table_name\n from information_schema_tables\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.full_table_name"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.8357844, "supported_languages": null}, "macro.elementary.databricks__get_tables_from_information_schema": {"name": "databricks__get_tables_from_information_schema", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/metadata_collection/get_tables_from_information_schema.sql", "original_file_path": "macros/edr/metadata_collection/get_tables_from_information_schema.sql", "unique_id": "macro.elementary.databricks__get_tables_from_information_schema", "macro_sql": "{% macro databricks__get_tables_from_information_schema(schema_tuple) %}\n {%- set database_name, schema_name = schema_tuple %}\n {% set schema_relation = api.Relation.create(database=database_name, schema=schema_name).without_identifier() %}\n\n {#\n Database only exists when using databricks with catalog (it is the catalog).\n When using databricks without catalog, it is none.\n #}\n {% set is_catalog = schema_relation.database is not none %}\n\n {# Information schema only exists on databricks with catalog #}\n {% if is_catalog %}\n with information_schema_tables as (\n\n select\n upper(table_catalog) as database_name,\n upper(table_schema) as schema_name,\n upper(table_name) as table_name\n from {{ schema_relation.information_schema('TABLES') }}\n where upper(table_schema) = upper('{{ schema_name }}')\n\n ),\n\n information_schema_schemata as (\n\n select\n upper(catalog_name) as database_name,\n upper(schema_name) as schema_name\n from {{ schema_relation.information_schema('SCHEMATA') }}\n where upper(schema_name) = upper('{{ schema_name }}')\n\n )\n\n select\n case when tables.table_name is not null\n then {{ elementary.full_table_name('TABLES') }}\n else null end as full_table_name,\n upper(schemas.database_name || '.' || schemas.schema_name) as full_schema_name,\n schemas.database_name as database_name,\n schemas.schema_name as schema_name,\n tables.table_name\n from information_schema_tables as tables\n full outer join information_schema_schemata as schemas\n on (tables.database_name = schemas.database_name and tables.schema_name = schemas.schema_name)\n {% else %}\n {{ elementary.get_empty_tables_from_information_schema_table() }}\n {% endif %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.full_table_name", "macro.elementary.get_empty_tables_from_information_schema_table"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.8369613, "supported_languages": null}, "macro.elementary.get_empty_tables_from_information_schema_table": {"name": "get_empty_tables_from_information_schema_table", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/metadata_collection/get_tables_from_information_schema.sql", "original_file_path": "macros/edr/metadata_collection/get_tables_from_information_schema.sql", "unique_id": "macro.elementary.get_empty_tables_from_information_schema_table", "macro_sql": "{% macro get_empty_tables_from_information_schema_table() %}\n {{ elementary.empty_table([\n ('full_table_name', 'string'),\n ('full_schema_name', 'string'),\n ('database_name', 'string'),\n ('schema_name', 'string'),\n ('table_name', 'string'),\n ]) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.empty_table"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.8375175, "supported_languages": null}, "macro.elementary.get_columns_from_information_schema": {"name": "get_columns_from_information_schema", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/metadata_collection/get_columns_from_information_schema.sql", "original_file_path": "macros/edr/metadata_collection/get_columns_from_information_schema.sql", "unique_id": "macro.elementary.get_columns_from_information_schema", "macro_sql": "{% macro get_columns_from_information_schema(schema_tuple, table_name = none) %}\n {%- set database_name, schema_name = schema_tuple %}\n {{ return(adapter.dispatch('get_columns_from_information_schema', 'elementary')(database_name, schema_name, table_name)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.postgres__get_columns_from_information_schema"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.840474, "supported_languages": null}, "macro.elementary.default__get_columns_from_information_schema": {"name": "default__get_columns_from_information_schema", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/metadata_collection/get_columns_from_information_schema.sql", "original_file_path": "macros/edr/metadata_collection/get_columns_from_information_schema.sql", "unique_id": "macro.elementary.default__get_columns_from_information_schema", "macro_sql": "{% macro default__get_columns_from_information_schema(database_name, schema_name, table_name = none) %}\n {% set schema_relation = api.Relation.create(database=database_name, schema=schema_name).without_identifier() %}\n {% set column_relation = schema_relation.information_schema('COLUMNS') %}\n select\n upper(table_catalog || '.' || table_schema || '.' || table_name) as full_table_name,\n upper(table_catalog) as database_name,\n upper(table_schema) as schema_name,\n upper(table_name) as table_name,\n upper(column_name) as column_name,\n data_type\n from {{ column_relation }}\n where upper(table_schema) = upper('{{ schema_name }}')\n {% if table_name %}\n and upper(table_name) = upper('{{ table_name }}')\n {% endif %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.8412526, "supported_languages": null}, "macro.elementary.bigquery__get_columns_from_information_schema": {"name": "bigquery__get_columns_from_information_schema", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/metadata_collection/get_columns_from_information_schema.sql", "original_file_path": "macros/edr/metadata_collection/get_columns_from_information_schema.sql", "unique_id": "macro.elementary.bigquery__get_columns_from_information_schema", "macro_sql": "{% macro bigquery__get_columns_from_information_schema(database_name, schema_name, table_name = none) %}\n {% set schema_relation = api.Relation.create(database=database_name, schema=schema_name).without_identifier() %}\n {% set columns_schema = schema_relation.information_schema('COLUMNS') %}\n {% if elementary.can_query_relation(columns_schema) %}\n {{ elementary.default__get_columns_from_information_schema(database_name, schema_name, table_name) }}\n {% else %}\n {{ elementary.get_empty_columns_from_information_schema_table() }}\n {% endif %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.can_query_relation", "macro.elementary.default__get_columns_from_information_schema", "macro.elementary.get_empty_columns_from_information_schema_table"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.8421264, "supported_languages": null}, "macro.elementary.redshift__get_columns_from_information_schema": {"name": "redshift__get_columns_from_information_schema", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/metadata_collection/get_columns_from_information_schema.sql", "original_file_path": "macros/edr/metadata_collection/get_columns_from_information_schema.sql", "unique_id": "macro.elementary.redshift__get_columns_from_information_schema", "macro_sql": "{% macro redshift__get_columns_from_information_schema(database_name, schema_name, table_name = none) %}\n select\n upper(table_catalog || '.' || table_schema || '.' || table_name) as full_table_name,\n upper(table_catalog) as database_name,\n upper(table_schema) as schema_name,\n upper(table_name) as table_name,\n upper(column_name) as column_name,\n data_type\n from pg_catalog.svv_columns\n where upper(table_schema) = upper('{{ schema_name }}')\n {% if table_name %}\n and upper(table_name) = upper('{{ table_name }}')\n {% endif %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.8425257, "supported_languages": null}, "macro.elementary.postgres__get_columns_from_information_schema": {"name": "postgres__get_columns_from_information_schema", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/metadata_collection/get_columns_from_information_schema.sql", "original_file_path": "macros/edr/metadata_collection/get_columns_from_information_schema.sql", "unique_id": "macro.elementary.postgres__get_columns_from_information_schema", "macro_sql": "{% macro postgres__get_columns_from_information_schema(database_name, schema_name, table_name = none) %}\n select\n upper(table_catalog || '.' || table_schema || '.' || table_name) as full_table_name,\n upper(table_catalog) as database_name,\n upper(table_schema) as schema_name,\n upper(table_name) as table_name,\n upper(column_name) as column_name,\n data_type\n from information_schema.columns\n where upper(table_schema) = upper('{{ schema_name }}')\n {% if table_name %}\n and upper(table_name) = upper('{{ table_name }}')\n {% endif %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.842913, "supported_languages": null}, "macro.elementary.databricks__get_columns_from_information_schema": {"name": "databricks__get_columns_from_information_schema", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/metadata_collection/get_columns_from_information_schema.sql", "original_file_path": "macros/edr/metadata_collection/get_columns_from_information_schema.sql", "unique_id": "macro.elementary.databricks__get_columns_from_information_schema", "macro_sql": "{% macro databricks__get_columns_from_information_schema(database_name, schema_name, table_name = none) %}\n {% if target.catalog is none %}\n {# Information schema is only available when using Unity Catalog. #}\n {% do return(elementary.get_empty_columns_from_information_schema_table()) %}\n {% endif %}\n {% set column_relation = api.Relation.create('system', 'information_schema', 'columns') %}\n select\n upper(table_catalog || '.' || table_schema || '.' || table_name) as full_table_name,\n upper(table_catalog) as database_name,\n upper(table_schema) as schema_name,\n upper(table_name) as table_name,\n upper(column_name) as column_name,\n data_type\n from {{ column_relation }}\n where upper(table_schema) = upper('{{ schema_name }}')\n {% if table_name %}\n and upper(table_name) = upper('{{ table_name }}')\n {% endif %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.get_empty_columns_from_information_schema_table"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.8437424, "supported_languages": null}, "macro.elementary.spark__get_columns_from_information_schema": {"name": "spark__get_columns_from_information_schema", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/metadata_collection/get_columns_from_information_schema.sql", "original_file_path": "macros/edr/metadata_collection/get_columns_from_information_schema.sql", "unique_id": "macro.elementary.spark__get_columns_from_information_schema", "macro_sql": "{% macro spark__get_columns_from_information_schema(database_name, schema_name, table_name = none) %}\n {{ elementary.get_empty_columns_from_information_schema_table() }}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.get_empty_columns_from_information_schema_table"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.8441331, "supported_languages": null}, "macro.elementary.get_empty_columns_from_information_schema_table": {"name": "get_empty_columns_from_information_schema_table", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/metadata_collection/get_columns_from_information_schema.sql", "original_file_path": "macros/edr/metadata_collection/get_columns_from_information_schema.sql", "unique_id": "macro.elementary.get_empty_columns_from_information_schema_table", "macro_sql": "{% macro get_empty_columns_from_information_schema_table() %}\n {{ elementary.empty_table([('full_table_name', 'string'), ('database_name', 'string'), ('schema_name', 'string'), ('table_name', 'string'), ('column_name', 'string'), ('data_type', 'string')]) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.empty_table"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.844733, "supported_languages": null}, "macro.elementary.athena__get_columns_from_information_schema": {"name": "athena__get_columns_from_information_schema", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/metadata_collection/get_columns_from_information_schema.sql", "original_file_path": "macros/edr/metadata_collection/get_columns_from_information_schema.sql", "unique_id": "macro.elementary.athena__get_columns_from_information_schema", "macro_sql": "{% macro athena__get_columns_from_information_schema(database_name, schema_name, table_name = none) %}\n {{ elementary.empty_table([('full_table_name', 'string'), ('database_name', 'string'), ('schema_name', 'string'), ('table_name', 'string'), ('column_name', 'string'), ('data_type', 'string')]) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.empty_table"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.84542, "supported_languages": null}, "macro.elementary.get_columns_in_project": {"name": "get_columns_in_project", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/metadata_collection/get_columns_in_project.sql", "original_file_path": "macros/edr/metadata_collection/get_columns_in_project.sql", "unique_id": "macro.elementary.get_columns_in_project", "macro_sql": "{% macro get_columns_in_project() %}\n {% set configured_schemas = elementary.get_configured_schemas_from_graph() %}\n {{ elementary.get_columns_by_schemas(configured_schemas) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.get_configured_schemas_from_graph", "macro.elementary.get_columns_by_schemas"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.845835, "supported_languages": null}, "macro.elementary.get_columns_by_schemas": {"name": "get_columns_by_schemas", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/metadata_collection/get_columns_by_schemas.sql", "original_file_path": "macros/edr/metadata_collection/get_columns_by_schemas.sql", "unique_id": "macro.elementary.get_columns_by_schemas", "macro_sql": "{% macro get_columns_by_schemas(configured_schemas) %}\n {%- if configured_schemas | length > 0 -%}\n {{ elementary.union_macro_queries(configured_schemas, elementary.get_columns_from_information_schema) }}\n {%- else %}\n {{ elementary.get_empty_columns_from_information_schema_table() }}\n {%- endif %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.union_macro_queries", "macro.elementary.get_empty_columns_from_information_schema_table"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.8464458, "supported_languages": null}, "macro.elementary.get_runtime_config": {"name": "get_runtime_config", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/system/system_utils/get_runtime_config.sql", "original_file_path": "macros/edr/system/system_utils/get_runtime_config.sql", "unique_id": "macro.elementary.get_runtime_config", "macro_sql": "{% macro get_runtime_config() %}\n {{ return(builtins.ref.config) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.8467321, "supported_languages": null}, "macro.elementary.get_test_argument": {"name": "get_test_argument", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/system/system_utils/get_test_argument.sql", "original_file_path": "macros/edr/system/system_utils/get_test_argument.sql", "unique_id": "macro.elementary.get_test_argument", "macro_sql": "{% macro get_test_argument(argument_name, value, model_graph_node) %}\n {% if value is defined %}\n {% do return(value) %}\n {%- endif %}\n {%- if model_graph_node %}\n {% set elementary_config = elementary.get_elementary_config_from_node(model_graph_node) %}\n {% if elementary_config and elementary_config is mapping %}\n {%- if argument_name in elementary_config %}\n {% do return(elementary_config.get(argument_name)) %}\n {%- endif %}\n {% endif %}\n {% endif %}\n {% set config_value = elementary.get_config_var(argument_name) %}\n {% if config_value is defined %}\n {% do return(config_value) %}\n {% endif %}\n {% do return(none) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.get_elementary_config_from_node", "macro.elementary.get_config_var"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.848384, "supported_languages": null}, "macro.elementary.get_var": {"name": "get_var", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/system/system_utils/get_var.sql", "original_file_path": "macros/edr/system/system_utils/get_var.sql", "unique_id": "macro.elementary.get_var", "macro_sql": "{% macro get_var(config_var_name, env_vars_names) %}\n {% do return(elementary.get_config_var(config_var_name) or elementary.get_first_env_var(env_vars_names)) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.get_config_var", "macro.elementary.get_first_env_var"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.84881, "supported_languages": null}, "macro.elementary.get_elementary_package_version": {"name": "get_elementary_package_version", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/system/system_utils/get_elementary_package_version.sql", "original_file_path": "macros/edr/system/system_utils/get_elementary_package_version.sql", "unique_id": "macro.elementary.get_elementary_package_version", "macro_sql": "{% macro get_elementary_package_version() %}\n {% set conf = elementary.get_runtime_config() %}\n {% do return(conf.dependencies[\"elementary\"].version) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.get_runtime_config"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.8492935, "supported_languages": null}, "macro.elementary.empty_elementary_test_results": {"name": "empty_elementary_test_results", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/system/system_utils/empty_table.sql", "original_file_path": "macros/edr/system/system_utils/empty_table.sql", "unique_id": "macro.elementary.empty_elementary_test_results", "macro_sql": "{% macro empty_elementary_test_results() %}\n {{ elementary.empty_table([\n ('id','long_string'),\n ('data_issue_id','string'),\n ('test_execution_id','long_string'),\n ('test_unique_id','long_string'),\n ('model_unique_id','long_string'),\n ('invocation_id', 'string'),\n ('detected_at','timestamp'),\n ('created_at','timestamp'),\n ('database_name','string'),\n ('schema_name','string'),\n ('table_name','string'),\n ('column_name','string'),\n ('test_type','string'),\n ('test_sub_type','string'),\n ('test_results_description','long_string'),\n ('owners','string'),\n ('tags','string'),\n ('test_results_query','long_string'),\n ('other','string'),\n ('test_name','long_string'),\n ('test_params','long_string'),\n ('severity','string'),\n ('status','string'),\n ('failures', 'bigint'),\n ('test_short_name', 'string'),\n ('test_alias', 'string'),\n ('result_rows', 'long_string'),\n ('failed_row_count', 'bigint')\n ]) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.empty_table"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.8574257, "supported_languages": null}, "macro.elementary.empty_dbt_source_freshness_results": {"name": "empty_dbt_source_freshness_results", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/system/system_utils/empty_table.sql", "original_file_path": "macros/edr/system/system_utils/empty_table.sql", "unique_id": "macro.elementary.empty_dbt_source_freshness_results", "macro_sql": "{% macro empty_dbt_source_freshness_results() %}\n {{ elementary.empty_table([\n ('source_freshness_execution_id','string'),\n ('unique_id','string'),\n ('max_loaded_at','string'),\n ('snapshotted_at','string'),\n ('generated_at', 'string'),\n ('created_at', 'timestamp'),\n ('max_loaded_at_time_ago_in_s','float'),\n ('status','string'),\n ('error','string'),\n ('compile_started_at', 'string'),\n ('compile_completed_at', 'string'),\n ('execute_started_at', 'string'),\n ('execute_completed_at', 'string'),\n ('invocation_id', 'string'),\n ('warn_after', 'string'),\n ('error_after', 'string'),\n ('filter', 'long_string')\n ]) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.empty_table"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.8587074, "supported_languages": null}, "macro.elementary.empty_data_monitoring_metrics": {"name": "empty_data_monitoring_metrics", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/system/system_utils/empty_table.sql", "original_file_path": "macros/edr/system/system_utils/empty_table.sql", "unique_id": "macro.elementary.empty_data_monitoring_metrics", "macro_sql": "{% macro empty_data_monitoring_metrics(with_created_at=true) %}\n {% set columns = [('id','string'),\n ('full_table_name','string'),\n ('column_name','string'),\n ('metric_name','string'),\n ('metric_value','float'),\n ('source_value','string'),\n ('bucket_start','timestamp'),\n ('bucket_end','timestamp'),\n ('bucket_duration_hours','int'),\n ('updated_at','timestamp'),\n ('dimension','string'),\n ('dimension_value','string'),\n ('metric_properties','string')]\n %}\n {% if with_created_at %}\n {% do columns.append(('created_at','timestamp')) %}\n {% endif %}\n {{ elementary.empty_table(columns) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.empty_table"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.8600428, "supported_languages": null}, "macro.elementary.empty_schema_columns_snapshot": {"name": "empty_schema_columns_snapshot", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/system/system_utils/empty_table.sql", "original_file_path": "macros/edr/system/system_utils/empty_table.sql", "unique_id": "macro.elementary.empty_schema_columns_snapshot", "macro_sql": "{% macro empty_schema_columns_snapshot() %}\n {{ elementary.empty_table([('column_state_id','string'),('full_column_name','string'),('full_table_name','string'),('column_name','string'),('data_type','string'),('is_new','boolean'),('detected_at','timestamp'),('created_at','timestamp')]) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.empty_table"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.8607335, "supported_languages": null}, "macro.elementary.empty_column_monitors_cte": {"name": "empty_column_monitors_cte", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/system/system_utils/empty_table.sql", "original_file_path": "macros/edr/system/system_utils/empty_table.sql", "unique_id": "macro.elementary.empty_column_monitors_cte", "macro_sql": "{% macro empty_column_monitors_cte() %}\n {%- set column_monitors_list = elementary.get_agg_column_monitors() %}\n {%- set columns_definition = [('column_name', 'string'), ('bucket', 'timestamp')] %}\n {%- for monitor in column_monitors_list %}\n {%- do columns_definition.append((monitor,'int'))-%}\n {%- endfor %}\n {{ elementary.empty_table(columns_definition) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.get_agg_column_monitors", "macro.elementary.empty_table"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.8614824, "supported_languages": null}, "macro.elementary.empty_table": {"name": "empty_table", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/system/system_utils/empty_table.sql", "original_file_path": "macros/edr/system/system_utils/empty_table.sql", "unique_id": "macro.elementary.empty_table", "macro_sql": "{% macro empty_table(column_name_and_type_list) %}\n\n {%- set empty_table_query -%}\n select * from (\n select\n {% for column in column_name_and_type_list %}\n {{ elementary.empty_column(column[0], column[1]) }} {%- if not loop.last -%},{%- endif %}\n {%- endfor %}\n ) as empty_table\n where 1 = 0\n {%- endset -%}\n\n {{- return(empty_table_query)-}}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.empty_column"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.86213, "supported_languages": null}, "macro.elementary.empty_column": {"name": "empty_column", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/system/system_utils/empty_table.sql", "original_file_path": "macros/edr/system/system_utils/empty_table.sql", "unique_id": "macro.elementary.empty_column", "macro_sql": "{% macro empty_column(column_name, data_type) %}\n\n {%- set dummy_values = elementary.dummy_values() %}\n\n {%- if data_type == 'boolean' %}\n cast ({{ dummy_values['boolean'] }} as {{ elementary.edr_type_bool()}}) as {{ column_name }}\n {%- elif data_type == 'timestamp' -%}\n cast('{{ dummy_values['timestamp'] }}' as {{ elementary.edr_type_timestamp() }}) as {{ column_name }}\n {%- elif data_type == 'int' %}\n cast({{ dummy_values['int'] }} as {{ elementary.edr_type_int() }}) as {{ column_name }}\n {%- elif data_type == 'bigint' %}\n cast({{ dummy_values['bigint'] }} as {{ elementary.edr_type_bigint() }}) as {{ column_name }}\n {%- elif data_type == 'float' %}\n cast({{ dummy_values['float'] }} as {{ elementary.edr_type_float() }}) as {{ column_name }}\n {%- elif data_type == 'long_string' %}\n cast('{{ dummy_values['long_string'] }}' as {{ elementary.edr_type_long_string() }}) as {{ column_name }}\n {%- else %}\n cast('{{ dummy_values['string'] }}' as {{ elementary.edr_type_string() }}) as {{ column_name }}\n {%- endif %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.dummy_values", "macro.elementary.edr_type_bool", "macro.elementary.edr_type_timestamp", "macro.elementary.edr_type_int", "macro.elementary.edr_type_bigint", "macro.elementary.edr_type_float", "macro.elementary.edr_type_long_string", "macro.elementary.edr_type_string"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.8640919, "supported_languages": null}, "macro.elementary.dummy_values": {"name": "dummy_values", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/system/system_utils/empty_table.sql", "original_file_path": "macros/edr/system/system_utils/empty_table.sql", "unique_id": "macro.elementary.dummy_values", "macro_sql": "{% macro dummy_values() %}\n\n {%- set dummy_values = {\n 'string': \"dummy_string\",\n 'long_string': \"this_is_just_a_long_dummy_string\",\n 'boolean': 'True',\n 'int': 123456789,\n 'bigint': 31474836478,\n 'float': 123456789.99,\n 'timestamp': \"2091-02-17\"\n } %}\n\n {{ return(dummy_values) }}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.8647873, "supported_languages": null}, "macro.elementary.clean_elementary_temp_tables": {"name": "clean_elementary_temp_tables", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/system/system_utils/clean_elementary_temp_tables.sql", "original_file_path": "macros/edr/system/system_utils/clean_elementary_temp_tables.sql", "unique_id": "macro.elementary.clean_elementary_temp_tables", "macro_sql": "{% macro clean_elementary_temp_tables() %}\n {% do elementary.clean_elementary_test_tables() %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.clean_elementary_test_tables"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.8651009, "supported_languages": null}, "macro.elementary.complete_buckets_cte": {"name": "complete_buckets_cte", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/system/system_utils/buckets_cte.sql", "original_file_path": "macros/edr/system/system_utils/buckets_cte.sql", "unique_id": "macro.elementary.complete_buckets_cte", "macro_sql": "{% macro complete_buckets_cte(metric_properties, min_bucket_start, max_bucket_end) %}\n {%- set time_bucket = metric_properties.time_bucket %}\n {%- set bucket_end_expr = elementary.edr_timeadd(time_bucket.period, time_bucket.count, 'edr_bucket_start') %}\n {%- set min_bucket_start_expr = elementary.edr_cast_as_timestamp(min_bucket_start) %}\n {%- set max_bucket_end_expr = elementary.edr_cast_as_timestamp(max_bucket_end) %}\n {{ adapter.dispatch('complete_buckets_cte','elementary')(time_bucket, bucket_end_expr, min_bucket_start_expr, max_bucket_end_expr) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.edr_timeadd", "macro.elementary.edr_cast_as_timestamp", "macro.elementary.postgres__complete_buckets_cte"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.8762176, "supported_languages": null}, "macro.elementary.default__complete_buckets_cte": {"name": "default__complete_buckets_cte", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/system/system_utils/buckets_cte.sql", "original_file_path": "macros/edr/system/system_utils/buckets_cte.sql", "unique_id": "macro.elementary.default__complete_buckets_cte", "macro_sql": "{% macro default__complete_buckets_cte(time_bucket, bucket_end_expr, min_bucket_start_expr, max_bucket_end_expr) %}\n {{ exceptions.raise_compiler_error(\"The adapter does not have an implementation for macro 'complete_buckets_cte'\") }}\n {{ return('') }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.8765879, "supported_languages": null}, "macro.elementary.spark__complete_buckets_cte": {"name": "spark__complete_buckets_cte", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/system/system_utils/buckets_cte.sql", "original_file_path": "macros/edr/system/system_utils/buckets_cte.sql", "unique_id": "macro.elementary.spark__complete_buckets_cte", "macro_sql": "{% macro spark__complete_buckets_cte(time_bucket, bucket_end_expr, min_bucket_start_expr, max_bucket_end_expr) %}\n {%- set complete_buckets_cte %}\n select\n edr_bucket_start,\n {{ bucket_end_expr }} as edr_bucket_end\n from (select explode(sequence({{ min_bucket_start_expr }}, {{ max_bucket_end_expr }}, interval {{ time_bucket.count }} {{ time_bucket.period }})) as edr_bucket_start)\n where {{ bucket_end_expr }} <= {{ max_bucket_end_expr }}\n {%- endset %}\n {{ return(complete_buckets_cte) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.8772101, "supported_languages": null}, "macro.elementary.snowflake__complete_buckets_cte": {"name": "snowflake__complete_buckets_cte", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/system/system_utils/buckets_cte.sql", "original_file_path": "macros/edr/system/system_utils/buckets_cte.sql", "unique_id": "macro.elementary.snowflake__complete_buckets_cte", "macro_sql": "{% macro snowflake__complete_buckets_cte(time_bucket, bucket_end_expr, min_bucket_start_expr, max_bucket_end_expr) -%}\n {%- set complete_buckets_cte %}\n with timestamps as (\n select {{ min_bucket_start_expr }} as edr_bucket_start\n union all\n select {{ bucket_end_expr }} as next_bucket\n from timestamps\n where next_bucket < {{ max_bucket_end_expr }}\n )\n select\n edr_bucket_start,\n {{ bucket_end_expr }} as edr_bucket_end\n from timestamps\n where {{ bucket_end_expr }} <= {{ max_bucket_end_expr }}\n {%- endset %}\n {{ return(complete_buckets_cte) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.8777726, "supported_languages": null}, "macro.elementary.bigquery__complete_buckets_cte": {"name": "bigquery__complete_buckets_cte", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/system/system_utils/buckets_cte.sql", "original_file_path": "macros/edr/system/system_utils/buckets_cte.sql", "unique_id": "macro.elementary.bigquery__complete_buckets_cte", "macro_sql": "{% macro bigquery__complete_buckets_cte(time_bucket, bucket_end_expr, min_bucket_start_expr, max_bucket_end_expr) %}\n\n {%- if time_bucket.period | lower in ['second', 'minute', 'hour', 'day'] %}\n {%- set complete_buckets_cte %}\n select\n edr_bucket_start,\n {{ bucket_end_expr }} as edr_bucket_end\n from unnest(generate_timestamp_array({{ min_bucket_start_expr }}, {{ max_bucket_end_expr }}, interval {{ time_bucket.count }} {{ time_bucket.period }})) as edr_bucket_start\n where {{ bucket_end_expr }} <= {{ max_bucket_end_expr }}\n {%- endset %}\n {%- elif time_bucket.period | lower in ['week', 'month', 'quarter', 'year'] %}\n {%- set complete_buckets_cte %}\n select\n {{ elementary.edr_cast_as_timestamp('edr_bucket_start') }} as edr_bucket_start,\n {{ elementary.edr_cast_as_timestamp(bucket_end_expr) }} as edr_bucket_end\n from unnest(generate_date_array({{ elementary.edr_cast_as_date(min_bucket_start_expr) }}, {{ elementary.edr_cast_as_date(max_bucket_end_expr) }}, interval {{ time_bucket.count }} {{ time_bucket.period }})) as edr_bucket_start\n where {{ elementary.edr_cast_as_timestamp(bucket_end_expr) }} <= {{ max_bucket_end_expr }}\n {%- endset %}\n {%- else %}\n {{ exceptions.raise_compiler_error(\"Unsupported time bucket period: \".format(time_bucket.period)) }}\n {%- endif %}\n\n {{ return(complete_buckets_cte) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.edr_cast_as_timestamp", "macro.elementary.edr_cast_as_date"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.8795497, "supported_languages": null}, "macro.elementary.redshift__complete_buckets_cte": {"name": "redshift__complete_buckets_cte", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/system/system_utils/buckets_cte.sql", "original_file_path": "macros/edr/system/system_utils/buckets_cte.sql", "unique_id": "macro.elementary.redshift__complete_buckets_cte", "macro_sql": "{% macro redshift__complete_buckets_cte(time_bucket, bucket_end_expr, min_bucket_start_expr, max_bucket_end_expr) %}\n {%- set complete_buckets_cte %}\n with integers as (\n select (row_number() over (order by 1)) - 1 as num\n from pg_catalog.pg_class\n limit {{ elementary.edr_datediff(min_bucket_start_expr, max_bucket_end_expr, time_bucket.period) }} / {{ time_bucket.count }} + 1\n )\n select\n {{ min_bucket_start_expr }} + (num * interval '{{ time_bucket.count }} {{ time_bucket.period }}') as edr_bucket_start,\n {{ min_bucket_start_expr }} + ((num + 1) * interval '{{ time_bucket.count }} {{ time_bucket.period }}') as edr_bucket_end\n from integers\n where edr_bucket_end <= {{ max_bucket_end_expr }}\n {%- endset %}\n {{ return(complete_buckets_cte) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.edr_datediff"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.8803763, "supported_languages": null}, "macro.elementary.postgres__complete_buckets_cte": {"name": "postgres__complete_buckets_cte", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/system/system_utils/buckets_cte.sql", "original_file_path": "macros/edr/system/system_utils/buckets_cte.sql", "unique_id": "macro.elementary.postgres__complete_buckets_cte", "macro_sql": "{% macro postgres__complete_buckets_cte(time_bucket, bucket_end_expr, min_bucket_start_expr, max_bucket_end_expr) %}\n {%- set complete_buckets_cte %}\n select\n edr_bucket_start,\n {{ bucket_end_expr }} as edr_bucket_end\n from generate_series({{ min_bucket_start_expr }}, {{ max_bucket_end_expr }}, interval '{{ time_bucket.count }} {{ time_bucket.period }}') edr_bucket_start\n where {{ bucket_end_expr }} <= {{ max_bucket_end_expr }}\n {%- endset %}\n {{ return(complete_buckets_cte) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.8809972, "supported_languages": null}, "macro.elementary.athena__complete_buckets_cte": {"name": "athena__complete_buckets_cte", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/system/system_utils/buckets_cte.sql", "original_file_path": "macros/edr/system/system_utils/buckets_cte.sql", "unique_id": "macro.elementary.athena__complete_buckets_cte", "macro_sql": "{% macro athena__complete_buckets_cte(time_bucket, bucket_end_expr, min_bucket_start_expr, max_bucket_end_expr) %}\n {%- set complete_buckets_cte %}\n select\n edr_bucket_start,\n {{ bucket_end_expr }} as edr_bucket_end\n from unnest(sequence(\n {{ min_bucket_start_expr }},\n {{ max_bucket_end_expr }},\n {%- if time_bucket.period | lower == 'week' %}\n interval '{{ time_bucket.count * 7 }}' day\n {%- else %}\n interval '{{ time_bucket.count }}' {{ time_bucket.period }}\n {%- endif %}\n )) as t(edr_bucket_start)\n where {{ bucket_end_expr }} <= {{ max_bucket_end_expr }}\n {%- endset %}\n {{ return(complete_buckets_cte) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.8818443, "supported_languages": null}, "macro.elementary.get_run_started_at": {"name": "get_run_started_at", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/system/system_utils/get_run_started_at.sql", "original_file_path": "macros/edr/system/system_utils/get_run_started_at.sql", "unique_id": "macro.elementary.get_run_started_at", "macro_sql": "{% macro get_run_started_at() %}\n {% set custom_run_started_at = elementary.get_config_var('custom_run_started_at') %}\n {% if custom_run_started_at %}\n {# dbt run_started_at is fromtype datetime, so we convert the given custom time to be datetime as well. #}\n {{ return(modules.datetime.datetime.fromisoformat(custom_run_started_at)) }}\n {% else %}\n {{ return(run_started_at) }}\n {% endif %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.get_config_var"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.8826232, "supported_languages": null}, "macro.elementary.no_results_query": {"name": "no_results_query", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/system/system_utils/no_results_query.sql", "original_file_path": "macros/edr/system/system_utils/no_results_query.sql", "unique_id": "macro.elementary.no_results_query", "macro_sql": "{% macro no_results_query() %}\n with nothing as (select 1 as num)\n select * from nothing where num = 2\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.8828218, "supported_languages": null}, "macro.elementary.edr_log": {"name": "edr_log", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/system/system_utils/logs.sql", "original_file_path": "macros/edr/system/system_utils/logs.sql", "unique_id": "macro.elementary.edr_log", "macro_sql": "{% macro edr_log(msg, info=True) %}\n {%- if execute %}\n {% do log('Elementary: ' ~ msg, info=info) %}\n {%- endif %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.884555, "supported_languages": null}, "macro.elementary.edr_log_warning": {"name": "edr_log_warning", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/system/system_utils/logs.sql", "original_file_path": "macros/edr/system/system_utils/logs.sql", "unique_id": "macro.elementary.edr_log_warning", "macro_sql": "{% macro edr_log_warning(msg, info=True) %}\n {%- if execute %}\n {% do elementary.edr_log(\"Warning - \" ~ msg, info=info) %}\n {%- endif %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.edr_log"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.8849905, "supported_languages": null}, "macro.elementary.file_log": {"name": "file_log", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/system/system_utils/logs.sql", "original_file_path": "macros/edr/system/system_utils/logs.sql", "unique_id": "macro.elementary.file_log", "macro_sql": "{% macro file_log(msg) %}\n {% if execute %}\n {% do elementary.edr_log(msg, info=false) %}\n {% do elementary.debug_log(msg) %}\n {% endif %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.edr_log", "macro.elementary.debug_log"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.885446, "supported_languages": null}, "macro.elementary.debug_log": {"name": "debug_log", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/system/system_utils/logs.sql", "original_file_path": "macros/edr/system/system_utils/logs.sql", "unique_id": "macro.elementary.debug_log", "macro_sql": "{% macro debug_log(msg) %}\n {%- if execute %}\n {% set debug_logs_enabled = elementary.get_config_var('debug_logs') %}\n {% if debug_logs_enabled %}\n {{ elementary.edr_log(msg) }}\n {% endif %}\n {%- endif %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.get_config_var", "macro.elementary.edr_log"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.8859456, "supported_languages": null}, "macro.elementary.test_log": {"name": "test_log", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/system/system_utils/logs.sql", "original_file_path": "macros/edr/system/system_utils/logs.sql", "unique_id": "macro.elementary.test_log", "macro_sql": "{% macro test_log(msg_type, table_name, column_name=none) %}\n {%- if column_name %}\n {%- set start = 'Started running data monitors on: ' ~ table_name ~ ' ' ~ column_name %}\n {%- set end = 'Finished running data monitors on: ' ~ table_name ~ ' ' ~ column_name %}\n {%- else %}\n {%- set start = 'Started running data monitors on: ' ~ table_name %}\n {%- set end = 'Finished running data monitors on: ' ~ table_name %}\n {%- endif %}\n\n {%- if msg_type == 'start' %}\n {% do elementary.edr_log(start) %}\n {%- elif msg_type == 'end' %}\n {% do elementary.edr_log(end) %}\n {%- endif %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.edr_log"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.8881729, "supported_languages": null}, "macro.elementary.get_time_format": {"name": "get_time_format", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/system/system_utils/times.sql", "original_file_path": "macros/edr/system/system_utils/times.sql", "unique_id": "macro.elementary.get_time_format", "macro_sql": "{% macro get_time_format() %}\n {% do return(\"%Y-%m-%d %H:%M:%S\") %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.8893306, "supported_languages": null}, "macro.elementary.run_started_at_as_string": {"name": "run_started_at_as_string", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/system/system_utils/times.sql", "original_file_path": "macros/edr/system/system_utils/times.sql", "unique_id": "macro.elementary.run_started_at_as_string", "macro_sql": "{% macro run_started_at_as_string() %}\n {% do return(elementary.get_run_started_at().strftime(elementary.get_time_format())) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.get_run_started_at", "macro.elementary.get_time_format"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.8898609, "supported_languages": null}, "macro.elementary.datetime_now_utc_as_string": {"name": "datetime_now_utc_as_string", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/system/system_utils/times.sql", "original_file_path": "macros/edr/system/system_utils/times.sql", "unique_id": "macro.elementary.datetime_now_utc_as_string", "macro_sql": "{% macro datetime_now_utc_as_string() %}\n {% do return(modules.datetime.datetime.utcnow().strftime(elementary.get_time_format())) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.get_time_format"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.8902287, "supported_languages": null}, "macro.elementary.current_timestamp_column": {"name": "current_timestamp_column", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/system/system_utils/times.sql", "original_file_path": "macros/edr/system/system_utils/times.sql", "unique_id": "macro.elementary.current_timestamp_column", "macro_sql": "{% macro current_timestamp_column() %}\n cast ({{elementary.edr_current_timestamp_in_utc()}} as {{ elementary.edr_type_timestamp() }})\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.edr_current_timestamp_in_utc", "macro.elementary.edr_type_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.8905025, "supported_languages": null}, "macro.elementary.datetime_now_utc_as_timestamp_column": {"name": "datetime_now_utc_as_timestamp_column", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/system/system_utils/times.sql", "original_file_path": "macros/edr/system/system_utils/times.sql", "unique_id": "macro.elementary.datetime_now_utc_as_timestamp_column", "macro_sql": "{% macro datetime_now_utc_as_timestamp_column() %}\n cast ('{{ elementary.datetime_now_utc_as_string() }}' as {{ elementary.edr_type_timestamp() }})\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.datetime_now_utc_as_string", "macro.elementary.edr_type_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.8907764, "supported_languages": null}, "macro.elementary.clean_dbt_columns_temp_tables": {"name": "clean_dbt_columns_temp_tables", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/system/system_utils/clean_dbt_columns_temp_tables.sql", "original_file_path": "macros/edr/system/system_utils/clean_dbt_columns_temp_tables.sql", "unique_id": "macro.elementary.clean_dbt_columns_temp_tables", "macro_sql": "{% macro clean_dbt_columns_temp_tables() %}\n {% do elementary.edr_log(\"Deleting dbt_columns temp tables\") %}\n {% set elementary_database, elementary_schema = elementary.get_package_database_and_schema() %}\n {% set dbt_columns_temp_tables_relations = dbt_utils.get_relations_by_prefix(schema=elementary_schema, prefix='dbt_columns__tmp_', database=elementary_database) %}\n {% for temp_relation in dbt_columns_temp_tables_relations %}\n {% do elementary.edr_log(\"Deleting temp table - \" ~ temp_relation) %}\n {% do adapter.drop_relation(temp_relation) %}\n {% endfor %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.edr_log", "macro.elementary.get_package_database_and_schema", "macro.dbt_utils.get_relations_by_prefix"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.891898, "supported_languages": null}, "macro.elementary.get_first_env_var": {"name": "get_first_env_var", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/system/system_utils/get_first_env_var.sql", "original_file_path": "macros/edr/system/system_utils/get_first_env_var.sql", "unique_id": "macro.elementary.get_first_env_var", "macro_sql": "{% macro get_first_env_var(var_names) %}\n {% for var_name in var_names %}\n {% set value = env_var(var_name, \"\") %}\n {% if value %}\n {{ return(value) }}\n {% endif %}\n {% endfor %}\n {{ return(none) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.8926659, "supported_languages": null}, "macro.elementary.full_table_name": {"name": "full_table_name", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/system/system_utils/full_names.sql", "original_file_path": "macros/edr/system/system_utils/full_names.sql", "unique_id": "macro.elementary.full_table_name", "macro_sql": "{% macro full_table_name(alias) -%}\n {% if alias is defined %}{%- set alias_dot = alias ~ '.' %}{% endif %}\n upper({{ alias_dot }}database_name || '.' || {{ alias_dot }}schema_name || '.' || {{ alias_dot }}table_name)\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.8969455, "supported_languages": null}, "macro.elementary.full_schema_name": {"name": "full_schema_name", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/system/system_utils/full_names.sql", "original_file_path": "macros/edr/system/system_utils/full_names.sql", "unique_id": "macro.elementary.full_schema_name", "macro_sql": "{% macro full_schema_name() -%}\n upper(database_name || '.' || schema_name)\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.8971133, "supported_languages": null}, "macro.elementary.full_column_name": {"name": "full_column_name", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/system/system_utils/full_names.sql", "original_file_path": "macros/edr/system/system_utils/full_names.sql", "unique_id": "macro.elementary.full_column_name", "macro_sql": "{% macro full_column_name() -%}\n upper(database_name || '.' || schema_name || '.' || table_name || '.' || column_name)\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.8972712, "supported_languages": null}, "macro.elementary.full_name_split": {"name": "full_name_split", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/system/system_utils/full_names.sql", "original_file_path": "macros/edr/system/system_utils/full_names.sql", "unique_id": "macro.elementary.full_name_split", "macro_sql": "{% macro full_name_split(part_name) %}\n {{ adapter.dispatch('full_name_split','elementary')(part_name) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.postgres__full_name_split"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.8975692, "supported_languages": null}, "macro.elementary.default__full_name_split": {"name": "default__full_name_split", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/system/system_utils/full_names.sql", "original_file_path": "macros/edr/system/system_utils/full_names.sql", "unique_id": "macro.elementary.default__full_name_split", "macro_sql": "{% macro default__full_name_split(part_name) %}\n {%- if part_name == 'database_name' -%}\n {%- set part_index = 0 -%}\n {%- elif part_name == 'schema_name' -%}\n {%- set part_index = 1 -%}\n {%- elif part_name == 'table_name' -%}\n {%- set part_index = 2 -%}\n {%- else -%}\n {{ return('') }}\n {%- endif -%}\n trim(split(full_table_name,'.')[{{ part_index }}],'\"') as {{ part_name }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.8983245, "supported_languages": null}, "macro.elementary.bigquery__full_name_split": {"name": "bigquery__full_name_split", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/system/system_utils/full_names.sql", "original_file_path": "macros/edr/system/system_utils/full_names.sql", "unique_id": "macro.elementary.bigquery__full_name_split", "macro_sql": "{% macro bigquery__full_name_split(part_name) %}\n {%- if part_name == 'database_name' -%}\n {%- set part_index = 0 %}\n {%- elif part_name == 'schema_name' -%}\n {%- set part_index = 1 %}\n {%- elif part_name == 'table_name' -%}\n {%- set part_index = 2 -%}\n {%- else -%}\n {{ return('') }}\n {%- endif -%}\n trim(split(full_table_name,'.')[OFFSET({{ part_index }})],'\"') as {{ part_name }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.8990722, "supported_languages": null}, "macro.elementary.postgres__full_name_split": {"name": "postgres__full_name_split", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/system/system_utils/full_names.sql", "original_file_path": "macros/edr/system/system_utils/full_names.sql", "unique_id": "macro.elementary.postgres__full_name_split", "macro_sql": "{% macro postgres__full_name_split(part_name) %}\n {%- if part_name == 'database_name' -%}\n {%- set part_index = 1 -%}\n {%- elif part_name == 'schema_name' -%}\n {%- set part_index = 2 -%}\n {%- elif part_name == 'table_name' -%}\n {%- set part_index = 3 -%}\n {%- else -%}\n {{ return('') }}\n {%- endif -%}\n trim(split_part(full_table_name,'.',{{ part_index }}),'\"') as {{ part_name }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.899823, "supported_languages": null}, "macro.elementary.databricks__full_name_split": {"name": "databricks__full_name_split", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/system/system_utils/full_names.sql", "original_file_path": "macros/edr/system/system_utils/full_names.sql", "unique_id": "macro.elementary.databricks__full_name_split", "macro_sql": "{% macro databricks__full_name_split(part_name) %}\n {%- if part_name == 'database_name' -%}\n {%- set part_index = 0 -%}\n {%- elif part_name == 'schema_name' -%}\n {%- set part_index = 1 -%}\n {%- elif part_name == 'table_name' -%}\n {%- set part_index = 2 -%}\n {%- else -%}\n {{ return('') }}\n {%- endif -%}\n trim('\"' from split(full_table_name,'[.]')[{{ part_index }}]) as {{ part_name }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.9005704, "supported_languages": null}, "macro.elementary.relation_to_full_name": {"name": "relation_to_full_name", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/system/system_utils/full_names.sql", "original_file_path": "macros/edr/system/system_utils/full_names.sql", "unique_id": "macro.elementary.relation_to_full_name", "macro_sql": "{% macro relation_to_full_name(relation) %}\n {%- if relation.is_cte %}\n {# Ephemeral models don't have db and schema #}\n {%- set full_table_name = relation.identifier | upper %}\n {%- elif relation.database %}\n {%- set full_table_name = relation.database | upper ~'.'~ relation.schema | upper ~'.'~ relation.identifier | upper %}\n {%- else %}\n {# Databricks doesn't always have a database #}\n {%- set full_table_name = relation.schema | upper ~'.'~ relation.identifier | upper %}\n {%- endif %}\n {{ return(full_table_name) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.9016097, "supported_languages": null}, "macro.elementary.model_node_to_full_name": {"name": "model_node_to_full_name", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/system/system_utils/full_names.sql", "original_file_path": "macros/edr/system/system_utils/full_names.sql", "unique_id": "macro.elementary.model_node_to_full_name", "macro_sql": "{% macro model_node_to_full_name(model_node) %}\n {% set identifier = model_node.identifier or model_node.alias %}\n {%- if model_node.database %}\n {%- set full_table_name = model_node.database | upper ~'.'~ model_node.schema | upper ~'.'~ identifier | upper %}\n {%- else %}\n {# Databricks doesn't always have a database #}\n {%- set full_table_name = model_node.schema | upper ~'.'~ identifier | upper %}\n {%- endif %}\n {{ return(full_table_name) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.902425, "supported_languages": null}, "macro.elementary.configured_schemas_from_graph_as_tuple": {"name": "configured_schemas_from_graph_as_tuple", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/system/system_utils/full_names.sql", "original_file_path": "macros/edr/system/system_utils/full_names.sql", "unique_id": "macro.elementary.configured_schemas_from_graph_as_tuple", "macro_sql": "{% macro configured_schemas_from_graph_as_tuple() %}\n\n {%- set configured_schema_tuples = elementary.get_configured_schemas_from_graph() %}\n {%- set schemas_list = [] %}\n\n {%- for configured_schema_tuple in configured_schema_tuples %}\n {%- set database_name, schema_name = configured_schema_tuple %}\n {%- set full_schema_name = database_name | upper ~ '.' ~ schema_name | upper %}\n {%- do schemas_list.append(full_schema_name) -%}\n {%- endfor %}\n\n {% set schemas_tuple = elementary.strings_list_to_tuple(schemas_list) %}\n {{ return(schemas_tuple) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.get_configured_schemas_from_graph", "macro.elementary.strings_list_to_tuple"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.903306, "supported_languages": null}, "macro.elementary.get_config_var": {"name": "get_config_var", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/system/system_utils/get_config_var.sql", "original_file_path": "macros/edr/system/system_utils/get_config_var.sql", "unique_id": "macro.elementary.get_config_var", "macro_sql": "{% macro get_config_var(var_name) %}\n {% set default_config = elementary.get_default_config() %}\n {% set var_value = var(var_name, default_config.get(var_name)) %}\n {% if var_value is string %}\n {% if var_value.lower() == \"true\" %}\n {% do return(true) %}\n {% elif var_value.lower() == \"false\" %}\n {% do return(false) %}\n {% endif %}\n {% endif %}\n {% do return(var_value) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.get_default_config"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.90555, "supported_languages": null}, "macro.elementary.get_default_config": {"name": "get_default_config", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/system/system_utils/get_config_var.sql", "original_file_path": "macros/edr/system/system_utils/get_config_var.sql", "unique_id": "macro.elementary.get_default_config", "macro_sql": "{% macro get_default_config(var_name) %}\n {{ return(adapter.dispatch('get_default_config', 'elementary')()) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.elementary.default__get_default_config"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.9058769, "supported_languages": null}, "macro.elementary.default__get_default_config": {"name": "default__get_default_config", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/system/system_utils/get_config_var.sql", "original_file_path": "macros/edr/system/system_utils/get_config_var.sql", "unique_id": "macro.elementary.default__get_default_config", "macro_sql": "{%- macro default__get_default_config() -%}\n{# We use this macro to define and call vars, as the global vars defined in dbt_project.yml\n of the package are not accessible at on-run-start and on-run-end #}\n {% set default_config = {\n 'days_back': 14,\n 'anomaly_sensitivity': 3,\n 'backfill_days': 2,\n 'tests_schema_name': '',\n 'debug_logs': false,\n 'disable_warn_alerts': false,\n 'disable_model_alerts': false,\n 'disable_test_alerts': false,\n 'disable_source_freshness_alerts': false,\n 'disable_run_results': false,\n 'disable_tests_results': false,\n 'disable_dbt_artifacts_autoupload': false,\n 'disable_dbt_columns_autoupload': false,\n 'upload_only_columns_with_descriptions': false,\n 'disable_dbt_invocation_autoupload': false,\n 'disable_skipped_model_alerts': true,\n 'disable_skipped_test_alerts': true,\n 'dbt_artifacts_chunk_size': 5000,\n 'test_sample_row_count': 5,\n 'edr_cli_run': false,\n 'max_int': 2147483647,\n 'custom_run_started_at': none,\n 'edr_monitors': elementary.get_default_monitors(),\n 'long_string_size': 65535,\n 'collect_model_sql': true,\n 'query_max_size': 1000000,\n 'insert_rows_method': 'max_query_size',\n 'upload_artifacts_method': 'diff',\n 'project_name': none,\n 'elementary_full_refresh': false,\n 'min_training_set_size': 7,\n 'cache_artifacts': true,\n 'anomaly_direction': 'both',\n 'store_result_rows_in_own_table': true,\n 'mute_dbt_upgrade_recommendation': false,\n 'calculate_failed_count': true,\n 'tests_use_temp_tables': false,\n 'collect_metrics': false,\n 'clean_elementary_temp_tables': true,\n 'force_metrics_backfill': false,\n 'ignore_small_changes': {\n 'spike_failure_percent_threshold': none,\n 'drop_failure_percent_threshold': none\n },\n 'include_other_warehouse_specific_columns': false,\n 'fail_on_zero': false,\n 'anomaly_exclude_metrics': none\n } %}\n {{- return(default_config) -}}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.elementary.get_default_monitors"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.908195, "supported_languages": null}, "macro.elementary.bigquery__get_default_config": {"name": "bigquery__get_default_config", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/system/system_utils/get_config_var.sql", "original_file_path": "macros/edr/system/system_utils/get_config_var.sql", "unique_id": "macro.elementary.bigquery__get_default_config", "macro_sql": "{%- macro bigquery__get_default_config() -%}\n {% set default_config = elementary.default__get_default_config() %}\n {% do default_config.update({'query_max_size': 250000}) %}\n {{- return(default_config) -}}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.elementary.default__get_default_config"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.9086528, "supported_languages": null}, "macro.elementary.athena__get_default_config": {"name": "athena__get_default_config", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/system/system_utils/get_config_var.sql", "original_file_path": "macros/edr/system/system_utils/get_config_var.sql", "unique_id": "macro.elementary.athena__get_default_config", "macro_sql": "{%- macro athena__get_default_config() -%}\n {% set default_config = elementary.default__get_default_config() %}\n {% do default_config.update({'query_max_size': 250000}) %}\n {{- return(default_config) -}}\n{%- endmacro -%}", "depends_on": {"macros": ["macro.elementary.default__get_default_config"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.9091153, "supported_languages": null}, "macro.elementary.is_elementary_enabled": {"name": "is_elementary_enabled", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/system/configuration/is_elementary_enabled.sql", "original_file_path": "macros/edr/system/configuration/is_elementary_enabled.sql", "unique_id": "macro.elementary.is_elementary_enabled", "macro_sql": "{% macro is_elementary_enabled() %}\n {% do return(\"elementary\" in graph) %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.9094412, "supported_languages": null}, "macro.elementary.get_configured_databases_from_graph": {"name": "get_configured_databases_from_graph", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/system/configuration/get_configured_databases_from_graph.sql", "original_file_path": "macros/edr/system/configuration/get_configured_databases_from_graph.sql", "unique_id": "macro.elementary.get_configured_databases_from_graph", "macro_sql": "{% macro get_configured_databases_from_graph() %}\n {% set schema_tuples = elementary.get_configured_schemas_from_graph() %}\n {% do return(schema_tuples | map(attribute=0) | unique) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.get_configured_schemas_from_graph"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.9099264, "supported_languages": null}, "macro.elementary.get_configured_schemas_from_graph": {"name": "get_configured_schemas_from_graph", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/system/configuration/get_configured_schemas_from_graph.sql", "original_file_path": "macros/edr/system/configuration/get_configured_schemas_from_graph.sql", "unique_id": "macro.elementary.get_configured_schemas_from_graph", "macro_sql": "{% macro get_configured_schemas_from_graph() %}\n {% set configured_schemas = [] %}\n {% set existing_schemas = [] %}\n {% if execute %}\n {% set root_project = context[\"project_name\"] %}\n {% set nodes = elementary.get_nodes_from_graph() %}\n {% for node in nodes %}\n {% if node.resource_type in ['model', 'source', 'snapshot', 'seed'] and node.package_name == root_project %}\n {% set schema_tuple = (node.database, node.schema) %}\n {% if schema_tuple not in configured_schemas %}\n {% do configured_schemas.append(schema_tuple) %}\n {% endif %}\n {% endif %}\n {% endfor %}\n\n {% for schema_tuple in configured_schemas %}\n {% set database_name = schema_tuple[0] %}\n {% set schema_name = schema_tuple[1] %}\n {% if elementary.schema_exists(database_name, schema_name) %}\n {% do existing_schemas.append(schema_tuple) %}\n {% endif %}\n {% endfor %}\n {% endif %}\n {{ return(existing_schemas) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.get_nodes_from_graph", "macro.elementary.schema_exists"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.91266, "supported_languages": null}, "macro.elementary.on_run_start": {"name": "on_run_start", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/system/hooks/on_run_start.sql", "original_file_path": "macros/edr/system/hooks/on_run_start.sql", "unique_id": "macro.elementary.on_run_start", "macro_sql": "{% macro on_run_start() %}\n {% set edr_cli_run = elementary.get_config_var('edr_cli_run') %}\n {% if not execute or edr_cli_run %}\n {{ return('') }}\n {% endif %}\n\n {% do recommend_dbt_core_artifacts_upgrade() %}\n {% do elementary.init_elementary_graph() %}\n\n {% if elementary.is_test_command() %}\n {{ elementary.create_elementary_tests_schema() }}\n {% endif %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.get_config_var", "macro.elementary.recommend_dbt_core_artifacts_upgrade", "macro.elementary.init_elementary_graph", "macro.elementary.is_test_command", "macro.elementary.create_elementary_tests_schema"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.9136646, "supported_languages": null}, "macro.elementary.on_run_end": {"name": "on_run_end", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/system/hooks/on_run_end.sql", "original_file_path": "macros/edr/system/hooks/on_run_end.sql", "unique_id": "macro.elementary.on_run_end", "macro_sql": "{% macro on_run_end() %}\n {%- if execute and not elementary.is_docs_command() %}\n {% set edr_cli_run = elementary.get_config_var('edr_cli_run') %}\n {% if not execute or edr_cli_run %}\n {% do return(\"\") %}\n {% endif %}\n\n {% if elementary.is_run_command() %}\n {% do elementary.insert_metrics() %}\n {% endif %}\n\n {% if not elementary.get_config_var('disable_dbt_artifacts_autoupload') %}\n {% do elementary.upload_dbt_artifacts() %}\n {% endif %}\n\n {% if not elementary.get_config_var('disable_run_results') %}\n {% do elementary.upload_run_results() %}\n {% endif %}\n\n {% if elementary.is_test_command() and not elementary.get_config_var('disable_tests_results') %}\n {% do elementary.handle_tests_results() %}\n {% endif %}\n\n {% if not elementary.get_config_var('disable_dbt_invocation_autoupload') %}\n {% do elementary.upload_dbt_invocation() %}\n {% endif %}\n\n {# \n Elementary temp tables are not really temp and should be cleaned on the end of the run.\n We want to make sure we clean the temp tables even if elementary on run end hooks are disabled.\n\n IMPORTANT! - This must be running last because other hooks are relaying on the temp tables.\n #}\n {% if elementary.get_config_var(\"clean_elementary_temp_tables\") %}\n {% do elementary.clean_elementary_temp_tables() %}\n {% endif %}\n {% endif %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.is_docs_command", "macro.elementary.get_config_var", "macro.elementary.is_run_command", "macro.elementary.insert_metrics", "macro.elementary.upload_dbt_artifacts", "macro.elementary.upload_run_results", "macro.elementary.is_test_command", "macro.elementary.handle_tests_results", "macro.elementary.upload_dbt_invocation", "macro.elementary.clean_elementary_temp_tables"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.9162867, "supported_languages": null}, "macro.elementary.test_volume_anomalies": {"name": "test_volume_anomalies", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/tests/test_volume_anomalies.sql", "original_file_path": "macros/edr/tests/test_volume_anomalies.sql", "unique_id": "macro.elementary.test_volume_anomalies", "macro_sql": "{% test volume_anomalies(model, timestamp_column, where_expression, anomaly_sensitivity, anomaly_direction, min_training_set_size, time_bucket, days_back, backfill_days, seasonality, sensitivity, ignore_small_changes, fail_on_zero, detection_delay, anomaly_exclude_metrics, detection_period, training_period) %}\n {{ config(tags = ['elementary-tests']) }}\n\n {{ elementary.test_table_anomalies(\n model=model,\n table_anomalies=[\"row_count\"],\n freshness_column=none,\n timestamp_column=timestamp_column,\n where_expression=where_expression,\n anomaly_sensitivity=anomaly_sensitivity,\n anomaly_direction=anomaly_direction,\n min_training_set_size=min_training_set_size,\n time_bucket=time_bucket,\n days_back=days_back,\n backfill_days=backfill_days,\n seasonality=seasonality,\n sensitivity=sensitivity,\n ignore_small_changes=ignore_small_changes,\n fail_on_zero=fail_on_zero,\n detection_delay=detection_delay,\n anomaly_exclude_metrics=anomaly_exclude_metrics,\n detection_period=detection_period,\n training_period=training_period\n )\n }}\n{% endtest %}", "depends_on": {"macros": ["macro.elementary.test_table_anomalies"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.9178002, "supported_languages": null}, "macro.elementary.test_event_freshness_anomalies": {"name": "test_event_freshness_anomalies", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/tests/test_event_freshness_anomalies.sql", "original_file_path": "macros/edr/tests/test_event_freshness_anomalies.sql", "unique_id": "macro.elementary.test_event_freshness_anomalies", "macro_sql": "{% test event_freshness_anomalies(model, event_timestamp_column, update_timestamp_column, where_expression, anomaly_sensitivity, anomaly_direction, min_training_set_size, time_bucket, days_back, backfill_days, sensitivity, detection_delay, anomaly_exclude_metrics) %}\n {{ config(tags = ['elementary-tests']) }}\n {% if execute and elementary.is_test_command() and elementary.is_elementary_enabled() %}\n {% set model_relation = elementary.get_model_relation_for_test(model, context[\"model\"]) %}\n {% if not model_relation %}\n {{ exceptions.raise_compiler_error(\"Unsupported model: \" ~ model ~ \" (this might happen if you override 'ref' or 'source')\") }}\n {% endif %}\n\n {%- if not event_timestamp_column -%}\n {%- do exceptions.raise_compiler_error('event_timestamp_column must be specified for the event freshness test!') -%}\n {%- endif -%}\n {%- set event_timestamp_column_data_type = elementary.find_normalized_data_type_for_column(model_relation, event_timestamp_column) -%}\n {%- if not elementary.is_column_timestamp(model_relation, event_timestamp_column, event_timestamp_column_data_type) -%}\n {% do exceptions.raise_compiler_error(\"Column `{}` is not a timestamp.\".format(event_timestamp_column)) %}\n {%- endif -%}\n {% endif %}\n {{ elementary.test_table_anomalies(\n model=model,\n table_anomalies=[\"event_freshness\"],\n timestamp_column=update_timestamp_column,\n where_expression=where_expression,\n anomaly_sensitivity=anomaly_sensitivity,\n min_training_set_size=min_training_set_size,\n time_bucket=time_bucket,\n days_back=days_back,\n backfill_days=backfill_days,\n event_timestamp_column=event_timestamp_column,\n mandatory_params=['event_timestamp_column'],\n sensitivity=sensitivity,\n detection_delay=detection_delay,\n anomaly_exclude_metrics=anomaly_exclude_metrics\n )\n }}\n{% endtest %}", "depends_on": {"macros": ["macro.elementary.is_test_command", "macro.elementary.is_elementary_enabled", "macro.elementary.get_model_relation_for_test", "macro.elementary.find_normalized_data_type_for_column", "macro.elementary.is_column_timestamp", "macro.elementary.test_table_anomalies"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.9208035, "supported_languages": null}, "macro.elementary.test_column_anomalies": {"name": "test_column_anomalies", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/tests/test_column_anomalies.sql", "original_file_path": "macros/edr/tests/test_column_anomalies.sql", "unique_id": "macro.elementary.test_column_anomalies", "macro_sql": "{% test column_anomalies(model, column_name, column_anomalies, timestamp_column, where_expression, anomaly_sensitivity, anomaly_direction, min_training_set_size, time_bucket, days_back, backfill_days, seasonality, sensitivity,ignore_small_changes, fail_on_zero, detection_delay, anomaly_exclude_metrics, detection_period, training_period) %}\n {{ config(tags = ['elementary-tests']) }}\n {%- if execute and elementary.is_test_command() and elementary.is_elementary_enabled() %}\n {% set model_relation = elementary.get_model_relation_for_test(model, context[\"model\"]) %}\n {% if not model_relation %}\n {{ exceptions.raise_compiler_error(\"Unsupported model: \" ~ model ~ \" (this might happen if you override 'ref' or 'source')\") }}\n {% endif %}\n\n {%- if elementary.is_ephemeral_model(model_relation) %}\n {{ exceptions.raise_compiler_error(\"The test is not supported for ephemeral models, model name: {}\".format(model_relation.identifier)) }}\n {%- endif %}\n\n {% set test_table_name = elementary.get_elementary_test_table_name() %}\n {{ elementary.debug_log('collecting metrics for test: ' ~ test_table_name) }}\n {#- creates temp relation for test metrics -#}\n {% set database_name, schema_name = elementary.get_package_database_and_schema('elementary') %}\n {% set tests_schema_name = elementary.get_elementary_tests_schema(database_name, schema_name) %}\n\n {#- get table configuration -#}\n {%- set full_table_name = elementary.relation_to_full_name(model_relation) %}\n\n {%- set test_configuration, metric_properties = elementary.get_anomalies_test_configuration(model_relation=model_relation,\n timestamp_column=timestamp_column,\n where_expression=where_expression,\n anomaly_sensitivity=anomaly_sensitivity,\n anomaly_direction=anomaly_direction,\n min_training_set_size=min_training_set_size,\n time_bucket=time_bucket,\n days_back=days_back,\n backfill_days=backfill_days,\n seasonality=seasonality,\n ignore_small_changes=ignore_small_changes,\n sensitivity=sensitivity,\n fail_on_zero=fail_on_zero,\n detection_delay=detection_delay,\n anomaly_exclude_metrics=anomaly_exclude_metrics,\n detection_period=detection_period,\n training_period=training_period) %}\n\n {%- if not test_configuration %}\n {{ exceptions.raise_compiler_error(\"Failed to create test configuration dict for test `{}`\".format(test_table_name)) }}\n {%- endif %}\n {{ elementary.debug_log('test configuration - ' ~ test_configuration) }}\n\n {%- set column_obj_and_monitors = elementary.get_column_obj_and_monitors(model_relation, column_name, column_anomalies) -%}\n {%- if not column_obj_and_monitors -%}\n {{ exceptions.raise_compiler_error(\"Unable to find column `{}` in `{}`\".format(column_name, full_table_name)) }}\n {%- endif -%}\n {%- set column_monitors = column_obj_and_monitors['monitors'] -%}\n {%- set column_obj = column_obj_and_monitors['column'] -%}\n {{ elementary.debug_log('column_monitors - ' ~ column_monitors) }}\n\n {% if test_configuration.timestamp_column %}\n {%- set min_bucket_start, max_bucket_end = elementary.get_test_buckets_min_and_max(model_relation=model_relation,\n backfill_days=test_configuration.backfill_days,\n days_back=test_configuration.days_back,\n detection_delay=test_configuration.detection_delay,\n monitors=column_monitors,\n column_name=column_name,\n metric_properties=metric_properties) %}\n {%- endif %}\n {{ elementary.debug_log('min_bucket_start - ' ~ min_bucket_start) }}\n {#- execute table monitors and write to temp test table -#}\n {{ elementary.test_log('start', full_table_name, column_name) }}\n {%- set column_monitoring_query = elementary.column_monitoring_query(model,\n model_relation,\n min_bucket_start,\n max_bucket_end,\n test_configuration.days_back,\n column_obj,\n column_monitors,\n metric_properties) %}\n {{ elementary.debug_log('column_monitoring_query - \\n' ~ column_monitoring_query) }}\n {% set temp_table_relation = elementary.create_elementary_test_table(database_name, tests_schema_name, test_table_name, 'metrics', column_monitoring_query) %}\n\n {#- calculate anomaly scores for metrics -#}\n {%- set temp_table_name = elementary.relation_to_full_name(temp_table_relation) %}\n {% set anomaly_scores_query = elementary.get_anomaly_scores_query(test_metrics_table_relation=temp_table_relation,\n model_relation=model_relation,\n test_configuration=test_configuration,\n monitors=column_monitors,\n column_name=column_name,\n metric_properties=metric_properties\n ) %}\n\n {{ elementary.debug_log('anomaly_score_query - \\n' ~ anomaly_scores_query) }}\n {% set anomaly_scores_test_table_relation = elementary.create_elementary_test_table(database_name, tests_schema_name, test_table_name, 'anomaly_scores', anomaly_scores_query) %}\n {{ elementary.test_log('end', full_table_name, column_name) }}\n\n {{ elementary.get_read_anomaly_scores_query() }}\n\n {%- else %}\n\n {#- test must run an sql query -#}\n {{ elementary.no_results_query() }}\n\n {%- endif %}\n{% endtest %}", "depends_on": {"macros": ["macro.elementary.is_test_command", "macro.elementary.is_elementary_enabled", "macro.elementary.get_model_relation_for_test", "macro.elementary.is_ephemeral_model", "macro.elementary.get_elementary_test_table_name", "macro.elementary.debug_log", "macro.elementary.get_package_database_and_schema", "macro.elementary.get_elementary_tests_schema", "macro.elementary.relation_to_full_name", "macro.elementary.get_anomalies_test_configuration", "macro.elementary.get_column_obj_and_monitors", "macro.elementary.get_test_buckets_min_and_max", "macro.elementary.test_log", "macro.elementary.column_monitoring_query", "macro.elementary.create_elementary_test_table", "macro.elementary.get_anomaly_scores_query", "macro.elementary.get_read_anomaly_scores_query", "macro.elementary.no_results_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.9317067, "supported_languages": null}, "macro.elementary.test_table_anomalies": {"name": "test_table_anomalies", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/tests/test_table_anomalies.sql", "original_file_path": "macros/edr/tests/test_table_anomalies.sql", "unique_id": "macro.elementary.test_table_anomalies", "macro_sql": "{% test table_anomalies(model, table_anomalies, timestamp_column, where_expression, anomaly_sensitivity, anomaly_direction, min_training_set_size, time_bucket, days_back, backfill_days, seasonality, mandatory_params=none, event_timestamp_column=none, freshness_column=none, sensitivity=none, ignore_small_changes={\"spike_failure_percent_threshold\": none, \"drop_failure_percent_threshold\": none}, fail_on_zero=false, detection_delay=none, anomaly_exclude_metrics=none, detection_period=none, training_period=none) %}\n {{ config(tags = ['elementary-tests']) }}\n {%- if execute and elementary.is_test_command() and elementary.is_elementary_enabled() %}\n {% set model_relation = elementary.get_model_relation_for_test(model, context[\"model\"]) %}\n {% if not model_relation %}\n {{ exceptions.raise_compiler_error(\"The test has unsupported configuration, please contact Elementary support\") }}\n {% endif %}\n\n {%- if elementary.is_ephemeral_model(model_relation) %}\n {{ exceptions.raise_compiler_error(\"The test is not supported for ephemeral models, model name: {}\".format(model_relation.identifier)) }}\n {%- endif %}\n\n {% set test_table_name = elementary.get_elementary_test_table_name() %}\n {{ elementary.debug_log('collecting metrics for test: ' ~ test_table_name) }}\n {#- creates temp relation for test metrics -#}\n {% set database_name, schema_name = elementary.get_package_database_and_schema('elementary') %}\n {% set tests_schema_name = elementary.get_elementary_tests_schema(database_name, schema_name) %}\n\n {#- get table configuration -#}\n {%- set full_table_name = elementary.relation_to_full_name(model_relation) %}\n\n {% set test_configuration, metric_properties = elementary.get_anomalies_test_configuration(model_relation=model_relation,\n mandatory_params=mandatory_params,\n timestamp_column=timestamp_column,\n where_expression=where_expression,\n anomaly_sensitivity=anomaly_sensitivity,\n anomaly_direction=anomaly_direction,\n min_training_set_size=min_training_set_size,\n time_bucket=time_bucket,\n days_back=days_back,\n backfill_days=backfill_days,\n seasonality=seasonality,\n event_timestamp_column=event_timestamp_column,\n sensitivity=sensitivity,\n ignore_small_changes=ignore_small_changes,\n fail_on_zero=fail_on_zero,\n detection_delay=detection_delay,\n anomaly_exclude_metrics=anomaly_exclude_metrics,\n detection_period=detection_period,\n training_period=training_period) %}\n\n {% if not test_configuration %}\n {{ exceptions.raise_compiler_error(\"Failed to create test configuration dict for test `{}`\".format(test_table_name)) }}\n {% endif %}\n {{ elementary.debug_log('test configuration - ' ~ test_configuration) }}\n {%- set table_monitors = elementary.get_final_table_monitors(table_anomalies) %}\n {{ elementary.debug_log('table_monitors - ' ~ table_monitors) }}\n {% if test_configuration.timestamp_column %}\n {%- set min_bucket_start, max_bucket_end = elementary.get_test_buckets_min_and_max(model_relation=model_relation,\n backfill_days=test_configuration.backfill_days,\n days_back=test_configuration.days_back,\n detection_delay=test_configuration.detection_delay,\n monitors=table_monitors,\n metric_properties=metric_properties) %}\n {%- endif %}\n {{ elementary.debug_log('min_bucket_start: ' ~ min_bucket_start ~ ' | max_bucket_end: ' ~ max_bucket_end ) }}\n\n {#- execute table monitors and write to temp test table -#}\n {{ elementary.test_log('start', full_table_name) }}\n {%- set table_monitoring_query = elementary.table_monitoring_query(model,\n model_relation,\n min_bucket_start,\n max_bucket_end,\n table_monitors,\n metric_properties=metric_properties) %}\n {{ elementary.debug_log('table_monitoring_query - \\n' ~ table_monitoring_query) }}\n {% set temp_table_relation = elementary.create_elementary_test_table(database_name, tests_schema_name, test_table_name, 'metrics', table_monitoring_query) %}\n\n {#- calculate anomaly scores for metrics -#}\n {% set anomaly_scores_query = elementary.get_anomaly_scores_query(temp_table_relation,\n model_relation,\n test_configuration=test_configuration,\n metric_properties=metric_properties,\n monitors=table_monitors) %}\n {{ elementary.debug_log('table monitors anomaly scores query - \\n' ~ anomaly_scores_query) }}\n \n {% set anomaly_scores_test_table_relation = elementary.create_elementary_test_table(database_name, tests_schema_name, test_table_name, 'anomaly_scores', anomaly_scores_query) %}\n {{ elementary.test_log('end', full_table_name) }}\n {{ elementary.get_read_anomaly_scores_query() }}\n {% else %}\n\n {# test must run an sql query #}\n {{ elementary.no_results_query() }}\n\n {% endif %}\n\n{% endtest %}", "depends_on": {"macros": ["macro.elementary.is_test_command", "macro.elementary.is_elementary_enabled", "macro.elementary.get_model_relation_for_test", "macro.elementary.is_ephemeral_model", "macro.elementary.get_elementary_test_table_name", "macro.elementary.debug_log", "macro.elementary.get_package_database_and_schema", "macro.elementary.get_elementary_tests_schema", "macro.elementary.relation_to_full_name", "macro.elementary.get_anomalies_test_configuration", "macro.elementary.get_final_table_monitors", "macro.elementary.get_test_buckets_min_and_max", "macro.elementary.test_log", "macro.elementary.table_monitoring_query", "macro.elementary.create_elementary_test_table", "macro.elementary.get_anomaly_scores_query", "macro.elementary.get_read_anomaly_scores_query", "macro.elementary.no_results_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.9411776, "supported_languages": null}, "macro.elementary.test_json_schema": {"name": "test_json_schema", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/tests/test_json_schema.sql", "original_file_path": "macros/edr/tests/test_json_schema.sql", "unique_id": "macro.elementary.test_json_schema", "macro_sql": "{% test json_schema(model, column_name, where_expression) %}\n {{ config(fail_calc = 'fail_count', tags=['elementary-tests']) }}\n\n {% if not execute or not elementary.is_test_command() or not elementary.is_elementary_enabled() %}\n {% do return(none) %}\n {% endif %}\n\n {% if model is string %}\n {{ exceptions.raise_compiler_error(\"Unsupported model: \" ~ model ~ \" (this might happen if you provide a 'where' parameter to the test or override 'ref' or 'source')\") }}\n {% endif %}\n\n {% if not elementary.column_exists_in_relation(model, column_name) %}\n {% do exceptions.raise_compiler_error(\"Column '{}' does not exist in node '{}'!\".format(column_name, model.name)) %}\n {% endif %}\n {% if not kwargs %}\n {% do exceptions.raise_compiler_error(\"A json schema must be supplied as a part of the test!\") %}\n {% endif %}\n\n {{ elementary.test_python(model, elementary.json_schema_python_test, {'column_name': column_name, 'json_schema': kwargs}, where_expression,\n packages=['jsonschema']) }}\n{% endtest %}", "depends_on": {"macros": ["macro.elementary.is_test_command", "macro.elementary.is_elementary_enabled", "macro.elementary.column_exists_in_relation", "macro.elementary.test_python"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.9440968, "supported_languages": null}, "macro.elementary.json_schema_python_test": {"name": "json_schema_python_test", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/tests/test_json_schema.sql", "original_file_path": "macros/edr/tests/test_json_schema.sql", "unique_id": "macro.elementary.json_schema_python_test", "macro_sql": "{% macro json_schema_python_test(args) %}\nimport json\nimport jsonschema\n\ndef is_valid_json(val, json_schema):\n try:\n jsonschema.validate(json.loads(val), json_schema)\n return True\n except (json.JSONDecodeError, jsonschema.ValidationError):\n return False\n\ndef get_column_name_in_df(df, column_name):\n matching = [col for col in df.columns if col.lower() == column_name.lower()]\n if len(matching) > 1:\n # Case matters, switch to case-sensitive match\n matching = [col for col in df.columns if col == column_name]\n\n if len(matching) == 0:\n raise Exception(\"No column with the name: {}\".format(col))\n return matching[0]\n\ndef test(model_df, ref, session):\n raw_json_schema = r\"\"\"{{ args.json_schema if args.json_schema is string else tojson(args.json_schema) }}\"\"\"\n json_schema = json.loads(raw_json_schema)\n\n model_df = model_df.toPandas()\n column_name = get_column_name_in_df(model_df, \"{{ args.column_name }}\")\n model_df[\"is_valid_json\"] = model_df[column_name].apply(lambda val: is_valid_json(val, json_schema))\n\n return model_df[model_df.is_valid_json == False]\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.9445705, "supported_languages": null}, "macro.elementary.test_freshness_anomalies": {"name": "test_freshness_anomalies", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/tests/test_freshness_anomalies.sql", "original_file_path": "macros/edr/tests/test_freshness_anomalies.sql", "unique_id": "macro.elementary.test_freshness_anomalies", "macro_sql": "{% test freshness_anomalies(model, timestamp_column, where_expression, anomaly_sensitivity, anomaly_direction, min_training_set_size, time_bucket, days_back, backfill_days, seasonality, sensitivity, detection_delay, anomaly_exclude_metrics, detection_period, training_period) %}\n {{ config(tags = ['elementary-tests']) }}\n {{ elementary.test_table_anomalies(\n model=model,\n table_anomalies=[\"freshness\"],\n freshness_column=none,\n timestamp_column=timestamp_column,\n where_expression=where_expression,\n anomaly_sensitivity=anomaly_sensitivity,\n min_training_set_size=min_training_set_size,\n time_bucket=time_bucket,\n days_back=days_back,\n backfill_days=backfill_days,\n mandatory_params=['timestamp_column'],\n seasonality=seasonality,\n sensitivity=sensitivity,\n detection_delay=detection_delay,\n anomaly_exclude_metrics=anomaly_exclude_metrics,\n detection_period=detection_period,\n training_period=training_period\n )\n }}\n{% endtest %}", "depends_on": {"macros": ["macro.elementary.test_table_anomalies"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.9459717, "supported_languages": null}, "macro.elementary.test_python": {"name": "test_python", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/tests/python.sql", "original_file_path": "macros/edr/tests/python.sql", "unique_id": "macro.elementary.test_python", "macro_sql": "{% test python(model, code_macro, macro_args, where_expression) %}\n {{ config(fail_calc = 'fail_count', tags = ['elementary-tests']) }}\n\n {% if not execute or not elementary.is_elementary_enabled() %}\n {% do return(none) %}\n {% endif %}\n\n {% if model is string %}\n {{ exceptions.raise_compiler_error(\"Unsupported model: \" ~ model ~ \" (this might happen if you provide a 'where' parameter to the test or override 'ref' or 'source')\") }}\n {% endif %}\n\n {% if not code_macro %}\n {% do exceptions.raise_compiler_error('A `code_macro` must be provided to a Python test.') %}\n {% endif %}\n {% if not macro_args %}\n {% set macro_args = {} %}\n {% endif %}\n\n {% set test_args = kwargs %}\n {% set test_node = context.model %}\n {% set model_relation = model.quote(false, false, false) %}\n {% set elementary_database_name, elementary_schema_name = elementary.get_package_database_and_schema() %}\n {% set output_table = api.Relation.create(database=elementary_database_name, schema=elementary_schema_name,\n identifier='pytest_tmp__' ~ test_node.alias).quote(false, false, false) %}\n\n {# This affects where resources needed for python execution (e.g. stored procedures) are created.\n By default, dbt uses the audit schema (adds _dbt__test_audit to the model's schema).\n We prefer to change this behavior and use Elementary's database and schema instead (this also guarantees the test\n will work for sources).\n #}\n {% do test_node.update({'database': elementary_database_name, 'schema': elementary_schema_name}) %}\n\n {% do test_node.config.update(test_args) %}\n\n {% if code_macro is string %}\n {% set user_py_code_macro = context[code_macro] %}\n {% else %}\n {% set user_py_code_macro = code_macro %}\n {% endif %}\n\n {% if not user_py_code_macro %}\n {% do exceptions.raise_compiler_error('Unable to find the macro `' ~ code_macro ~ '`.') %}\n {% endif %}\n {% set user_py_code = user_py_code_macro(macro_args) %}\n {% set compiled_py_code = adapter.dispatch('compile_py_code', 'elementary')(model_relation, user_py_code,\n output_table, where_expression, code_type='test') %}\n\n {% do elementary.run_python(test_node, compiled_py_code) %}\n select fail_count from {{ output_table }}\n{% endtest %}", "depends_on": {"macros": ["macro.elementary.is_elementary_enabled", "macro.elementary.get_package_database_and_schema", "macro.elementary.default__compile_py_code", "macro.elementary.run_python"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.950464, "supported_languages": null}, "macro.elementary.test_exposure_schema_validity": {"name": "test_exposure_schema_validity", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/tests/test_exposure_schema_validity.sql", "original_file_path": "macros/edr/tests/test_exposure_schema_validity.sql", "unique_id": "macro.elementary.test_exposure_schema_validity", "macro_sql": "{% test exposure_schema_validity(model, exposures, node, columns) %}\n {{ config(tags = ['elementary-tests']) }}\n {%- if not execute or not elementary.is_test_command() or not elementary.is_elementary_enabled() -%}\n {%- do return(none) -%}\n {%- endif -%}\n\n {%- if dbt_version <= '1.3.0' -%}\n {# attached_node is only available on newer dbt versions #}\n {%- set base_node = context['model']['depends_on']['nodes'][0] -%}\n {%- else -%}\n {%- set base_node = context['model']['attached_node'] -%}\n {%- endif -%}\n\n {# Parameters used only for dependency injection in integration tests #}\n {%- set node = node or base_node -%}\n {%- set exposures = (exposures or graph.exposures).values() -%}\n {%- set columns = columns or adapter.get_columns_in_relation(model) -%}\n\n {%- set model_relation = elementary.get_model_relation_for_test(model, context[\"model\"]) -%}\n {%- set full_table_name = elementary.relation_to_full_name(model_relation) -%}\n {{- elementary.test_log('start', full_table_name, 'exposure validation') -}}\n\n {%- set matching_exposures = [] -%}\n\n {%- for exposure in exposures -%}\n {#\n\n We need the 'meta' property to be defined in the exposure, since column level info is not available on exposures.\n The 'meta' property needs to have a 'referenced_columns' array (see properties in the next comment)\n\n #}\n {%- if node in exposure.depends_on.nodes and (exposure['meta'] or none) is not none -%}\n {%- do matching_exposures.append(exposure) -%}\n {%- endif -%}\n {%- endfor -%}\n {%- if matching_exposures | length > 0 -%}\n {%- set columns_dict = {} -%}\n {%- for column in columns -%}\n {%- do columns_dict.update({ column['name'].strip('\"').strip(\"'\") | upper : elementary.normalize_data_type(elementary.get_column_data_type(column)) }) -%}\n {%- endfor -%}\n {%- set invalid_exposures = [] -%}\n {%- for exposure in matching_exposures -%}\n {%- set meta = exposure['meta'] or none -%}\n {%- if meta != none and (meta['referenced_columns'] or none) is iterable -%}\n {%- for exposure_column in meta['referenced_columns'] -%}\n {#\n Each column in 'referenced_columns' has the following property:\n\n 'column_name'\n\n Optionally, you can specify the following properties:\n\n 'data_type' - the specific data type of the column\n\n 'node' - the ref to the source node of the specific column used in the exposure\n\n #}\n {%- if matching_exposures | length > 1 and 'node' not in exposure_column -%}\n {%- do elementary.edr_log_warning(\"missing node property for the exposure: \" ~ exposure['name'] ~ \" which not the only exposure depending on \" ~ model ~ \", We're not able to verify the column level dependencies of this exposure\") -%}\n {%- elif matching_exposures | length == 1 or (context['render'](elementary.get_rendered_ref((exposure_column['node'] or ''))) == context['render'](model | lower)) -%}\n {%- if exposure_column['column_name'] | upper not in columns_dict.keys() -%}\n {%- do invalid_exposures.append({\n 'exposure': exposure['name'],\n 'url': exposure['url'],\n 'error': exposure_column['column_name'] ~ ' column missing in the model'\n })\n -%}\n {%- elif (exposure_column['data_type'] or '') != '' and exposure_column['data_type'] != columns_dict[exposure_column['column_name'] | upper] -%}\n {%- do invalid_exposures.append({\n 'exposure': exposure['name'],\n 'url': exposure['url'],\n 'error': 'different data type for the column ' ~ exposure_column['column_name'] ~ ' ' ~ exposure_column['data_type'] ~ ' vs ' ~ columns_dict[exposure_column['name'] | upper]\n })\n -%}\n {%- endif -%}\n {%- endif -%}\n {%- endfor -%}\n {%- else -%}\n {%- do elementary.edr_log_warning(\"missing meta property for the exposure: \" ~ exposure['name'] ~ \", We're not able to verify the column level dependencies of this exposure\") -%}\n {%- endif -%}\n {%- endfor -%}\n {%- if invalid_exposures | length > 0 -%}\n {%- for invalid_exposure in invalid_exposures %}\n {{ 'UNION ALL ' if not loop.first }}SELECT '{{ invalid_exposure['exposure'] }}' as exposure, '{{ invalid_exposure['url'] }}' as url, '{{ invalid_exposure['error'] }}' as error\n {%- endfor -%}\n {%- else -%}\n {{ elementary.no_results_query() }}\n {%- endif -%}\n {%- else -%}\n {{ elementary.no_results_query() }}\n\n {%- endif -%}\n {{ elementary.test_log('end', full_table_name, 'exposure validation') }}\n{% endtest %}", "depends_on": {"macros": ["macro.elementary.is_test_command", "macro.elementary.is_elementary_enabled", "macro.elementary.get_model_relation_for_test", "macro.elementary.relation_to_full_name", "macro.elementary.test_log", "macro.elementary.normalize_data_type", "macro.elementary.get_column_data_type", "macro.elementary.edr_log_warning", "macro.elementary.get_rendered_ref", "macro.elementary.no_results_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.9594667, "supported_languages": null}, "macro.elementary.test_schema_changes": {"name": "test_schema_changes", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/tests/test_schema_changes.sql", "original_file_path": "macros/edr/tests/test_schema_changes.sql", "unique_id": "macro.elementary.test_schema_changes", "macro_sql": "{% test schema_changes(model) %}\n {{ config(tags = ['elementary-tests']) }}\n {%- if execute and elementary.is_test_command() and elementary.is_elementary_enabled() %}\n {% set model_relation = elementary.get_model_relation_for_test(model, context[\"model\"]) %}\n {% if not model_relation %}\n {{ exceptions.raise_compiler_error(\"Unsupported model: \" ~ model ~ \" (this might happen if you override 'ref' or 'source')\") }}\n {% endif %}\n\n {%- if elementary.is_ephemeral_model(model_relation) %}\n {{ exceptions.raise_compiler_error(\"The test is not supported for ephemeral models, model name: {}\".format(model_relation.identifier)) }}\n {%- endif %}\n {% set test_table_name = elementary.get_elementary_test_table_name() %}\n {{ elementary.debug_log('collecting metrics for test: ' ~ test_table_name) }}\n {# creates temp relation for schema columns info #}\n {% set database_name, schema_name = elementary.get_package_database_and_schema('elementary') %}\n {% set tests_schema_name = elementary.get_elementary_tests_schema(database_name, schema_name) %}\n\n {#- get table configuration -#}\n {%- set full_table_name = elementary.relation_to_full_name(model_relation) %}\n\n {#- query current schema and write to temp test table -#}\n {{ elementary.edr_log('Started testing schema changes on:' ~ full_table_name) }}\n {%- set column_snapshot_query = elementary.get_columns_snapshot_query(model_relation, full_table_name) %}\n {{ elementary.debug_log('column_snapshot_query - \\n' ~ column_snapshot_query) }}\n\n {% set temp_table_relation = elementary.create_elementary_test_table(database_name, tests_schema_name, test_table_name, 'schema_changes', column_snapshot_query) %}\n\n {# query if there were schema changes since last execution #}\n {% set schema_changes_alert_query = elementary.get_columns_changes_from_last_run_query(full_table_name, temp_table_relation) %}\n {{ elementary.debug_log('schema_changes_alert_query - \\n' ~ schema_changes_alert_query) }}\n {% set alerts_temp_table_relation = elementary.create_elementary_test_table(database_name, tests_schema_name, test_table_name, 'schema_changes_alerts', schema_changes_alert_query) %}\n {# return schema changes query as standard test query #}\n select * from {{ alerts_temp_table_relation }}\n\n {% else %}\n\n {# test must run an sql query #}\n {{ elementary.no_results_query() }}\n\n {% endif %}\n\n{% endtest %}", "depends_on": {"macros": ["macro.elementary.is_test_command", "macro.elementary.is_elementary_enabled", "macro.elementary.get_model_relation_for_test", "macro.elementary.is_ephemeral_model", "macro.elementary.get_elementary_test_table_name", "macro.elementary.debug_log", "macro.elementary.get_package_database_and_schema", "macro.elementary.get_elementary_tests_schema", "macro.elementary.relation_to_full_name", "macro.elementary.edr_log", "macro.elementary.get_columns_snapshot_query", "macro.elementary.create_elementary_test_table", "macro.elementary.get_columns_changes_from_last_run_query", "macro.elementary.no_results_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.9630797, "supported_languages": null}, "macro.elementary.test_dimension_anomalies": {"name": "test_dimension_anomalies", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/tests/test_dimension_anomalies.sql", "original_file_path": "macros/edr/tests/test_dimension_anomalies.sql", "unique_id": "macro.elementary.test_dimension_anomalies", "macro_sql": "{% test dimension_anomalies(model, dimensions, timestamp_column, where_expression, anomaly_sensitivity, anomaly_direction, min_training_set_size, time_bucket, days_back, backfill_days, seasonality, sensitivity,ignore_small_changes, fail_on_zero, detection_delay, anomaly_exclude_metrics, detection_period, training_period) %}\n {{ config(tags = ['elementary-tests']) }}\n {%- if execute and elementary.is_test_command() and elementary.is_elementary_enabled() %}\n {% set model_relation = elementary.get_model_relation_for_test(model, context[\"model\"]) %}\n {% if not model_relation %}\n {{ exceptions.raise_compiler_error(\"Unsupported model: \" ~ model ~ \" (this might happen if you override 'ref' or 'source')\") }}\n {% endif %}\n\n {%- if elementary.is_ephemeral_model(model_relation) %}\n {{ exceptions.raise_compiler_error(\"The test is not supported for ephemeral models, model name: {}\".format(model_relation.identifier)) }}\n {%- endif %}\n {%- set mandatory_params = ['dimensions'] %}\n\n {% set test_table_name = elementary.get_elementary_test_table_name() %}\n {{ elementary.debug_log('collecting metrics for test: ' ~ test_table_name) }}\n {#- creates temp relation for test metrics -#}\n {% set database_name, schema_name = elementary.get_package_database_and_schema('elementary') %}\n {% set tests_schema_name = elementary.get_elementary_tests_schema(database_name, schema_name) %}\n\n {#- get table configuration -#}\n {%- set full_table_name = elementary.relation_to_full_name(model_relation) %}\n\n {%- set test_configuration, metric_properties = elementary.get_anomalies_test_configuration(model_relation=model_relation,\n mandatory_params=mandatory_params,\n timestamp_column=timestamp_column,\n where_expression=where_expression,\n anomaly_sensitivity=anomaly_sensitivity,\n anomaly_direction=anomaly_direction,\n min_training_set_size=min_training_set_size,\n time_bucket=time_bucket,\n days_back=days_back,\n backfill_days=backfill_days,\n seasonality=seasonality,\n dimensions=dimensions,\n sensitivity=sensitivity,\n ignore_small_changes=ignore_small_changes,\n fail_on_zero=fail_on_zero,\n detection_delay=detection_delay,\n anomaly_exclude_metrics=anomaly_exclude_metrics,\n detection_period=detection_period,\n training_period=training_period) %}\n \n {%- if not test_configuration %}\n {{ exceptions.raise_compiler_error(\"Failed to create test configuration dict for test `{}`\".format(test_table_name)) }}\n {%- endif %}\n {{ elementary.debug_log('test configuration - ' ~ test_configuration) }}\n\n {%- set min_bucket_start, max_bucket_end = elementary.get_test_buckets_min_and_max(model_relation=model_relation,\n backfill_days=test_configuration.backfill_days,\n days_back=test_configuration.days_back,\n detection_delay=test_configuration.detection_delay,\n metric_properties=metric_properties) %}\n\n {{ elementary.debug_log('min_bucket_start - ' ~ min_bucket_start) }}\n {#- execute table monitors and write to temp test table -#}\n {{ elementary.test_log('start', full_table_name) }}\n\n {%- set dimension_monitoring_query = elementary.dimension_monitoring_query(model, model_relation, metric_properties.dimensions, min_bucket_start, max_bucket_end, test_configuration, metric_properties) %}\n {{ elementary.debug_log('dimension_monitoring_query - \\n' ~ dimension_monitoring_query) }}\n\n {% set temp_table_relation = elementary.create_elementary_test_table(database_name, tests_schema_name, test_table_name, 'metrics', dimension_monitoring_query) %}\n\n {#- calculate anomaly scores for metrics -#}\n {% set anomaly_scores_query = elementary.get_anomaly_scores_query(test_metrics_table_relation=temp_table_relation,\n model_relation=model_relation,\n test_configuration=test_configuration,\n monitors=['dimension'],\n metric_properties=metric_properties) %}\n\n {{ elementary.debug_log('dimension monitors anomaly scores query - \\n' ~ anomaly_scores_query) }}\n {% set anomaly_scores_test_table_relation = elementary.create_elementary_test_table(database_name, tests_schema_name, test_table_name, 'anomaly_scores', anomaly_scores_query) %}\n {{ elementary.test_log('end', full_table_name) }}\n\n {{ elementary.get_anomaly_query() }}\n\n {% else %}\n\n {# test must run an sql query #}\n {{ elementary.no_results_query() }}\n\n {% endif %}\n\n{% endtest %}", "depends_on": {"macros": ["macro.elementary.is_test_command", "macro.elementary.is_elementary_enabled", "macro.elementary.get_model_relation_for_test", "macro.elementary.is_ephemeral_model", "macro.elementary.get_elementary_test_table_name", "macro.elementary.debug_log", "macro.elementary.get_package_database_and_schema", "macro.elementary.get_elementary_tests_schema", "macro.elementary.relation_to_full_name", "macro.elementary.get_anomalies_test_configuration", "macro.elementary.get_test_buckets_min_and_max", "macro.elementary.test_log", "macro.elementary.dimension_monitoring_query", "macro.elementary.create_elementary_test_table", "macro.elementary.get_anomaly_scores_query", "macro.elementary.get_anomaly_query", "macro.elementary.no_results_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.970659, "supported_languages": null}, "macro.elementary.test_all_columns_anomalies": {"name": "test_all_columns_anomalies", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/tests/test_all_columns_anomalies.sql", "original_file_path": "macros/edr/tests/test_all_columns_anomalies.sql", "unique_id": "macro.elementary.test_all_columns_anomalies", "macro_sql": "{% test all_columns_anomalies(model, column_anomalies, exclude_prefix, exclude_regexp, timestamp_column, where_expression, anomaly_sensitivity, anomaly_direction, min_training_set_size, time_bucket, days_back, backfill_days, seasonality, sensitivity,ignore_small_changes, fail_on_zero, detection_delay, anomaly_exclude_metrics, detection_period, training_period) %}\n {{ config(tags = ['elementary-tests']) }}\n {%- if execute and elementary.is_test_command() and elementary.is_elementary_enabled() %}\n {% set model_relation = elementary.get_model_relation_for_test(model, context[\"model\"]) %}\n {% if not model_relation %}\n {{ exceptions.raise_compiler_error(\"Unsupported model: \" ~ model ~ \" (this might happen if you override 'ref' or 'source')\") }}\n {% endif %}\n\n {%- if elementary.is_ephemeral_model(model_relation) %}\n {{ exceptions.raise_compiler_error(\"The test is not supported for ephemeral models, model name: {}\".format(model_relation.identifier)) }}\n {%- endif %}\n\n {%- set test_table_name = elementary.get_elementary_test_table_name() %}\n {{- elementary.debug_log('collecting metrics for test: ' ~ test_table_name) }}\n {#- creates temp relation for test metrics -#}\n {%- set database_name, schema_name = elementary.get_package_database_and_schema('elementary') %}\n {% set tests_schema_name = elementary.get_elementary_tests_schema(database_name, schema_name) %}\n {%- set empty_table_query = elementary.empty_data_monitoring_metrics(with_created_at=false) %}\n {% set temp_table_relation = elementary.create_elementary_test_table(database_name, tests_schema_name, test_table_name, 'metrics', empty_table_query) %}\n\n {#- get table configuration -#}\n {%- set full_table_name = elementary.relation_to_full_name(model_relation) %}\n\n {%- set test_configuration, metric_properties = elementary.get_anomalies_test_configuration(model_relation=model_relation,\n timestamp_column=timestamp_column,\n where_expression=where_expression,\n anomaly_sensitivity=anomaly_sensitivity,\n anomaly_direction=anomaly_direction,\n min_training_set_size=min_training_set_size,\n time_bucket=time_bucket,\n days_back=days_back,\n backfill_days=backfill_days,\n seasonality=seasonality,\n sensitivity=sensitivity,\n ignore_small_changes=ignore_small_changes,\n fail_on_zero=fail_on_zero,\n detection_delay=detection_delay,\n anomaly_exclude_metrics=anomaly_exclude_metrics,\n detection_period=detection_period,\n training_period=training_period) %}\n\n {%- if not test_configuration %}\n {{ exceptions.raise_compiler_error(\"Failed to create test configuration dict for test `{}`\".format(test_table_name)) }}\n {%- endif %}\n {{ elementary.debug_log('test configuration - ' ~ test_configuration) }}\n\n {%- set column_objs_and_monitors = elementary.get_all_column_obj_and_monitors(model_relation, column_anomalies) -%}\n {#- execute table monitors and write to temp test table -#}\n {%- set monitors = [] %}\n {%- if column_objs_and_monitors | length > 0 %}\n {{- elementary.test_log('start', full_table_name, 'all columns') }}\n {%- for column_obj_and_monitors in column_objs_and_monitors %}\n {%- set column_obj = column_obj_and_monitors['column'] %}\n {%- set column_monitors = column_obj_and_monitors['monitors'] %}\n {%- set column_name = column_obj.name -%}\n {%- set ignore_column = elementary.should_ignore_column(column_name, exclude_regexp, exclude_prefix) -%}\n {%- if not ignore_column -%}\n {%- do monitors.extend(column_monitors) -%}\n {% if test_configuration.timestamp_column %}\n {%- set min_bucket_start, max_bucket_end = elementary.get_test_buckets_min_and_max(model_relation=model_relation,\n backfill_days=test_configuration.backfill_days,\n days_back=test_configuration.days_back,\n detection_delay=test_configuration.detection_delay,\n monitors=column_monitors,\n column_name=column_name,\n metric_properties=metric_properties) %}\n {%- endif %}\n {{ elementary.debug_log('min_bucket_start - ' ~ min_bucket_start) }}\n {{ elementary.test_log('start', full_table_name, column_name) }}\n {%- set column_monitoring_query = elementary.column_monitoring_query(model, model_relation, min_bucket_start, max_bucket_end, test_configuration.days_back, column_obj, column_monitors, metric_properties) %}\n {%- do elementary.run_query(elementary.insert_as_select(temp_table_relation, column_monitoring_query)) -%}\n {%- else -%}\n {{ elementary.debug_log('column ' ~ column_name ~ ' is excluded') }}\n {%- endif -%}\n {%- endfor %}\n {%- endif %}\n {%- set all_columns_monitors = monitors | unique | list %}\n {#- query if there is an anomaly in recent metrics -#}\n {%- set anomaly_scores_query = elementary.get_anomaly_scores_query(test_metrics_table_relation=temp_table_relation,\n model_relation=model_relation,\n test_configuration=test_configuration,\n monitors=all_columns_monitors,\n columns_only=true,\n metric_properties=metric_properties) %}\n\n {% set anomaly_scores_test_table_relation = elementary.create_elementary_test_table(database_name, tests_schema_name, test_table_name, 'anomaly_scores', anomaly_scores_query) %}\n\n {{- elementary.test_log('end', full_table_name, 'all columns') }}\n\n {{ elementary.get_read_anomaly_scores_query() }}\n\n {%- else %}\n\n {#- test must run an sql query -#}\n {{- elementary.no_results_query() }}\n\n {%- endif %}\n{% endtest %}", "depends_on": {"macros": ["macro.elementary.is_test_command", "macro.elementary.is_elementary_enabled", "macro.elementary.get_model_relation_for_test", "macro.elementary.is_ephemeral_model", "macro.elementary.get_elementary_test_table_name", "macro.elementary.debug_log", "macro.elementary.get_package_database_and_schema", "macro.elementary.get_elementary_tests_schema", "macro.elementary.empty_data_monitoring_metrics", "macro.elementary.create_elementary_test_table", "macro.elementary.relation_to_full_name", "macro.elementary.get_anomalies_test_configuration", "macro.elementary.get_all_column_obj_and_monitors", "macro.elementary.test_log", "macro.elementary.should_ignore_column", "macro.elementary.get_test_buckets_min_and_max", "macro.elementary.column_monitoring_query", "macro.elementary.run_query", "macro.elementary.insert_as_select", "macro.elementary.get_anomaly_scores_query", "macro.elementary.get_read_anomaly_scores_query", "macro.elementary.no_results_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.982333, "supported_languages": null}, "macro.elementary.should_ignore_column": {"name": "should_ignore_column", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/tests/test_all_columns_anomalies.sql", "original_file_path": "macros/edr/tests/test_all_columns_anomalies.sql", "unique_id": "macro.elementary.should_ignore_column", "macro_sql": "\n\n{%- macro should_ignore_column(column_name, exclude_regexp, exclude_prefix) -%}\n {%- set regex_module = modules.re -%}\n {%- if exclude_regexp -%}\n {%- set is_match = regex_module.match(exclude_regexp, column_name, regex_module.IGNORECASE) %}\n {%- if is_match -%}\n {{ return(True) }}\n {%- endif -%}\n {%- endif -%}\n {% if exclude_prefix %}\n {%- set exclude_regexp = '^' ~ exclude_prefix ~ '.*' %}\n {%- set is_match = regex_module.match(exclude_regexp, column_name, regex_module.IGNORECASE) %}\n {%- if is_match -%}\n {{ return(True) }}\n {%- endif -%}\n {%- endif -%}\n {{ return(False) }}\n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.9835398, "supported_languages": null}, "macro.elementary.test_schema_changes_from_baseline": {"name": "test_schema_changes_from_baseline", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/tests/test_schema_changes_from_baseline.sql", "original_file_path": "macros/edr/tests/test_schema_changes_from_baseline.sql", "unique_id": "macro.elementary.test_schema_changes_from_baseline", "macro_sql": "{% test schema_changes_from_baseline(model, fail_on_added=False, enforce_types=False) %}\n {{ config(tags = ['elementary-tests']) }}\n {%- if execute and elementary.is_test_command() and elementary.is_elementary_enabled() %}\n {% set model_relation = elementary.get_model_relation_for_test(model, context[\"model\"]) %}\n {% if not model_relation %}\n {{ exceptions.raise_compiler_error(\"Unsupported model: \" ~ model ~ \" (this might happen if you override 'ref' or 'source)\") }}\n {% endif %}\n\n {%- if elementary.is_ephemeral_model(model_relation) %}\n {{ exceptions.raise_compiler_error(\"The test is not supported for ephemeral models, model name: {}\".format(model_relation.identifier)) }}\n {%- endif %}\n\n {% set test_table_name = elementary.get_elementary_test_table_name() %}\n {% set database_name, schema_name = elementary.get_package_database_and_schema('elementary') %}\n {% set tests_schema_name = elementary.get_elementary_tests_schema(database_name, schema_name) %}\n\n {# Get baseline and store it in a table #}\n {% set baseline_columns = elementary.get_model_baseline_columns(model_relation, enforce_types=enforce_types) %}\n {% set baseline_table_relation = elementary.create_model_baseline_table(baseline_columns, database_name, schema_name, test_table_name) %}\n\n {% set full_table_name = elementary.relation_to_full_name(model_relation) %}\n {% set changes_from_baseline_query = elementary.get_column_changes_from_baseline_query(model_relation, full_table_name, baseline_table_relation, include_added=fail_on_added) %}\n {{ changes_from_baseline_query }}\n {% else %}\n {# test must run an sql query #}\n {{ elementary.no_results_query() }}\n {% endif %}\n{% endtest %}", "depends_on": {"macros": ["macro.elementary.is_test_command", "macro.elementary.is_elementary_enabled", "macro.elementary.get_model_relation_for_test", "macro.elementary.is_ephemeral_model", "macro.elementary.get_elementary_test_table_name", "macro.elementary.get_package_database_and_schema", "macro.elementary.get_elementary_tests_schema", "macro.elementary.get_model_baseline_columns", "macro.elementary.create_model_baseline_table", "macro.elementary.relation_to_full_name", "macro.elementary.get_column_changes_from_baseline_query", "macro.elementary.no_results_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.9865093, "supported_languages": null}, "macro.elementary.create_elementary_tests_schema": {"name": "create_elementary_tests_schema", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/tests/on_run_start/create_elementary_tests_schema.sql", "original_file_path": "macros/edr/tests/on_run_start/create_elementary_tests_schema.sql", "unique_id": "macro.elementary.create_elementary_tests_schema", "macro_sql": "{% macro create_elementary_tests_schema() %}\n {% if execute and elementary.is_test_command() %}\n {% set database_name, schema_name = elementary.get_package_database_and_schema('elementary') %}\n {% set tests_schema_name = elementary.get_elementary_tests_schema(database_name, schema_name) %}\n {%- if tests_schema_name != schema_name and not adapter.check_schema_exists(database_name, tests_schema_name) %}\n {{ elementary.edr_log(\"Creating Elementary's tests schema.\") }}\n {% set schema_relation = api.Relation.create(database=database_name, schema=tests_schema_name).without_identifier() %}\n {%- do dbt.create_schema(schema_relation) %}\n {% do adapter.commit() %}\n {%- endif %}\n {% endif %}\n {{ return('') }}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.is_test_command", "macro.elementary.get_package_database_and_schema", "macro.elementary.get_elementary_tests_schema", "macro.elementary.edr_log", "macro.dbt.create_schema"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.9881048, "supported_languages": null}, "macro.elementary.init_elementary_graph": {"name": "init_elementary_graph", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/tests/on_run_start/init_elementary_graph.sql", "original_file_path": "macros/edr/tests/on_run_start/init_elementary_graph.sql", "unique_id": "macro.elementary.init_elementary_graph", "macro_sql": "{% macro init_elementary_graph() %}\n {% do graph.setdefault(\"elementary\", {\n \"elementary_test_results\": {},\n \"elementary_test_failed_row_counts\": {},\n \"tests_schema_name\": none,\n \"tables\": {\n \"metrics\": {\n \"relations\": [],\n \"rows\": []\n },\n \"schema_snapshots\": []\n },\n \"temp_test_table_relations_map\": {},\n }) %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.9889555, "supported_languages": null}, "macro.elementary.recommend_dbt_core_artifacts_upgrade": {"name": "recommend_dbt_core_artifacts_upgrade", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/tests/on_run_start/recommend_dbt_core_artifacts_upgrade.sql", "original_file_path": "macros/edr/tests/on_run_start/recommend_dbt_core_artifacts_upgrade.sql", "unique_id": "macro.elementary.recommend_dbt_core_artifacts_upgrade", "macro_sql": "{% macro recommend_dbt_core_artifacts_upgrade() %}\n {% if elementary.get_config_var(\"mute_dbt_upgrade_recommendation\") %}\n {% do return(none) %}\n {% endif %}\n\n {% set major, minor, revision = dbt_version.split(\".\") %}\n {% set major = major | int %}\n {% set minor = minor | int %}\n {% if major < 1 or major == 1 and minor < 4 %}\n {%- set msg %}\nYou are using dbt version {{ dbt_version }}.\nElementary introduced major performance improvements for dbt version 1.4.0 or later.\nMore information on the performance impact can be found here: https://docs.elementary-data.com/dbt/on-run-end_hooks#performance-impact-of-on-run-end-hooks\nThis message can be muted by setting the 'mute_dbt_upgrade_recommendation' var to true.\n {% endset %}\n {% do log(msg, info=true) %}\n {% endif %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.get_config_var"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.9904773, "supported_languages": null}, "macro.elementary.get_days_back": {"name": "get_days_back", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/tests/test_configuration/get_days_back.sql", "original_file_path": "macros/edr/tests/test_configuration/get_days_back.sql", "unique_id": "macro.elementary.get_days_back", "macro_sql": "{% macro get_days_back(days_back, model_graph_node, seasonality=none) %}\n {% set days_back = elementary.get_test_argument('days_back', days_back, model_graph_node) %}\n {% if seasonality in [\"day_of_week\", \"hour_of_week\"] %}\n {% do return(days_back * 7) %}\n {% endif %}\n {% do return(days_back) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.get_test_argument"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.991314, "supported_languages": null}, "macro.elementary.get_no_detection_delay": {"name": "get_no_detection_delay", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/tests/test_configuration/get_detection_delay.sql", "original_file_path": "macros/edr/tests/test_configuration/get_detection_delay.sql", "unique_id": "macro.elementary.get_no_detection_delay", "macro_sql": "{% macro get_no_detection_delay() %}\n {% do return({\"period\": \"hour\", \"count\": 0}) %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.995, "supported_languages": null}, "macro.elementary.get_default_detection_delay": {"name": "get_default_detection_delay", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/tests/test_configuration/get_detection_delay.sql", "original_file_path": "macros/edr/tests/test_configuration/get_detection_delay.sql", "unique_id": "macro.elementary.get_default_detection_delay", "macro_sql": "{% macro get_default_detection_delay() %}\n {% do return(elementary.get_no_detection_delay()) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.get_no_detection_delay"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.9952593, "supported_languages": null}, "macro.elementary.get_detection_delay_supported_periods": {"name": "get_detection_delay_supported_periods", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/tests/test_configuration/get_detection_delay.sql", "original_file_path": "macros/edr/tests/test_configuration/get_detection_delay.sql", "unique_id": "macro.elementary.get_detection_delay_supported_periods", "macro_sql": "{% macro get_detection_delay_supported_periods() %}\n {% do return([\"hour\", \"day\", \"week\"]) %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.9955513, "supported_languages": null}, "macro.elementary.get_detection_delay": {"name": "get_detection_delay", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/tests/test_configuration/get_detection_delay.sql", "original_file_path": "macros/edr/tests/test_configuration/get_detection_delay.sql", "unique_id": "macro.elementary.get_detection_delay", "macro_sql": "{% macro get_detection_delay(detection_delay, model_graph_node) %}\n {%- set configured_detection_delay = elementary.get_test_argument('detection_delay', detection_delay, model_graph_node) %}\n {%- do elementary.validate_detection_delay(configured_detection_delay) %}\n {%- set default_detection_delay = elementary.get_default_detection_delay() %}\n\n {%- if not configured_detection_delay %}\n {{ return(default_detection_delay) }}\n {%- else %}\n {%- set detection_delay = default_detection_delay.copy() %}\n {%- do detection_delay.update(configured_detection_delay) %}\n {{ return(detection_delay) }}\n {%- endif %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.get_test_argument", "macro.elementary.validate_detection_delay", "macro.elementary.get_default_detection_delay"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.9964654, "supported_languages": null}, "macro.elementary.validate_detection_delay": {"name": "validate_detection_delay", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/tests/test_configuration/get_detection_delay.sql", "original_file_path": "macros/edr/tests/test_configuration/get_detection_delay.sql", "unique_id": "macro.elementary.validate_detection_delay", "macro_sql": "{% macro validate_detection_delay(detection_delay) %}\n {% if detection_delay %}\n {%- if detection_delay is not mapping %}\n {% do exceptions.raise_compiler_error(\n \"\n Invalid detection_delay format. Expected format:\n\n detection_delay:\n count: int\n period: string\n \") %}\n {%- endif %}\n {%- if detection_delay is mapping %}\n {%- set invalid_keys = [] %}\n {%- set valid_keys = ['period', 'count'] %}\n {%- for key, value in detection_delay.items() %}\n {%- if key not in valid_keys %}\n {%- do invalid_keys.append(key) -%}\n {%- endif %}\n {%- endfor %}\n {%- if invalid_keys | length > 0 %}\n {% do exceptions.raise_compiler_error(\n (\"\n Found invalid keys in detection_delay: {0}.\n Supported keys: {1}.\n Expected format:\n\n detection_delay:\n count: int\n period: string\n \").format(invalid_keys, valid_keys)) %}\n {%- endif %}\n {%- endif %}\n\n {% if detection_delay.count and detection_delay.count is not integer %}\n {% do exceptions.raise_compiler_error(\"detection_delay.count expects valid integer, got: {} (If it's an integer, try to remove quotes)\".format(detection_delay.count)) %}\n {% endif %}\n {% if detection_delay.count < 0 %}\n {% do exceptions.raise_compiler_error(\"detection_delay.count can't be negative, got: {})\".format(detection_delay.count)) %}\n {% endif %}\n {% set supported_periods = elementary.get_detection_delay_supported_periods() %}\n {% if detection_delay.period and detection_delay.period not in supported_periods %}\n {% do exceptions.raise_compiler_error(\"detection_delay.period value should be one of {0}, got: {1}\".format(supported_periods, detection_delay.period)) %}\n {% endif %}\n {% endif %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.get_detection_delay_supported_periods"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549920.9989302, "supported_languages": null}, "macro.elementary.detection_period_to_backfill_days": {"name": "detection_period_to_backfill_days", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/tests/test_configuration/get_period_vars.sql", "original_file_path": "macros/edr/tests/test_configuration/get_period_vars.sql", "unique_id": "macro.elementary.detection_period_to_backfill_days", "macro_sql": "{% macro detection_period_to_backfill_days(detection_period, backfill_days, model_graph_node) %}\n {% if detection_period %}\n {% if elementary.get_count_of_period(detection_period) != (elementary.get_count_of_period(detection_period) | int) %}\n {%- do elementary.edr_log_warning(\"Got a float number value in detection_period count. Rounding it down...\") -%}\n {% endif %}\n\n {% if not detection_period.period %}\n {{ return(detection_period.count) }}\n {% endif %}\n\n {{ return(elementary.convert_period(detection_period, \"day\").count) }}\n {% endif %}\n\n {{ return(elementary.get_test_argument('backfill_days', backfill_days, model_graph_node)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.get_count_of_period", "macro.elementary.edr_log_warning", "macro.elementary.convert_period", "macro.elementary.get_test_argument"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.0039225, "supported_languages": null}, "macro.elementary.training_period_to_days_back": {"name": "training_period_to_days_back", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/tests/test_configuration/get_period_vars.sql", "original_file_path": "macros/edr/tests/test_configuration/get_period_vars.sql", "unique_id": "macro.elementary.training_period_to_days_back", "macro_sql": "{% macro training_period_to_days_back(training_period, days_back, model_graph_node) %}\n {% if training_period %}\n {% if elementary.get_count_of_period(training_period) != (elementary.get_count_of_period(training_period) | int) %}\n {%- do elementary.edr_log_warning(\"Got a float number value in training_period count. Rounding it down...\") -%}\n {% endif %}\n\n {% if not training_period.period %}\n {{ return(training_period.count) }}\n {% endif %}\n\n {{ return(elementary.convert_period(training_period, \"day\").count) }}\n {% endif %}\n\n {{ return(elementary.get_test_argument('days_back', days_back, model_graph_node)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.get_count_of_period", "macro.elementary.edr_log_warning", "macro.elementary.convert_period", "macro.elementary.get_test_argument"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.0050333, "supported_languages": null}, "macro.elementary.get_period_default_var": {"name": "get_period_default_var", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/tests/test_configuration/get_period_vars.sql", "original_file_path": "macros/edr/tests/test_configuration/get_period_vars.sql", "unique_id": "macro.elementary.get_period_default_var", "macro_sql": "{% macro get_period_default_var(period, count) %}\n {{ return({'period': period, 'count': count}) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.005376, "supported_languages": null}, "macro.elementary.get_unit_of_period": {"name": "get_unit_of_period", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/tests/test_configuration/get_period_vars.sql", "original_file_path": "macros/edr/tests/test_configuration/get_period_vars.sql", "unique_id": "macro.elementary.get_unit_of_period", "macro_sql": "{% macro get_unit_of_period(period_dict) %}\n {{ return(period_dict.period) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.0056136, "supported_languages": null}, "macro.elementary.get_count_of_period": {"name": "get_count_of_period", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/tests/test_configuration/get_period_vars.sql", "original_file_path": "macros/edr/tests/test_configuration/get_period_vars.sql", "unique_id": "macro.elementary.get_count_of_period", "macro_sql": "{% macro get_count_of_period(period_dict) %}\n {{ return(period_dict.count) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.0058448, "supported_languages": null}, "macro.elementary.convert_period": {"name": "convert_period", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/tests/test_configuration/get_period_vars.sql", "original_file_path": "macros/edr/tests/test_configuration/get_period_vars.sql", "unique_id": "macro.elementary.convert_period", "macro_sql": "{% macro convert_period(period_dict, convert_to) %}\n {% set convert_from = elementary.get_unit_of_period(period_dict) %}\n {% set period_count = elementary.get_count_of_period(period_dict) %}\n \n {% if convert_from == 'week' %}\n {% if convert_to == 'day' %}\n {% set period_count = period_count * 7 %}\n {% elif convert_to == 'hour' %}\n {% set period_count = period_count * 7 * 24 %}\n {% elif convert_to == 'month' %}\n {% set period_count = (period_count * 7) / 30 %}\n {% endif %}\n \n {% elif convert_from == 'day' %}\n {% if convert_to == 'hour' %}\n {% set period_count = period_count * 24 %}\n {% elif convert_to == 'week '%}\n {% set period_count = period_count / 7 %}\n {% elif convert_to == 'month' %}\n {% set period_count = period_count / 30 %}\n {% endif %}\n\n {% elif convert_from == 'hour' %}\n {% if convert_to == 'day' %}\n {% set period_count = period_count / 24 %}\n {% elif convert_to == 'week' %}\n {% set period_count = period_count / (7 * 24) %}\n {% elif convert_to == 'month' %}\n {% set period_count = period_count / (24 * 30) %}\n {% endif %}\n\n {% elif convert_from == 'month' %}\n {% if convert_to == 'day' %}\n {% set period_count = period_count * 30 %}\n {% elif convert_to == 'week' %}\n {% set period_count = (period_count * 30) / 7 %}\n {% elif convert_to == 'hour' %}\n {% set period_count = period_count * 30 * 24 %}\n {% endif %}\n {% endif %}\n\n {% set period_count = period_count | int %}\n {{ return({'period': convert_to, 'count': period_count}) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.get_unit_of_period", "macro.elementary.get_count_of_period"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.0092022, "supported_languages": null}, "macro.elementary.get_anomalies_test_configuration": {"name": "get_anomalies_test_configuration", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/tests/test_configuration/get_anomalies_test_configuration.sql", "original_file_path": "macros/edr/tests/test_configuration/get_anomalies_test_configuration.sql", "unique_id": "macro.elementary.get_anomalies_test_configuration", "macro_sql": "{% macro get_anomalies_test_configuration(model_relation,\n mandatory_params,\n timestamp_column,\n where_expression,\n anomaly_sensitivity,\n anomaly_direction,\n min_training_set_size,\n time_bucket,\n days_back,\n backfill_days,\n seasonality,\n freshness_column,\n event_timestamp_column,\n dimensions,\n sensitivity,\n ignore_small_changes,\n fail_on_zero,\n detection_delay,\n anomaly_exclude_metrics,\n detection_period,\n training_period) %}\n\n {%- set model_graph_node = elementary.get_model_graph_node(model_relation) %}\n\n {# All anomaly detection tests #}\n {%- set timestamp_column = elementary.get_test_argument('timestamp_column', timestamp_column, model_graph_node) %}\n {%- set where_expression = elementary.get_test_argument('where_expression', where_expression, model_graph_node) %}\n {# We had a names mix in sensitivity/anomaly_sensitivity, this keeps backwards competability #}\n {%- set anomaly_sensitivity = sensitivity if sensitivity else elementary.get_test_argument('anomaly_sensitivity', anomaly_sensitivity, model_graph_node) %}\n {%- set anomaly_direction = elementary.get_anomaly_direction(anomaly_direction, model_graph_node) %}\n {%- set detection_period = elementary.get_test_argument('detection_period', detection_period, model_graph_node) -%}\n {%- set backfill_days = elementary.detection_period_to_backfill_days(detection_period, backfill_days, model_graph_node) -%}\n {%- set fail_on_zero = elementary.get_test_argument('fail_on_zero', fail_on_zero, model_graph_node) %}\n \n\n {# timestamp_column anomaly detection tests #}\n {%- set time_bucket = elementary.get_time_bucket(time_bucket, model_graph_node) %}\n {%- set seasonality = elementary.get_seasonality(seasonality, model_graph_node, time_bucket, timestamp_column) %}\n {%- set training_period = elementary.get_test_argument('training_period', training_period, model_graph_node) -%}\n {%- set days_back = elementary.training_period_to_days_back(training_period, days_back, model_graph_node) -%}\n {%- set days_back = elementary.get_days_back(days_back, model_graph_node, seasonality) %}\n {%- set detection_delay = elementary.get_detection_delay(detection_delay, model_graph_node) %}\n\n {%- set ignore_small_changes = elementary.get_test_argument('ignore_small_changes', ignore_small_changes, model_graph_node) %}\n {# Validate ignore_small_changes #}\n\n {% set event_timestamp_column = elementary.get_test_argument('event_timestamp_column', event_timestamp_column, model_graph_node) %}\n {% set anomaly_exclude_metrics = elementary.get_test_argument('anomaly_exclude_metrics', anomaly_exclude_metrics, model_graph_node) %}\n\n {% set test_configuration =\n {'timestamp_column': timestamp_column,\n 'where_expression': where_expression,\n 'anomaly_sensitivity': anomaly_sensitivity,\n 'anomaly_direction': anomaly_direction,\n 'time_bucket': time_bucket,\n 'days_back': days_back,\n 'backfill_days': backfill_days,\n 'seasonality': seasonality,\n 'freshness_column': freshness_column,\n 'event_timestamp_column': event_timestamp_column,\n 'dimensions': dimensions,\n 'ignore_small_changes': ignore_small_changes,\n 'fail_on_zero': fail_on_zero,\n 'detection_delay': detection_delay,\n 'anomaly_exclude_metrics': anomaly_exclude_metrics\n } %}\n {%- set test_configuration = elementary.undefined_dict_keys_to_none(test_configuration) -%}\n {%- do elementary.validate_mandatory_configuration(test_configuration, mandatory_params) -%}\n {%- do elementary.validate_ignore_small_changes(test_configuration) -%}\n\n {# Changes in these configs impact the metric id of the test. #}\n {# If these configs change, we ignore the old metrics and recalculate. #}\n {% set metric_properties =\n {'timestamp_column': timestamp_column,\n 'where_expression': where_expression,\n 'time_bucket': time_bucket,\n 'freshness_column': freshness_column,\n 'event_timestamp_column': event_timestamp_column,\n 'dimensions': dimensions\n } %}\n {%- set metric_properties = elementary.undefined_dict_keys_to_none(metric_properties) -%}\n\n {# Adding to cache so test configuration will be available outside the test context #}\n {%- set test_unique_id = elementary.get_test_unique_id() %}\n {%- do elementary.set_cache(test_unique_id, test_configuration) -%}\n {{ return([test_configuration, metric_properties]) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.get_model_graph_node", "macro.elementary.get_test_argument", "macro.elementary.get_anomaly_direction", "macro.elementary.detection_period_to_backfill_days", "macro.elementary.get_time_bucket", "macro.elementary.get_seasonality", "macro.elementary.training_period_to_days_back", "macro.elementary.get_days_back", "macro.elementary.get_detection_delay", "macro.elementary.undefined_dict_keys_to_none", "macro.elementary.validate_mandatory_configuration", "macro.elementary.validate_ignore_small_changes", "macro.elementary.get_test_unique_id", "macro.elementary.set_cache"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.016222, "supported_languages": null}, "macro.elementary.validate_mandatory_configuration": {"name": "validate_mandatory_configuration", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/tests/test_configuration/get_anomalies_test_configuration.sql", "original_file_path": "macros/edr/tests/test_configuration/get_anomalies_test_configuration.sql", "unique_id": "macro.elementary.validate_mandatory_configuration", "macro_sql": "{% macro validate_mandatory_configuration(test_configuration, mandatory_params) %}\n {%- set mandatory_configuration = ['anomaly_sensitivity', 'anomaly_direction', 'backfill_days'] %}\n {%- set with_timestamp_mandatory_configuration = ['time_bucket', 'days_back'] %}\n {%- set missing_mandatory_params = [] %}\n\n {%- if mandatory_params and mandatory_params is iterable %}\n {%- set mandatory_configuration = elementary.union_lists(mandatory_configuration, mandatory_params) %}\n {%- endif %}\n {%- if test_configuration.timestamp_column %}\n {%- set mandatory_configuration = elementary.union_lists(mandatory_configuration, with_timestamp_mandatory_configuration) %}\n {%- endif %}\n\n {%- for mandatory_param in mandatory_configuration %}\n {%- if not test_configuration.get(mandatory_param) %}\n {%- do missing_mandatory_params.append(mandatory_param) -%}\n {%- endif %}\n {%- endfor %}\n {%- if missing_mandatory_params | length > 0 %}\n {% do exceptions.raise_compiler_error('Missing mandatory configuration: {}'.format(missing_mandatory_params)) %}\n {%- endif %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.union_lists"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.017811, "supported_languages": null}, "macro.elementary.validate_ignore_small_changes": {"name": "validate_ignore_small_changes", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/tests/test_configuration/get_anomalies_test_configuration.sql", "original_file_path": "macros/edr/tests/test_configuration/get_anomalies_test_configuration.sql", "unique_id": "macro.elementary.validate_ignore_small_changes", "macro_sql": "{% macro validate_ignore_small_changes(test_configuration) %}\n {% for key, value in test_configuration.ignore_small_changes.items() %}\n {% if key not in ['spike_failure_percent_threshold', 'drop_failure_percent_threshold'] %}\n {% do exceptions.raise_compiler_error('Illegal configuration key: {}'.format(key)) %}\n {% endif %}\n\n {% if (value is not none) and (value | int) and (value >= 0) %}\n {% if (value | int) == 0 or value < 0 %}\n {% do exceptions.raise_compiler_error('Illegal value for ignore_small_changes config: {}'.format(value)) %}\n {% endif %}\n {% endif %}\n {% endfor %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.01903, "supported_languages": null}, "macro.elementary.get_daily_time_bucket": {"name": "get_daily_time_bucket", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/tests/test_configuration/get_time_bucket.sql", "original_file_path": "macros/edr/tests/test_configuration/get_time_bucket.sql", "unique_id": "macro.elementary.get_daily_time_bucket", "macro_sql": "{% macro get_daily_time_bucket() %}\n {% do return({\"period\": \"day\", \"count\": 1}) %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.0228221, "supported_languages": null}, "macro.elementary.get_default_time_bucket": {"name": "get_default_time_bucket", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/tests/test_configuration/get_time_bucket.sql", "original_file_path": "macros/edr/tests/test_configuration/get_time_bucket.sql", "unique_id": "macro.elementary.get_default_time_bucket", "macro_sql": "{% macro get_default_time_bucket() %}\n {% do return(elementary.get_daily_time_bucket()) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.get_daily_time_bucket"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.0230916, "supported_languages": null}, "macro.elementary.get_time_bucket": {"name": "get_time_bucket", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/tests/test_configuration/get_time_bucket.sql", "original_file_path": "macros/edr/tests/test_configuration/get_time_bucket.sql", "unique_id": "macro.elementary.get_time_bucket", "macro_sql": "{% macro get_time_bucket(time_bucket, model_graph_node) %}\n {%- set configured_time_bucket = elementary.get_test_argument('time_bucket', time_bucket, model_graph_node) %}\n {%- do elementary.validate_time_bucket(configured_time_bucket) %}\n {%- set default_time_bucket = elementary.get_default_time_bucket() %}\n\n {%- if not configured_time_bucket %}\n {{ return(default_time_bucket) }}\n {%- else %}\n {%- set time_bucket = default_time_bucket.copy() %}\n {%- do time_bucket.update(configured_time_bucket) %}\n {{ return(time_bucket) }}\n {%- endif %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.get_test_argument", "macro.elementary.validate_time_bucket", "macro.elementary.get_default_time_bucket"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.0240157, "supported_languages": null}, "macro.elementary.validate_time_bucket": {"name": "validate_time_bucket", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/tests/test_configuration/get_time_bucket.sql", "original_file_path": "macros/edr/tests/test_configuration/get_time_bucket.sql", "unique_id": "macro.elementary.validate_time_bucket", "macro_sql": "{% macro validate_time_bucket(time_bucket) %}\n {% if time_bucket %}\n {%- if time_bucket is not mapping %}\n {% do exceptions.raise_compiler_error(\n \"\n Invalid time_bucket format. Expected format:\n\n time_bucket:\n count: int\n period: string\n \") %}\n {%- endif %}\n {%- if time_bucket is mapping %}\n {%- set invalid_keys = [] %}\n {%- set valid_keys = ['period', 'count'] %}\n {%- for key, value in time_bucket.items() %}\n {%- if key not in valid_keys %}\n {%- do invalid_keys.append(key) -%}\n {%- endif %}\n {%- endfor %}\n {%- if invalid_keys | length > 0 %}\n {% do exceptions.raise_compiler_error(\n (\"\n Found invalid keys in time_bucket: {0}.\n Supported keys: {1}.\n Expected format:\n\n time_bucket:\n count: int\n period: string\n \").format(invalid_keys, valid_keys)) %}\n {%- endif %}\n {%- endif %}\n\n {% if time_bucket.count and time_bucket.count is not integer %}\n {% do exceptions.raise_compiler_error(\"time_bucket.count expects valid integer, got: {} (If it's an integer, try to remove quotes)\".format(time_bucket.count)) %}\n {% endif %}\n {% if time_bucket.count <= 0 %}\n {% do exceptions.raise_compiler_error(\"time_bucket.count has to be larger than 0, got: {})\".format(time_bucket.count)) %}\n {% endif %}\n {% set supported_periods = adapter.dispatch(\"supported_periods\", \"elementary\")() %}\n {% if time_bucket.period and time_bucket.period not in supported_periods %}\n {% do exceptions.raise_compiler_error(\"time_bucket.period value should be one of {0}, got: {1}\".format(supported_periods, time_bucket.period)) %}\n {% endif %}\n {% endif %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.default__supported_periods"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.026441, "supported_languages": null}, "macro.elementary.default__supported_periods": {"name": "default__supported_periods", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/tests/test_configuration/get_time_bucket.sql", "original_file_path": "macros/edr/tests/test_configuration/get_time_bucket.sql", "unique_id": "macro.elementary.default__supported_periods", "macro_sql": "{% macro default__supported_periods() %}\n {% do return([\"hour\", \"day\", \"week\", \"month\"]) %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.0267756, "supported_languages": null}, "macro.elementary.redshift__supported_periods": {"name": "redshift__supported_periods", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/tests/test_configuration/get_time_bucket.sql", "original_file_path": "macros/edr/tests/test_configuration/get_time_bucket.sql", "unique_id": "macro.elementary.redshift__supported_periods", "macro_sql": "{% macro redshift__supported_periods() %}\n {% do return([\"hour\", \"day\", \"week\"]) %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.0270655, "supported_languages": null}, "macro.elementary.get_seasonality": {"name": "get_seasonality", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/tests/test_configuration/get_seasonality.sql", "original_file_path": "macros/edr/tests/test_configuration/get_seasonality.sql", "unique_id": "macro.elementary.get_seasonality", "macro_sql": "{% macro get_seasonality(seasonality, model_graph_node, time_bucket, timestamp_column) %}\n {%- set seasonality = elementary.get_test_argument('seasonality', seasonality, model_graph_node) %}\n {%- do elementary.validate_seasonality(seasonality, time_bucket, timestamp_column) -%}\n {%- if seasonality %}\n {{ return(seasonality) }}\n {%- endif %}\n {{ return(none)}}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.get_test_argument", "macro.elementary.validate_seasonality"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.0287836, "supported_languages": null}, "macro.elementary.validate_seasonality": {"name": "validate_seasonality", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/tests/test_configuration/get_seasonality.sql", "original_file_path": "macros/edr/tests/test_configuration/get_seasonality.sql", "unique_id": "macro.elementary.validate_seasonality", "macro_sql": "{% macro validate_seasonality(seasonality, time_bucket, timestamp_column) %}\n {% if seasonality %}\n {% if not timestamp_column %}\n {% do exceptions.raise_compiler_error('Test with seasonality must have a timestamp_column, but none was provided') %}\n {% endif %}\n {% set supported_seasonality_values = ['day_of_week', 'hour_of_day', 'hour_of_week'] %}\n {%- set seasonality = seasonality | lower %}\n {% if seasonality not in supported_seasonality_values %}\n {% do exceptions.raise_compiler_error('Seasonality value should be one of' ~ supported_seasonality_values ~ ', got ' ~ seasonality ~ ' instead') %}\n {% endif %}\n {% if seasonality == 'day_of_week' and ((time_bucket.count != 1) or (time_bucket.period != 'day')) %}\n {% do exceptions.raise_compiler_error('Daily seasonality is supported only with time_bucket 1 day, got period: ' ~ time_bucket.period ~ ' and count: ' ~ time_bucket.count ~ ' instead') %}\n {% elif seasonality in ['hour_of_day', 'hour_of_week'] and ((time_bucket.count != 1) or (time_bucket.period != 'hour')) %}\n {% do exceptions.raise_compiler_error('Hourly seasonality is supported only with time_bucket 1 hour, got period: ' ~ time_bucket.period ~ ' and count: ' ~ time_bucket.count ~ ' instead') %}\n {% endif %}\n {% endif %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.0307221, "supported_languages": null}, "macro.elementary.get_model_baseline_columns": {"name": "get_model_baseline_columns", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/tests/test_configuration/get_model_baseline_columns.sql", "original_file_path": "macros/edr/tests/test_configuration/get_model_baseline_columns.sql", "unique_id": "macro.elementary.get_model_baseline_columns", "macro_sql": "{% macro get_model_baseline_columns(model, enforce_types=False) %}\n {# Get baseline columns #}\n {% set model_relation = dbt.load_relation(model) %}\n {% set model_graph_node = elementary.get_model_graph_node(model_relation) %}\n\n {% set baseline = [] %}\n {% set columns_without_types = [] %}\n {% for column in model_graph_node[\"columns\"].values() %}\n {% if \"data_type\" in column %}\n {% set info_schema_data_type = elementary.get_normalized_data_type(column[\"data_type\"]) %}\n {% else %}\n {% set info_schema_data_type = none %}\n {% endif %}\n {% set column_info = {\"column_name\": column[\"name\"], \"data_type\": info_schema_data_type } %}\n {% if column_info[\"data_type\"] is none %}\n {% do columns_without_types.append(column_info[\"column_name\"]) %}\n {% endif %}\n {% do baseline.append(column_info) %}\n {% endfor %}\n \n {% if columns_without_types %}\n {% if enforce_types %}\n {% do exceptions.raise_compiler_error(\"Data type not defined for columns `{}` on model `{}` for schema change from baseline test\".format(columns_without_types, model)) %}\n {% else %}\n {% do elementary.edr_log_warning(\"missing data types for columns: \" ~ columns_without_types) %}\n {% endif %}\n {% endif %}\n\n {% do return(baseline) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.load_relation", "macro.elementary.get_model_graph_node", "macro.elementary.get_normalized_data_type", "macro.elementary.edr_log_warning"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.0337834, "supported_languages": null}, "macro.elementary.get_anomaly_direction": {"name": "get_anomaly_direction", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/tests/test_configuration/get_anomaly_direction.sql", "original_file_path": "macros/edr/tests/test_configuration/get_anomaly_direction.sql", "unique_id": "macro.elementary.get_anomaly_direction", "macro_sql": "{% macro get_anomaly_direction(anomaly_direction, model_graph_node) %}\n {%- set anomaly_direction = elementary.get_test_argument('anomaly_direction', anomaly_direction, model_graph_node) | lower %}\n {%- do elementary.validate_anomaly_direction(anomaly_direction) -%}\n {{ return(anomaly_direction) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.get_test_argument", "macro.elementary.validate_anomaly_direction"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.0346851, "supported_languages": null}, "macro.elementary.validate_anomaly_direction": {"name": "validate_anomaly_direction", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/tests/test_configuration/get_anomaly_direction.sql", "original_file_path": "macros/edr/tests/test_configuration/get_anomaly_direction.sql", "unique_id": "macro.elementary.validate_anomaly_direction", "macro_sql": "{% macro validate_anomaly_direction(anomaly_direction) %}\n {% if anomaly_direction %}\n {% set direction_case_insensitive = anomaly_direction %}\n {% if direction_case_insensitive not in ['drop','spike','both'] %}\n {% do exceptions.raise_compiler_error('Supported anomaly directions are: both, drop, spike. received anomaly_direction: {}'.format(anomaly_direction)) %}\n {% endif %}\n {% else %}\n {% do exceptions.raise_compiler_error('anomaly_direction can\\'t be empty. Supported anomaly directions are: both, drop, spike') %}\n {% endif %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.0354512, "supported_languages": null}, "macro.elementary.get_elementary_test_table": {"name": "get_elementary_test_table", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/tests/test_utils/get_elementary_test_table.sql", "original_file_path": "macros/edr/tests/test_utils/get_elementary_test_table.sql", "unique_id": "macro.elementary.get_elementary_test_table", "macro_sql": "{% macro get_elementary_test_table(test_name, table_type) %}\n {% if execute %}\n {% set test_entry = elementary.get_cache(\"temp_test_table_relations_map\").setdefault(test_name, {}) %}\n {% do return(test_entry.get(table_type)) %}\n {% endif %}\n {% do return(none) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.get_cache"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.0362217, "supported_languages": null}, "macro.elementary.get_model_relation_for_test": {"name": "get_model_relation_for_test", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/tests/test_utils/get_model_relation_for_test.sql", "original_file_path": "macros/edr/tests/test_utils/get_model_relation_for_test.sql", "unique_id": "macro.elementary.get_model_relation_for_test", "macro_sql": "{% macro get_model_relation_for_test(test_model, test_node) %}\n {# If the test model is not a string, then return as-is #}\n {% if test_model is not string %}\n {% do return(test_model) %}\n {% endif %}\n\n {# Test model is a string, this might mean that a \"where\" parameter was passed to the test.\n In the heuristic below we rely on the fact that in this case the model jinja will have\n a very specific structure (see the \"build_model_str\" function in dbt-core) #}\n\n {% set test_metadata = elementary.safe_get_with_default(test_node, 'test_metadata', {}) %}\n {% set test_kwargs = elementary.safe_get_with_default(test_metadata, 'kwargs', {}) %}\n {% set test_model_jinja = test_kwargs.get('model') %}\n\n {% if not test_model_jinja %}\n {% do return(none) %}\n {% endif %}\n\n {# Try to match ref #}\n {% set match = modules.re.match(\n \"{{ get_where_subquery\\(ref\\('(?P.+)'\\)\\) }}\",\n test_model_jinja\n ) %}\n {% if match %}\n {% set group_dict = match.groupdict() %}\n {% set model_name = group_dict[\"model_name\"] %}\n {% do return(ref(model_name)) %}\n {% endif %}\n\n {# Try to match source #}\n {% set match = modules.re.match(\n \"{{ get_where_subquery\\(source\\('(?P.+)', '(?P.+)'\\)\\) }}\",\n test_model_jinja\n ) %}\n {% if match %}\n {% set group_dict = match.groupdict() %}\n {% set source_name = group_dict[\"source_name\"] %}\n {% set table_name = group_dict[\"table_name\"] %}\n {% do return(source(source_name, table_name)) %}\n {% endif %}\n\n {# If we got here, then probably \"ref\" or \"source\" have been overridden with a string query,\n which right now we cannot handle #}\n {% do return(none) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.safe_get_with_default"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.0391617, "supported_languages": null}, "macro.elementary.get_anomaly_query": {"name": "get_anomaly_query", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/tests/test_utils/get_anomaly_query.sql", "original_file_path": "macros/edr/tests/test_utils/get_anomaly_query.sql", "unique_id": "macro.elementary.get_anomaly_query", "macro_sql": "{%- macro get_anomaly_query(flattened_test=none) -%}\n {%- set query -%}\n select * from ({{ elementary.get_read_anomaly_scores_query(flattened_test) }}) results\n where is_anomalous = true\n {%- endset -%}\n {{- return(query) -}}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.elementary.get_read_anomaly_scores_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.0446265, "supported_languages": null}, "macro.elementary.get_read_anomaly_scores_query": {"name": "get_read_anomaly_scores_query", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/tests/test_utils/get_anomaly_query.sql", "original_file_path": "macros/edr/tests/test_utils/get_anomaly_query.sql", "unique_id": "macro.elementary.get_read_anomaly_scores_query", "macro_sql": "{% macro get_read_anomaly_scores_query(flattened_test=none) %}\n {% if not flattened_test %}\n {% set flattened_test = elementary.flatten_test(model) %}\n {% endif %}\n {%- set test_unique_id = flattened_test.unique_id %}\n {%- set test_configuration = elementary.get_cache(test_unique_id) %}\n {%- if not test_configuration %}\n {{ exceptions.raise_compiler_error(\"Failed to load configuration dict from cache for test `{}`\".format(test_unique_id)) }}\n {%- endif %}\n {%- set backfill_period = \"'-\" ~ test_configuration.backfill_days ~ \"'\" %}\n\n {%- set anomaly_query -%}\n with anomaly_scores as (\n select\n id,\n metric_id,\n test_execution_id,\n test_unique_id,\n detected_at,\n full_table_name,\n column_name,\n metric_name,\n anomaly_score,\n anomaly_score_threshold,\n anomalous_value,\n bucket_start,\n bucket_end,\n bucket_seasonality,\n metric_value,\n min_metric_value,\n max_metric_value,\n training_avg,\n training_stddev,\n training_set_size,\n training_start,\n training_end,\n dimension,\n dimension_value,\n {{ elementary.anomaly_detection_description() }},\n max(bucket_end) over (partition by test_execution_id) as max_bucket_end\n from {{ elementary.get_elementary_test_table(elementary.get_elementary_test_table_name(), 'anomaly_scores') }}\n ),\n anomaly_scores_with_is_anomalous as (\n select\n *,\ncase when\n anomaly_score is not null and\n (\n {{ elementary.fail_on_zero(test_configuration.fail_on_zero) }} or\n (\n {{ elementary.is_score_anomalous_condition(test_configuration.anomaly_sensitivity, test_configuration.anomaly_direction) }} and\n {{ elementary.avg_percent_anomalous_condition(\n test_configuration.ignore_small_changes.spike_failure_percent_threshold,\n test_configuration.ignore_small_changes.drop_failure_percent_threshold,\n test_configuration.anomaly_direction\n ) \n }}\n )\n ) and\n bucket_end >= {{ elementary.edr_timeadd('day', backfill_period, 'max_bucket_end') }}\n then TRUE else FALSE end as is_anomalous\n from anomaly_scores\n )\n\n select\n metric_value as value,\n training_avg as average,\n {# when there is an anomaly we would want to use the last value of the metric (lag), otherwise visually the expectations would look out of bounds #}\n case\n when is_anomalous = TRUE and '{{ test_configuration.anomaly_direction }}' = 'spike' then\n lag(metric_value) over (partition by full_table_name, column_name, metric_name, dimension, dimension_value, bucket_seasonality order by bucket_end)\n when is_anomalous = TRUE and '{{ test_configuration.anomaly_direction }}' != 'spike' then\n lag(min_metric_value) over (partition by full_table_name, column_name, metric_name, dimension, dimension_value, bucket_seasonality order by bucket_end)\n when '{{ test_configuration.anomaly_direction }}' = 'spike' then metric_value\n else min_metric_value end as min_value,\n case\n when is_anomalous = TRUE and '{{ test_configuration.anomaly_direction }}' = 'drop' then\n lag(metric_value) over (partition by full_table_name, column_name, metric_name, dimension, dimension_value, bucket_seasonality order by bucket_end)\n when is_anomalous = TRUE and '{{ test_configuration.anomaly_direction }}' != 'drop' then\n lag(max_metric_value) over (partition by full_table_name, column_name, metric_name, dimension, dimension_value, bucket_seasonality order by bucket_end)\n when '{{ test_configuration.anomaly_direction }}' = 'drop' then metric_value\n else max_metric_value end as max_value,\n bucket_start as start_time,\n bucket_end as end_time,\n *\n from anomaly_scores_with_is_anomalous\n order by bucket_end, dimension_value\n {%- endset -%}\n {{- return(anomaly_query) -}}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.flatten_test", "macro.elementary.get_cache", "macro.elementary.anomaly_detection_description", "macro.elementary.get_elementary_test_table", "macro.elementary.get_elementary_test_table_name", "macro.elementary.fail_on_zero", "macro.elementary.is_score_anomalous_condition", "macro.elementary.avg_percent_anomalous_condition", "macro.elementary.edr_timeadd"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.046926, "supported_languages": null}, "macro.elementary.set_directional_anomaly": {"name": "set_directional_anomaly", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/tests/test_utils/get_anomaly_query.sql", "original_file_path": "macros/edr/tests/test_utils/get_anomaly_query.sql", "unique_id": "macro.elementary.set_directional_anomaly", "macro_sql": "\n\n\n{%- macro set_directional_anomaly(anomaly_direction, anomaly_score, sensitivity) -%}\n {% if anomaly_direction | lower == 'spike' %}\n anomaly_score > {{ sensitivity }}\n {% elif anomaly_direction | lower == 'drop' %}\n anomaly_score < {{ sensitivity * -1 }}\n {% else %}\n abs(anomaly_score) > {{ sensitivity }}\n {% endif %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.0475166, "supported_languages": null}, "macro.elementary.is_score_anomalous_condition": {"name": "is_score_anomalous_condition", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/tests/test_utils/get_anomaly_query.sql", "original_file_path": "macros/edr/tests/test_utils/get_anomaly_query.sql", "unique_id": "macro.elementary.is_score_anomalous_condition", "macro_sql": "\n\n{%- macro is_score_anomalous_condition(sensitivity, anomaly_direction) -%}\n {%- set spikes_only_metrics = ['freshness', 'event_freshness'] -%}\n case when metric_name IN {{ elementary.strings_list_to_tuple(spikes_only_metrics) }} then\n anomaly_score > {{ sensitivity }}\n else\n {{ elementary.set_directional_anomaly(anomaly_direction, anomaly_score, sensitivity) }}\n end\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.elementary.strings_list_to_tuple", "macro.elementary.set_directional_anomaly"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.0480475, "supported_languages": null}, "macro.elementary.avg_percent_anomalous_condition": {"name": "avg_percent_anomalous_condition", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/tests/test_utils/get_anomaly_query.sql", "original_file_path": "macros/edr/tests/test_utils/get_anomaly_query.sql", "unique_id": "macro.elementary.avg_percent_anomalous_condition", "macro_sql": "{%- macro avg_percent_anomalous_condition(spike_failure_percent_threshold, drop_failure_percent_threshold, anomaly_direction) -%}\n (\n {% set spike_filter %}\n (metric_value > ((1 + {{ spike_failure_percent_threshold }}/100.0) * training_avg))\n {% endset %}\n {% set drop_filter %}\n (metric_value < ((1 - {{ drop_failure_percent_threshold }}/100.0) * training_avg))\n {% endset %}\n \n {% if spike_failure_percent_threshold and drop_failure_percent_threshold and (anomaly_direction | lower) == 'both' %}\n {{ spike_filter }} or {{ drop_filter }}\n {% else %}\n {% if spike_failure_percent_threshold and anomaly_direction | lower in ['spike', 'both'] %}\n {{ spike_filter }}\n {% else %}\n (1 = 1)\n {% endif %}\n\n and\n\n {% if drop_failure_percent_threshold and anomaly_direction | lower in ['drop', 'both'] %}\n {{ drop_filter }}\n {% else %}\n (1 = 1)\n {% endif %}\n {% endif %}\n )\n{%- endmacro -%}\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.049277, "supported_languages": null}, "macro.elementary.fail_on_zero": {"name": "fail_on_zero", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/tests/test_utils/get_anomaly_query.sql", "original_file_path": "macros/edr/tests/test_utils/get_anomaly_query.sql", "unique_id": "macro.elementary.fail_on_zero", "macro_sql": "{% macro fail_on_zero(fail_on_zero) %}\n (\n metric_value = 0 and \n {% if fail_on_zero %}\n 1 = 1\n {% else %}\n 1 = 2\n {% endif %}\n )\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.0495498, "supported_languages": null}, "macro.elementary.get_test_unique_id": {"name": "get_test_unique_id", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/tests/test_utils/get_test_unique_id.sql", "original_file_path": "macros/edr/tests/test_utils/get_test_unique_id.sql", "unique_id": "macro.elementary.get_test_unique_id", "macro_sql": "{% macro get_test_unique_id() %}\n {% set test_unique_id = model.get('unique_id') %}\n {{ return(test_unique_id) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.049962, "supported_languages": null}, "macro.elementary.create_model_baseline_table": {"name": "create_model_baseline_table", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/tests/test_utils/create_model_baseline_table.sql", "original_file_path": "macros/edr/tests/test_utils/create_model_baseline_table.sql", "unique_id": "macro.elementary.create_model_baseline_table", "macro_sql": "{% macro create_model_baseline_table(baseline_columns, database_name, schema_name, test_name) %}\n {% set empty_table_query = elementary.empty_table([('column_name','string'),('data_type','string')]) %}\n {% set baseline_table_relation = elementary.create_elementary_test_table(database_name, schema_name,\n test_name | lower, 'schema_baseline',\n empty_table_query) %}\n {% do elementary.insert_rows(baseline_table_relation, baseline_columns, should_commit=True, chunk_size=elementary.get_config_var('dbt_artifacts_chunk_size')) %}\n {% do return(baseline_table_relation) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.empty_table", "macro.elementary.create_elementary_test_table", "macro.elementary.insert_rows", "macro.elementary.get_config_var"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.0512147, "supported_languages": null}, "macro.elementary.get_test_type": {"name": "get_test_type", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/tests/test_utils/get_test_type.sql", "original_file_path": "macros/edr/tests/test_utils/get_test_type.sql", "unique_id": "macro.elementary.get_test_type", "macro_sql": "{% macro get_test_type(flattened_test) %}\n {% if flattened_test.test_namespace == \"elementary\" %}\n {%- set elementary_test_type = elementary.get_elementary_test_type(flattened_test) %}\n {% endif %}\n {% do return(elementary_test_type or \"dbt_test\") %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.get_elementary_test_type"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.0521944, "supported_languages": null}, "macro.elementary.get_elementary_test_type": {"name": "get_elementary_test_type", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/tests/test_utils/get_test_type.sql", "original_file_path": "macros/edr/tests/test_utils/get_test_type.sql", "unique_id": "macro.elementary.get_elementary_test_type", "macro_sql": "{% macro get_elementary_test_type(flattened_test) %}\n {%- set anomaly_detection_tests = [\n 'volume_anomalies',\n 'freshness_anomalies',\n 'event_freshness_anomalies',\n 'table_anomalies',\n 'dimension_anomalies',\n 'column_anomalies',\n 'all_columns_anomalies'\n ] %}\n {%- set schema_changes_tests = [\n 'schema_changes',\n 'schema_changes_from_baseline',\n 'json_schema',\n ] %}\n\n {% if flattened_test.short_name | lower in anomaly_detection_tests %}\n {% do return(\"anomaly_detection\") %}\n {% elif flattened_test.short_name | lower in schema_changes_tests %}\n {% do return(\"schema_change\") %}\n {% endif %}\n {% do return(none) %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.0532308, "supported_languages": null}, "macro.elementary.get_test_execution_id": {"name": "get_test_execution_id", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/tests/test_utils/get_test_execution_id.sql", "original_file_path": "macros/edr/tests/test_utils/get_test_execution_id.sql", "unique_id": "macro.elementary.get_test_execution_id", "macro_sql": "{% macro get_test_execution_id() %}\n {{ return(elementary.get_node_execution_id(model)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.get_node_execution_id"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.053549, "supported_languages": null}, "macro.elementary.backfill_result_rows": {"name": "backfill_result_rows", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/tests/test_utils/backfill_result_rows.sql", "original_file_path": "macros/edr/tests/test_utils/backfill_result_rows.sql", "unique_id": "macro.elementary.backfill_result_rows", "macro_sql": "{% macro backfill_result_rows() %}\n -- depends_on: {{ ref('elementary_test_results') }}\n {% if is_incremental() %}\n {% do return('') %}\n {% endif %}\n\n {% set elementary_test_results_relation = ref(\"elementary_test_results\") %}\n {% set result_row_exists = elementary.get_column_in_relation(elementary_test_results_relation, \"result_rows\") is not none %}\n {% if not result_row_exists %}\n {% do return('') %}\n {% endif %}\n\n {% set test_result_rows_rows = [] %}\n {% set backfill_query %}\n select\n id,\n detected_at,\n result_rows\n from {{ elementary_test_results_relation }}\n where {{ elementary.edr_datediff(elementary.edr_cast_as_timestamp('detected_at'), elementary.edr_current_timestamp(), 'day') }} < {{ elementary.get_config_var(\"days_back\") }}\n and result_rows is not null\n {% endset %}\n {% set test_results_with_result_rows = elementary.run_query(backfill_query) %}\n {% for elementary_test_results_row in test_results_with_result_rows %}\n {% set result_rows = fromjson(elementary_test_results_row.result_rows) %}\n {% for result_row in result_rows %}\n {% do test_result_rows_rows.append({\n \"elementary_test_results_id\": elementary_test_results_row.id,\n \"detected_at\": elementary_test_results_row.detected_at.strftime(elementary.get_time_format()),\n \"result_row\": result_row\n }) %}\n {% endfor %}\n {% endfor %}\n {% do elementary.insert_rows(this, test_result_rows_rows, should_commit=false, chunk_size=elementary.get_config_var('dbt_artifacts_chunk_size')) %}\n {% do return('') %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_unit_testing.is_incremental", "macro.elementary.get_column_in_relation", "macro.elementary.edr_datediff", "macro.elementary.edr_cast_as_timestamp", "macro.elementary.edr_current_timestamp", "macro.elementary.get_config_var", "macro.elementary.run_query", "macro.elementary.get_time_format", "macro.elementary.insert_rows"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.057265, "supported_languages": null}, "macro.elementary.get_elementary_test_table_name": {"name": "get_elementary_test_table_name", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/tests/test_utils/get_elementary_test_table_name.sql", "original_file_path": "macros/edr/tests/test_utils/get_elementary_test_table_name.sql", "unique_id": "macro.elementary.get_elementary_test_table_name", "macro_sql": "{% macro get_elementary_test_table_name() %}\n {% set test_node = model %}\n {% set test_hash = test_node.unique_id.split(\".\")[-1] %}\n {% set test_name = test_node.name %}\n {% do return(\"test_{}_{}\".format(test_hash, test_name)) %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.058025, "supported_languages": null}, "macro.elementary.clean_elementary_test_tables": {"name": "clean_elementary_test_tables", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/tests/test_utils/clean_elementary_test_tables.sql", "original_file_path": "macros/edr/tests/test_utils/clean_elementary_test_tables.sql", "unique_id": "macro.elementary.clean_elementary_test_tables", "macro_sql": "{% macro clean_elementary_test_tables() %}\n {% set test_table_relations = [] %}\n {% set temp_test_table_relations_map = elementary.get_cache(\"temp_test_table_relations_map\") %}\n {% if temp_test_table_relations_map %}\n {% for test_entry in temp_test_table_relations_map.values() %}\n {% for test_relation in test_entry.values() %}\n {% do test_table_relations.append(test_relation) %}\n {% endfor %}\n {% endfor %}\n\n {% do elementary.file_log(\"Deleting temporary Elementary test tables: {}\".format(test_table_relations)) %}\n {% set queries = elementary.get_clean_elementary_test_tables_queries(test_table_relations) %}\n {% for query in queries %}\n {% do elementary.run_query(query) %}\n {% endfor %}\n {% endif %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.get_cache", "macro.elementary.file_log", "macro.elementary.get_clean_elementary_test_tables_queries", "macro.elementary.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.0617955, "supported_languages": null}, "macro.elementary.get_clean_elementary_test_tables_queries": {"name": "get_clean_elementary_test_tables_queries", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/tests/test_utils/clean_elementary_test_tables.sql", "original_file_path": "macros/edr/tests/test_utils/clean_elementary_test_tables.sql", "unique_id": "macro.elementary.get_clean_elementary_test_tables_queries", "macro_sql": "{% macro get_clean_elementary_test_tables_queries(test_table_relations) %}\n {% do return(adapter.dispatch(\"get_clean_elementary_test_tables_queries\", \"elementary\")(test_table_relations)) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.default__get_clean_elementary_test_tables_queries"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.062154, "supported_languages": null}, "macro.elementary.default__get_clean_elementary_test_tables_queries": {"name": "default__get_clean_elementary_test_tables_queries", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/tests/test_utils/clean_elementary_test_tables.sql", "original_file_path": "macros/edr/tests/test_utils/clean_elementary_test_tables.sql", "unique_id": "macro.elementary.default__get_clean_elementary_test_tables_queries", "macro_sql": "{% macro default__get_clean_elementary_test_tables_queries(test_table_relations) %}\n {% do return(elementary.get_transaction_clean_elementary_test_tables_queries(test_table_relations)) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.get_transaction_clean_elementary_test_tables_queries"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.0624382, "supported_languages": null}, "macro.elementary.bigquery__get_clean_elementary_test_tables_queries": {"name": "bigquery__get_clean_elementary_test_tables_queries", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/tests/test_utils/clean_elementary_test_tables.sql", "original_file_path": "macros/edr/tests/test_utils/clean_elementary_test_tables.sql", "unique_id": "macro.elementary.bigquery__get_clean_elementary_test_tables_queries", "macro_sql": "{% macro bigquery__get_clean_elementary_test_tables_queries(test_table_relations) %}\n {% do return(elementary.get_transactionless_clean_elementary_test_tables_queries(test_table_relations)) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.get_transactionless_clean_elementary_test_tables_queries"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.0627139, "supported_languages": null}, "macro.elementary.spark__get_clean_elementary_test_tables_queries": {"name": "spark__get_clean_elementary_test_tables_queries", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/tests/test_utils/clean_elementary_test_tables.sql", "original_file_path": "macros/edr/tests/test_utils/clean_elementary_test_tables.sql", "unique_id": "macro.elementary.spark__get_clean_elementary_test_tables_queries", "macro_sql": "{% macro spark__get_clean_elementary_test_tables_queries(test_table_relations) %}\n {% do return(elementary.get_transactionless_clean_elementary_test_tables_queries(test_table_relations)) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.get_transactionless_clean_elementary_test_tables_queries"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.062988, "supported_languages": null}, "macro.elementary.athena__get_clean_elementary_test_tables_queries": {"name": "athena__get_clean_elementary_test_tables_queries", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/tests/test_utils/clean_elementary_test_tables.sql", "original_file_path": "macros/edr/tests/test_utils/clean_elementary_test_tables.sql", "unique_id": "macro.elementary.athena__get_clean_elementary_test_tables_queries", "macro_sql": "{% macro athena__get_clean_elementary_test_tables_queries(test_table_relations) %}\n {% set queries = [] %}\n {% for test_relation in test_table_relations %}\n {% do queries.append(\"DROP TABLE IF EXISTS {}\".format(test_relation.render_pure())) %}\n {% endfor %}\n {% do return(queries) %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.0635734, "supported_languages": null}, "macro.elementary.get_transaction_clean_elementary_test_tables_queries": {"name": "get_transaction_clean_elementary_test_tables_queries", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/tests/test_utils/clean_elementary_test_tables.sql", "original_file_path": "macros/edr/tests/test_utils/clean_elementary_test_tables.sql", "unique_id": "macro.elementary.get_transaction_clean_elementary_test_tables_queries", "macro_sql": "{% macro get_transaction_clean_elementary_test_tables_queries(test_table_relations) %}\n {% set query %}\n BEGIN TRANSACTION;\n {% for test_relation in test_table_relations %}\n DROP TABLE IF EXISTS {{ test_relation }};\n {% endfor %}\n COMMIT;\n {% endset %}\n {% do return([query]) %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.0640564, "supported_languages": null}, "macro.elementary.get_transactionless_clean_elementary_test_tables_queries": {"name": "get_transactionless_clean_elementary_test_tables_queries", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/tests/test_utils/clean_elementary_test_tables.sql", "original_file_path": "macros/edr/tests/test_utils/clean_elementary_test_tables.sql", "unique_id": "macro.elementary.get_transactionless_clean_elementary_test_tables_queries", "macro_sql": "{% macro get_transactionless_clean_elementary_test_tables_queries(test_table_relations) %}\n {% set queries = [] %}\n {% for test_relation in test_table_relations %}\n {% do queries.append(\"DROP TABLE IF EXISTS {}\".format(test_relation)) %}\n {% endfor %}\n {% do return(queries) %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.064615, "supported_languages": null}, "macro.elementary.snowflake__compile_py_code": {"name": "snowflake__compile_py_code", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/tests/test_utils/compile_py_code.sql", "original_file_path": "macros/edr/tests/test_utils/compile_py_code.sql", "unique_id": "macro.elementary.snowflake__compile_py_code", "macro_sql": "{% macro snowflake__compile_py_code(model, py_code, output_table, where_expression, code_type) %}\nimport pandas\nimport snowflake.snowpark\n\n{{ py_code }}\n\ndef write_output_table(session, output_df, target_relation):\n output_df.write.mode('overwrite').save_as_table(target_relation, table_type='temporary')\n\ndef get_fail_count(test_output):\n if isinstance(test_output, int):\n return test_output\n if isinstance(test_output, bool):\n return 0 if test_output else 1\n if isinstance(test_output, snowflake.snowpark.DataFrame):\n return test_output.count()\n if isinstance(test_output, pandas.DataFrame):\n return len(test_output)\n raise ValueError('Received invalid return value, expected either DataFrame or a boolean.')\n\ndef get_output_df(model_df, code_type, ref, session):\n if code_type == \"test\":\n test_output = test(model_df, ref, session)\n fail_count = get_fail_count(test_output)\n return session.createDataFrame([[fail_count]], ['fail_count'])\n elif code_type == \"function\":\n res = func(model_df, ref, session)\n return session.createDataFrame([[res]], ['result'])\n\n raise Exception(\"Unsupported code type: {}\".format(code_type))\n\ndef main(session):\n ref = session.table\n model_df = ref('{{ model }}')\n\n {% if where_expression %}\n model_df = model_df.filter(\"\"\"{{ where_expression }}\"\"\")\n {% endif %}\n\n output_df = get_output_df(model_df, '{{ code_type }}', ref, session)\n write_output_table(session, output_df, '{{ output_table }}')\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.0666234, "supported_languages": null}, "macro.elementary.bigquery__compile_py_code": {"name": "bigquery__compile_py_code", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/tests/test_utils/compile_py_code.sql", "original_file_path": "macros/edr/tests/test_utils/compile_py_code.sql", "unique_id": "macro.elementary.bigquery__compile_py_code", "macro_sql": "{% macro bigquery__compile_py_code(model, py_code, output_table, where_expression, code_type) %}\nimport pandas\nimport pyspark.sql\n\n{{ py_code }}\n\ndef write_output_table(session, output_df, target_relation):\n output_df.write.mode('overwrite').format('bigquery').option('writeMethod', 'direct').option('writeDisposition', 'WRITE_TRUNCATE').save(target_relation)\n\ndef get_fail_count(test_output):\n if isinstance(test_output, int):\n return test_output\n if isinstance(test_output, bool):\n return 0 if test_output else 1\n if isinstance(test_output, pyspark.sql.DataFrame):\n return test_output.count()\n if isinstance(test_output, pandas.DataFrame):\n return len(test_output)\n raise ValueError('Received invalid return value, expected either DataFrame or a boolean.')\n\ndef get_session():\n session = pyspark.sql.SparkSession.builder.appName('Elementary').getOrCreate()\n session.conf.set('viewsEnabled', 'true')\n session.conf.set('temporaryGcsBucket', '{{ target.gcs_bucket }}')\n return session\n\ndef get_output_df(model_df, code_type, ref, session):\n if code_type == \"test\":\n test_output = test(model_df, ref, session)\n fail_count = get_fail_count(test_output)\n return session.createDataFrame([[fail_count]], ['fail_count'])\n elif code_type == \"function\":\n res = func(model_df, ref, session)\n return session.createDataFrame([[res]], ['result'])\n\n raise Exception(\"Unsupported code type: {}\".format(code_type))\n\ndef main():\n session = get_session()\n ref = session.read.format('bigquery').load\n model_df = ref('{{ model }}')\n\n {% if where_expression %}\n model_df = model_df.filter(\"\"\"{{ where_expression }}\"\"\")\n {% endif %}\n\n output_df = get_output_df(model_df, '{{ code_type }}', ref, session)\n write_output_table(session, output_df, '{{ output_table }}')\n\nmain()\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.0673056, "supported_languages": null}, "macro.elementary.default__compile_py_code": {"name": "default__compile_py_code", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/tests/test_utils/compile_py_code.sql", "original_file_path": "macros/edr/tests/test_utils/compile_py_code.sql", "unique_id": "macro.elementary.default__compile_py_code", "macro_sql": "{% macro default__compile_py_code(model, py_code, output_table, where_expression, code_type) %}\n {{ exceptions.raise_compiler_error(\"Elementary's Python tests are not yet supported on %s.\" % target.type) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.0676486, "supported_languages": null}, "macro.elementary.get_elementary_tests_schema": {"name": "get_elementary_tests_schema", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/tests/test_utils/get_elementary_tests_schema.sql", "original_file_path": "macros/edr/tests/test_utils/get_elementary_tests_schema.sql", "unique_id": "macro.elementary.get_elementary_tests_schema", "macro_sql": "{% macro get_elementary_tests_schema(elementary_database, elementary_schema) %}\n {% set LEGACY_TESTS_SCHEMA_SUFFIX = \"__tests\" %}\n\n {% set cached_tests_schema_name = elementary.get_cache(\"tests_schema_name\") %}\n {% if cached_tests_schema_name is not none %}\n {{ return(cached_tests_schema_name) }}\n {% endif %}\n\n {% set tests_schema_suffix = elementary.get_config_var('tests_schema_name') %}\n {% set tests_schema_name = elementary_schema ~ tests_schema_suffix %}\n\n {# Backward compatibility - if a tests schema suffix is not defined, but the legacy tests schema exists in the DB,\n then use it #}\n {% if not tests_schema_suffix %}\n {% set legacy_tests_schema_name = elementary_schema ~ LEGACY_TESTS_SCHEMA_SUFFIX %}\n {% if adapter.check_schema_exists(elementary_database, legacy_tests_schema_name) %}\n {% set tests_schema_name = legacy_tests_schema_name %}\n {% endif %}\n {% endif %}\n\n {% do elementary.set_cache(\"tests_schema_name\", tests_schema_name) %}\n\n {{ return(tests_schema_name) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.get_cache", "macro.elementary.get_config_var", "macro.elementary.set_cache"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.0693665, "supported_languages": null}, "macro.elementary.create_elementary_test_table": {"name": "create_elementary_test_table", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/tests/test_utils/create_elementary_test_table.sql", "original_file_path": "macros/edr/tests/test_utils/create_elementary_test_table.sql", "unique_id": "macro.elementary.create_elementary_test_table", "macro_sql": "{% macro create_elementary_test_table(database_name, schema_name, test_name, table_type, sql_query) %}\n {% if execute %}\n {% set temp_table_name = elementary.table_name_with_suffix(test_name, \"__\" ~ table_type ~ elementary.get_timestamped_table_suffix()).replace(\"*\", \"\") %}\n \n {% set default_identifier_quoting = api.Relation.get_default_quote_policy().get_part(\"identifier\") %} \n {% if not adapter.config.quoting.get(\"identifier\", default_identifier_quoting) %}\n {% set temp_table_name = adapter.quote(temp_table_name) %}\n {% endif %}\n\n {{ elementary.debug_log(table_type ~ ' table: ' ~ database_name ~ '.' ~ schema_name ~ '.' ~ temp_table_name) }}\n\n {% set _, temp_table_relation = dbt.get_or_create_relation(database=database_name,\n schema=schema_name,\n identifier=temp_table_name,\n type='table') -%}\n\n {# Create the table if it doesn't exist #}\n {%- do elementary.create_or_replace(false, temp_table_relation, sql_query) %}\n\n {# Cache the test table for easy access later #}\n {% set test_entry = elementary.get_cache(\"temp_test_table_relations_map\").setdefault(test_name, {}) %}\n {% do test_entry.update({table_type: temp_table_relation}) %}\n {{ return(temp_table_relation) }}\n {% endif %}\n {{ return(none) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.table_name_with_suffix", "macro.elementary.get_timestamped_table_suffix", "macro.elementary.debug_log", "macro.dbt.get_or_create_relation", "macro.elementary.create_or_replace", "macro.elementary.get_cache"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.0723612, "supported_languages": null}, "macro.elementary.run_python": {"name": "run_python", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/tests/test_utils/run_python.sql", "original_file_path": "macros/edr/tests/test_utils/run_python.sql", "unique_id": "macro.elementary.run_python", "macro_sql": "{% macro run_python(graph_node, code) %}\n {% set macro_stack = context_macro_stack.call_stack %}\n {% set macro_stack_copy = macro_stack.copy() %}\n {% do macro_stack.clear() %}\n {% do macro_stack.extend([[\"materialization\"], \"macro.dbt.statement\"]) %}\n {% do submit_python_job(graph_node, code) %}\n {% do macro_stack.clear() %}\n {% do macro_stack.extend(macro_stack_copy) %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.0734334, "supported_languages": null}, "macro.elementary.get_model_graph_node": {"name": "get_model_graph_node", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/tests/test_utils/get_model_graph_node.sql", "original_file_path": "macros/edr/tests/test_utils/get_model_graph_node.sql", "unique_id": "macro.elementary.get_model_graph_node", "macro_sql": "{% macro get_model_graph_node(model_relation) %}\n {% if execute %}\n {# model here is actually the test node in the graph #}\n {% set test_graph_node = model %}\n {% set test_depends_on_unique_ids = test_graph_node.depends_on.nodes %}\n {# model relation is the relation object of the model where the test is defined #}\n {% set relation_name = model_relation.name | lower %}\n {% set depends_on_nodes = elementary.get_nodes_by_unique_ids(test_depends_on_unique_ids) %}\n {% if depends_on_nodes %}\n {% for node in depends_on_nodes %}\n {% set node_name = node.name | lower %}\n {% set node_alias = node.get('alias', '') | lower %}\n {% set node_identifier = node.get('identifier', '') | lower %}\n {% if node_name == relation_name or node_alias == relation_name or node_identifier == relation_name %}\n {{ return(node) }}\n {% endif %}\n {% endfor %}\n {% endif %}\n {% endif %}\n {{ return(none) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.get_nodes_by_unique_ids"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.0755436, "supported_languages": null}, "macro.elementary.find_normalized_data_type_for_column": {"name": "find_normalized_data_type_for_column", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/tests/test_utils/find_normalized_data_type_for_column.sql", "original_file_path": "macros/edr/tests/test_utils/find_normalized_data_type_for_column.sql", "unique_id": "macro.elementary.find_normalized_data_type_for_column", "macro_sql": "{% macro find_normalized_data_type_for_column(model_relation, column_name) %}\n\n{% set columns_from_relation = adapter.get_columns_in_relation(model_relation) %}\n{% if column_name and columns_from_relation and columns_from_relation is iterable %}\n {% for column_obj in columns_from_relation %}\n {% if column_obj.column | lower == column_name | trim('\\'\\\"\\`') | lower %}\n {{ return(elementary.normalize_data_type(elementary.get_column_data_type(column_obj))) }}\n {% endif %}\n {% endfor %}\n {% do exceptions.raise_compiler_error(\"Column `{}` was not found in `{}`.\".format(column_name, model_relation.name)) %}\n{% endif %}\n{{ return(none) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.normalize_data_type", "macro.elementary.get_column_data_type"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.076982, "supported_languages": null}, "macro.elementary.insert_metrics": {"name": "insert_metrics", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/tests/on_run_end/insert_metrics.sql", "original_file_path": "macros/edr/tests/on_run_end/insert_metrics.sql", "unique_id": "macro.elementary.insert_metrics", "macro_sql": "{% macro insert_metrics() %}\n {% set metrics = elementary.get_cache(\"tables\").get(\"metrics\").get(\"rows\") %}\n {%- set target_relation = elementary.get_elementary_relation('data_monitoring_metrics') -%}\n {% if not target_relation %}\n {% do elementary.warn_missing_elementary_models() %}\n {% do return(none) %}\n {% endif %}\n\n {{ elementary.file_log(\"Inserting {} metrics into {}.\".format(metrics | length, target_relation)) }}\n {% do elementary.insert_rows(target_relation, metrics, should_commit=true, chunk_size=elementary.get_config_var('dbt_artifacts_chunk_size')) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.get_cache", "macro.elementary.get_elementary_relation", "macro.elementary.warn_missing_elementary_models", "macro.elementary.file_log", "macro.elementary.insert_rows", "macro.elementary.get_config_var"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.0783253, "supported_languages": null}, "macro.elementary.union_columns_snapshot_query": {"name": "union_columns_snapshot_query", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/tests/on_run_end/union_columns_snapshot_query.sql", "original_file_path": "macros/edr/tests/on_run_end/union_columns_snapshot_query.sql", "unique_id": "macro.elementary.union_columns_snapshot_query", "macro_sql": "{% macro union_columns_snapshot_query(temp_columns_snapshot_tables) %}\n {%- if temp_columns_snapshot_tables | length > 0 %}\n {%- set union_temp_query -%}\n with union_temp_columns_snapshot as (\n {%- for temp_table in temp_columns_snapshot_tables -%}\n select * from {{ temp_table }}\n {%- if not loop.last %} union all {% endif %}\n {%- endfor %}\n ),\n columns_snapshot_with_duplicates as (\n select *,\n row_number() over (partition by column_state_id order by detected_at desc) as row_number\n from union_temp_columns_snapshot\n )\n select\n column_state_id,\n full_column_name,\n full_table_name,\n column_name,\n data_type,\n is_new,\n detected_at\n from columns_snapshot_with_duplicates\n where row_number = 1\n {%- endset %}\n {{ return(union_temp_query) }}\n {%- endif %}\n {{ return(none) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.079656, "supported_languages": null}, "macro.elementary.union_metrics_query": {"name": "union_metrics_query", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/tests/on_run_end/union_metrics_query.sql", "original_file_path": "macros/edr/tests/on_run_end/union_metrics_query.sql", "unique_id": "macro.elementary.union_metrics_query", "macro_sql": "{% macro union_metrics_query(temp_metrics_tables) %}\n {%- if temp_metrics_tables | length > 0 %}\n {%- set union_temp_query -%}\n with union_temps_metrics as (\n {%- for temp_table in temp_metrics_tables -%}\n select * from {{ temp_table }}\n {%- if not loop.last %} union all {% endif %}\n {%- endfor %}\n ),\n metrics_with_duplicates as (\n select *,\n row_number() over (partition by id order by updated_at desc) as row_number\n from union_temps_metrics\n )\n select\n id,\n full_table_name,\n column_name,\n metric_name,\n metric_value,\n source_value,\n bucket_start,\n bucket_end,\n bucket_duration_hours,\n updated_at,\n dimension,\n dimension_value,\n metric_properties\n from metrics_with_duplicates\n where row_number = 1\n {%- endset %}\n {{ return(union_temp_query) }}\n {%- endif %}\n {{ return(none) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.081105, "supported_languages": null}, "macro.elementary.handle_tests_results": {"name": "handle_tests_results", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/tests/on_run_end/handle_tests_results.sql", "original_file_path": "macros/edr/tests/on_run_end/handle_tests_results.sql", "unique_id": "macro.elementary.handle_tests_results", "macro_sql": "{% macro handle_tests_results() %}\n {{ elementary.file_log(\"Handling test results.\") }}\n {% set cached_elementary_test_results = elementary.get_cache(\"elementary_test_results\") %}\n {% set cached_elementary_test_failed_row_counts = elementary.get_cache(\"elementary_test_failed_row_counts\") %}\n {% set store_result_rows_in_own_table = elementary.get_config_var(\"store_result_rows_in_own_table\") %}\n {% set elementary_test_results = elementary.get_result_enriched_elementary_test_results(cached_elementary_test_results, cached_elementary_test_failed_row_counts, render_result_rows=(not store_result_rows_in_own_table)) %}\n {% if store_result_rows_in_own_table %}\n {% set test_result_rows = elementary.pop_test_result_rows(elementary_test_results) %}\n {% endif %}\n {% set tables_cache = elementary.get_cache(\"tables\") %}\n {% set test_metrics_tables = tables_cache.get(\"metrics\").get(\"relations\") %}\n {% set test_columns_snapshot_tables = tables_cache.get(\"schema_snapshots\") %}\n {% set database_name, schema_name = elementary.get_package_database_and_schema('elementary') %}\n {% do elementary.insert_data_monitoring_metrics(database_name, schema_name, test_metrics_tables) %}\n {% do elementary.insert_schema_columns_snapshot(database_name, schema_name, test_columns_snapshot_tables) %}\n {% if test_result_rows %}\n {% set test_result_rows_relation = elementary.get_elementary_relation('test_result_rows') %}\n {% do elementary.insert_rows(test_result_rows_relation, test_result_rows, should_commit=True, chunk_size=elementary.get_config_var('dbt_artifacts_chunk_size')) %}\n {% endif %}\n {% if elementary_test_results %}\n {% set elementary_test_results_relation = elementary.get_elementary_relation('elementary_test_results') %}\n {% do elementary.insert_rows(elementary_test_results_relation, elementary_test_results, should_commit=True, chunk_size=elementary.get_config_var('dbt_artifacts_chunk_size')) %}\n {% endif %}\n {% do elementary.file_log(\"Handled test results successfully.\") %}\n {% do return('') %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.file_log", "macro.elementary.get_cache", "macro.elementary.get_config_var", "macro.elementary.get_result_enriched_elementary_test_results", "macro.elementary.pop_test_result_rows", "macro.elementary.get_package_database_and_schema", "macro.elementary.insert_data_monitoring_metrics", "macro.elementary.insert_schema_columns_snapshot", "macro.elementary.get_elementary_relation", "macro.elementary.insert_rows"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.0920951, "supported_languages": null}, "macro.elementary.get_result_enriched_elementary_test_results": {"name": "get_result_enriched_elementary_test_results", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/tests/on_run_end/handle_tests_results.sql", "original_file_path": "macros/edr/tests/on_run_end/handle_tests_results.sql", "unique_id": "macro.elementary.get_result_enriched_elementary_test_results", "macro_sql": "{% macro get_result_enriched_elementary_test_results(cached_elementary_test_results, cached_elementary_test_failed_row_counts, render_result_rows=false) %}\n {% set elementary_test_results = [] %}\n\n {% for result in results | selectattr('node.resource_type', '==', 'test') %}\n {% set result = result.to_dict() %}\n {% set elementary_test_results_rows = cached_elementary_test_results.get(result.node.unique_id) %}\n {% set elementary_test_failed_row_count = cached_elementary_test_failed_row_counts.get(result.node.unique_id) %}\n\n {# Materializing the test failed and therefore was not added to the cache. #}\n {% if not elementary_test_results_rows %}\n {% set flattened_test = elementary.flatten_test(result.node) %}\n {% set elementary_test_results_rows = [elementary.get_dbt_test_result_row(flattened_test)] %}\n {% endif %}\n\n {% for elementary_test_results_row in elementary_test_results_rows %}\n {% set failures = elementary_test_results_row.get(\"failures\", result.failures) %}\n {% set status = \"pass\" if failures == 0 else result.status %}\n {% do elementary_test_results_row.update({'status': status, 'failures': failures, 'invocation_id': invocation_id, \n 'failed_row_count': elementary_test_failed_row_count}) %}\n {% do elementary_test_results_row.setdefault('test_results_description', result.message) %}\n {% if render_result_rows %}\n {% do elementary_test_results_row.update({\"result_rows\": elementary.render_result_rows(elementary_test_results_row.result_rows)}) %}\n {% endif %}\n {% do elementary_test_results.append(elementary_test_results_row) %}\n {% endfor %}\n {% endfor %}\n\n {% do return(elementary_test_results) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.flatten_test", "macro.elementary.get_dbt_test_result_row", "macro.elementary.render_result_rows"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.0949092, "supported_languages": null}, "macro.elementary.insert_data_monitoring_metrics": {"name": "insert_data_monitoring_metrics", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/tests/on_run_end/handle_tests_results.sql", "original_file_path": "macros/edr/tests/on_run_end/handle_tests_results.sql", "unique_id": "macro.elementary.insert_data_monitoring_metrics", "macro_sql": "{% macro insert_data_monitoring_metrics(database_name, schema_name, test_metrics_tables) %}\n {%- if not test_metrics_tables %}\n {% do return(none) %}\n {% endif %}\n\n {%- set test_tables_union_query = elementary.union_metrics_query(test_metrics_tables) -%}\n {% if not test_tables_union_query %}\n {% do return(none) %}\n {% endif %}\n\n {%- set target_relation = elementary.get_elementary_relation('data_monitoring_metrics') -%}\n {% if not target_relation %}\n {% do elementary.raise_missing_elementary_models() %}\n {% endif %}\n\n {%- set temp_relation = elementary.make_temp_view_relation(target_relation) -%}\n {% set insert_query %}\n INSERT INTO {{ target_relation }} (\n id,\n full_table_name,\n column_name,\n metric_name,\n metric_value,\n source_value,\n bucket_start,\n bucket_end,\n bucket_duration_hours,\n updated_at,\n dimension,\n dimension_value,\n metric_properties,\n created_at\n )\n SELECT\n id,\n full_table_name,\n column_name,\n metric_name,\n metric_value,\n source_value,\n bucket_start,\n bucket_end,\n bucket_duration_hours,\n updated_at,\n dimension,\n dimension_value,\n metric_properties,\n {{ elementary.edr_current_timestamp() }} as created_at\n FROM {{ temp_relation }}\n {% endset %}\n\n {{ elementary.file_log(\"Inserting metrics into {}.\".format(target_relation)) }}\n {%- do elementary.run_query(dbt.create_table_as(True, temp_relation, test_tables_union_query)) %}\n {% do elementary.run_query(insert_query) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.union_metrics_query", "macro.elementary.get_elementary_relation", "macro.elementary.raise_missing_elementary_models", "macro.elementary.make_temp_view_relation", "macro.elementary.edr_current_timestamp", "macro.elementary.file_log", "macro.elementary.run_query", "macro.dbt.create_table_as"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.0965474, "supported_languages": null}, "macro.elementary.insert_schema_columns_snapshot": {"name": "insert_schema_columns_snapshot", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/tests/on_run_end/handle_tests_results.sql", "original_file_path": "macros/edr/tests/on_run_end/handle_tests_results.sql", "unique_id": "macro.elementary.insert_schema_columns_snapshot", "macro_sql": "{% macro insert_schema_columns_snapshot(database_name, schema_name, test_columns_snapshot_tables) %}\n {%- if not test_columns_snapshot_tables %}\n {% do return(none) %}\n {% endif %}\n\n {%- set test_tables_union_query = elementary.union_columns_snapshot_query(test_columns_snapshot_tables) -%}\n {% if not test_tables_union_query %}\n {% do return(none) %}\n {% endif %}\n\n {%- set target_relation = elementary.get_elementary_relation('schema_columns_snapshot') -%}\n {% if not target_relation %}\n {% do elementary.raise_missing_elementary_models() %}\n {% endif %}\n\n {%- set temp_relation = elementary.make_temp_view_relation(target_relation) -%}\n {% set insert_query %}\n INSERT INTO {{ target_relation }} (\n column_state_id,\n full_column_name,\n full_table_name,\n column_name,\n data_type,\n is_new,\n detected_at,\n created_at\n )\n SELECT\n column_state_id,\n full_column_name,\n full_table_name,\n column_name,\n data_type,\n is_new,\n detected_at,\n {{ elementary.edr_current_timestamp() }} as created_at\n FROM {{ temp_relation }}\n {% endset %}\n\n {{ elementary.file_log(\"Inserting schema columns snapshot into {}.\".format(target_relation)) }}\n {%- do elementary.run_query(dbt.create_table_as(True, temp_relation, test_tables_union_query)) %}\n {% do elementary.run_query(insert_query) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.union_columns_snapshot_query", "macro.elementary.get_elementary_relation", "macro.elementary.raise_missing_elementary_models", "macro.elementary.make_temp_view_relation", "macro.elementary.edr_current_timestamp", "macro.elementary.file_log", "macro.elementary.run_query", "macro.dbt.create_table_as"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.098178, "supported_languages": null}, "macro.elementary.pop_test_result_rows": {"name": "pop_test_result_rows", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/tests/on_run_end/handle_tests_results.sql", "original_file_path": "macros/edr/tests/on_run_end/handle_tests_results.sql", "unique_id": "macro.elementary.pop_test_result_rows", "macro_sql": "{% macro pop_test_result_rows(elementary_test_results) %}\n {% set result_rows = [] %}\n {% for test_result in elementary_test_results %}\n {% for result_row in test_result.pop('result_rows', []) %}\n {% do result_rows.append({\n \"elementary_test_results_id\": test_result.id,\n \"detected_at\": test_result.detected_at,\n \"result_row\": result_row\n }) %}\n {% endfor %}\n {% endfor %}\n {% do return(result_rows) %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.0990217, "supported_languages": null}, "macro.elementary.render_result_rows": {"name": "render_result_rows", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/tests/on_run_end/handle_tests_results.sql", "original_file_path": "macros/edr/tests/on_run_end/handle_tests_results.sql", "unique_id": "macro.elementary.render_result_rows", "macro_sql": "{% macro render_result_rows(test_result_rows) %}\n {% set column_size = elementary.get_column_size() %}\n {% if not column_size or (tojson(test_result_rows) | length) < column_size %}\n {% do return(test_result_rows) %}\n {% endif %}\n {% do return(none) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.get_column_size"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.0996408, "supported_languages": null}, "macro.elementary.get_last_schema_changes_time": {"name": "get_last_schema_changes_time", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/data_monitoring/schema_changes/get_last_schema_changes_time.sql", "original_file_path": "macros/edr/data_monitoring/schema_changes/get_last_schema_changes_time.sql", "unique_id": "macro.elementary.get_last_schema_changes_time", "macro_sql": "{% macro get_last_schema_changes_time() %}\n -- depends_on: {{ ref('elementary_test_results') }}\n {%- if execute -%}\n {%- set last_schema_changes_time_query %}\n select max(detected_at) as last_alert_time\n from {{ ref('elementary_test_results') }}\n where test_type = 'schema_change' and test_sub_type != 'table_added'\n {%- endset %}\n\n {%- set last_schema_changes_query_result = elementary.result_value(last_schema_changes_time_query) %}\n\n {%- if last_schema_changes_query_result %}\n {{ return(last_schema_changes_query_result) }}\n {%- else %}\n {{ return(none) }}\n {%- endif %}\n {%- endif -%}\n {{- return(none) -}}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.result_value"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.1008415, "supported_languages": null}, "macro.elementary.get_columns_snapshot_query": {"name": "get_columns_snapshot_query", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/data_monitoring/schema_changes/get_columns_snapshot_query.sql", "original_file_path": "macros/edr/data_monitoring/schema_changes/get_columns_snapshot_query.sql", "unique_id": "macro.elementary.get_columns_snapshot_query", "macro_sql": "{% macro get_columns_snapshot_query(model_relation, full_table_name) %}\n {%- set schema_columns_snapshot_relation = elementary.get_elementary_relation('schema_columns_snapshot') %}\n {%- set known_columns_query %}\n select full_column_name from {{ schema_columns_snapshot_relation }}\n where detected_at = (select max(detected_at) from {{ schema_columns_snapshot_relation }} where lower(full_table_name) = lower('{{ full_table_name }}'))\n and lower(full_table_name) = lower('{{ full_table_name }}')\n {% endset %}\n\n {%- set known_tables_query %}\n select distinct full_table_name from {{ schema_columns_snapshot_relation }}\n where detected_at = (select max(detected_at) from {{ schema_columns_snapshot_relation }} where lower(full_table_name) = lower('{{ full_table_name }}'))\n and lower(full_table_name) = lower('{{ full_table_name }}')\n {% endset %}\n\n {% set columns = adapter.get_columns_in_relation(model_relation) %}\n\n with table_info as (\n select\n {{ elementary.edr_cast_as_string(elementary.edr_quote(full_table_name)) }} as full_table_name,\n {{ elementary.edr_cast_as_string(elementary.edr_quote(model_relation.database)) }} as database_name,\n {{ elementary.edr_cast_as_string(elementary.edr_quote(model_relation.schema)) }} as schema_name,\n {{ elementary.edr_cast_as_string(elementary.edr_quote(model_relation.identifier)) }} as table_name,\n {{ elementary.datetime_now_utc_as_timestamp_column() }} as detected_at\n ),\n\n columns_info as (\n select\n full_table_name,\n database_name,\n schema_name,\n table_name,\n column_name,\n data_type,\n detected_at\n from table_info\n cross join\n (\n {% for column in columns %}\n select\n {{ elementary.edr_cast_as_string(elementary.edr_quote(column.name)) }} as column_name,\n {{ elementary.edr_cast_as_string(elementary.edr_quote(elementary.get_normalized_data_type(elementary.get_column_data_type(column)))) }} as data_type\n {% if not loop.last %}\n union all\n {% endif %}\n {% endfor %}\n ) rt\n ),\n\n columns_snapshot as (\n select\n full_table_name,\n database_name,\n schema_name,\n table_name,\n column_name,\n data_type,\n detected_at,\n case when\n {{ elementary.full_column_name() }} not in ({{ known_columns_query }})\n and full_table_name in ({{ known_tables_query }})\n then true\n else false\n end as is_new\n from columns_info\n ),\n\n columns_snapshot_with_id as (\n select\n {{ elementary.generate_surrogate_key([\n 'full_table_name',\n 'column_name',\n 'data_type',\n ]) }} as column_state_id,\n {{ elementary.full_column_name() }} as full_column_name,\n full_table_name,\n column_name,\n data_type,\n is_new,\n detected_at\n from columns_snapshot\n group by 1,2,3,4,5,6,7\n )\n\n select\n {{ elementary.edr_cast_as_string('column_state_id') }} as column_state_id,\n {{ elementary.edr_cast_as_string('full_column_name') }} as full_column_name,\n {{ elementary.edr_cast_as_string('full_table_name') }} as full_table_name,\n {{ elementary.edr_cast_as_string('column_name') }} as column_name,\n {{ elementary.edr_cast_as_string('data_type') }} as data_type,\n {{ elementary.edr_cast_as_bool('is_new') }} as is_new,\n {{ elementary.edr_cast_as_timestamp('detected_at') }} as detected_at\n from columns_snapshot_with_id\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.elementary.get_elementary_relation", "macro.elementary.edr_cast_as_string", "macro.elementary.edr_quote", "macro.elementary.datetime_now_utc_as_timestamp_column", "macro.elementary.get_normalized_data_type", "macro.elementary.get_column_data_type", "macro.elementary.full_column_name", "macro.elementary.generate_surrogate_key", "macro.elementary.edr_cast_as_bool", "macro.elementary.edr_cast_as_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.1081705, "supported_languages": null}, "macro.elementary.get_columns_changes_from_last_run_query": {"name": "get_columns_changes_from_last_run_query", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/data_monitoring/schema_changes/get_columns_changes_query.sql", "original_file_path": "macros/edr/data_monitoring/schema_changes/get_columns_changes_query.sql", "unique_id": "macro.elementary.get_columns_changes_from_last_run_query", "macro_sql": "{% macro get_columns_changes_from_last_run_query(full_table_name, temp_columns_snapshot_relation) %}\n {%- set schema_columns_snapshot_relation = elementary.get_elementary_relation('schema_columns_snapshot') %}\n {%- set previous_schema_time_query -%}\n (select max(detected_at) from {{ schema_columns_snapshot_relation }} where lower(full_table_name) = lower('{{ full_table_name }}'))\n {%- endset %}\n\n {% set cur %}\n {# This is the current snapshot of the columns. #}\n select full_table_name, column_name, data_type, is_new, detected_at\n from {{ temp_columns_snapshot_relation }}\n {% endset %}\n\n {% set pre %}\n {# This is the previous snapshot of the columns. #}\n select full_table_name, column_name, data_type, detected_at\n from {{ schema_columns_snapshot_relation }}\n where lower(full_table_name) = lower('{{ full_table_name }}')\n and detected_at = {{ previous_schema_time_query }}\n order by detected_at desc\n {% endset %}\n\n {{ elementary.get_columns_changes_query_generic(full_table_name, cur, pre) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.get_elementary_relation", "macro.elementary.get_columns_changes_query_generic"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.1119025, "supported_languages": null}, "macro.elementary.get_column_changes_from_baseline_query": {"name": "get_column_changes_from_baseline_query", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/data_monitoring/schema_changes/get_columns_changes_query.sql", "original_file_path": "macros/edr/data_monitoring/schema_changes/get_columns_changes_query.sql", "unique_id": "macro.elementary.get_column_changes_from_baseline_query", "macro_sql": "{% macro get_column_changes_from_baseline_query(model_relation, full_table_name, model_baseline_relation, include_added=False) %}\n {% set cur %}\n with baseline as (\n select lower(column_name) as column_name, data_type\n from {{ model_baseline_relation }}\n )\n\n select\n columns_snapshot.full_table_name,\n lower(columns_snapshot.column_name) as column_name,\n columns_snapshot.data_type,\n (baseline.column_name IS NULL) as is_new,\n {{ elementary.datetime_now_utc_as_timestamp_column() }} as detected_at\n from ({{ elementary.get_columns_snapshot_query(model_relation, full_table_name) }}) columns_snapshot\n left join baseline on (\n lower(columns_snapshot.column_name) = lower(baseline.column_name)\n )\n where lower(columns_snapshot.full_table_name) = lower('{{ full_table_name }}')\n {% endset %}\n\n {% set pre %}\n select\n {{ elementary.const_as_string(full_table_name) }} as full_table_name,\n column_name,\n data_type,\n {{ elementary.datetime_now_utc_as_timestamp_column() }} as detected_at\n from {{ model_baseline_relation }}\n {% endset %}\n\n {{ elementary.get_columns_changes_query_generic(full_table_name, cur, pre, include_added=include_added) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.datetime_now_utc_as_timestamp_column", "macro.elementary.get_columns_snapshot_query", "macro.elementary.const_as_string", "macro.elementary.get_columns_changes_query_generic"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.1129403, "supported_languages": null}, "macro.elementary.get_columns_changes_query_generic": {"name": "get_columns_changes_query_generic", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/data_monitoring/schema_changes/get_columns_changes_query.sql", "original_file_path": "macros/edr/data_monitoring/schema_changes/get_columns_changes_query.sql", "unique_id": "macro.elementary.get_columns_changes_query_generic", "macro_sql": "{% macro get_columns_changes_query_generic(full_table_name, cur, pre, include_added=True) %}\n {%- set test_execution_id = elementary.get_test_execution_id() %}\n {%- set test_unique_id = elementary.get_test_unique_id() %}\n\n with cur as (\n {{ cur }}\n ),\n\n pre as (\n {{ pre }}\n ),\n\n type_changes as (\n\n {# Finding the columns that have changed type. #}\n select\n cur.full_table_name,\n 'type_changed' as change,\n cur.column_name,\n cur.data_type as data_type,\n pre.data_type as pre_data_type,\n pre.detected_at\n from cur inner join pre\n on (lower(cur.full_table_name) = lower(pre.full_table_name) and lower(cur.column_name) = lower(pre.column_name))\n where pre.data_type IS NOT NULL AND lower(cur.data_type) != lower(pre.data_type)\n\n ),\n\n {% if include_added %}\n columns_added as (\n\n {# This is the columns that have been added. #}\n select\n full_table_name,\n 'column_added' as change,\n column_name,\n data_type,\n {{ elementary.null_string() }} as pre_data_type,\n detected_at as detected_at\n from cur\n where is_new = true\n\n ),\n {% endif %}\n\n columns_removed as (\n\n {# This is finding the columns that have been removed. #}\n select\n pre.full_table_name,\n 'column_removed' as change,\n pre.column_name as column_name,\n {{ elementary.null_string() }} as data_type,\n pre.data_type as pre_data_type,\n pre.detected_at as detected_at\n from pre left join cur\n on (lower(cur.full_table_name) = lower(pre.full_table_name) and lower(cur.column_name) = lower(pre.column_name))\n where cur.full_table_name is null and cur.column_name is null\n\n ),\n\n columns_removed_filter_deleted_tables as (\n\n {# This is filtering out the columns of tables that have been deleted. #}\n select\n removed.full_table_name,\n removed.change,\n removed.column_name,\n removed.data_type,\n removed.pre_data_type,\n removed.detected_at\n from columns_removed as removed join cur\n on (lower(removed.full_table_name) = lower(cur.full_table_name))\n\n ),\n\n all_column_changes as (\n\n {# Combining the results of the three queries into one table. #}\n select * from type_changes\n union all\n select * from columns_removed_filter_deleted_tables\n {% if include_added %}\n union all\n select * from columns_added\n {% endif %}\n ),\n\n column_changes_test_results as (\n\n {# This is the query that is creating the test results table, by formatting a description and adding id + detection time #}\n select\n {{ elementary.generate_surrogate_key([\n 'full_table_name',\n 'column_name',\n 'change',\n 'detected_at',\n ]) }} as data_issue_id,\n {{ elementary.datetime_now_utc_as_timestamp_column() }} as detected_at,\n {{ elementary.full_name_split('database_name') }},\n {{ elementary.full_name_split('schema_name') }},\n {{ elementary.full_name_split('table_name') }},\n column_name,\n 'schema_change' as test_type,\n change as test_sub_type,\n case\n when change = 'column_added'\n then 'The column \"' || column_name || '\" was added'\n when change= 'column_removed'\n then 'The column \"' || column_name || '\" was removed'\n when change= 'type_changed'\n then 'The type of \"' || column_name || '\" was changed from ' || pre_data_type || ' to ' || data_type\n else NULL\n end as test_results_description\n from all_column_changes\n {{ dbt_utils.group_by(9) }}\n\n )\n\n {# Creating a unique id for each row in the table, and adding execution id #}\n select {{ elementary.generate_surrogate_key([\n 'data_issue_id',\n elementary.const_as_string(test_execution_id)\n ]) }} as id,\n {{ elementary.const_as_string(test_execution_id) }} as test_execution_id,\n {{ elementary.const_as_string(test_unique_id) }} as test_unique_id,\n *\n from column_changes_test_results\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.elementary.get_test_execution_id", "macro.elementary.get_test_unique_id", "macro.elementary.null_string", "macro.elementary.generate_surrogate_key", "macro.elementary.datetime_now_utc_as_timestamp_column", "macro.elementary.full_name_split", "macro.dbt_utils.group_by", "macro.elementary.const_as_string"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.1149435, "supported_languages": null}, "macro.elementary.get_anomaly_scores_query": {"name": "get_anomaly_scores_query", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/data_monitoring/anomaly_detection/get_anomaly_scores_query.sql", "original_file_path": "macros/edr/data_monitoring/anomaly_detection/get_anomaly_scores_query.sql", "unique_id": "macro.elementary.get_anomaly_scores_query", "macro_sql": "{% macro get_anomaly_scores_query(test_metrics_table_relation, model_relation, test_configuration, monitors, column_name = none, columns_only = false, metric_properties = none, data_monitoring_metrics_table=none) %}\n {%- set model_graph_node = elementary.get_model_graph_node(model_relation) %}\n {%- set full_table_name = elementary.model_node_to_full_name(model_graph_node) %}\n {%- set test_execution_id = elementary.get_test_execution_id() %}\n {%- set test_unique_id = elementary.get_test_unique_id() %}\n {%- if not data_monitoring_metrics_table %}\n {# data_monitoring_metrics_table is none except for integration-tests that test the get_anomaly_scores_query macro,\n and in which case it holds mock history metrics #}\n {%- set data_monitoring_metrics_table = elementary.get_elementary_relation('data_monitoring_metrics') %}\n {%- endif %}\n\n {%- if elementary.is_incremental_model(model_graph_node) %}\n {%- set latest_full_refresh = elementary.get_latest_full_refresh(model_graph_node) %}\n {%- else %}\n {%- set latest_full_refresh = none %}\n {%- endif %}\n\n {%- if test_configuration.seasonality == 'day_of_week' %}\n {%- set bucket_seasonality_expr = elementary.edr_day_of_week_expression('bucket_end') %}\n\n {%- elif test_configuration.seasonality == 'hour_of_day' %}\n {%- set bucket_seasonality_expr = elementary.edr_hour_of_day_expression('bucket_end') %}\n\n {%- elif test_configuration.seasonality == 'hour_of_week' %}\n {%- set bucket_seasonality_expr = elementary.edr_hour_of_week_expression('bucket_end') %}\n\n {%- else %}\n {%- set bucket_seasonality_expr = elementary.const_as_text('no_seasonality') %}\n {%- endif %}\n {%- set detection_end = elementary.get_detection_end(test_configuration.detection_delay) %}\n {%- set min_bucket_start_expr = elementary.get_trunc_min_bucket_start_expr(detection_end, metric_properties, test_configuration.days_back) %}\n\n {# For timestamped tests, this will be the bucket start, and for non-timestamped tests it will be the\n bucket end (which is the actual time of the test) #}\n {%- set metric_time_bucket_expr = 'case when bucket_start is not null then bucket_start else bucket_end end' %}\n\n {%- set anomaly_scores_query %}\n {% if test_configuration.timestamp_column %}\n with buckets as (\n select edr_bucket_start, edr_bucket_end\n from ({{ elementary.complete_buckets_cte(metric_properties, min_bucket_start_expr,\n elementary.edr_quote(detection_end)) }}) results\n where edr_bucket_start >= {{ elementary.edr_cast_as_timestamp(min_bucket_start_expr) }}\n and edr_bucket_end <= {{ elementary.edr_cast_as_timestamp(elementary.edr_quote(detection_end)) }}\n ),\n {% else %}\n with\n {% endif %}\n data_monitoring_metrics as (\n\n select\n id,\n full_table_name,\n column_name,\n metric_name,\n metric_value,\n source_value,\n bucket_start,\n bucket_end,\n bucket_duration_hours,\n updated_at,\n dimension,\n dimension_value,\n metric_properties\n from {{ data_monitoring_metrics_table }}\n -- We use bucket_end because non-timestamp tests have only bucket_end field.\n where\n bucket_end > {{ min_bucket_start_expr }}\n {% if test_configuration.timestamp_column %}\n -- For timestamped tests, verify that the bucket we got from the history is actually\n -- a valid one (this check is important for buckets that are not aligned with a day).\n and {{ elementary.edr_multi_value_in(\n [elementary.edr_cast_as_timestamp('bucket_start'), elementary.edr_cast_as_timestamp('bucket_end')],\n ['edr_bucket_start', 'edr_bucket_end'],\n 'buckets'\n ) }}\n {% endif %}\n and metric_properties = {{ elementary.dict_to_quoted_json(metric_properties) }}\n {% if latest_full_refresh %}\n and updated_at > {{ elementary.edr_cast_as_timestamp(elementary.edr_quote(latest_full_refresh)) }}\n {% endif %}\n and upper(full_table_name) = upper('{{ full_table_name }}')\n and metric_name in {{ elementary.strings_list_to_tuple(monitors) }}\n {%- if column_name %}\n and upper(column_name) = upper('{{ column_name }}')\n {%- endif %}\n {%- if columns_only %}\n and column_name is not null\n {%- endif %}\n {% if test_configuration.dimensions %}\n and dimension = {{ elementary.edr_quote(elementary.join_list(test_configuration.dimensions, '; ')) }}\n {% endif %}\n ),\n\n union_metrics as (\n\n select * from data_monitoring_metrics\n union all\n select * from {{ test_metrics_table_relation }}\n\n ),\n\n grouped_metrics_duplicates as (\n\n select\n id,\n full_table_name,\n column_name,\n metric_name,\n metric_value,\n source_value,\n bucket_start,\n bucket_end,\n bucket_duration_hours,\n updated_at,\n dimension,\n dimension_value,\n\n -- Fields added for the anomaly_exclude_metrics expression used below\n {{ metric_time_bucket_expr }} as metric_time_bucket,\n {{ elementary.edr_cast_as_date(elementary.edr_date_trunc('day', metric_time_bucket_expr))}} as metric_date,\n\n row_number() over (partition by id order by updated_at desc) as row_number\n from union_metrics\n\n ),\n\n grouped_metrics as (\n\n select\n id as metric_id,\n full_table_name,\n column_name,\n dimension,\n dimension_value,\n metric_name,\n metric_value,\n source_value,\n bucket_start,\n bucket_end,\n {{ bucket_seasonality_expr }} as bucket_seasonality,\n {{ test_configuration.anomaly_exclude_metrics or 'FALSE' }} as is_excluded,\n bucket_duration_hours,\n updated_at\n from grouped_metrics_duplicates\n where row_number = 1\n ),\n\n time_window_aggregation as (\n\n select\n metric_id,\n full_table_name,\n column_name,\n dimension,\n dimension_value,\n metric_name,\n metric_value,\n source_value,\n bucket_start,\n bucket_end,\n bucket_seasonality,\n bucket_duration_hours,\n updated_at,\n avg(metric_value) over (partition by metric_name, full_table_name, column_name, dimension, dimension_value, bucket_seasonality order by bucket_end asc rows between unbounded preceding and current row) as training_avg,\n stddev(metric_value) over (partition by metric_name, full_table_name, column_name, dimension, dimension_value, bucket_seasonality order by bucket_end asc rows between unbounded preceding and current row) as training_stddev,\n count(metric_value) over (partition by metric_name, full_table_name, column_name, dimension, dimension_value, bucket_seasonality order by bucket_end asc rows between unbounded preceding and current row) as training_set_size,\n last_value(bucket_end) over (partition by metric_name, full_table_name, column_name, dimension, dimension_value, bucket_seasonality order by bucket_end asc rows between unbounded preceding and current row) training_end,\n first_value(bucket_end) over (partition by metric_name, full_table_name, column_name, dimension, dimension_value, bucket_seasonality order by bucket_end asc rows between unbounded preceding and current row) as training_start\n from grouped_metrics\n where not is_excluded\n {{ dbt_utils.group_by(13) }}\n ),\n\n anomaly_scores as (\n\n select\n {{ elementary.generate_surrogate_key([\n 'metric_id',\n elementary.const_as_string(test_execution_id)\n ]) }} as id,\n metric_id,\n {{ elementary.const_as_string(test_execution_id) }} as test_execution_id,\n {{ elementary.const_as_string(test_unique_id) }} as test_unique_id,\n {{ elementary.current_timestamp_column() }} as detected_at,\n full_table_name,\n column_name,\n metric_name,\n case\n when training_stddev is null then null\n when training_stddev = 0 then 0\n else (metric_value - training_avg) / (training_stddev)\n end as anomaly_score,\n {{ test_configuration.anomaly_sensitivity }} as anomaly_score_threshold,\n source_value as anomalous_value,\n {{ elementary.edr_cast_as_timestamp('bucket_start') }} as bucket_start,\n {{ elementary.edr_cast_as_timestamp('bucket_end') }} as bucket_end,\n bucket_seasonality,\n metric_value,\n \n {% set limit_values = elementary.get_limit_metric_values(test_configuration) %}\n case\n when training_stddev is null then null\n when {{ limit_values.min_metric_value }} > 0 or metric_name in {{ elementary.to_sql_list(elementary.get_negative_value_supported_metrics()) }} then {{ limit_values.min_metric_value }}\n else 0\n end as min_metric_value,\n case \n when training_stddev is null then null\n else {{ limit_values.max_metric_value }}\n end as max_metric_value,\n training_avg,\n training_stddev,\n training_set_size,\n {{ elementary.edr_cast_as_timestamp('training_start') }} as training_start,\n {{ elementary.edr_cast_as_timestamp('training_end') }} as training_end,\n dimension,\n dimension_value\n from time_window_aggregation\n where\n metric_value is not null\n and training_avg is not null\n )\n\n select * from anomaly_scores\n\n {% endset %}\n {{ return(anomaly_scores_query) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.get_model_graph_node", "macro.elementary.model_node_to_full_name", "macro.elementary.get_test_execution_id", "macro.elementary.get_test_unique_id", "macro.elementary.get_elementary_relation", "macro.elementary.is_incremental_model", "macro.elementary.get_latest_full_refresh", "macro.elementary.edr_day_of_week_expression", "macro.elementary.edr_hour_of_day_expression", "macro.elementary.edr_hour_of_week_expression", "macro.elementary.const_as_text", "macro.elementary.get_detection_end", "macro.elementary.get_trunc_min_bucket_start_expr", "macro.elementary.complete_buckets_cte", "macro.elementary.edr_quote", "macro.elementary.edr_cast_as_timestamp", "macro.elementary.edr_multi_value_in", "macro.elementary.dict_to_quoted_json", "macro.elementary.strings_list_to_tuple", "macro.elementary.join_list", "macro.elementary.edr_cast_as_date", "macro.elementary.edr_date_trunc", "macro.dbt_utils.group_by", "macro.elementary.generate_surrogate_key", "macro.elementary.const_as_string", "macro.elementary.current_timestamp_column", "macro.elementary.get_limit_metric_values", "macro.elementary.to_sql_list", "macro.elementary.get_negative_value_supported_metrics"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.13809, "supported_languages": null}, "macro.elementary.get_negative_value_supported_metrics": {"name": "get_negative_value_supported_metrics", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/data_monitoring/anomaly_detection/get_anomaly_scores_query.sql", "original_file_path": "macros/edr/data_monitoring/anomaly_detection/get_anomaly_scores_query.sql", "unique_id": "macro.elementary.get_negative_value_supported_metrics", "macro_sql": "{% macro get_negative_value_supported_metrics() %}\n {% do return([\"min\", \"max\", \"average\", \"standard_deviation\", \"variance\", \"sum\"]) %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.1384895, "supported_languages": null}, "macro.elementary.get_limit_metric_values": {"name": "get_limit_metric_values", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/data_monitoring/anomaly_detection/get_anomaly_scores_query.sql", "original_file_path": "macros/edr/data_monitoring/anomaly_detection/get_anomaly_scores_query.sql", "unique_id": "macro.elementary.get_limit_metric_values", "macro_sql": "{% macro get_limit_metric_values(test_configuration) %}\n {%- set min_val -%}\n ((-1) * {{ test_configuration.anomaly_sensitivity }} * training_stddev + training_avg)\n {%- endset -%}\n\n {% if test_configuration.ignore_small_changes.drop_failure_percent_threshold %}\n {%- set drop_avg_threshold -%}\n ((1 + {{ test_configuration.ignore_small_changes.drop_failure_percent_threshold }}/100.0) * training_avg)\n {%- endset -%}\n {%- set min_val -%}\n {{ elementary.arithmetic_min(drop_avg_threshold, min_val) }}\n {%- endset -%}\n {% endif %}\n\n {%- set max_val -%}\n {{ test_configuration.anomaly_sensitivity }} * training_stddev + training_avg\n {%- endset -%}\n\n {% if test_configuration.ignore_small_changes.spike_failure_percent_threshold %}\n {%- set spike_avg_threshold -%}\n ((1 + {{ test_configuration.ignore_small_changes.spike_failure_percent_threshold }}/100.0) * training_avg)\n {%- endset -%}\n {%- set max_val -%}\n {{ elementary.arithmetic_max(spike_avg_threshold, max_val) }}\n {%- endset -%}\n {% endif %}\n\n {{ return({\"min_metric_value\": min_val, \"max_metric_value\": max_val}) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.arithmetic_min", "macro.elementary.arithmetic_max"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.1397967, "supported_languages": null}, "macro.elementary.count_true": {"name": "count_true", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/data_monitoring/monitors/column_boolean_monitors.sql", "original_file_path": "macros/edr/data_monitoring/monitors/column_boolean_monitors.sql", "unique_id": "macro.elementary.count_true", "macro_sql": "{% macro count_true(column_name) -%}\n coalesce(sum(case when cast({{ column_name }} as {{ elementary.edr_type_bool() }}) is true then 1 else 0 end), 0)\n{%- endmacro %}", "depends_on": {"macros": ["macro.elementary.edr_type_bool"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.1402218, "supported_languages": null}, "macro.elementary.count_false": {"name": "count_false", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/data_monitoring/monitors/column_boolean_monitors.sql", "original_file_path": "macros/edr/data_monitoring/monitors/column_boolean_monitors.sql", "unique_id": "macro.elementary.count_false", "macro_sql": "{% macro count_false(column_name) -%}\n coalesce(sum(case when cast({{ column_name }} as {{ elementary.edr_type_bool() }}) is true then 0 else 1 end), 0)\n{%- endmacro %}", "depends_on": {"macros": ["macro.elementary.edr_type_bool"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.1404781, "supported_languages": null}, "macro.elementary.max": {"name": "max", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/data_monitoring/monitors/column_numeric_monitors.sql", "original_file_path": "macros/edr/data_monitoring/monitors/column_numeric_monitors.sql", "unique_id": "macro.elementary.max", "macro_sql": "{% macro max(column_name) -%}\n max(cast({{ column_name }} as {{ elementary.edr_type_float() }}))\n{%- endmacro %}", "depends_on": {"macros": ["macro.elementary.edr_type_float"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.1418657, "supported_languages": null}, "macro.elementary.min": {"name": "min", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/data_monitoring/monitors/column_numeric_monitors.sql", "original_file_path": "macros/edr/data_monitoring/monitors/column_numeric_monitors.sql", "unique_id": "macro.elementary.min", "macro_sql": "{% macro min(column_name) -%}\n min(cast({{ column_name }} as {{ elementary.edr_type_float() }}))\n{%- endmacro %}", "depends_on": {"macros": ["macro.elementary.edr_type_float"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.1421142, "supported_languages": null}, "macro.elementary.average": {"name": "average", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/data_monitoring/monitors/column_numeric_monitors.sql", "original_file_path": "macros/edr/data_monitoring/monitors/column_numeric_monitors.sql", "unique_id": "macro.elementary.average", "macro_sql": "{% macro average(column_name) -%}\n avg(cast({{ column_name }} as {{ elementary.edr_type_float() }}))\n{%- endmacro %}", "depends_on": {"macros": ["macro.elementary.edr_type_float"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.1423585, "supported_languages": null}, "macro.elementary.zero_count": {"name": "zero_count", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/data_monitoring/monitors/column_numeric_monitors.sql", "original_file_path": "macros/edr/data_monitoring/monitors/column_numeric_monitors.sql", "unique_id": "macro.elementary.zero_count", "macro_sql": "{% macro zero_count(column_name) %}\n coalesce(sum(case when {{ column_name }} is null then 1 when cast({{ column_name }} as {{ elementary.edr_type_float() }}) = 0 then 1 else 0 end), 0)\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.edr_type_float"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.1426377, "supported_languages": null}, "macro.elementary.zero_percent": {"name": "zero_percent", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/data_monitoring/monitors/column_numeric_monitors.sql", "original_file_path": "macros/edr/data_monitoring/monitors/column_numeric_monitors.sql", "unique_id": "macro.elementary.zero_percent", "macro_sql": "{% macro zero_percent(column_name) %}\n {{ elementary.edr_percent(elementary.zero_count(column_name), elementary.row_count()) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.edr_percent", "macro.elementary.zero_count", "macro.elementary.row_count"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.1429563, "supported_languages": null}, "macro.elementary.not_zero_percent": {"name": "not_zero_percent", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/data_monitoring/monitors/column_numeric_monitors.sql", "original_file_path": "macros/edr/data_monitoring/monitors/column_numeric_monitors.sql", "unique_id": "macro.elementary.not_zero_percent", "macro_sql": "{% macro not_zero_percent(column_name) %}\n {{ elementary.edr_not_percent(elementary.zero_count(column_name), elementary.row_count()) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.edr_not_percent", "macro.elementary.zero_count", "macro.elementary.row_count"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.1432726, "supported_languages": null}, "macro.elementary.standard_deviation": {"name": "standard_deviation", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/data_monitoring/monitors/column_numeric_monitors.sql", "original_file_path": "macros/edr/data_monitoring/monitors/column_numeric_monitors.sql", "unique_id": "macro.elementary.standard_deviation", "macro_sql": "{% macro standard_deviation(column_name) -%}\n stddev(cast({{ column_name }} as {{ elementary.edr_type_float() }}))\n{%- endmacro %}", "depends_on": {"macros": ["macro.elementary.edr_type_float"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.143522, "supported_languages": null}, "macro.elementary.variance": {"name": "variance", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/data_monitoring/monitors/column_numeric_monitors.sql", "original_file_path": "macros/edr/data_monitoring/monitors/column_numeric_monitors.sql", "unique_id": "macro.elementary.variance", "macro_sql": "{% macro variance(column_name) -%}\n variance(cast({{ column_name }} as {{ elementary.edr_type_float() }}))\n{%- endmacro %}", "depends_on": {"macros": ["macro.elementary.edr_type_float"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.1437593, "supported_languages": null}, "macro.elementary.sum": {"name": "sum", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/data_monitoring/monitors/column_numeric_monitors.sql", "original_file_path": "macros/edr/data_monitoring/monitors/column_numeric_monitors.sql", "unique_id": "macro.elementary.sum", "macro_sql": "{% macro sum(column_name) -%}\n sum(cast({{ column_name }} as {{ elementary.edr_type_float() }}))\n{%- endmacro %}", "depends_on": {"macros": ["macro.elementary.edr_type_float"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.1439981, "supported_languages": null}, "macro.elementary.max_length": {"name": "max_length", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/data_monitoring/monitors/column_string_monitors.sql", "original_file_path": "macros/edr/data_monitoring/monitors/column_string_monitors.sql", "unique_id": "macro.elementary.max_length", "macro_sql": "{% macro max_length(column_name) -%}\n max(length({{ column_name }}))\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.1446743, "supported_languages": null}, "macro.elementary.min_length": {"name": "min_length", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/data_monitoring/monitors/column_string_monitors.sql", "original_file_path": "macros/edr/data_monitoring/monitors/column_string_monitors.sql", "unique_id": "macro.elementary.min_length", "macro_sql": "{% macro min_length(column_name) -%}\n min(length({{ column_name }}))\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.1448772, "supported_languages": null}, "macro.elementary.average_length": {"name": "average_length", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/data_monitoring/monitors/column_string_monitors.sql", "original_file_path": "macros/edr/data_monitoring/monitors/column_string_monitors.sql", "unique_id": "macro.elementary.average_length", "macro_sql": "{% macro average_length(column_name) -%}\n avg(length({{ column_name }}))\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.1450696, "supported_languages": null}, "macro.elementary.missing_count": {"name": "missing_count", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/data_monitoring/monitors/column_string_monitors.sql", "original_file_path": "macros/edr/data_monitoring/monitors/column_string_monitors.sql", "unique_id": "macro.elementary.missing_count", "macro_sql": "{% macro missing_count(column_name) %}\n coalesce(sum(case when {{ column_name }} is null then 1 when trim({{ column_name }}) = '' then 1 when lower({{ column_name }}) = 'null' then 1 else 0 end), 0)\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.1453156, "supported_languages": null}, "macro.elementary.missing_percent": {"name": "missing_percent", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/data_monitoring/monitors/column_string_monitors.sql", "original_file_path": "macros/edr/data_monitoring/monitors/column_string_monitors.sql", "unique_id": "macro.elementary.missing_percent", "macro_sql": "{% macro missing_percent(column_name) %}\n {{ elementary.edr_percent(elementary.missing_count(column_name), elementary.row_count()) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.edr_percent", "macro.elementary.missing_count", "macro.elementary.row_count"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.145632, "supported_languages": null}, "macro.elementary.not_missing_percent": {"name": "not_missing_percent", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/data_monitoring/monitors/column_string_monitors.sql", "original_file_path": "macros/edr/data_monitoring/monitors/column_string_monitors.sql", "unique_id": "macro.elementary.not_missing_percent", "macro_sql": "{% macro not_missing_percent(column_name) %}\n {{ elementary.edr_not_percent(elementary.missing_count(column_name), elementary.row_count()) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.edr_not_percent", "macro.elementary.missing_count", "macro.elementary.row_count"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.1459553, "supported_languages": null}, "macro.elementary.null_count": {"name": "null_count", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/data_monitoring/monitors/column_any_type_monitors.sql", "original_file_path": "macros/edr/data_monitoring/monitors/column_any_type_monitors.sql", "unique_id": "macro.elementary.null_count", "macro_sql": "{% macro null_count(column_name) %}\n coalesce(sum(case when {{ column_name }} is null then 1 else 0 end), 0)\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.1463227, "supported_languages": null}, "macro.elementary.null_percent": {"name": "null_percent", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/data_monitoring/monitors/column_any_type_monitors.sql", "original_file_path": "macros/edr/data_monitoring/monitors/column_any_type_monitors.sql", "unique_id": "macro.elementary.null_percent", "macro_sql": "{% macro null_percent(column_name) %}\n {{ elementary.edr_percent(elementary.null_count(column_name), elementary.row_count()) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.edr_percent", "macro.elementary.null_count", "macro.elementary.row_count"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.1467412, "supported_languages": null}, "macro.elementary.not_null_percent": {"name": "not_null_percent", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/data_monitoring/monitors/column_any_type_monitors.sql", "original_file_path": "macros/edr/data_monitoring/monitors/column_any_type_monitors.sql", "unique_id": "macro.elementary.not_null_percent", "macro_sql": "{% macro not_null_percent(column_name) %}\n {{ elementary.edr_not_percent(elementary.null_count(column_name), elementary.row_count()) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.edr_not_percent", "macro.elementary.null_count", "macro.elementary.row_count"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.14706, "supported_languages": null}, "macro.elementary.row_count": {"name": "row_count", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/data_monitoring/monitors/table_monitors.sql", "original_file_path": "macros/edr/data_monitoring/monitors/table_monitors.sql", "unique_id": "macro.elementary.row_count", "macro_sql": "{% macro row_count() -%}\n count(*)\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.1472368, "supported_languages": null}, "macro.elementary.get_available_monitors": {"name": "get_available_monitors", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/data_monitoring/monitors/monitors.sql", "original_file_path": "macros/edr/data_monitoring/monitors/monitors.sql", "unique_id": "macro.elementary.get_available_monitors", "macro_sql": "{% macro get_available_monitors() %}\n {% do return({\n 'table': ['row_count', 'freshness'],\n 'column_any_type': ['null_count', 'null_percent', 'not_null_percent'],\n 'column_string': ['min_length', 'max_length', 'average_length', 'missing_count', 'missing_percent', 'not_missing_percent'],\n 'column_numeric': ['min', 'max', 'zero_count', 'zero_percent', 'not_zero_percent', 'average', 'standard_deviation', 'variance', 'sum'],\n 'column_boolean': ['count_true', 'count_false']\n }) %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.1485252, "supported_languages": null}, "macro.elementary.get_default_monitors": {"name": "get_default_monitors", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/data_monitoring/monitors/monitors.sql", "original_file_path": "macros/edr/data_monitoring/monitors/monitors.sql", "unique_id": "macro.elementary.get_default_monitors", "macro_sql": "{% macro get_default_monitors() %}\n {% do return({\n 'table': ['row_count', 'freshness'],\n 'column_any_type': ['null_count', 'null_percent'],\n 'column_string': ['min_length', 'max_length', 'average_length', 'missing_count', 'missing_percent'],\n 'column_numeric': ['min', 'max', 'zero_count', 'zero_percent', 'average', 'standard_deviation', 'variance'],\n 'column_boolean': ['count_true', 'count_false']\n }) %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.1493483, "supported_languages": null}, "macro.elementary.column_monitoring_query": {"name": "column_monitoring_query", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/data_monitoring/monitors_query/column_monitoring_query.sql", "original_file_path": "macros/edr/data_monitoring/monitors_query/column_monitoring_query.sql", "unique_id": "macro.elementary.column_monitoring_query", "macro_sql": "{% macro column_monitoring_query(monitored_table, monitored_table_relation, min_bucket_start, max_bucket_end, days_back, column_obj, column_monitors, metric_properties) %}\n {%- set full_table_name_str = elementary.edr_quote(elementary.relation_to_full_name(monitored_table_relation)) %}\n {%- set timestamp_column = metric_properties.timestamp_column %}\n\n\n with monitored_table as (\n select * from {{ monitored_table }}\n {% if metric_properties.where_expression %} where {{ metric_properties.where_expression }} {% endif %}\n ),\n\n {% if timestamp_column -%}\n buckets as (\n select edr_bucket_start, edr_bucket_end\n from ({{ elementary.complete_buckets_cte(metric_properties, min_bucket_start, max_bucket_end) }}) results\n where edr_bucket_start >= {{ elementary.edr_cast_as_timestamp(min_bucket_start) }}\n and edr_bucket_end <= {{ elementary.edr_cast_as_timestamp(max_bucket_end) }}\n ),\n\n filtered_monitored_table as (\n select {{ column_obj.quoted }},\n {{ elementary.get_start_bucket_in_data(timestamp_column, min_bucket_start, metric_properties.time_bucket) }} as start_bucket_in_data\n from monitored_table\n where\n {{ elementary.edr_cast_as_timestamp(timestamp_column) }} >= (select min(edr_bucket_start) from buckets)\n and {{ elementary.edr_cast_as_timestamp(timestamp_column) }} < (select max(edr_bucket_end) from buckets)\n ),\n {%- else %}\n filtered_monitored_table as (\n select {{ column_obj.quoted }},\n {{ elementary.null_timestamp() }} as start_bucket_in_data\n from monitored_table\n ),\n {% endif %}\n\n column_monitors as (\n\n {%- if column_monitors %}\n {%- set column = column_obj.quoted -%}\n select\n {%- if timestamp_column %}\n edr_bucket_start as bucket_start,\n edr_bucket_end as bucket_end,\n {{ elementary.timediff(\"hour\", \"edr_bucket_start\", \"edr_bucket_end\") }} as bucket_duration_hours,\n {%- else %}\n {{ elementary.null_timestamp() }} as bucket_start,\n {{ elementary.edr_cast_as_timestamp(elementary.edr_quote(elementary.run_started_at_as_string())) }} as bucket_end,\n {{ elementary.null_int() }} as bucket_duration_hours,\n {%- endif %}\n {{ elementary.const_as_string(column_obj.name) }} as edr_column_name,\n {%- if 'null_count' in column_monitors -%} {{ elementary.null_count(column) }} {%- else -%} null {% endif %} as null_count,\n {%- if 'null_percent' in column_monitors -%} {{ elementary.null_percent(column) }} {%- else -%} null {% endif %} as null_percent,\n {%- if 'not_null_percent' in column_monitors -%} {{ elementary.not_null_percent(column) }} {%- else -%} null {% endif %} as not_null_percent,\n {%- if 'max' in column_monitors -%} {{ elementary.max(column) }} {%- else -%} null {% endif %} as max,\n {%- if 'min' in column_monitors -%} {{ elementary.min(column) }} {%- else -%} null {% endif %} as min,\n {%- if 'average' in column_monitors -%} {{ elementary.average(column) }} {%- else -%} null {% endif %} as average,\n {%- if 'zero_count' in column_monitors -%} {{ elementary.zero_count(column) }} {%- else -%} null {% endif %} as zero_count,\n {%- if 'zero_percent' in column_monitors -%} {{ elementary.zero_percent(column) }} {%- else -%} null {% endif %} as zero_percent,\n {%- if 'not_zero_percent' in column_monitors -%} {{ elementary.not_zero_percent(column) }} {%- else -%} null {% endif %} as not_zero_percent,\n {%- if 'standard_deviation' in column_monitors -%} {{ elementary.standard_deviation(column) }} {%- else -%} null {% endif %} as standard_deviation,\n {%- if 'variance' in column_monitors -%} {{ elementary.variance(column) }} {%- else -%} null {% endif %} as variance,\n {%- if 'max_length' in column_monitors -%} {{ elementary.max_length(column) }} {%- else -%} null {% endif %} as max_length,\n {%- if 'min_length' in column_monitors -%} {{ elementary.min_length(column) }} {%- else -%} null {% endif %} as min_length,\n {%- if 'average_length' in column_monitors -%} {{ elementary.average_length(column) }} {%- else -%} null {% endif %} as average_length,\n {%- if 'missing_count' in column_monitors -%} {{ elementary.missing_count(column) }} {%- else -%} null {% endif %} as missing_count,\n {%- if 'missing_percent' in column_monitors -%} {{ elementary.missing_percent(column) }} {%- else -%} null {% endif %} as missing_percent,\n {%- if 'count_true' in column_monitors -%} {{ elementary.count_true(column) }} {%- else -%} null {% endif %} as count_true,\n {%- if 'count_false' in column_monitors -%} {{ elementary.count_false(column) }} {%- else -%} null {% endif %} as count_false,\n {%- if 'not_missing_percent' in column_monitors -%} {{ elementary.not_missing_percent(column) }} {%- else -%} null {% endif %} as not_missing_percent,\n {%- if 'sum' in column_monitors -%} {{ elementary.sum(column) }} {%- else -%} null {% endif %} as sum\n from filtered_monitored_table\n {%- if timestamp_column %}\n left join buckets on (edr_bucket_start = start_bucket_in_data)\n {%- endif %}\n group by 1,2,3,4\n {%- else %}\n {{ elementary.empty_column_monitors_cte() }}\n {%- endif %}\n\n ),\n\n column_monitors_unpivot as (\n\n {%- if column_monitors %}\n {% for monitor in column_monitors %}\n select edr_column_name, bucket_start, bucket_end, bucket_duration_hours, {{ elementary.edr_cast_as_string(elementary.edr_quote(monitor)) }} as metric_name, {{ elementary.edr_cast_as_float(monitor) }} as metric_value from column_monitors where {{ monitor }} is not null\n {% if not loop.last %} union all {% endif %}\n {%- endfor %}\n {%- else %}\n {{ elementary.empty_table([('edr_column_name','string'),('bucket_start','timestamp'),('bucket_end','timestamp'),('bucket_duration_hours','int'),('metric_name','string'),('metric_value','float')]) }}\n {%- endif %}\n\n ),\n\n metrics_final as (\n\n select\n {{ elementary.edr_cast_as_string(full_table_name_str) }} as full_table_name,\n edr_column_name as column_name,\n metric_name,\n {{ elementary.edr_cast_as_float('metric_value') }} as metric_value,\n {{ elementary.null_string() }} as source_value,\n bucket_start,\n bucket_end,\n bucket_duration_hours,\n {{ elementary.null_string() }} as dimension,\n {{ elementary.null_string() }} as dimension_value,\n {{elementary.dict_to_quoted_json(metric_properties) }} as metric_properties\n from column_monitors_unpivot\n\n )\n\n select\n {{ elementary.generate_surrogate_key([\n 'full_table_name',\n 'column_name',\n 'metric_name',\n 'bucket_end',\n 'metric_properties'\n ]) }} as id,\n full_table_name,\n column_name,\n metric_name,\n metric_value,\n source_value,\n bucket_start,\n bucket_end,\n bucket_duration_hours,\n {{ elementary.edr_current_timestamp_in_utc() }} as updated_at,\n dimension,\n dimension_value,\n metric_properties\n from metrics_final\n\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.edr_quote", "macro.elementary.relation_to_full_name", "macro.elementary.complete_buckets_cte", "macro.elementary.edr_cast_as_timestamp", "macro.elementary.get_start_bucket_in_data", "macro.elementary.null_timestamp", "macro.elementary.timediff", "macro.elementary.run_started_at_as_string", "macro.elementary.null_int", "macro.elementary.const_as_string", "macro.elementary.null_count", "macro.elementary.null_percent", "macro.elementary.not_null_percent", "macro.elementary.max", "macro.elementary.min", "macro.elementary.average", "macro.elementary.zero_count", "macro.elementary.zero_percent", "macro.elementary.not_zero_percent", "macro.elementary.standard_deviation", "macro.elementary.variance", "macro.elementary.max_length", "macro.elementary.min_length", "macro.elementary.average_length", "macro.elementary.missing_count", "macro.elementary.missing_percent", "macro.elementary.count_true", "macro.elementary.count_false", "macro.elementary.not_missing_percent", "macro.elementary.sum", "macro.elementary.empty_column_monitors_cte", "macro.elementary.edr_cast_as_string", "macro.elementary.edr_cast_as_float", "macro.elementary.empty_table", "macro.elementary.null_string", "macro.elementary.dict_to_quoted_json", "macro.elementary.generate_surrogate_key", "macro.elementary.edr_current_timestamp_in_utc"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.1788087, "supported_languages": null}, "macro.elementary.get_latest_full_refresh": {"name": "get_latest_full_refresh", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/data_monitoring/monitors_query/get_latest_full_refresh.sql", "original_file_path": "macros/edr/data_monitoring/monitors_query/get_latest_full_refresh.sql", "unique_id": "macro.elementary.get_latest_full_refresh", "macro_sql": "{% macro get_latest_full_refresh(model_node) %}\n {%- set dbt_run_results_relation = elementary.get_elementary_relation('dbt_run_results') %}\n {% set query %}\n select generated_at from {{ dbt_run_results_relation }}\n where\n unique_id = '{{ model_node.unique_id }}' and\n full_refresh = true\n order by generated_at desc\n limit 1\n {% endset %}\n {% do return(elementary.result_value(query)) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.get_elementary_relation", "macro.elementary.result_value"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.1796117, "supported_languages": null}, "macro.elementary.dimension_monitoring_query": {"name": "dimension_monitoring_query", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/data_monitoring/monitors_query/dimension_monitoring_query.sql", "original_file_path": "macros/edr/data_monitoring/monitors_query/dimension_monitoring_query.sql", "unique_id": "macro.elementary.dimension_monitoring_query", "macro_sql": "{% macro dimension_monitoring_query(monitored_table, monitored_table_relation, dimensions, min_bucket_start, max_bucket_end, test_configuration, metric_properties) %}\n {% set metric_name = 'dimension' %}\n {% set full_table_name_str = elementary.edr_quote(elementary.relation_to_full_name(monitored_table_relation)) %}\n {% set dimensions_string = elementary.join_list(dimensions, '; ') %}\n {% set concat_dimensions_sql_expression = elementary.list_concat_with_separator(dimensions, '; ') %}\n {% set timestamp_column = metric_properties.timestamp_column %}\n {%- set data_monitoring_metrics_relation = elementary.get_elementary_relation('data_monitoring_metrics') %}\n\n with filtered_monitored_table as (\n select *,\n {{ concat_dimensions_sql_expression }} as dimension_value\n from {{ monitored_table }}\n {% if metric_properties.where_expression %}\n where {{ metric_properties.where_expression }}\n {% endif %}\n ),\n\n {% if timestamp_column %}\n buckets as (\n select\n edr_bucket_start,\n edr_bucket_end,\n 1 as joiner\n from ({{ elementary.complete_buckets_cte(metric_properties, min_bucket_start, max_bucket_end) }}) results\n where edr_bucket_start >= {{ elementary.edr_cast_as_timestamp(min_bucket_start) }}\n and edr_bucket_end <= {{ elementary.edr_cast_as_timestamp(max_bucket_end) }}\n ),\n\n time_filtered_monitored_table as (\n select *,\n {{ elementary.get_start_bucket_in_data(timestamp_column, min_bucket_start, metric_properties.time_bucket) }} as start_bucket_in_data\n from filtered_monitored_table\n where\n {{ elementary.edr_cast_as_timestamp(timestamp_column) }} >= (select min(edr_bucket_start) from buckets)\n and {{ elementary.edr_cast_as_timestamp(timestamp_column) }} < (select max(edr_bucket_end) from buckets)\n ),\n\n all_dimension_metrics as (\n select\n bucket_end,\n dimension_value,\n metric_value,\n row_number () over (partition by dimension_value order by bucket_end desc) as row_number\n from {{ data_monitoring_metrics_relation }}\n where full_table_name = {{ full_table_name_str }}\n and metric_name = {{ elementary.edr_quote(metric_name) }}\n and metric_properties = {{ elementary.dict_to_quoted_json(metric_properties) }}\n ),\n\n training_set_dimensions as (\n select distinct\n dimension_value,\n 1 as joiner,\n min(bucket_end) as dimension_min_bucket_end,\n sum(metric_value)\n from all_dimension_metrics\n group by 1,2\n {# Remove outdated dimension values (dimensions with all metrics of 0 in the range of the test time) #}\n having sum(metric_value) > 0\n ),\n\n {# Create buckets for each previous dimension value #}\n dimensions_buckets as (\n select edr_bucket_start, edr_bucket_end, dimension_value\n from training_set_dimensions left join buckets\n on (buckets.joiner = training_set_dimensions.joiner\n {# This makes sure we don't create empty buckets for dimensions before their first appearance #}\n and edr_bucket_end >= dimension_min_bucket_end)\n where dimension_value is not null\n ),\n\n {# Calculating the row count for the value of each dimension #}\n row_count_values as (\n select\n edr_bucket_start,\n edr_bucket_end,\n start_bucket_in_data,\n dimension_value,\n case when start_bucket_in_data is null then\n 0\n else {{ elementary.edr_cast_as_float(elementary.row_count()) }} end as row_count_value\n from buckets left join time_filtered_monitored_table on (edr_bucket_start = start_bucket_in_data)\n group by 1,2,3,4\n ),\n\n {# Merging between the row count and the dimensions buckets #}\n {# This way we make sure that if a dimension has no rows, it will get a metric with value 0 #}\n fill_empty_buckets_row_count_values as (\n select dimensions_buckets.edr_bucket_start,\n dimensions_buckets.edr_bucket_end,\n start_bucket_in_data,\n dimensions_buckets.dimension_value,\n case when start_bucket_in_data is null then\n 0\n else row_count_value end as row_count_value\n from dimensions_buckets left join row_count_values\n on (dimensions_buckets.edr_bucket_start = start_bucket_in_data and dimensions_buckets.dimension_value = row_count_values.dimension_value)\n ),\n\n {# We union so new buckets added in this run will be included (were filtered by the join we did on 'fill_empty_buckets_row_count_values') #}\n union_row_count_values as (\n select distinct *\n from\n (\n select * from row_count_values\n union all\n select * from fill_empty_buckets_row_count_values\n ) as results\n ),\n\n row_count as (\n select edr_bucket_start,\n edr_bucket_end,\n {{ elementary.const_as_string(metric_name) }} as metric_name,\n {{ elementary.null_string() }} as source_value,\n row_count_value as metric_value,\n {{ elementary.const_as_string(dimensions_string) }} as dimension,\n dimension_value,\n {{elementary.dict_to_quoted_json(metric_properties) }} as metric_properties\n from union_row_count_values\n ),\n\n metrics_final as (\n\n select\n {{ elementary.edr_cast_as_string(full_table_name_str) }} as full_table_name,\n {{ elementary.null_string() }} as column_name,\n metric_name,\n {{ elementary.edr_cast_as_float('metric_value') }} as metric_value,\n source_value,\n edr_bucket_start as bucket_start,\n edr_bucket_end as bucket_end,\n {{ elementary.timediff(\"hour\", \"edr_bucket_start\", \"edr_bucket_end\") }} as bucket_duration_hours,\n dimension,\n dimension_value,\n metric_properties\n from row_count\n where (metric_value is not null and cast(metric_value as {{ elementary.edr_type_int() }}) < {{ elementary.get_config_var('max_int') }}) or\n metric_value is null\n )\n\n {% else %}\n\n {# Get all of the dimension anomaly metrics that were created for the test until this run #}\n all_dimension_metrics as (\n select\n bucket_end,\n dimension_value,\n metric_value,\n row_number () over (partition by dimension_value order by bucket_end desc) as row_number\n from {{ data_monitoring_metrics_relation }}\n where full_table_name = {{ full_table_name_str }}\n and metric_name = {{ elementary.edr_quote(metric_name) }}\n and metric_properties = {{ elementary.dict_to_quoted_json(metric_properties) }}\n ),\n\n training_set_dimensions as (\n select distinct\n dimension_value,\n sum(metric_value)\n from all_dimension_metrics\n group by 1\n {# Remove outdated dimension values (dimensions with all metrics of 0 in the range of the test time) #}\n having sum(metric_value) > 0\n ),\n\n {# Calculating the row count for the value of each dimension #}\n row_count_values as (\n select\n {{ elementary.edr_cast_as_timestamp(elementary.edr_quote(elementary.run_started_at_as_string())) }} as bucket_end,\n dimension_value,\n {{ elementary.edr_cast_as_float(elementary.row_count()) }} as row_count_value\n from filtered_monitored_table\n group by 1,2\n ),\n\n {# This way we make sure that if a dimension has no rows, it will get a metric with value 0 #}\n fill_empty_dimensions_row_count_values as (\n select {{ elementary.edr_cast_as_timestamp(elementary.edr_quote(elementary.run_started_at_as_string())) }} as bucket_end,\n dimension_value,\n 0 as row_count_value\n from training_set_dimensions\n where dimension_value not in (select distinct dimension_value from row_count_values)\n ),\n\n {# Union between current row count for each dimension, and the \"hydrated\" metrics of the test until this run #}\n row_count as (\n select * from row_count_values\n union all\n select * from fill_empty_dimensions_row_count_values\n ),\n\n metrics_final as (\n select\n {{ elementary.edr_cast_as_string(full_table_name_str) }} as full_table_name,\n {{ elementary.null_string() }} as column_name,\n {{ elementary.const_as_string(metric_name) }} as metric_name,\n {{ elementary.edr_cast_as_float('row_count_value') }} as metric_value,\n {{ elementary.null_string() }} as source_value,\n {{ elementary.null_timestamp() }} as bucket_start,\n bucket_end,\n {{ elementary.null_int() }} as bucket_duration_hours,\n {{ elementary.const_as_string(dimensions_string) }} as dimension,\n dimension_value,\n {{ elementary.dict_to_quoted_json(metric_properties) }} as metric_properties\n from row_count\n )\n {% endif %}\n\n select\n {{ elementary.generate_surrogate_key([\n 'full_table_name',\n 'column_name',\n 'metric_name',\n 'dimension',\n 'dimension_value',\n 'bucket_end',\n 'metric_properties']) }} as id,\n full_table_name,\n column_name,\n metric_name,\n metric_value,\n source_value,\n bucket_start,\n bucket_end,\n bucket_duration_hours,\n {{ elementary.edr_current_timestamp_in_utc() }} as updated_at,\n dimension,\n dimension_value,\n metric_properties\n from metrics_final\n\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.edr_quote", "macro.elementary.relation_to_full_name", "macro.elementary.join_list", "macro.elementary.list_concat_with_separator", "macro.elementary.get_elementary_relation", "macro.elementary.complete_buckets_cte", "macro.elementary.edr_cast_as_timestamp", "macro.elementary.get_start_bucket_in_data", "macro.elementary.dict_to_quoted_json", "macro.elementary.edr_cast_as_float", "macro.elementary.row_count", "macro.elementary.const_as_string", "macro.elementary.null_string", "macro.elementary.edr_cast_as_string", "macro.elementary.timediff", "macro.elementary.edr_type_int", "macro.elementary.get_config_var", "macro.elementary.run_started_at_as_string", "macro.elementary.null_timestamp", "macro.elementary.null_int", "macro.elementary.generate_surrogate_key", "macro.elementary.edr_current_timestamp_in_utc"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.1927612, "supported_languages": null}, "macro.elementary.table_monitoring_query": {"name": "table_monitoring_query", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/data_monitoring/monitors_query/table_monitoring_query.sql", "original_file_path": "macros/edr/data_monitoring/monitors_query/table_monitoring_query.sql", "unique_id": "macro.elementary.table_monitoring_query", "macro_sql": "{% macro table_monitoring_query(monitored_table, monitored_table_relation, min_bucket_start, max_bucket_end, table_monitors, metric_properties) %}\n\n {{ elementary.get_table_monitoring_query(monitored_table, monitored_table_relation, min_bucket_start, max_bucket_end, table_monitors, metric_properties) }}\n\n select\n {{ elementary.generate_surrogate_key([\n 'full_table_name',\n 'column_name',\n 'metric_name',\n 'bucket_end',\n 'metric_properties'\n ]) }} as id,\n full_table_name,\n column_name,\n metric_name,\n metric_value,\n source_value,\n bucket_start,\n bucket_end,\n bucket_duration_hours,\n {{ elementary.edr_current_timestamp_in_utc() }} as updated_at,\n dimension,\n dimension_value,\n metric_properties\n from metrics_final\n\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.get_table_monitoring_query", "macro.elementary.generate_surrogate_key", "macro.elementary.edr_current_timestamp_in_utc"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.2130854, "supported_languages": null}, "macro.elementary.get_table_monitoring_query": {"name": "get_table_monitoring_query", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/data_monitoring/monitors_query/table_monitoring_query.sql", "original_file_path": "macros/edr/data_monitoring/monitors_query/table_monitoring_query.sql", "unique_id": "macro.elementary.get_table_monitoring_query", "macro_sql": "{% macro get_table_monitoring_query(monitored_table, monitored_table_relation, min_bucket_start, max_bucket_end, table_monitors, metric_properties) %}\n {%- set full_table_name_str = elementary.edr_quote(elementary.relation_to_full_name(monitored_table_relation)) %}\n {%- set timestamp_column = metric_properties.timestamp_column %}\n\n {%- if timestamp_column %}\n {{ elementary.get_timestamp_table_query(monitored_table, metric_properties, timestamp_column, table_monitors, min_bucket_start, max_bucket_end, full_table_name_str) }}\n {%- elif table_monitors == [\"row_count\"] %}\n {{ elementary.get_no_timestamp_volume_query(monitored_table, metric_properties, full_table_name_str) }}\n {%- elif table_monitors == [\"event_freshness\"] %}\n {# Event freshness with only event_timestamp and not update_timestamp #}\n {{ elementary.get_no_timestamp_event_freshness_query(monitored_table, metric_properties, full_table_name_str) }}\n {%- else %}\n {% do exceptions.raise_compiler_error(\"freshness_anomalies test is not supported without timestamp_column.\") %}\n {# TODO: We can enhance this test for models to use model_run_results in case a timestamp column is not defined #}\n {% do return(none) %}\n {%- endif %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.edr_quote", "macro.elementary.relation_to_full_name", "macro.elementary.get_timestamp_table_query", "macro.elementary.get_no_timestamp_volume_query", "macro.elementary.get_no_timestamp_event_freshness_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.2144992, "supported_languages": null}, "macro.elementary.get_no_timestamp_volume_query": {"name": "get_no_timestamp_volume_query", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/data_monitoring/monitors_query/table_monitoring_query.sql", "original_file_path": "macros/edr/data_monitoring/monitors_query/table_monitoring_query.sql", "unique_id": "macro.elementary.get_no_timestamp_volume_query", "macro_sql": "{% macro get_no_timestamp_volume_query(monitored_table, metric_properties, full_table_name_str) %}\n with monitored_table_metrics as (\n select\n {{ elementary.const_as_string('row_count') }} as metric_name,\n {{ elementary.row_count() }} as metric_value\n from {{ monitored_table }}\n {% if metric_properties.where_expression %} where {{ metric_properties.where_expression }} {% endif %}\n group by 1\n ),\n metrics_final as (\n select\n {{ elementary.edr_cast_as_string(full_table_name_str) }} as full_table_name,\n {{ elementary.null_string() }} as column_name,\n metric_name,\n {{ elementary.edr_cast_as_float('metric_value') }} as metric_value,\n {{ elementary.null_string() }} as source_value,\n {{ elementary.null_timestamp() }} as bucket_start,\n {{ elementary.edr_cast_as_timestamp(elementary.edr_quote(elementary.run_started_at_as_string())) }} as bucket_end,\n {{ elementary.null_int() }} as bucket_duration_hours,\n {{ elementary.null_string() }} as dimension,\n {{ elementary.null_string() }} as dimension_value,\n {{elementary.dict_to_quoted_json(metric_properties) }} as metric_properties\n from monitored_table_metrics\n )\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.const_as_string", "macro.elementary.row_count", "macro.elementary.edr_cast_as_string", "macro.elementary.null_string", "macro.elementary.edr_cast_as_float", "macro.elementary.null_timestamp", "macro.elementary.edr_cast_as_timestamp", "macro.elementary.edr_quote", "macro.elementary.run_started_at_as_string", "macro.elementary.null_int", "macro.elementary.dict_to_quoted_json"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.2158036, "supported_languages": null}, "macro.elementary.get_timestamp_table_query": {"name": "get_timestamp_table_query", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/data_monitoring/monitors_query/table_monitoring_query.sql", "original_file_path": "macros/edr/data_monitoring/monitors_query/table_monitoring_query.sql", "unique_id": "macro.elementary.get_timestamp_table_query", "macro_sql": "{% macro get_timestamp_table_query(monitored_table, metric_properties, timestamp_column, table_monitors, min_bucket_start, max_bucket_end, full_table_name_str) %}\n with partially_time_filtered_monitored_table as (\n select\n {{ elementary.edr_cast_as_timestamp(timestamp_column) }} as monitored_table_timestamp_column\n {%- if metric_properties.timestamp_column and metric_properties.event_timestamp_column %}\n , {{ elementary.edr_cast_as_timestamp(metric_properties.event_timestamp_column) }} as monitored_table_event_timestamp_column\n {%- endif %}\n from {{ monitored_table }}\n -- Freshness metric calculated differences between consecutive buckets, thus the first diff\n -- is always null. Therefore we let few old buckets inside the query and filter them later, just for\n -- the first relevant diff not to be null\n where {{ elementary.edr_cast_as_timestamp(timestamp_column) }} >= {{ elementary.edr_timeadd(\"day\", -7, elementary.edr_cast_as_timestamp(min_bucket_start)) }}\n {% if metric_properties.where_expression %} and {{ metric_properties.where_expression }} {% endif %}\n ),\n monitored_table as (\n select\n *\n from partially_time_filtered_monitored_table\n where monitored_table_timestamp_column >= {{ elementary.edr_cast_as_timestamp(min_bucket_start) }}\n ),\n buckets as (\n select edr_bucket_start, edr_bucket_end\n from ({{ elementary.complete_buckets_cte(metric_properties, min_bucket_start, max_bucket_end) }}) results\n where edr_bucket_start >= {{ elementary.edr_cast_as_timestamp(min_bucket_start) }}\n and edr_bucket_end <= {{ elementary.edr_cast_as_timestamp(max_bucket_end) }}\n ),\n\n time_filtered_monitored_table as (\n select *,\n {{ elementary.get_start_bucket_in_data('monitored_table_timestamp_column', min_bucket_start, metric_properties.time_bucket) }} as start_bucket_in_data\n from monitored_table\n where\n monitored_table_timestamp_column >= (select min(edr_bucket_start) from buckets)\n and monitored_table_timestamp_column < (select max(edr_bucket_end) from buckets)\n {# To avoid adding buckets before the table first timestamp #}\n and monitored_table_timestamp_column >= (select min(monitored_table_timestamp_column) from monitored_table)\n ),\n\n metrics as (\n {{ elementary.get_unified_metrics_query(metrics=table_monitors,\n metric_properties=metric_properties) }}\n ),\n\n metrics_final as (\n select\n {{ elementary.edr_cast_as_string(full_table_name_str) }} as full_table_name,\n {{ elementary.null_string() }} as column_name,\n metric_name,\n {{ elementary.edr_cast_as_float('metric_value') }} as metric_value,\n source_value,\n edr_bucket_start as bucket_start,\n edr_bucket_end as bucket_end,\n {{ elementary.timediff(\"hour\", \"edr_bucket_start\", \"edr_bucket_end\") }} as bucket_duration_hours,\n {{ elementary.null_string() }} as dimension,\n {{ elementary.null_string() }} as dimension_value,\n {{elementary.dict_to_quoted_json(metric_properties) }} as metric_properties\n from\n metrics\n where (metric_value is not null and cast(metric_value as {{ elementary.edr_type_int() }}) < {{ elementary.get_config_var('max_int') }}) or\n metric_value is null\n )\n\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.edr_cast_as_timestamp", "macro.elementary.edr_timeadd", "macro.elementary.complete_buckets_cte", "macro.elementary.get_start_bucket_in_data", "macro.elementary.get_unified_metrics_query", "macro.elementary.edr_cast_as_string", "macro.elementary.null_string", "macro.elementary.edr_cast_as_float", "macro.elementary.timediff", "macro.elementary.dict_to_quoted_json", "macro.elementary.edr_type_int", "macro.elementary.get_config_var"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.2182505, "supported_languages": null}, "macro.elementary.get_unified_metrics_query": {"name": "get_unified_metrics_query", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/data_monitoring/monitors_query/table_monitoring_query.sql", "original_file_path": "macros/edr/data_monitoring/monitors_query/table_monitoring_query.sql", "unique_id": "macro.elementary.get_unified_metrics_query", "macro_sql": "{% macro get_unified_metrics_query(metrics, metric_properties) %}\n {%- set included_monitors = {} %}\n {%- for metric_name in metrics %}\n {%- set metric_query = elementary.get_metric_query(metric_name, metric_properties) %}\n {%- if metric_query %}\n {% do included_monitors.update({metric_name: metric_query}) %}\n {%- endif %}\n {%- endfor %}\n\n {% if not included_monitors %}\n {% if metric_properties.timestamp_column %}\n {% do return(elementary.empty_table([('edr_bucket_start','timestamp'),('edr_bucket_end','timestamp'),('metric_name','string'),('source_value','string'),('metric_value','int')])) %}\n {% else %}\n {% do return(elementary.empty_table([('metric_name','string'),('metric_value','int')])) %}\n {% endif %}\n {% endif %}\n\n with\n {%- for metric_name, metric_query in included_monitors.items() %}\n {{ metric_name }} as (\n {{ metric_query }}\n ){% if not loop.last %},{% endif %}\n {%- endfor %}\n\n {%- for metric_name in included_monitors %}\n select * from {{ metric_name }}\n {% if not loop.last %} union all {% endif %}\n {%- endfor %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.get_metric_query", "macro.elementary.empty_table"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.2204533, "supported_languages": null}, "macro.elementary.get_metric_query": {"name": "get_metric_query", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/data_monitoring/monitors_query/table_monitoring_query.sql", "original_file_path": "macros/edr/data_monitoring/monitors_query/table_monitoring_query.sql", "unique_id": "macro.elementary.get_metric_query", "macro_sql": "{% macro get_metric_query(metric_name, metric_properties) %}\n {%- set metrics_macro_mapping = {\n \"row_count\": elementary.row_count_metric_query,\n \"freshness\": elementary.freshness_metric_query,\n \"event_freshness\": elementary.event_freshness_metric_query\n } %}\n\n {%- set metric_macro = metrics_macro_mapping.get(metric_name) %}\n {%- if not metric_macro %}\n {%- do return(none) %}\n {%- endif %}\n\n {%- set metric_query = metric_macro(metric_properties) %}\n {%- if not metric_query %}\n {%- do return(none) %}\n {%- endif %}\n\n {{ metric_query }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.2214215, "supported_languages": null}, "macro.elementary.row_count_metric_query": {"name": "row_count_metric_query", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/data_monitoring/monitors_query/table_monitoring_query.sql", "original_file_path": "macros/edr/data_monitoring/monitors_query/table_monitoring_query.sql", "unique_id": "macro.elementary.row_count_metric_query", "macro_sql": "{% macro row_count_metric_query(metric_properties) %}\n with row_count_values as (\n select edr_bucket_start,\n edr_bucket_end,\n start_bucket_in_data,\n case when start_bucket_in_data is null then\n 0\n else {{ elementary.edr_cast_as_float(elementary.row_count()) }} end as row_count_value\n from buckets left join time_filtered_monitored_table on (edr_bucket_start = start_bucket_in_data)\n group by 1,2,3\n )\n\n select edr_bucket_start,\n edr_bucket_end,\n {{ elementary.const_as_string('row_count') }} as metric_name,\n {{ elementary.null_string() }} as source_value,\n row_count_value as metric_value\n from row_count_values\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.edr_cast_as_float", "macro.elementary.row_count", "macro.elementary.const_as_string", "macro.elementary.null_string"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.2218783, "supported_languages": null}, "macro.elementary.freshness_metric_query": {"name": "freshness_metric_query", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/data_monitoring/monitors_query/table_monitoring_query.sql", "original_file_path": "macros/edr/data_monitoring/monitors_query/table_monitoring_query.sql", "unique_id": "macro.elementary.freshness_metric_query", "macro_sql": "{% macro freshness_metric_query(metric_properties) %}\n -- get ordered consecutive update timestamps in the source data\n with unique_timestamps as (\n select distinct monitored_table_timestamp_column as timestamp_val\n from partially_time_filtered_monitored_table\n order by 1\n ),\n\n -- compute freshness for every update as the time difference from the previous update\n consecutive_updates_freshness as (\n select\n timestamp_val as update_timestamp,\n {{ elementary.timediff('second', 'lag(timestamp_val) over (order by timestamp_val)', 'timestamp_val') }} as freshness\n from unique_timestamps\n ),\n time_filtered_consecutive_updates_freshness as (\n select\n *\n from consecutive_updates_freshness\n where update_timestamp >= (select min(edr_bucket_start) from buckets)\n ),\n -- divide the freshness metrics above to buckets\n bucketed_consecutive_updates_freshness as (\n select\n edr_bucket_start, edr_bucket_end, update_timestamp, freshness\n from buckets cross join time_filtered_consecutive_updates_freshness\n where update_timestamp >= edr_bucket_start AND update_timestamp < edr_bucket_end\n ),\n\n -- we also want to record the freshness at the end of each bucket as an additional point. By this we mean\n -- the time that passed since the last update in the bucket and the end of the bucket.\n bucket_end_freshness as (\n select\n edr_bucket_start,\n edr_bucket_end,\n max(timestamp_val) as update_timestamp,\n {{ elementary.timediff('second', elementary.edr_cast_as_timestamp('max(timestamp_val)'), \"least(edr_bucket_end, {})\".format(elementary.current_timestamp_column())) }} as freshness\n from buckets cross join unique_timestamps\n where timestamp_val < edr_bucket_end\n group by 1,2\n ),\n\n -- create a single table with all the freshness values\n bucket_all_freshness_metrics as (\n select * from bucketed_consecutive_updates_freshness\n union all\n select * from bucket_end_freshness\n ),\n\n -- get all the freshness values, ranked by size (we use partition by and not group by, because we also want to have\n -- the associated timestamp as source value)\n bucket_freshness_ranked as (\n select\n *,\n row_number () over (partition by edr_bucket_end order by freshness is null, freshness desc) as row_number\n from bucket_all_freshness_metrics\n )\n\n select\n edr_bucket_start,\n edr_bucket_end,\n {{ elementary.const_as_string('freshness') }} as metric_name,\n {{ elementary.edr_cast_as_string('update_timestamp') }} as source_value,\n freshness as metric_value\n from bucket_freshness_ranked\n where row_number = 1\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.timediff", "macro.elementary.edr_cast_as_timestamp", "macro.elementary.current_timestamp_column", "macro.elementary.const_as_string", "macro.elementary.edr_cast_as_string"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.2227702, "supported_languages": null}, "macro.elementary.event_freshness_metric_query": {"name": "event_freshness_metric_query", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/data_monitoring/monitors_query/table_monitoring_query.sql", "original_file_path": "macros/edr/data_monitoring/monitors_query/table_monitoring_query.sql", "unique_id": "macro.elementary.event_freshness_metric_query", "macro_sql": "{% macro event_freshness_metric_query(metric_properties) %}\n select\n edr_bucket_start,\n edr_bucket_end,\n {{ elementary.const_as_string('event_freshness') }} as metric_name,\n {{ elementary.edr_cast_as_string('max({})'.format('monitored_table_event_timestamp_column')) }} as source_value,\n {{ 'coalesce(max({}), {})'.format(\n elementary.timediff('second', elementary.edr_cast_as_timestamp('monitored_table_event_timestamp_column'), elementary.edr_cast_as_timestamp('monitored_table_timestamp_column')),\n elementary.timediff('second', 'edr_bucket_start', 'edr_bucket_end')\n ) }} as metric_value\n from buckets left join time_filtered_monitored_table on (edr_bucket_start = start_bucket_in_data)\n group by 1,2\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.const_as_string", "macro.elementary.edr_cast_as_string", "macro.elementary.timediff", "macro.elementary.edr_cast_as_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.2235234, "supported_languages": null}, "macro.elementary.get_no_timestamp_event_freshness_query": {"name": "get_no_timestamp_event_freshness_query", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/data_monitoring/monitors_query/table_monitoring_query.sql", "original_file_path": "macros/edr/data_monitoring/monitors_query/table_monitoring_query.sql", "unique_id": "macro.elementary.get_no_timestamp_event_freshness_query", "macro_sql": "{% macro get_no_timestamp_event_freshness_query(monitored_table, metric_properties, full_table_name_str) %}\n with monitored_table_metrics as (\n select\n {{ elementary.const_as_string('event_freshness') }} as metric_name,\n {{ elementary.timediff('second', elementary.edr_cast_as_timestamp(\"max({})\".format(metric_properties.event_timestamp_column)), elementary.edr_quote(elementary.get_run_started_at())) }} as metric_value\n from {{ monitored_table }}\n {% if metric_properties.where_expression %} where {{ metric_properties.where_expression }} {% endif %}\n group by 1\n ),\n metrics_final as (\n select\n {{ elementary.edr_cast_as_string(full_table_name_str) }} as full_table_name,\n {{ elementary.null_string() }} as column_name,\n metric_name,\n {{ elementary.edr_cast_as_float('metric_value') }} as metric_value,\n {{ elementary.null_string() }} as source_value,\n {{ elementary.null_timestamp() }} as bucket_start,\n {{ elementary.edr_cast_as_timestamp(elementary.edr_quote(elementary.run_started_at_as_string())) }} as bucket_end,\n {{ elementary.null_int() }} as bucket_duration_hours,\n {{ elementary.null_string() }} as dimension,\n {{ elementary.null_string() }} as dimension_value,\n {{elementary.dict_to_quoted_json(metric_properties) }} as metric_properties\n from monitored_table_metrics\n )\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.const_as_string", "macro.elementary.timediff", "macro.elementary.edr_cast_as_timestamp", "macro.elementary.edr_quote", "macro.elementary.get_run_started_at", "macro.elementary.edr_cast_as_string", "macro.elementary.null_string", "macro.elementary.edr_cast_as_float", "macro.elementary.null_timestamp", "macro.elementary.run_started_at_as_string", "macro.elementary.null_int", "macro.elementary.dict_to_quoted_json"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.225052, "supported_languages": null}, "macro.elementary.get_start_bucket_in_data": {"name": "get_start_bucket_in_data", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/data_monitoring/monitors_query/get_start_bucket_in_data.sql", "original_file_path": "macros/edr/data_monitoring/monitors_query/get_start_bucket_in_data.sql", "unique_id": "macro.elementary.get_start_bucket_in_data", "macro_sql": "{% macro get_start_bucket_in_data(timestamp_column, min_bucket_start, time_bucket) %}\n {% set bucket_start_datediff_expr %}\n floor({{ elementary.edr_datediff(min_bucket_start, elementary.edr_cast_as_timestamp(timestamp_column), time_bucket.period) }} / {{ time_bucket.count }}) * {{ time_bucket.count }}\n {% endset %}\n {% do return(elementary.edr_cast_as_timestamp(elementary.edr_timeadd(time_bucket.period, elementary.edr_cast_as_int(bucket_start_datediff_expr), min_bucket_start))) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.edr_datediff", "macro.elementary.edr_cast_as_timestamp", "macro.elementary.edr_timeadd", "macro.elementary.edr_cast_as_int"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.226044, "supported_languages": null}, "macro.elementary.get_column_obj_and_monitors": {"name": "get_column_obj_and_monitors", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/data_monitoring/data_monitors_configuration/get_column_monitors.sql", "original_file_path": "macros/edr/data_monitoring/data_monitors_configuration/get_column_monitors.sql", "unique_id": "macro.elementary.get_column_obj_and_monitors", "macro_sql": "{% macro get_column_obj_and_monitors(model_relation, column_name, column_tests=none) %}\n\n {% set column_obj_and_monitors = [] %}\n {% set column_objects = adapter.get_columns_in_relation(model_relation) %}\n {% for column_obj in column_objects %}\n {% if column_obj.name.strip('\"') | lower == column_name.strip('\"') | lower %}\n {% set column_monitors = elementary.column_monitors_by_type(elementary.get_column_data_type(column_obj), column_tests) %}\n {% set column_item = {'column': column_obj, 'monitors': column_monitors} %}\n {{ return(column_item) }}\n {% endif %}\n {% endfor %}\n\n {{ return(none) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.column_monitors_by_type", "macro.elementary.get_column_data_type"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.2301242, "supported_languages": null}, "macro.elementary.get_all_column_obj_and_monitors": {"name": "get_all_column_obj_and_monitors", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/data_monitoring/data_monitors_configuration/get_column_monitors.sql", "original_file_path": "macros/edr/data_monitoring/data_monitors_configuration/get_column_monitors.sql", "unique_id": "macro.elementary.get_all_column_obj_and_monitors", "macro_sql": "{% macro get_all_column_obj_and_monitors(model_relation, column_tests=none) %}\n\n {% set column_obj_and_monitors = [] %}\n {% set column_objects = adapter.get_columns_in_relation(model_relation) %}\n\n {% for column_obj in column_objects %}\n {% set column_monitors = elementary.column_monitors_by_type(elementary.get_column_data_type(column_obj), column_tests) %}\n {% set column_item = {'column': column_obj, 'monitors': column_monitors} %}\n {% do column_obj_and_monitors.append(column_item) %}\n {% endfor %}\n\n {{ return(column_obj_and_monitors) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.column_monitors_by_type", "macro.elementary.get_column_data_type"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.231144, "supported_languages": null}, "macro.elementary.column_monitors_by_type": {"name": "column_monitors_by_type", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/data_monitoring/data_monitors_configuration/get_column_monitors.sql", "original_file_path": "macros/edr/data_monitoring/data_monitors_configuration/get_column_monitors.sql", "unique_id": "macro.elementary.column_monitors_by_type", "macro_sql": "{% macro column_monitors_by_type(data_type, column_tests=none) %}\n {% set normalized_data_type = elementary.normalize_data_type(data_type) %}\n {% set monitors = [] %}\n {% set chosen_monitors = column_tests or elementary.get_agg_column_monitors(only_defaults=true) %}\n {% set available_monitors = elementary.get_available_monitors() %}\n\n {% set any_type_monitors = elementary.lists_intersection(chosen_monitors, available_monitors[\"column_any_type\"]) %}\n {% do monitors.extend(any_type_monitors) %}\n {% if normalized_data_type == 'numeric' %}\n {% set numeric_monitors = elementary.lists_intersection(chosen_monitors, available_monitors[\"column_numeric\"]) %}\n {% do monitors.extend(numeric_monitors) %}\n {% elif normalized_data_type == 'string' %}\n {% set string_monitors = elementary.lists_intersection(chosen_monitors, available_monitors[\"column_string\"]) %}\n {% do monitors.extend(string_monitors) %}\n {% elif normalized_data_type == 'boolean' %}\n {% set boolean_monitors = elementary.lists_intersection(chosen_monitors, available_monitors[\"column_boolean\"]) %}\n {% do monitors.extend(boolean_monitors) %}\n {% endif %}\n {{ return(monitors | unique | list) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.normalize_data_type", "macro.elementary.get_agg_column_monitors", "macro.elementary.get_available_monitors", "macro.elementary.lists_intersection"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.2332335, "supported_languages": null}, "macro.elementary.get_agg_column_monitors": {"name": "get_agg_column_monitors", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/data_monitoring/data_monitors_configuration/get_column_monitors.sql", "original_file_path": "macros/edr/data_monitoring/data_monitors_configuration/get_column_monitors.sql", "unique_id": "macro.elementary.get_agg_column_monitors", "macro_sql": "{% macro get_agg_column_monitors(only_defaults=false) %}\n {% set agg_column_monitors = [] %}\n {% if only_defaults %}\n {% set monitors = elementary.get_default_monitors() %}\n {% else %}\n {% set monitors = elementary.get_available_monitors() %}\n {% endif %}\n {% do agg_column_monitors.extend(monitors['column_any_type']) %}\n {% do agg_column_monitors.extend(monitors['column_string']) %}\n {% do agg_column_monitors.extend(monitors['column_numeric']) %}\n {% do agg_column_monitors.extend(monitors['column_boolean']) %}\n {{ return(agg_column_monitors) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.get_default_monitors", "macro.elementary.get_available_monitors"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.2343667, "supported_languages": null}, "macro.elementary.get_detection_end": {"name": "get_detection_end", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/data_monitoring/data_monitors_configuration/get_buckets_configuration.sql", "original_file_path": "macros/edr/data_monitoring/data_monitors_configuration/get_buckets_configuration.sql", "unique_id": "macro.elementary.get_detection_end", "macro_sql": "{% macro get_detection_end(detection_delay) %}\n {%- set kwargs = {detection_delay.period+'s': detection_delay.count} %}\n {%- set detection_end = elementary.get_run_started_at() - modules.datetime.timedelta(**kwargs) %}\n {{ return(detection_end) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.get_run_started_at"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.2377825, "supported_languages": null}, "macro.elementary.get_trunc_min_bucket_start_expr": {"name": "get_trunc_min_bucket_start_expr", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/data_monitoring/data_monitors_configuration/get_buckets_configuration.sql", "original_file_path": "macros/edr/data_monitoring/data_monitors_configuration/get_buckets_configuration.sql", "unique_id": "macro.elementary.get_trunc_min_bucket_start_expr", "macro_sql": "{% macro get_trunc_min_bucket_start_expr(detection_end, metric_properties, days_back) %}\n {%- set untruncated_min = (detection_end - modules.datetime.timedelta(days_back | int)).strftime(\"%Y-%m-%d 00:00:00\") %}\n {%- set trunc_min_bucket_start_expr = elementary.edr_date_trunc(metric_properties.time_bucket.period, elementary.edr_cast_as_timestamp(elementary.edr_quote(untruncated_min)))%}\n {{ return(trunc_min_bucket_start_expr) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.edr_date_trunc", "macro.elementary.edr_cast_as_timestamp", "macro.elementary.edr_quote"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.2384844, "supported_languages": null}, "macro.elementary.get_backfill_bucket_start": {"name": "get_backfill_bucket_start", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/data_monitoring/data_monitors_configuration/get_buckets_configuration.sql", "original_file_path": "macros/edr/data_monitoring/data_monitors_configuration/get_buckets_configuration.sql", "unique_id": "macro.elementary.get_backfill_bucket_start", "macro_sql": "{% macro get_backfill_bucket_start(detection_end, backfill_days) %}\n {% do return((detection_end - modules.datetime.timedelta(backfill_days)).strftime(\"%Y-%m-%d 00:00:00\")) %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.2388685, "supported_languages": null}, "macro.elementary.get_test_buckets_min_and_max": {"name": "get_test_buckets_min_and_max", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/data_monitoring/data_monitors_configuration/get_buckets_configuration.sql", "original_file_path": "macros/edr/data_monitoring/data_monitors_configuration/get_buckets_configuration.sql", "unique_id": "macro.elementary.get_test_buckets_min_and_max", "macro_sql": "{% macro get_test_buckets_min_and_max(model_relation, backfill_days, days_back, detection_delay, monitors=none, column_name=none, metric_properties=none, unit_test=false, unit_test_relation=none) %}\n\n {%- set detection_end = elementary.get_detection_end(detection_delay) %}\n {%- set detection_end_expr = elementary.edr_cast_as_timestamp(elementary.edr_quote(detection_end)) %}\n {%- set trunc_min_bucket_start_expr = elementary.get_trunc_min_bucket_start_expr(detection_end, metric_properties, days_back) %}\n {%- set backfill_bucket_start = elementary.edr_cast_as_timestamp(elementary.edr_quote(elementary.get_backfill_bucket_start(detection_end, backfill_days))) %}\n {%- set full_table_name = elementary.relation_to_full_name(model_relation) %}\n {%- set force_metrics_backfill = elementary.get_config_var('force_metrics_backfill') %}\n\n {%- if monitors %}\n {%- set monitors_tuple = elementary.strings_list_to_tuple(monitors) %}\n {%- endif %}\n\n {%- if unit_test %}\n {%- set data_monitoring_metrics_relation = dbt.load_relation(unit_test_relation) %}\n {%- else %}\n {%- set data_monitoring_metrics_relation = elementary.get_elementary_relation('data_monitoring_metrics') %}\n {%- endif %}\n\n {%- set regular_bucket_times_query %}\n with bucket_times as (\n select\n {{ trunc_min_bucket_start_expr }} as days_back_start\n , {{ detection_end_expr }} as detection_end\n ),\n full_buckets_calc as (\n select *,\n floor({{ elementary.edr_datediff('days_back_start', 'detection_end', metric_properties.time_bucket.period) }} / {{ metric_properties.time_bucket.count }}) * {{ metric_properties.time_bucket.count }} as periods_until_max\n from bucket_times\n )\n select\n days_back_start as min_bucket_start,\n {{ elementary.edr_timeadd(metric_properties.time_bucket.period, 'periods_until_max', 'days_back_start') }} {# Add full buckets to last_max_bucket_end #}\n as max_bucket_end\n from full_buckets_calc\n {%- endset %}\n\n {%- set incremental_bucket_times_query %}\n with all_buckets as (\n select edr_bucket_start as bucket_start, edr_bucket_end as bucket_end\n from ({{ elementary.complete_buckets_cte(metric_properties, trunc_min_bucket_start_expr, detection_end_expr) }}) results\n where edr_bucket_start >= {{ trunc_min_bucket_start_expr }}\n and edr_bucket_end <= {{ detection_end_expr }}\n ),\n buckets_with_existing_metrics as (\n select distinct bucket_start, bucket_end\n from {{ data_monitoring_metrics_relation }}\n where bucket_start >= {{ trunc_min_bucket_start_expr }}\n and bucket_end <= {{ detection_end_expr }}\n and upper(full_table_name) = upper('{{ full_table_name }}')\n and metric_properties = {{ elementary.dict_to_quoted_json(metric_properties) }}\n {%- if monitors %}\n and metric_name in {{ monitors_tuple }}\n {%- endif %}\n {%- if column_name %}\n and upper(column_name) = upper('{{ column_name }}')\n {%- endif %}\n ),\n missing_bucket_starts as (\n select all_buckets.bucket_start\n from all_buckets\n left outer join buckets_with_existing_metrics existing on (\n existing.bucket_start = all_buckets.bucket_start and\n existing.bucket_end = all_buckets.bucket_end\n )\n where existing.bucket_start is NULL\n ),\n min_bucket_start_candidates as (\n select bucket_start from missing_bucket_starts\n union all\n select {{ backfill_bucket_start }} as bucket_start\n )\n select\n min(bucket_start) as min_bucket_start,\n {{ detection_end_expr }} as max_bucket_end\n from min_bucket_start_candidates\n {% endset %}\n\n {# We assume we should also cosider sources as incremental #}\n {% if force_metrics_backfill or not (elementary.is_incremental_model(elementary.get_model_graph_node(model_relation), source_included=true) or unit_test) %}\n {%- set buckets = elementary.agate_to_dicts(elementary.run_query(regular_bucket_times_query))[0] %}\n {%- else %}\n {%- set buckets = elementary.agate_to_dicts(elementary.run_query(incremental_bucket_times_query))[0] %}\n {% endif %}\n\n {%- if buckets %}\n {%- set min_bucket_start = elementary.edr_quote(buckets.get('min_bucket_start')) %}\n {%- set max_bucket_end = elementary.edr_quote(buckets.get('max_bucket_end')) %}\n {{ return([min_bucket_start, max_bucket_end]) }}\n {%- else %}\n {{ exceptions.raise_compiler_error(\"Failed to calc test buckets min and max\") }}\n {%- endif %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.get_detection_end", "macro.elementary.edr_cast_as_timestamp", "macro.elementary.edr_quote", "macro.elementary.get_trunc_min_bucket_start_expr", "macro.elementary.get_backfill_bucket_start", "macro.elementary.relation_to_full_name", "macro.elementary.get_config_var", "macro.elementary.strings_list_to_tuple", "macro.dbt.load_relation", "macro.elementary.get_elementary_relation", "macro.elementary.edr_datediff", "macro.elementary.edr_timeadd", "macro.elementary.complete_buckets_cte", "macro.elementary.dict_to_quoted_json", "macro.elementary.is_incremental_model", "macro.elementary.get_model_graph_node", "macro.elementary.agate_to_dicts", "macro.elementary.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.2433095, "supported_languages": null}, "macro.elementary.get_final_table_monitors": {"name": "get_final_table_monitors", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/data_monitoring/data_monitors_configuration/get_table_monitors.sql", "original_file_path": "macros/edr/data_monitoring/data_monitors_configuration/get_table_monitors.sql", "unique_id": "macro.elementary.get_final_table_monitors", "macro_sql": "{% macro get_final_table_monitors(table_anomalies) %}\n {%- set final_table_monitors = [] %}\n\n {%- if table_anomalies and table_anomalies | length > 0 %}\n {%- set allowed_table_monitors = elementary.get_allowed_table_monitors() %}\n {%- set final_table_monitors = elementary.lists_intersection(table_anomalies, allowed_table_monitors) %}\n {%- else %}\n {%- set final_table_monitors = elementary.get_default_table_monitors() %}\n {%- endif %}\n {{ return(final_table_monitors) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.get_allowed_table_monitors", "macro.elementary.lists_intersection", "macro.elementary.get_default_table_monitors"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.2444963, "supported_languages": null}, "macro.elementary.get_default_table_monitors": {"name": "get_default_table_monitors", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/data_monitoring/data_monitors_configuration/get_table_monitors.sql", "original_file_path": "macros/edr/data_monitoring/data_monitors_configuration/get_table_monitors.sql", "unique_id": "macro.elementary.get_default_table_monitors", "macro_sql": "{% macro get_default_table_monitors() %}\n {%- set default_table_monitors = elementary.get_config_var('edr_monitors')['table'] | list %}\n {{ return(default_table_monitors) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.get_config_var"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.244893, "supported_languages": null}, "macro.elementary.get_allowed_table_monitors": {"name": "get_allowed_table_monitors", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/data_monitoring/data_monitors_configuration/get_table_monitors.sql", "original_file_path": "macros/edr/data_monitoring/data_monitors_configuration/get_table_monitors.sql", "unique_id": "macro.elementary.get_allowed_table_monitors", "macro_sql": "{% macro get_allowed_table_monitors() %}\n {% do return([\"row_count\", \"freshness\", \"event_freshness\"]) %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.2451963, "supported_languages": null}, "macro.elementary.get_failed_row_count": {"name": "get_failed_row_count", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/materializations/test/failed_row_count.sql", "original_file_path": "macros/edr/materializations/test/failed_row_count.sql", "unique_id": "macro.elementary.get_failed_row_count", "macro_sql": "{% macro get_failed_row_count(flattened_test) %}\n {% set test_result = elementary.get_test_result() %}\n {% if config.get(\"fail_calc\").strip() == elementary.get_failed_row_count_calc(flattened_test) %}\n {% do elementary.debug_log(\"Using test failures as failed_rows value.\") %}\n {% do return(test_result.failures|int) %}\n {% endif %}\n {% if elementary.did_test_pass(test_result) %}\n {% do return(none) %}\n {% endif %}\n {% set failed_row_count_query = elementary.get_failed_row_count_query(flattened_test) %}\n {% if failed_row_count_query %}\n {% set result_count = elementary.result_value(failed_row_count_query) %}\n {% do return(result_count) %}\n {% endif %}\n {% do return(none) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.get_test_result", "macro.elementary.get_failed_row_count_calc", "macro.elementary.debug_log", "macro.elementary.did_test_pass", "macro.elementary.get_failed_row_count_query", "macro.elementary.result_value"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.2478707, "supported_languages": null}, "macro.elementary.get_failed_row_count_query": {"name": "get_failed_row_count_query", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/materializations/test/failed_row_count.sql", "original_file_path": "macros/edr/materializations/test/failed_row_count.sql", "unique_id": "macro.elementary.get_failed_row_count_query", "macro_sql": "{% macro get_failed_row_count_query(flattened_test) %}\n {% set failed_row_count_calc = elementary.get_failed_row_count_calc(flattened_test) %}\n {% if failed_row_count_calc %}\n {% set failed_row_count_query = elementary.get_failed_row_count_calc_query(failed_row_count_calc) %}\n {% do return(failed_row_count_query) %}\n {% endif %}\n {% do return(none) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.get_failed_row_count_calc", "macro.elementary.get_failed_row_count_calc_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.2485132, "supported_languages": null}, "macro.elementary.get_failed_row_count_calc": {"name": "get_failed_row_count_calc", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/materializations/test/failed_row_count.sql", "original_file_path": "macros/edr/materializations/test/failed_row_count.sql", "unique_id": "macro.elementary.get_failed_row_count_calc", "macro_sql": "{% macro get_failed_row_count_calc(flattened_test) %}\n {% if \"failed_row_count_calc\" in flattened_test[\"meta\"] %}\n {% do return(flattened_test[\"meta\"][\"failed_row_count_calc\"]) %}\n {% endif %}\n {% set common_test_config = elementary.get_common_test_config(flattened_test) %}\n {% if common_test_config %}\n {% do return(common_test_config.get(\"failed_row_count_calc\")) %}\n {% endif %}\n {% do return(none) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.get_common_test_config"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.2494638, "supported_languages": null}, "macro.elementary.get_failed_row_count_calc_query": {"name": "get_failed_row_count_calc_query", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/materializations/test/failed_row_count.sql", "original_file_path": "macros/edr/materializations/test/failed_row_count.sql", "unique_id": "macro.elementary.get_failed_row_count_calc_query", "macro_sql": "{% macro get_failed_row_count_calc_query(failed_row_count_calc) %}\n with results as (\n {{ sql }}\n )\n select {{ failed_row_count_calc }} as count from results\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.2496953, "supported_languages": null}, "macro.elementary.get_test_result": {"name": "get_test_result", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/materializations/test/test_result.sql", "original_file_path": "macros/edr/materializations/test/test_result.sql", "unique_id": "macro.elementary.get_test_result", "macro_sql": "{% macro get_test_result() %}\n{#\n This macro should return a dictionary with the following keys:\n - failures - the result of dbts fail_calc\n - should_warn\n - should_error\n#}\n {% set result = load_result('main') %}\n {% set rows = elementary.agate_to_dicts(result.table) %}\n {% do return(rows[0]) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.agate_to_dicts"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.2504044, "supported_languages": null}, "macro.elementary.did_test_pass": {"name": "did_test_pass", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/materializations/test/test_result.sql", "original_file_path": "macros/edr/materializations/test/test_result.sql", "unique_id": "macro.elementary.did_test_pass", "macro_sql": "{% macro did_test_pass(test_result=none) %}\n {% if test_result is none %}\n {% set test_result = elementary.get_test_result() %}\n {% endif %}\n {% do return(not test_result.should_warn and not test_result.should_error) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.get_test_result"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.2509162, "supported_languages": null}, "macro.elementary.create_test_result_temp_table": {"name": "create_test_result_temp_table", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/materializations/test/test.sql", "original_file_path": "macros/edr/materializations/test/test.sql", "unique_id": "macro.elementary.create_test_result_temp_table", "macro_sql": "{% macro create_test_result_temp_table() %}\n {% set database, schema = elementary.get_package_database_and_schema() %}\n {% set test_id = model[\"alias\"] %}\n {% set relation = elementary.create_temp_table(database, schema, test_id, sql) %}\n {% set new_sql %}\n select * from {{ relation }}\n {% endset %}\n {% do return(new_sql) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.get_package_database_and_schema", "macro.elementary.create_temp_table"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.2863965, "supported_languages": null}, "macro.elementary.query_test_result_rows": {"name": "query_test_result_rows", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/materializations/test/test.sql", "original_file_path": "macros/edr/materializations/test/test.sql", "unique_id": "macro.elementary.query_test_result_rows", "macro_sql": "{% macro query_test_result_rows(sample_limit=none, ignore_passed_tests=false) %}\n {% if sample_limit == 0 %} {# performance: no need to run a sql query that we know returns an empty list #}\n {% do return([]) %}\n {% endif %}\n {% if ignore_passed_tests and elementary.did_test_pass() %}\n {% do elementary.debug_log(\"Skipping sample query because the test passed.\") %}\n {% do return([]) %}\n {% endif %}\n {% set query %}\n with test_results as (\n {{ sql }}\n )\n select * from test_results {% if sample_limit is not none %} limit {{ sample_limit }} {% endif %}\n {% endset %}\n {% do return(elementary.agate_to_dicts(elementary.run_query(query))) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.did_test_pass", "macro.elementary.debug_log", "macro.elementary.agate_to_dicts", "macro.elementary.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.2875872, "supported_languages": null}, "macro.elementary.cache_elementary_test_results_rows": {"name": "cache_elementary_test_results_rows", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/materializations/test/test.sql", "original_file_path": "macros/edr/materializations/test/test.sql", "unique_id": "macro.elementary.cache_elementary_test_results_rows", "macro_sql": "{% macro cache_elementary_test_results_rows(elementary_test_results_rows) %}\n {% do elementary.get_cache(\"elementary_test_results\").update({model.unique_id: elementary_test_results_rows}) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.get_cache"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.2879589, "supported_languages": null}, "macro.elementary.handle_anomaly_test": {"name": "handle_anomaly_test", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/materializations/test/test.sql", "original_file_path": "macros/edr/materializations/test/test.sql", "unique_id": "macro.elementary.handle_anomaly_test", "macro_sql": "{% macro handle_anomaly_test(flattened_test, materialization_macro) %}\n {% set metrics_tables_cache = elementary.get_cache(\"tables\").get(\"metrics\").get(\"relations\") %}\n {% set metrics_table = elementary.get_elementary_test_table(elementary.get_elementary_test_table_name(), 'metrics') %}\n {% if metrics_table %}\n {% do metrics_tables_cache.append(metrics_table) %}\n {% endif %}\n\n {% set anomaly_scores_groups_rows = {} %}\n {% set anomaly_scores_rows = elementary.query_test_result_rows() %}\n {% for anomaly_scores_row in anomaly_scores_rows %}\n {% set anomaly_scores_group = (anomaly_scores_row.full_table_name, anomaly_scores_row.column_name, anomaly_scores_row.metric_name) %}\n {% do anomaly_scores_groups_rows.setdefault(anomaly_scores_group, []) %}\n {% do anomaly_scores_groups_rows[anomaly_scores_group].append(anomaly_scores_row) %}\n {% endfor %}\n\n {% set elementary_test_results_rows = [] %}\n {% for anomaly_scores_group, anomaly_scores_rows in anomaly_scores_groups_rows.items() %}\n {% do elementary.debug_log(\"Found {} anomaly scores for group {}.\".format(anomaly_scores_rows | length, anomaly_scores_group)) %}\n {% do elementary_test_results_rows.append(elementary.get_anomaly_test_result_row(flattened_test, anomaly_scores_rows)) %}\n {% endfor %}\n {% do elementary.cache_elementary_test_results_rows(elementary_test_results_rows) %}\n\n {% do context.update({\"sql\": elementary.get_anomaly_query(flattened_test)}) %}\n {% do return(materialization_macro()) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.get_cache", "macro.elementary.get_elementary_test_table", "macro.elementary.get_elementary_test_table_name", "macro.elementary.query_test_result_rows", "macro.elementary.debug_log", "macro.elementary.get_anomaly_test_result_row", "macro.elementary.cache_elementary_test_results_rows", "macro.elementary.get_anomaly_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.2904136, "supported_languages": null}, "macro.elementary.handle_schema_changes_test": {"name": "handle_schema_changes_test", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/materializations/test/test.sql", "original_file_path": "macros/edr/materializations/test/test.sql", "unique_id": "macro.elementary.handle_schema_changes_test", "macro_sql": "{% macro handle_schema_changes_test(flattened_test, materialization_macro) %}\n {% set schema_snapshots_tables_cache = elementary.get_cache(\"tables\").get(\"schema_snapshots\") %}\n {% set schema_snapshots_table = elementary.get_elementary_test_table(elementary.get_elementary_test_table_name(), 'schema_changes') %}\n {% if schema_snapshots_table %}\n {% do schema_snapshots_tables_cache.append(schema_snapshots_table) %}\n {% endif %}\n\n {% set elementary_test_results_rows = [] %}\n {% set schema_changes_rows = elementary.query_test_result_rows() %}\n {% for schema_changes_row in schema_changes_rows %}\n {% do elementary_test_results_rows.append(elementary.get_schema_changes_test_result_row(flattened_test, schema_changes_row, schema_changes_rows)) %}\n {% endfor %}\n {% do elementary.cache_elementary_test_results_rows(elementary_test_results_rows) %}\n {% do return(materialization_macro()) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.get_cache", "macro.elementary.get_elementary_test_table", "macro.elementary.get_elementary_test_table_name", "macro.elementary.query_test_result_rows", "macro.elementary.get_schema_changes_test_result_row", "macro.elementary.cache_elementary_test_results_rows"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.2917986, "supported_languages": null}, "macro.elementary.handle_dbt_test": {"name": "handle_dbt_test", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/materializations/test/test.sql", "original_file_path": "macros/edr/materializations/test/test.sql", "unique_id": "macro.elementary.handle_dbt_test", "macro_sql": "{% macro handle_dbt_test(flattened_test, materialization_macro) %}\n {% set result = materialization_macro() %}\n {% set result_rows = elementary.query_test_result_rows(sample_limit=elementary.get_config_var('test_sample_row_count'),\n ignore_passed_tests=true) %}\n {% set elementary_test_results_row = elementary.get_dbt_test_result_row(flattened_test, result_rows) %}\n {% do elementary.cache_elementary_test_results_rows([elementary_test_results_row]) %}\n {% do return(result) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.query_test_result_rows", "macro.elementary.get_config_var", "macro.elementary.get_dbt_test_result_row", "macro.elementary.cache_elementary_test_results_rows"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.2926192, "supported_languages": null}, "macro.elementary.get_test_type_handler": {"name": "get_test_type_handler", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/materializations/test/test.sql", "original_file_path": "macros/edr/materializations/test/test.sql", "unique_id": "macro.elementary.get_test_type_handler", "macro_sql": "{% macro get_test_type_handler(flattened_test) %}\n {% set test_type = elementary.get_test_type(flattened_test) %}\n {% set test_type_handler_map = {\n \"anomaly_detection\": elementary.handle_anomaly_test,\n \"schema_change\": elementary.handle_schema_changes_test,\n \"dbt_test\": elementary.handle_dbt_test,\n \"integrity\": elementary.handle_dbt_test\n } %}\n {% set test_type_handler = test_type_handler_map.get(test_type) %}\n {% if not test_type_handler %}\n {% do exceptions.raise_compiler_error(\"Unknown test type: {}\".format(test_type)) %}\n {% endif %}\n {% do return(test_type_handler) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.get_test_type"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.2936707, "supported_languages": null}, "macro.elementary.materialize_test": {"name": "materialize_test", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/materializations/test/test.sql", "original_file_path": "macros/edr/materializations/test/test.sql", "unique_id": "macro.elementary.materialize_test", "macro_sql": "{% macro materialize_test(materialization_macro) %}\n {% if not elementary.is_elementary_enabled() %}\n {% do return(materialization_macro()) %}\n {% endif %}\n\n {% set test_unique_id = model.get('unique_id') %}\n {% do elementary.debug_log(test_unique_id ~ \": starting test materialization hook\") %}\n {% if elementary.get_config_var(\"tests_use_temp_tables\") %}\n {% set temp_table_sql = elementary.create_test_result_temp_table() %}\n {% do context.update({\"sql\": temp_table_sql}) %}\n {% do elementary.debug_log(test_unique_id ~ \": created test temp table\") %}\n {% endif %}\n\n {% set flattened_test = elementary.flatten_test(model) %}\n {% do elementary.debug_log(test_unique_id ~ \": flattened test node\") %}\n {% set test_type_handler = elementary.get_test_type_handler(flattened_test) %}\n {% set result = test_type_handler(flattened_test, materialization_macro) %}\n {% do elementary.debug_log(test_unique_id ~ \": handler called by test type - \" ~ elementary.get_test_type(flattened_test)) %}\n {% if elementary.get_config_var(\"calculate_failed_count\") %}\n {% set failed_row_count = elementary.get_failed_row_count(flattened_test) %}\n {% if failed_row_count is not none %}\n {% do elementary.get_cache(\"elementary_test_failed_row_counts\").update({model.unique_id: failed_row_count}) %}\n {% do elementary.debug_log(test_unique_id ~ \": calculated failed row count\") %}\n {% endif %}\n {% endif %}\n {% do elementary.debug_log(test_unique_id ~ \": finished test materialization hook\") %}\n {% do return(result) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.is_elementary_enabled", "macro.elementary.debug_log", "macro.elementary.get_config_var", "macro.elementary.create_test_result_temp_table", "macro.elementary.flatten_test", "macro.elementary.get_test_type_handler", "macro.elementary.get_test_type", "macro.elementary.get_failed_row_count", "macro.elementary.get_cache"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.2962873, "supported_languages": null}, "macro.elementary.materialization_test_default": {"name": "materialization_test_default", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/materializations/test/test.sql", "original_file_path": "macros/edr/materializations/test/test.sql", "unique_id": "macro.elementary.materialization_test_default", "macro_sql": "{% materialization test, default %}\n {% set result = elementary.materialize_test(dbt.materialization_test_default) %}\n {% do return(result) %}\n{% endmaterialization %}", "depends_on": {"macros": ["macro.elementary.materialize_test"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.296675, "supported_languages": ["sql"]}, "macro.elementary.materialization_test_snowflake": {"name": "materialization_test_snowflake", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/materializations/test/test.sql", "original_file_path": "macros/edr/materializations/test/test.sql", "unique_id": "macro.elementary.materialization_test_snowflake", "macro_sql": "{% materialization test, adapter=\"snowflake\" %}\n {%- if dbt.materialization_test_snowflake -%}\n {% set materialization_macro = dbt.materialization_test_snowflake %}\n {%- else -%}\n {% set materialization_macro = dbt.materialization_test_default %}\n {%- endif -%}\n {% set result = elementary.materialize_test(materialization_macro) %}\n {% do return(result) %}\n{% endmaterialization %}", "depends_on": {"macros": ["macro.elementary.materialize_test"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.2973166, "supported_languages": ["sql"]}, "macro.elementary.get_anomaly_test_result_row": {"name": "get_anomaly_test_result_row", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/materializations/test/test.sql", "original_file_path": "macros/edr/materializations/test/test.sql", "unique_id": "macro.elementary.get_anomaly_test_result_row", "macro_sql": "{% macro get_anomaly_test_result_row(flattened_test, anomaly_scores_rows) %}\n {%- set latest_row = anomaly_scores_rows[-1] %}\n {%- set full_table_name = elementary.insensitive_get_dict_value(latest_row, 'full_table_name') %}\n {%- set test_unique_id = flattened_test.unique_id %}\n {%- set test_configuration = elementary.get_cache(test_unique_id) %}\n {%- set test_params = elementary.insensitive_get_dict_value(flattened_test, 'test_params') %}\n {%- do test_params.update(test_configuration) %}\n {%- set parent_model_unique_id = elementary.insensitive_get_dict_value(flattened_test, 'parent_model_unique_id') %}\n {%- set column_name = elementary.insensitive_get_dict_value(latest_row, 'column_name') %}\n {%- set metric_name = elementary.insensitive_get_dict_value(latest_row, 'metric_name') %}\n {%- set test_unique_id = elementary.insensitive_get_dict_value(latest_row, 'test_unique_id') %}\n {%- set has_anomaly_score = elementary.insensitive_get_dict_value(latest_row, 'anomaly_score') is not none %}\n {%- if not has_anomaly_score %}\n {% do elementary.edr_log(\"Not enough data to calculate anomaly scores on `{}`\".format(test_unique_id)) %}\n {% endif %}\n {%- set test_results_query -%}\n select * from ({{ sql }}) results\n where\n anomaly_score is not null and\n upper(full_table_name) = upper({{ elementary.const_as_string(full_table_name) }}) and\n metric_name = {{ elementary.const_as_string(metric_name) }}\n {%- if column_name %}\n and upper(column_name) = upper({{ elementary.const_as_string(column_name) }})\n {%- endif %}\n {%- endset -%}\n {% set test_results_description %}\n {% if has_anomaly_score %}\n {{ elementary.insensitive_get_dict_value(latest_row, 'anomaly_description') }}\n {% else %}\n Not enough data to calculate anomaly score.\n {% endif %}\n {% endset %}\n {% set failures = namespace(data=0) %}\n {% set filtered_anomaly_scores_rows = [] %}\n {% for row in anomaly_scores_rows %}\n {% if row.anomaly_score is not none %}\n {% do filtered_anomaly_scores_rows.append(row) %}\n {% if row.is_anomalous %}\n {% set failures.data = failures.data + 1 %}\n {% endif %}\n {% endif %}\n {% endfor %}\n {% set test_result_dict = {\n 'id': elementary.insensitive_get_dict_value(latest_row, 'id'),\n 'data_issue_id': elementary.insensitive_get_dict_value(latest_row, 'metric_id'),\n 'model_unique_id': parent_model_unique_id,\n 'column_name': column_name,\n 'test_type': 'anomaly_detection',\n 'test_sub_type': metric_name,\n 'test_results_description': test_results_description,\n 'other': elementary.insensitive_get_dict_value(latest_row, 'anomalous_value'),\n 'test_results_query': test_results_query,\n 'test_params': test_params,\n 'result_rows': filtered_anomaly_scores_rows,\n 'failures': failures.data\n } %}\n {% set elementary_test_row = elementary.get_dbt_test_result_row(flattened_test) %}\n {% do elementary_test_row.update(test_result_dict) %}\n {% do return(elementary_test_row) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.insensitive_get_dict_value", "macro.elementary.get_cache", "macro.elementary.edr_log", "macro.elementary.const_as_string", "macro.elementary.get_dbt_test_result_row"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.30159, "supported_languages": null}, "macro.elementary.get_schema_changes_test_result_row": {"name": "get_schema_changes_test_result_row", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/materializations/test/test.sql", "original_file_path": "macros/edr/materializations/test/test.sql", "unique_id": "macro.elementary.get_schema_changes_test_result_row", "macro_sql": "{% macro get_schema_changes_test_result_row(flattened_test, schema_changes_row, schema_changes_rows) %}\n {% set elementary_test_row = elementary.get_dbt_test_result_row(flattened_test, schema_changes_rows) %}\n {% do elementary_test_row.update(schema_changes_row) %}\n {% do return(elementary_test_row) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.get_dbt_test_result_row"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.3021214, "supported_languages": null}, "macro.elementary.get_dbt_test_result_row": {"name": "get_dbt_test_result_row", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/materializations/test/test.sql", "original_file_path": "macros/edr/materializations/test/test.sql", "unique_id": "macro.elementary.get_dbt_test_result_row", "macro_sql": "{% macro get_dbt_test_result_row(flattened_test, result_rows=none) %}\n {% if not result_rows %}\n {% set result_rows = [] %}\n {% endif %}\n\n {% set test_execution_id = elementary.get_node_execution_id(flattened_test) %}\n {% set parent_model_unique_id = elementary.insensitive_get_dict_value(flattened_test, 'parent_model_unique_id') %}\n {% set parent_model = elementary.get_node(parent_model_unique_id) %}\n {% set parent_model_name = elementary.get_table_name_from_node(parent_model) %}\n {% set test_result_dict = {\n 'id': test_execution_id,\n 'data_issue_id': none,\n 'test_execution_id': test_execution_id,\n 'test_unique_id': elementary.insensitive_get_dict_value(flattened_test, 'unique_id'),\n 'model_unique_id': parent_model_unique_id,\n 'detected_at': elementary.insensitive_get_dict_value(flattened_test, 'generated_at'),\n 'database_name': elementary.insensitive_get_dict_value(flattened_test, 'database_name'),\n 'schema_name': elementary.insensitive_get_dict_value(flattened_test, 'schema_name'),\n 'table_name': parent_model_name,\n 'column_name': elementary.insensitive_get_dict_value(flattened_test, 'test_column_name'),\n 'test_type': elementary.get_test_type(flattened_test),\n 'test_sub_type': elementary.insensitive_get_dict_value(flattened_test, 'type'),\n 'other': none,\n 'owners': elementary.insensitive_get_dict_value(flattened_test, 'model_owners'),\n 'tags': elementary.insensitive_get_dict_value(flattened_test, 'model_tags') + elementary.insensitive_get_dict_value(flattened_test, 'tags'),\n 'test_results_query': elementary.get_compiled_code(flattened_test),\n 'test_name': elementary.insensitive_get_dict_value(flattened_test, 'name'),\n 'test_params': elementary.insensitive_get_dict_value(flattened_test, 'test_params'),\n 'severity': elementary.insensitive_get_dict_value(flattened_test, 'severity'),\n 'test_short_name': elementary.insensitive_get_dict_value(flattened_test, 'short_name'),\n 'test_alias': elementary.insensitive_get_dict_value(flattened_test, 'alias'),\n 'result_rows': result_rows\n }%}\n {% do return(test_result_dict) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.get_node_execution_id", "macro.elementary.insensitive_get_dict_value", "macro.elementary.get_node", "macro.elementary.get_table_name_from_node", "macro.elementary.get_test_type", "macro.elementary.get_compiled_code"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.3051133, "supported_languages": null}, "macro.elementary.materialization_incremental_default": {"name": "materialization_incremental_default", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/materializations/model/incremental.sql", "original_file_path": "macros/edr/materializations/model/incremental.sql", "unique_id": "macro.elementary.materialization_incremental_default", "macro_sql": "{% materialization incremental, default %}\n {% set relations = dbt.materialization_incremental_default.call_macro() %}\n {% if not elementary.is_elementary_enabled() %}\n {% do return(relations) %}\n {% endif %}\n\n {% set metrics = elementary.query_metrics() %}\n {% do elementary.cache_metrics(metrics) %}\n {% do return(relations) %}\n{% endmaterialization %}", "depends_on": {"macros": ["macro.elementary.is_elementary_enabled", "macro.elementary.query_metrics", "macro.elementary.cache_metrics"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.3083012, "supported_languages": ["sql"]}, "macro.elementary.materialization_incremental_snowflake": {"name": "materialization_incremental_snowflake", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/materializations/model/incremental.sql", "original_file_path": "macros/edr/materializations/model/incremental.sql", "unique_id": "macro.elementary.materialization_incremental_snowflake", "macro_sql": "{% materialization incremental, adapter=\"snowflake\", supported_languages=[\"sql\", \"python\"] %}\n {% set relations = dbt.materialization_incremental_snowflake.call_macro() %}\n {% if not elementary.is_elementary_enabled() %}\n {% do return(relations) %}\n {% endif %}\n\n {% set metrics = elementary.query_metrics() %}\n {% do elementary.cache_metrics(metrics) %}\n {% do return(relations) %}\n{% endmaterialization %}", "depends_on": {"macros": ["macro.elementary.is_elementary_enabled", "macro.elementary.query_metrics", "macro.elementary.cache_metrics"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.3091662, "supported_languages": ["sql", "python"]}, "macro.elementary.materialization_incremental_bigquery": {"name": "materialization_incremental_bigquery", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/materializations/model/incremental.sql", "original_file_path": "macros/edr/materializations/model/incremental.sql", "unique_id": "macro.elementary.materialization_incremental_bigquery", "macro_sql": "{% materialization incremental, adapter=\"bigquery\", supported_languages=[\"sql\", \"python\"] %}\n {% set relations = dbt.materialization_incremental_bigquery.call_macro() %}\n {% if not elementary.is_elementary_enabled() %}\n {% do return(relations) %}\n {% endif %}\n\n {% set metrics = elementary.query_metrics() %}\n {% do elementary.cache_metrics(metrics) %}\n {% do return(relations) %}\n{% endmaterialization %}", "depends_on": {"macros": ["macro.elementary.is_elementary_enabled", "macro.elementary.query_metrics", "macro.elementary.cache_metrics"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.3100173, "supported_languages": ["sql", "python"]}, "macro.elementary.materialization_incremental_spark": {"name": "materialization_incremental_spark", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/materializations/model/incremental.sql", "original_file_path": "macros/edr/materializations/model/incremental.sql", "unique_id": "macro.elementary.materialization_incremental_spark", "macro_sql": "{% materialization incremental, adapter=\"spark\", supported_languages=[\"sql\", \"python\"] %}\n {% set relations = dbt.materialization_incremental_spark.call_macro() %}\n {% if not elementary.is_elementary_enabled() %}\n {% do return(relations) %}\n {% endif %}\n\n {% set metrics = elementary.query_metrics() %}\n {% do elementary.cache_metrics(metrics) %}\n {% do return(relations) %}\n{% endmaterialization %}", "depends_on": {"macros": ["macro.elementary.is_elementary_enabled", "macro.elementary.query_metrics", "macro.elementary.cache_metrics"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.310843, "supported_languages": ["sql", "python"]}, "macro.elementary.materialization_incremental_databricks": {"name": "materialization_incremental_databricks", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/materializations/model/incremental.sql", "original_file_path": "macros/edr/materializations/model/incremental.sql", "unique_id": "macro.elementary.materialization_incremental_databricks", "macro_sql": "{% materialization incremental, adapter=\"databricks\", supported_languages=[\"sql\", \"python\"] %}\n {% set relations = dbt.materialization_incremental_databricks.call_macro() %}\n {% if not elementary.is_elementary_enabled() %}\n {% do return(relations) %}\n {% endif %}\n\n {% set metrics = elementary.query_metrics() %}\n {% do elementary.cache_metrics(metrics) %}\n {% do return(relations) %}\n{% endmaterialization %}", "depends_on": {"macros": ["macro.elementary.is_elementary_enabled", "macro.elementary.query_metrics", "macro.elementary.cache_metrics"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.3116734, "supported_languages": ["sql", "python"]}, "macro.elementary.materialization_incremental_athena": {"name": "materialization_incremental_athena", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/materializations/model/incremental.sql", "original_file_path": "macros/edr/materializations/model/incremental.sql", "unique_id": "macro.elementary.materialization_incremental_athena", "macro_sql": "{% materialization incremental, adapter=\"athena\", supported_languages=[\"sql\"] %}\n {% set relations = dbt.materialization_incremental_athena.call_macro() %}\n {% if not elementary.is_elementary_enabled() %}\n {% do return(relations) %}\n {% endif %}\n\n {% set metrics = elementary.query_metrics() %}\n {% do elementary.cache_metrics(metrics) %}\n {% do return(relations) %}\n{% endmaterialization %}", "depends_on": {"macros": ["macro.elementary.is_elementary_enabled", "macro.elementary.query_metrics", "macro.elementary.cache_metrics"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.3124893, "supported_languages": ["sql"]}, "macro.elementary.materialize_table": {"name": "materialize_table", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/materializations/model/table.sql", "original_file_path": "macros/edr/materializations/model/table.sql", "unique_id": "macro.elementary.materialize_table", "macro_sql": "{% macro materialize_table(adapter_name) %}\n {% set original_name = 'materialization_table_' ~ adapter_name %}\n {% set original = dbt.get(original_name, dbt.materialization_table_default) %}\n {% set relations = original.call_macro() %}\n {% if not elementary.is_elementary_enabled() %}\n {% do return(relations) %}\n {% endif %}\n\n {% set metrics = elementary.query_metrics() %}\n {% do elementary.cache_metrics(metrics) %}\n {% do return(relations) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.is_elementary_enabled", "macro.elementary.query_metrics", "macro.elementary.cache_metrics"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.3149824, "supported_languages": null}, "macro.elementary.materialization_table_default": {"name": "materialization_table_default", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/materializations/model/table.sql", "original_file_path": "macros/edr/materializations/model/table.sql", "unique_id": "macro.elementary.materialization_table_default", "macro_sql": "{% materialization table, default %}\n {% do return(elementary.materialize_table.call_macro('default')) %}\n{% endmaterialization %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.3152857, "supported_languages": ["sql"]}, "macro.elementary.materialization_table_snowflake": {"name": "materialization_table_snowflake", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/materializations/model/table.sql", "original_file_path": "macros/edr/materializations/model/table.sql", "unique_id": "macro.elementary.materialization_table_snowflake", "macro_sql": "{% materialization table, adapter=\"snowflake\", supported_languages=[\"sql\", \"python\"] %}\n {% do return(elementary.materialize_table.call_macro('snowflake')) %}\n{% endmaterialization %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.3156798, "supported_languages": ["sql", "python"]}, "macro.elementary.materialization_table_bigquery": {"name": "materialization_table_bigquery", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/materializations/model/table.sql", "original_file_path": "macros/edr/materializations/model/table.sql", "unique_id": "macro.elementary.materialization_table_bigquery", "macro_sql": "{% materialization table, adapter=\"bigquery\", supported_languages=[\"sql\", \"python\"] %}\n {% do return(elementary.materialize_table.call_macro('bigquery')) %}\n{% endmaterialization %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.3160717, "supported_languages": ["sql", "python"]}, "macro.elementary.materialization_table_spark": {"name": "materialization_table_spark", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/materializations/model/table.sql", "original_file_path": "macros/edr/materializations/model/table.sql", "unique_id": "macro.elementary.materialization_table_spark", "macro_sql": "{% materialization table, adapter=\"spark\", supported_languages=[\"sql\", \"python\"] %}\n {% do return(elementary.materialize_table.call_macro('spark')) %}\n{% endmaterialization %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.316462, "supported_languages": ["sql", "python"]}, "macro.elementary.materialization_table_databricks": {"name": "materialization_table_databricks", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/materializations/model/table.sql", "original_file_path": "macros/edr/materializations/model/table.sql", "unique_id": "macro.elementary.materialization_table_databricks", "macro_sql": "{% materialization table, adapter=\"databricks\", supported_languages=[\"sql\", \"python\"] %}\n {% do return(elementary.materialize_table.call_macro('databricks')) %}\n{% endmaterialization %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.3168676, "supported_languages": ["sql", "python"]}, "macro.elementary.materialization_table_redshift": {"name": "materialization_table_redshift", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/materializations/model/table.sql", "original_file_path": "macros/edr/materializations/model/table.sql", "unique_id": "macro.elementary.materialization_table_redshift", "macro_sql": "{% materialization table, adapter=\"redshift\", supported_languages=[\"sql\", \"python\"] %}\n {% do return(elementary.materialize_table.call_macro('redshift')) %}\n{% endmaterialization %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.317393, "supported_languages": ["sql", "python"]}, "macro.elementary.materialization_table_athena": {"name": "materialization_table_athena", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/materializations/model/table.sql", "original_file_path": "macros/edr/materializations/model/table.sql", "unique_id": "macro.elementary.materialization_table_athena", "macro_sql": "{% materialization table, adapter=\"athena\", supported_languages=[\"sql\"] %}\n {% set relations = dbt.materialization_table_athena.call_macro() %}\n {% if not elementary.is_elementary_enabled() %}\n {% do return(relations) %}\n {% endif %}\n\n {% set metrics = elementary.query_metrics() %}\n {% do elementary.cache_metrics(metrics) %}\n {% do return(relations) %}\n{% endmaterialization %}", "depends_on": {"macros": ["macro.elementary.is_elementary_enabled", "macro.elementary.query_metrics", "macro.elementary.cache_metrics"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.3181922, "supported_languages": ["sql"]}, "macro.elementary.query_table_metrics": {"name": "query_table_metrics", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/materializations/model/metrics.sql", "original_file_path": "macros/edr/materializations/model/metrics.sql", "unique_id": "macro.elementary.query_table_metrics", "macro_sql": "{% macro query_table_metrics() %}\n {% set query %}\n select\n {{ modules.datetime.datetime.utcnow().timestamp() }} as build_timestamp,\n count(*) as row_count\n from {{ this }}\n {% endset %}\n\n {% set metrics = [] %}\n {% for metric_column in elementary.run_query(query).columns %}\n {% set metric_name = metric_column.name %}\n {% set metric_value = metric_column[0] %}\n {% do metrics.append({\n \"id\": \"{}.{}\".format(invocation_id, this),\n \"full_table_name\": elementary.relation_to_full_name(this),\n \"column_name\": none,\n \"metric_name\": metric_name,\n \"metric_value\": metric_value,\n \"updated_at\": elementary.datetime_now_utc_as_string()\n }) %}\n {% endfor %}\n {% do return(metrics) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.run_query", "macro.elementary.relation_to_full_name", "macro.elementary.datetime_now_utc_as_string"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.3205206, "supported_languages": null}, "macro.elementary.can_query_metrics": {"name": "can_query_metrics", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/materializations/model/metrics.sql", "original_file_path": "macros/edr/materializations/model/metrics.sql", "unique_id": "macro.elementary.can_query_metrics", "macro_sql": "{% macro can_query_metrics() %}\n {% if not elementary.get_config_var('collect_metrics') %}\n {% do return(false) %}\n {% endif %}\n\n {% if model.config.require_partition_filter %}\n {% do return(false) %}\n {% endif %}\n\n {% do return(true) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.get_config_var"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.3211923, "supported_languages": null}, "macro.elementary.query_metrics": {"name": "query_metrics", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/materializations/model/metrics.sql", "original_file_path": "macros/edr/materializations/model/metrics.sql", "unique_id": "macro.elementary.query_metrics", "macro_sql": "{% macro query_metrics() %}\n {% if not elementary.can_query_metrics() %}\n {% do return([]) %}\n {% endif %}\n\n {% do return(elementary.query_table_metrics()) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.can_query_metrics", "macro.elementary.query_table_metrics"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.321655, "supported_languages": null}, "macro.elementary.cache_metrics": {"name": "cache_metrics", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/materializations/model/metrics.sql", "original_file_path": "macros/edr/materializations/model/metrics.sql", "unique_id": "macro.elementary.cache_metrics", "macro_sql": "{% macro cache_metrics(metrics) %}\n {% do elementary.get_cache(\"tables\").get(\"metrics\").get(\"rows\").extend(metrics) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.get_cache"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.322045, "supported_languages": null}, "macro.elementary.get_artifact_metadata_hash": {"name": "get_artifact_metadata_hash", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/dbt_artifacts/get_artifact_metadata_hash.sql", "original_file_path": "macros/edr/dbt_artifacts/get_artifact_metadata_hash.sql", "unique_id": "macro.elementary.get_artifact_metadata_hash", "macro_sql": "{% macro get_artifact_metadata_hash(artifact) %}\n {% if not local_md5 %}\n {% do return(none) %}\n {% endif %}\n\n {% set time_excluded_artifact = artifact.copy() %}\n {% do time_excluded_artifact.pop(\"generated_at\") %}\n {% do return(local_md5(tojson(time_excluded_artifact, sort_keys=true))) %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.3228898, "supported_languages": null}, "macro.elementary.upload_dbt_tests": {"name": "upload_dbt_tests", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/dbt_artifacts/upload_dbt_tests.sql", "original_file_path": "macros/edr/dbt_artifacts/upload_dbt_tests.sql", "unique_id": "macro.elementary.upload_dbt_tests", "macro_sql": "{%- macro upload_dbt_tests(should_commit=false, metadata_hashes=none) -%}\n {% set relation = elementary.get_elementary_relation('dbt_tests') %}\n {% if execute and relation %}\n {% set tests = graph.nodes.values() | selectattr('resource_type', '==', 'test') %}\n {% do elementary.upload_artifacts_to_table(relation, tests, elementary.flatten_test, should_commit=should_commit, metadata_hashes=metadata_hashes) %}\n {%- endif -%}\n {{- return('') -}}\n{%- endmacro -%}\n\n\n\n\n", "depends_on": {"macros": ["macro.elementary.get_elementary_relation", "macro.elementary.upload_artifacts_to_table"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.3360744, "supported_languages": null}, "macro.elementary.get_dbt_tests_empty_table_query": {"name": "get_dbt_tests_empty_table_query", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/dbt_artifacts/upload_dbt_tests.sql", "original_file_path": "macros/edr/dbt_artifacts/upload_dbt_tests.sql", "unique_id": "macro.elementary.get_dbt_tests_empty_table_query", "macro_sql": "{% macro get_dbt_tests_empty_table_query() %}\n {% set dbt_tests_empty_table_query = elementary.empty_table([('unique_id', 'string'),\n ('database_name', 'string'),\n ('schema_name', 'string'),\n ('name', 'string'),\n ('short_name', 'string'),\n ('alias', 'string'),\n ('test_column_name', 'string'),\n ('severity', 'string'),\n ('warn_if', 'string'),\n ('error_if', 'string'),\n ('test_params', 'long_string'),\n ('test_namespace', 'string'),\n ('tags', 'long_string'),\n ('model_tags', 'long_string'),\n ('model_owners', 'long_string'),\n ('meta', 'long_string'),\n ('depends_on_macros', 'long_string'),\n ('depends_on_nodes', 'long_string'),\n ('parent_model_unique_id', 'string'),\n ('description', 'long_string'),\n ('package_name', 'string'),\n ('type', 'string'),\n ('original_path', 'long_string'),\n ('path', 'string'),\n ('generated_at', 'string'),\n ('metadata_hash', 'string'),\n ('quality_dimension', 'string')\n ]) %}\n {{ return(dbt_tests_empty_table_query) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.empty_table"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.3381104, "supported_languages": null}, "macro.elementary.flatten_test": {"name": "flatten_test", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/dbt_artifacts/upload_dbt_tests.sql", "original_file_path": "macros/edr/dbt_artifacts/upload_dbt_tests.sql", "unique_id": "macro.elementary.flatten_test", "macro_sql": "{% macro flatten_test(node_dict) %}\n {% set config_dict = elementary.safe_get_with_default(node_dict, 'config', {}) %}\n {% set depends_on_dict = elementary.safe_get_with_default(node_dict, 'depends_on', {}) %}\n\n {% set test_metadata = elementary.safe_get_with_default(node_dict, 'test_metadata', {}) %}\n {% set test_namespace = test_metadata.get('namespace') %}\n {% set test_short_name = elementary.get_test_short_name(node_dict, test_metadata) %}\n\n {% set default_description = elementary.get_default_description(test_short_name, test_namespace) %}\n\n {% set config_meta_dict = elementary.safe_get_with_default(config_dict, 'meta', {}) %}\n {% set meta_dict = {} %}\n {% if default_description %}\n {% set meta_dict = {'description': default_description} %} \n {% endif %}\n {% do meta_dict.update(elementary.safe_get_with_default(node_dict, 'meta', {})) %}\n {% do meta_dict.update(config_meta_dict) %}\n\n {% set config_tags = elementary.safe_get_with_default(config_dict, 'tags', []) %}\n {% set global_tags = elementary.safe_get_with_default(node_dict, 'tags', []) %}\n {% set meta_tags = elementary.safe_get_with_default(meta_dict, 'tags', []) %}\n {% set tags = elementary.union_lists(config_tags, global_tags) %}\n {% set tags = elementary.union_lists(tags, meta_tags) %}\n\n {% set test_model_unique_ids = elementary.get_parent_model_unique_ids_from_test_node(node_dict) %}\n {% set test_model_nodes = elementary.get_nodes_by_unique_ids(test_model_unique_ids) %}\n {% set test_models_owners = [] %}\n {% set test_models_tags = [] %}\n {% for test_model_node in test_model_nodes %}\n {% set flatten_test_model_node = elementary.flatten_model(test_model_node) %}\n {% set test_model_owner = flatten_test_model_node.get('owner') %}\n {% if test_model_owner %}\n {% if test_model_owner is string %}\n {% set owners = test_model_owner.split(',') %}\n {% for owner in owners %}\n {% do test_models_owners.append(owner | trim) %} \n {% endfor %}\n {% elif test_model_owner is iterable %}\n {% do test_models_owners.extend(test_model_owner) %}\n {% endif %}\n {% endif %}\n {% set test_model_tags = flatten_test_model_node.get('tags') %}\n {% if test_model_tags and test_model_tags is sequence %}\n {% do test_models_tags.extend(test_model_tags) %}\n {% endif %}\n {% endfor %}\n {% set test_models_owners = test_models_owners | unique | list %}\n {% set test_models_tags = test_models_tags | unique | list %}\n\n {% set test_kwargs = elementary.safe_get_with_default(test_metadata, 'kwargs', {}) %}\n\n {% set primary_test_model_id = namespace(data=none) %}\n {% if test_model_unique_ids | length == 1 %}\n {# if only one parent model for this test, simply use this model #}\n {% set primary_test_model_id.data = test_model_unique_ids[0] %}\n {% else %}\n {% set test_model_jinja = test_kwargs.get('model') %}\n {% if test_model_jinja %}\n {% set test_model_name_matches =\n modules.re.findall(\"ref\\(['\\\"](\\w+)['\\\"]\\)\", test_model_jinja) +\n modules.re.findall(\"source\\(['\\\"]\\w+['\\\"], ['\\\"](\\w+)['\\\"]\\)\", test_model_jinja) %}\n {% if test_model_name_matches | length == 1 %}\n {% set test_model_name = test_model_name_matches[0] %}\n {% for test_model_unique_id in test_model_unique_ids %}\n {% set split_test_model_unique_id = test_model_unique_id.split('.') %}\n {% if split_test_model_unique_id and split_test_model_unique_id | length > 0 %}\n {% set test_node_model_name = split_test_model_unique_id[-1] %}\n {% if test_node_model_name == test_model_name %}\n {% set primary_test_model_id.data = test_model_unique_id %}\n {% endif %}\n {% endif %}\n {% endfor %}\n {% endif %}\n {% endif %}\n {% endif %}\n\n {% set primary_test_model_database = none %}\n {% set primary_test_model_schema = none %}\n {%- if primary_test_model_id.data is not none -%}\n {% set tested_model_node = elementary.get_node(primary_test_model_id.data) %}\n {%- if tested_model_node -%}\n {% set primary_test_model_database = tested_model_node.get('database') %}\n {% set primary_test_model_schema = tested_model_node.get('schema') %}\n {%- endif -%}\n {%- endif -%}\n\n {%- if primary_test_model_database is none or primary_test_model_schema is none -%}\n {# This is mainly here to support singular test cases with multiple referred models, in this case the tested node is being used to extract the db and schema #}\n {% set primary_test_model_database, primary_test_model_schema = elementary.get_model_database_and_schema_from_test_node(node_dict) %}\n {%- endif -%}\n\n {% set original_file_path = node_dict.get('original_file_path') %}\n {% set flatten_test_metadata_dict = {\n 'unique_id': node_dict.get('unique_id'),\n 'short_name': test_short_name,\n 'alias': node_dict.get('alias'),\n 'test_column_name': node_dict.get('column_name'),\n 'severity': config_dict.get('severity'),\n 'warn_if': config_dict.get('warn_if'),\n 'error_if': config_dict.get('error_if'),\n 'test_params': test_kwargs,\n 'test_namespace': test_namespace,\n 'tags': elementary.filter_none_and_sort(tags),\n 'model_tags': elementary.filter_none_and_sort(test_models_tags),\n 'model_owners': elementary.filter_none_and_sort(test_models_owners),\n 'meta': meta_dict,\n 'database_name': primary_test_model_database,\n 'schema_name': primary_test_model_schema,\n 'depends_on_macros': elementary.filter_none_and_sort(depends_on_dict.get('macros', [])),\n 'depends_on_nodes': elementary.filter_none_and_sort(depends_on_dict.get('nodes', [])),\n 'parent_model_unique_id': primary_test_model_id.data,\n 'description': meta_dict.get('description'),\n 'name': node_dict.get('name'),\n 'package_name': node_dict.get('package_name'),\n 'type': elementary.get_test_sub_type(original_file_path, test_namespace),\n 'original_path': original_file_path,\n 'compiled_code': elementary.get_compiled_code(node_dict),\n 'path': node_dict.get('path'),\n 'generated_at': elementary.datetime_now_utc_as_string(),\n 'quality_dimension': meta_dict.get('quality_dimension') or elementary.get_quality_dimension(test_short_name, test_namespace)\n }%}\n {% do flatten_test_metadata_dict.update({\"metadata_hash\": elementary.get_artifact_metadata_hash(flatten_test_metadata_dict)}) %}\n {{ return(flatten_test_metadata_dict) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.safe_get_with_default", "macro.elementary.get_test_short_name", "macro.elementary.get_default_description", "macro.elementary.union_lists", "macro.elementary.get_parent_model_unique_ids_from_test_node", "macro.elementary.get_nodes_by_unique_ids", "macro.elementary.flatten_model", "macro.elementary.get_node", "macro.elementary.get_model_database_and_schema_from_test_node", "macro.elementary.filter_none_and_sort", "macro.elementary.get_test_sub_type", "macro.elementary.get_compiled_code", "macro.elementary.datetime_now_utc_as_string", "macro.elementary.get_quality_dimension", "macro.elementary.get_artifact_metadata_hash"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.3482835, "supported_languages": null}, "macro.elementary.get_test_sub_type": {"name": "get_test_sub_type", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/dbt_artifacts/upload_dbt_tests.sql", "original_file_path": "macros/edr/dbt_artifacts/upload_dbt_tests.sql", "unique_id": "macro.elementary.get_test_sub_type", "macro_sql": "{% macro get_test_sub_type(test_path, test_namespace = none) %}\n {% set test_type = 'generic' %}\n {%- if test_namespace == 'dbt_expectations' -%}\n {% set test_type = 'expectation' %}\n {%- elif 'tests/generic' in test_path or 'macros/' in test_path -%}\n {% set test_type = 'generic' %}\n {%- elif 'tests/' in test_path -%}\n {% set test_type = 'singular' %}\n {%- endif -%}\n {{- return(test_type) -}}\n{%- endmacro -%}\n\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.349173, "supported_languages": null}, "macro.elementary.get_test_short_name": {"name": "get_test_short_name", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/dbt_artifacts/upload_dbt_tests.sql", "original_file_path": "macros/edr/dbt_artifacts/upload_dbt_tests.sql", "unique_id": "macro.elementary.get_test_short_name", "macro_sql": "{% macro get_test_short_name(node_dict, test_metadata) %}\n {#\n If there is a custom name it overrides the dbt auto generated long name.\n This is a best effort to extract custom names.\n dbt automated name generation -\n - Generic test long name starts with the generic name or source_generic\n - Generic tests from packages long name starts with the package_generic or package_source_generic\n #}\n\n {% set generic_test_name = test_metadata.get('name') %} {# 'unique', 'relationships', 'volume_anomalies' etc #}\n {% set test_package_name = test_metadata.get('namespace') %}\n {% set test_instance_name = node_dict.get('name') %} {# Test custom name or dbt auto generated long name #}\n {%- if generic_test_name %}\n {%- if test_package_name == 'elementary' %}\n {{ return(generic_test_name) }}\n {%- elif test_package_name %}\n {% set test_short_name =\n generic_test_name if (test_instance_name.startswith(test_package_name + '_' + generic_test_name) or test_instance_name.startswith(test_package_name + '_source_' + generic_test_name))\n else test_instance_name\n %}\n {%- else %}\n {% set test_short_name =\n generic_test_name if (test_instance_name.startswith(generic_test_name) or test_instance_name.startswith('source_' + generic_test_name))\n else test_instance_name\n %}\n {%- endif %}\n {{ return(test_short_name) }}\n {%- else %}\n {{ return(test_instance_name) }}\n {%- endif %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.3507895, "supported_languages": null}, "macro.elementary.get_default_description": {"name": "get_default_description", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/dbt_artifacts/upload_dbt_tests.sql", "original_file_path": "macros/edr/dbt_artifacts/upload_dbt_tests.sql", "unique_id": "macro.elementary.get_default_description", "macro_sql": "{% macro get_default_description(short_name, test_namespace = none) %}\n {% set description = none %}\n {% set common_test_config = elementary.get_common_test_config_by_namespace_and_name(test_namespace, short_name) %}\n {% if common_test_config %}\n {% set description = common_test_config.get(\"description\") %}\n {% endif %}\n {% do return(description) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.get_common_test_config_by_namespace_and_name"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.351472, "supported_languages": null}, "macro.elementary.get_quality_dimension": {"name": "get_quality_dimension", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/dbt_artifacts/upload_dbt_tests.sql", "original_file_path": "macros/edr/dbt_artifacts/upload_dbt_tests.sql", "unique_id": "macro.elementary.get_quality_dimension", "macro_sql": "{% macro get_quality_dimension(short_name, test_namespace = none) %}\n {% set quality_dimension = none %}\n {% set common_test_config = elementary.get_common_test_config_by_namespace_and_name(test_namespace, short_name) %}\n {% if common_test_config %}\n {% set quality_dimension = common_test_config.get(\"quality_dimension\") %}\n {% endif %}\n {% do return(quality_dimension) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.get_common_test_config_by_namespace_and_name"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.3521452, "supported_languages": null}, "macro.elementary.upload_dbt_models": {"name": "upload_dbt_models", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/dbt_artifacts/upload_dbt_models.sql", "original_file_path": "macros/edr/dbt_artifacts/upload_dbt_models.sql", "unique_id": "macro.elementary.upload_dbt_models", "macro_sql": "{%- macro upload_dbt_models(should_commit=false, metadata_hashes=none) -%}\n {% set relation = elementary.get_elementary_relation('dbt_models') %}\n {% if execute and relation %}\n {% set models = graph.nodes.values() | selectattr('resource_type', '==', 'model') %}\n {% do elementary.upload_artifacts_to_table(relation, models, elementary.flatten_model, should_commit=should_commit, metadata_hashes=metadata_hashes) %}\n {%- endif -%}\n {{- return('') -}}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.elementary.get_elementary_relation", "macro.elementary.upload_artifacts_to_table"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.357136, "supported_languages": null}, "macro.elementary.get_dbt_models_empty_table_query": {"name": "get_dbt_models_empty_table_query", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/dbt_artifacts/upload_dbt_models.sql", "original_file_path": "macros/edr/dbt_artifacts/upload_dbt_models.sql", "unique_id": "macro.elementary.get_dbt_models_empty_table_query", "macro_sql": "{% macro get_dbt_models_empty_table_query() %}\n {% set columns = [\n ('unique_id', 'string'),\n ('alias', 'string'),\n ('checksum', 'string'),\n ('materialization', 'string'),\n ('tags', 'long_string'),\n ('meta', 'long_string'),\n ('owner', 'string'),\n ('database_name', 'string'),\n ('schema_name', 'string'),\n ('depends_on_macros', 'long_string'),\n ('depends_on_nodes', 'long_string'),\n ('description', 'long_string'),\n ('name', 'string'),\n ('package_name', 'string'),\n ('original_path', 'long_string'),\n ('path', 'string'),\n ('patch_path', 'string'),\n ('generated_at', 'string'),\n ('metadata_hash', 'string'),\n ] %}\n {% if target.type == \"bigquery\" or elementary.get_config_var(\"include_other_warehouse_specific_columns\") %}\n {% do columns.extend([('bigquery_partition_by', 'string')]) %}\n {% endif %}\n\n {% set dbt_models_empty_table_query = elementary.empty_table(columns) %}\n {{ return(dbt_models_empty_table_query) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.get_config_var", "macro.elementary.empty_table"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.3590567, "supported_languages": null}, "macro.elementary.flatten_model": {"name": "flatten_model", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/dbt_artifacts/upload_dbt_models.sql", "original_file_path": "macros/edr/dbt_artifacts/upload_dbt_models.sql", "unique_id": "macro.elementary.flatten_model", "macro_sql": "{% macro flatten_model(node_dict) %}\n {% set checksum_dict = elementary.safe_get_with_default(node_dict, 'checksum', {}) %}\n {% set config_dict = elementary.safe_get_with_default(node_dict, 'config', {}) %}\n {% set depends_on_dict = elementary.safe_get_with_default(node_dict, 'depends_on', {}) %}\n\n {% set config_meta_dict = elementary.safe_get_with_default(config_dict, 'meta', {}) %}\n {% set meta_dict = elementary.safe_get_with_default(node_dict, 'meta', {}) %}\n {% do meta_dict.update(config_meta_dict) %}\n {% set formatted_owner = [] %}\n {% set raw_owner = meta_dict.get('owner') or config_dict.get('owner') %}\n {% if raw_owner is string %}\n {% set owners = raw_owner.split(',') %}\n {% for owner in owners %}\n {% do formatted_owner.append(owner | trim) %} \n {% endfor %}\n {% elif raw_owner is iterable %}\n {% do formatted_owner.extend(raw_owner) %}\n {% endif %}\n {% set config_tags = elementary.safe_get_with_default(config_dict, 'tags', []) %}\n {% set global_tags = elementary.safe_get_with_default(node_dict, 'tags', []) %}\n {% set meta_tags = elementary.safe_get_with_default(meta_dict, 'tags', []) %}\n {% set tags = elementary.union_lists(config_tags, global_tags) %}\n {% set tags = elementary.union_lists(tags, meta_tags) %}\n\n {% set flatten_model_metadata_dict = {\n 'unique_id': node_dict.get('unique_id'),\n 'alias': node_dict.get('alias'),\n 'checksum': checksum_dict.get('checksum'),\n 'materialization': config_dict.get('materialized'),\n 'tags': elementary.filter_none_and_sort(tags),\n 'meta': meta_dict,\n 'owner': elementary.filter_none_and_sort(formatted_owner),\n 'database_name': node_dict.get('database'),\n 'schema_name': node_dict.get('schema'),\n 'depends_on_macros': elementary.filter_none_and_sort(depends_on_dict.get('macros', [])),\n 'depends_on_nodes': elementary.filter_none_and_sort(depends_on_dict.get('nodes', [])),\n 'description': node_dict.get('description'),\n 'name': node_dict.get('name'),\n 'package_name': node_dict.get('package_name'),\n 'original_path': node_dict.get('original_file_path'),\n 'path': node_dict.get('path'),\n 'patch_path': node_dict.get('patch_path'),\n 'generated_at': elementary.datetime_now_utc_as_string(),\n 'bigquery_partition_by': config_dict.get(\"partition_by\"),\n } %}\n {% do flatten_model_metadata_dict.update({\"metadata_hash\": elementary.get_artifact_metadata_hash(flatten_model_metadata_dict)}) %}\n {{ return(flatten_model_metadata_dict) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.safe_get_with_default", "macro.elementary.union_lists", "macro.elementary.filter_none_and_sort", "macro.elementary.datetime_now_utc_as_string", "macro.elementary.get_artifact_metadata_hash"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.3638756, "supported_languages": null}, "macro.elementary.upload_dbt_metrics": {"name": "upload_dbt_metrics", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/dbt_artifacts/upload_dbt_metrics.sql", "original_file_path": "macros/edr/dbt_artifacts/upload_dbt_metrics.sql", "unique_id": "macro.elementary.upload_dbt_metrics", "macro_sql": "{%- macro upload_dbt_metrics(should_commit=false, metadata_hashes=none) -%}\n {% set relation = elementary.get_elementary_relation('dbt_metrics') %}\n {% if execute and relation %}\n {% set metrics = graph.metrics.values() | selectattr('resource_type', '==', 'metric') %}\n {% do elementary.upload_artifacts_to_table(relation, metrics, elementary.flatten_metric, should_commit=should_commit, metadata_hashes=metadata_hashes) %}\n {%- endif -%}\n {{- return('') -}}\n{%- endmacro -%}\n\n\n\n", "depends_on": {"macros": ["macro.elementary.get_elementary_relation", "macro.elementary.upload_artifacts_to_table"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.3692803, "supported_languages": null}, "macro.elementary.get_dbt_metrics_empty_table_query": {"name": "get_dbt_metrics_empty_table_query", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/dbt_artifacts/upload_dbt_metrics.sql", "original_file_path": "macros/edr/dbt_artifacts/upload_dbt_metrics.sql", "unique_id": "macro.elementary.get_dbt_metrics_empty_table_query", "macro_sql": "{% macro get_dbt_metrics_empty_table_query() %}\n {% set dbt_metrics_empty_table_query = elementary.empty_table([('unique_id', 'string'),\n ('name', 'string'),\n ('label', 'string'),\n ('model', 'string'),\n ('type', 'string'),\n ('sql', 'long_string'),\n ('timestamp', 'string'),\n ('filters', 'long_string'),\n ('time_grains', 'long_string'),\n ('dimensions', 'long_string'),\n ('depends_on_macros', 'long_string'),\n ('depends_on_nodes', 'long_string'),\n ('description', 'long_string'),\n ('tags', 'long_string'),\n ('meta', 'long_string'),\n ('package_name', 'string'),\n ('original_path', 'long_string'),\n ('path', 'string'),\n ('generated_at', 'string'),\n ('metadata_hash', 'string'),\n ]) %}\n {{ return(dbt_metrics_empty_table_query) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.empty_table"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.370884, "supported_languages": null}, "macro.elementary.flatten_metric": {"name": "flatten_metric", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/dbt_artifacts/upload_dbt_metrics.sql", "original_file_path": "macros/edr/dbt_artifacts/upload_dbt_metrics.sql", "unique_id": "macro.elementary.flatten_metric", "macro_sql": "{% macro flatten_metric(node_dict) %}\n {% set depends_on_dict = elementary.safe_get_with_default(node_dict, 'depends_on', {}) %}\n {% set meta_dict = elementary.safe_get_with_default(node_dict, 'meta', {}) %}\n {% set tags = elementary.safe_get_with_default(node_dict, 'tags', []) %}\n {% set flatten_metric_metadata_dict = {\n 'unique_id': node_dict.get('unique_id'),\n 'name': node_dict.get('name'),\n 'label': node_dict.get('label'),\n 'model': node_dict.get('model'),\n 'type': node_dict.get('type'),\n 'sql': node_dict.get('sql'),\n 'timestamp': node_dict.get('timestamp'),\n 'filters': node_dict.get('filters', {}),\n 'time_grains': elementary.filter_none_and_sort(node_dict.get('time_grains', [])),\n 'dimensions': elementary.filter_none_and_sort(node_dict.get('dimensions', [])),\n 'depends_on_macros': elementary.filter_none_and_sort(depends_on_dict.get('macros', [])),\n 'depends_on_nodes': elementary.filter_none_and_sort(depends_on_dict.get('nodes', [])),\n 'description': node_dict.get('description'),\n 'tags': elementary.filter_none_and_sort(tags),\n 'meta': meta_dict,\n 'package_name': node_dict.get('package_name'),\n 'original_path': node_dict.get('original_file_path'),\n 'path': node_dict.get('path'),\n 'generated_at': elementary.datetime_now_utc_as_string()\n }%}\n {% do flatten_metric_metadata_dict.update({\"metadata_hash\": elementary.get_artifact_metadata_hash(flatten_metric_metadata_dict)}) %}\n {{ return(flatten_metric_metadata_dict) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.safe_get_with_default", "macro.elementary.filter_none_and_sort", "macro.elementary.datetime_now_utc_as_string", "macro.elementary.get_artifact_metadata_hash"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.3737125, "supported_languages": null}, "macro.elementary.upload_dbt_sources": {"name": "upload_dbt_sources", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/dbt_artifacts/upload_dbt_sources.sql", "original_file_path": "macros/edr/dbt_artifacts/upload_dbt_sources.sql", "unique_id": "macro.elementary.upload_dbt_sources", "macro_sql": "{%- macro upload_dbt_sources(should_commit=false, metadata_hashes=none) -%}\n {% set relation = elementary.get_elementary_relation('dbt_sources') %}\n {% if execute and relation %}\n {% set sources = graph.sources.values() | selectattr('resource_type', '==', 'source') %}\n {% do elementary.upload_artifacts_to_table(relation, sources, elementary.flatten_source, should_commit=should_commit, metadata_hashes=metadata_hashes) %}\n {%- endif -%}\n {{- return('') -}}\n{%- endmacro -%}\n\n\n\n", "depends_on": {"macros": ["macro.elementary.get_elementary_relation", "macro.elementary.upload_artifacts_to_table"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.382391, "supported_languages": null}, "macro.elementary.get_dbt_sources_empty_table_query": {"name": "get_dbt_sources_empty_table_query", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/dbt_artifacts/upload_dbt_sources.sql", "original_file_path": "macros/edr/dbt_artifacts/upload_dbt_sources.sql", "unique_id": "macro.elementary.get_dbt_sources_empty_table_query", "macro_sql": "{% macro get_dbt_sources_empty_table_query() %}\n {% set dbt_sources_empty_table_query = elementary.empty_table([('unique_id', 'string'),\n ('database_name', 'string'),\n ('schema_name', 'string'),\n ('source_name', 'string'),\n ('name', 'string'),\n ('identifier', 'string'),\n ('loaded_at_field', 'string'),\n ('freshness_warn_after', 'string'),\n ('freshness_error_after', 'string'),\n ('freshness_filter', 'long_string'),\n ('freshness_description', 'long_string'),\n ('relation_name', 'string'),\n ('tags', 'long_string'),\n ('meta', 'long_string'),\n ('owner', 'string'),\n ('package_name', 'string'),\n ('original_path', 'long_string'),\n ('path', 'string'),\n ('source_description', 'long_string'),\n ('description', 'long_string'),\n ('generated_at', 'string'),\n ('metadata_hash', 'string'),\n ]) %}\n {{ return(dbt_sources_empty_table_query) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.empty_table"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.384093, "supported_languages": null}, "macro.elementary.flatten_source": {"name": "flatten_source", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/dbt_artifacts/upload_dbt_sources.sql", "original_file_path": "macros/edr/dbt_artifacts/upload_dbt_sources.sql", "unique_id": "macro.elementary.flatten_source", "macro_sql": "{% macro flatten_source(node_dict) %}\n {% set freshness_dict = elementary.safe_get_with_default(node_dict, 'freshness', {}) %}\n {% set config_dict = elementary.safe_get_with_default(node_dict, 'config', {}) %}\n {% set config_meta_dict = elementary.safe_get_with_default(config_dict, 'meta', {}) %}\n {% set source_meta_dict = elementary.safe_get_with_default(node_dict, 'source_meta', {}) %}\n {% set meta_dict = elementary.safe_get_with_default(node_dict, 'meta', {}) %}\n {% do meta_dict.update(source_meta_dict) %}\n {% do meta_dict.update(config_meta_dict) %}\n {% set formatted_owner = [] %}\n {% set raw_owner = meta_dict.get('owner') or config_dict.get('owner') %}\n {% if raw_owner is string %}\n {% set owners = raw_owner.split(',') %}\n {% for owner in owners %}\n {% do formatted_owner.append(owner | trim) %} \n {% endfor %}\n {% elif raw_owner is iterable %}\n {% do formatted_owner.extend(raw_owner) %}\n {% endif %}\n {% set config_tags = elementary.safe_get_with_default(config_dict, 'tags', []) %}\n {% set global_tags = elementary.safe_get_with_default(node_dict, 'tags', []) %}\n {% set meta_tags = elementary.safe_get_with_default(meta_dict, 'tags', []) %}\n {% set tags = elementary.union_lists(config_tags, global_tags) %}\n {% set tags = elementary.union_lists(tags, meta_tags) %}\n {% set flatten_source_metadata_dict = {\n 'unique_id': node_dict.get('unique_id'),\n 'database_name': node_dict.get('database'),\n 'schema_name': node_dict.get('schema'),\n 'source_name': node_dict.get('source_name'),\n 'name': node_dict.get('name'),\n 'identifier': node_dict.get('identifier'),\n 'loaded_at_field': node_dict.get('loaded_at_field'),\n 'freshness_warn_after': freshness_dict.get('warn_after', {}),\n 'freshness_error_after': freshness_dict.get('error_after', {}),\n 'freshness_filter': freshness_dict.get('filter'),\n 'freshness_description': elementary.get_source_freshness_description(),\n 'relation_name': node_dict.get('relation_name'),\n 'tags': elementary.filter_none_and_sort(tags),\n 'meta': meta_dict,\n 'owner': formatted_owner,\n 'package_name': node_dict.get('package_name'),\n 'original_path': node_dict.get('original_file_path'),\n 'path': node_dict.get('path'),\n 'source_description': node_dict.get('source_description'),\n 'description': node_dict.get('description'),\n 'generated_at': elementary.datetime_now_utc_as_string()\n }%}\n {% do flatten_source_metadata_dict.update({\"metadata_hash\": elementary.get_artifact_metadata_hash(flatten_source_metadata_dict)}) %}\n {{ return(flatten_source_metadata_dict) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.safe_get_with_default", "macro.elementary.union_lists", "macro.elementary.get_source_freshness_description", "macro.elementary.filter_none_and_sort", "macro.elementary.datetime_now_utc_as_string", "macro.elementary.get_artifact_metadata_hash"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.389065, "supported_languages": null}, "macro.elementary.get_source_freshness_description": {"name": "get_source_freshness_description", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/dbt_artifacts/upload_dbt_sources.sql", "original_file_path": "macros/edr/dbt_artifacts/upload_dbt_sources.sql", "unique_id": "macro.elementary.get_source_freshness_description", "macro_sql": "{% macro get_source_freshness_description() %}\n {% do return(\"Source freshness validates if the time elapsed between the test execution to the latest record is above an acceptable SLA threshold.\") %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.3893328, "supported_languages": null}, "macro.elementary.upload_dbt_invocation": {"name": "upload_dbt_invocation", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/dbt_artifacts/upload_dbt_invocation.sql", "original_file_path": "macros/edr/dbt_artifacts/upload_dbt_invocation.sql", "unique_id": "macro.elementary.upload_dbt_invocation", "macro_sql": "{% macro upload_dbt_invocation() %}\n {% set relation = elementary.get_elementary_relation('dbt_invocations') %}\n {% if not execute or not relation %}\n {{ return('') }}\n {% endif %}\n\n {% do elementary.file_log(\"Uploading dbt invocation.\") %}\n {% set now_str = elementary.datetime_now_utc_as_string() %}\n {% set orchestrator = elementary.get_orchestrator() %}\n {% set job_id = elementary.get_var(\"job_id\", [\"JOB_ID\", \"DBT_JOB_ID\", \"DBT_CLOUD_JOB_ID\"]) %}\n {% set job_run_id = elementary.get_var(\"job_run_id\", [\"DBT_JOB_RUN_ID\", \"DBT_CLOUD_RUN_ID\", \"GITHUB_RUN_ID\"]) %}\n {% set dbt_invocation = {\n 'invocation_id': invocation_id,\n 'run_started_at': elementary.run_started_at_as_string(),\n 'run_completed_at': now_str,\n 'generated_at': now_str,\n 'command': flags.WHICH,\n 'dbt_version': dbt_version,\n 'elementary_version': elementary.get_elementary_package_version(),\n 'full_refresh': flags.FULL_REFRESH,\n 'invocation_vars': elementary.get_invocation_vars(),\n 'vars': elementary.get_all_vars(),\n 'target_name': target.name,\n 'target_database': elementary.target_database(),\n 'target_schema': target.schema,\n 'target_profile_name': target.profile_name,\n 'threads': target.threads,\n 'selected': elementary.get_invocation_select_filter(),\n 'yaml_selector': elementary.get_invocation_yaml_selector(),\n 'project_name': elementary.get_project_name(),\n 'job_id': job_id,\n 'job_run_id': job_run_id,\n 'job_name': elementary.get_var(\"job_name\", [\"JOB_NAME\", \"DBT_JOB_NAME\"]),\n 'env': elementary.get_first_env_var([\"DBT_ENV\"]),\n 'env_id': elementary.get_first_env_var([\"DBT_ENV_ID\"]),\n 'project_id': elementary.get_first_env_var([\"DBT_PROJECT_ID\", \"DBT_CLOUD_PROJECT_ID\", \"GITHUB_REPOSITORY\"]),\n 'cause_category': elementary.get_first_env_var([\"DBT_CAUSE_CATEGORY\", \"DBT_CLOUD_RUN_REASON_CATEGORY\", \"GITHUB_EVENT_NAME\"]),\n 'cause': elementary.get_first_env_var([\"DBT_CAUSE\", \"DBT_CLOUD_RUN_REASON\"]),\n 'pull_request_id': elementary.get_first_env_var([\"DBT_PULL_REQUEST_ID\", \"DBT_CLOUD_PR_ID\", \"GITHUB_HEAD_REF\"]),\n 'git_sha': elementary.get_first_env_var([\"DBT_GIT_SHA\", \"DBT_CLOUD_GIT_SHA\", \"GITHUB_SHA\"]),\n 'orchestrator': orchestrator,\n 'dbt_user': elementary.get_first_env_var([\"DBT_USER\"]),\n 'job_url': elementary.get_job_url(orchestrator, job_id),\n 'job_run_url': elementary.get_job_run_url(orchestrator, job_id, job_run_id),\n 'account_id': elementary.get_var(\"account_id\", [\"DBT_ACCOUNT_ID\"]),\n 'target_adapter_specific_fields': elementary.get_target_adapter_specific_fields()\n } %}\n {% do elementary.insert_rows(relation, [dbt_invocation], should_commit=true, chunk_size=elementary.get_config_var('dbt_artifacts_chunk_size')) %}\n {% do elementary.file_log(\"Uploaded dbt invocation successfully.\") %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.get_elementary_relation", "macro.elementary.file_log", "macro.elementary.datetime_now_utc_as_string", "macro.elementary.get_orchestrator", "macro.elementary.get_var", "macro.elementary.run_started_at_as_string", "macro.elementary.get_elementary_package_version", "macro.elementary.get_invocation_vars", "macro.elementary.get_all_vars", "macro.elementary.target_database", "macro.elementary.get_invocation_select_filter", "macro.elementary.get_invocation_yaml_selector", "macro.elementary.get_project_name", "macro.elementary.get_first_env_var", "macro.elementary.get_job_url", "macro.elementary.get_job_run_url", "macro.elementary.get_target_adapter_specific_fields", "macro.elementary.insert_rows", "macro.elementary.get_config_var"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.419301, "supported_languages": null}, "macro.elementary.get_target_adapter_specific_fields": {"name": "get_target_adapter_specific_fields", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/dbt_artifacts/upload_dbt_invocation.sql", "original_file_path": "macros/edr/dbt_artifacts/upload_dbt_invocation.sql", "unique_id": "macro.elementary.get_target_adapter_specific_fields", "macro_sql": "{% macro get_target_adapter_specific_fields() %}\n {{ return(adapter.dispatch('get_target_adapter_specific_fields', 'elementary')()) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.postgres__get_target_adapter_specific_fields"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.4196675, "supported_languages": null}, "macro.elementary.default__get_target_adapter_specific_fields": {"name": "default__get_target_adapter_specific_fields", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/dbt_artifacts/upload_dbt_invocation.sql", "original_file_path": "macros/edr/dbt_artifacts/upload_dbt_invocation.sql", "unique_id": "macro.elementary.default__get_target_adapter_specific_fields", "macro_sql": "{% macro default__get_target_adapter_specific_fields() %}\n {{ return('') }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.419886, "supported_languages": null}, "macro.elementary.databricks__get_target_adapter_specific_fields": {"name": "databricks__get_target_adapter_specific_fields", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/dbt_artifacts/upload_dbt_invocation.sql", "original_file_path": "macros/edr/dbt_artifacts/upload_dbt_invocation.sql", "unique_id": "macro.elementary.databricks__get_target_adapter_specific_fields", "macro_sql": "{% macro databricks__get_target_adapter_specific_fields() %}\n {{ return({\"http_path\": target.http_path}) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.420162, "supported_languages": null}, "macro.elementary.snowflake__get_target_adapter_specific_fields": {"name": "snowflake__get_target_adapter_specific_fields", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/dbt_artifacts/upload_dbt_invocation.sql", "original_file_path": "macros/edr/dbt_artifacts/upload_dbt_invocation.sql", "unique_id": "macro.elementary.snowflake__get_target_adapter_specific_fields", "macro_sql": "{% macro snowflake__get_target_adapter_specific_fields() %}\n {{ return({\"warehouse\": target.warehouse, \"user\": target.user, \"role\": target.role}) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.4205449, "supported_languages": null}, "macro.elementary.postgres__get_target_adapter_specific_fields": {"name": "postgres__get_target_adapter_specific_fields", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/dbt_artifacts/upload_dbt_invocation.sql", "original_file_path": "macros/edr/dbt_artifacts/upload_dbt_invocation.sql", "unique_id": "macro.elementary.postgres__get_target_adapter_specific_fields", "macro_sql": "{% macro postgres__get_target_adapter_specific_fields() %}\n {{ return({\"user\": target.user}) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.4208057, "supported_languages": null}, "macro.elementary.get_project_name": {"name": "get_project_name", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/dbt_artifacts/upload_dbt_invocation.sql", "original_file_path": "macros/edr/dbt_artifacts/upload_dbt_invocation.sql", "unique_id": "macro.elementary.get_project_name", "macro_sql": "{% macro get_project_name() %}\n {% set project_name = elementary.get_config_var(\"project_name\") %}\n {% if project_name %}\n {{ return(project_name) }}\n {% endif %}\n\n {% set config = elementary.get_runtime_config() %}\n {% do return(config.project_name) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.get_config_var", "macro.elementary.get_runtime_config"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.4214208, "supported_languages": null}, "macro.elementary.get_invocation_select_filter": {"name": "get_invocation_select_filter", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/dbt_artifacts/upload_dbt_invocation.sql", "original_file_path": "macros/edr/dbt_artifacts/upload_dbt_invocation.sql", "unique_id": "macro.elementary.get_invocation_select_filter", "macro_sql": "\n\n{%- macro get_invocation_select_filter() -%}\n {% set config = elementary.get_runtime_config() %}\n {%- if invocation_args_dict and invocation_args_dict.select -%}\n {{- return(invocation_args_dict.select) -}}\n {%- elif config.args and config.args.select -%}\n {{- return(config.args.select) -}}\n {%- else -%}\n {{- return([]) -}}\n {%- endif -%}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.elementary.get_runtime_config"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.4220932, "supported_languages": null}, "macro.elementary.get_invocation_yaml_selector": {"name": "get_invocation_yaml_selector", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/dbt_artifacts/upload_dbt_invocation.sql", "original_file_path": "macros/edr/dbt_artifacts/upload_dbt_invocation.sql", "unique_id": "macro.elementary.get_invocation_yaml_selector", "macro_sql": "{% macro get_invocation_yaml_selector() %}\n {% set config = elementary.get_runtime_config() %}\n {% if invocation_args_dict and invocation_args_dict.selector %}\n {% do return(invocation_args_dict.selector) %}\n {% elif invocation_args_dict and invocation_args_dict.selector_name %}\n {% do return(invocation_args_dict.selector_name) %}\n {% elif config.args and config.args.selector_name %}\n {% do return(config.args.selector_name) %}\n {% else %}\n {% do return(none) %}\n {% endif %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.get_runtime_config"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.4230218, "supported_languages": null}, "macro.elementary.get_invocation_vars": {"name": "get_invocation_vars", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/dbt_artifacts/upload_dbt_invocation.sql", "original_file_path": "macros/edr/dbt_artifacts/upload_dbt_invocation.sql", "unique_id": "macro.elementary.get_invocation_vars", "macro_sql": "{% macro get_invocation_vars() %}\n {% set config = elementary.get_runtime_config() %}\n {% set invocation_vars = {} %}\n {% if invocation_args_dict and invocation_args_dict.vars %}\n {% if invocation_args_dict.vars is mapping %}\n {% set invocation_vars = invocation_args_dict.vars %}\n {% else %}\n {% set invocation_vars = fromyaml(invocation_args_dict.vars) %}\n {% endif %}\n {% elif config.cli_vars %}\n {% set invocation_vars = config.cli_vars %}\n {% endif %}\n {{ return(elementary.to_primitive(invocation_vars)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.get_runtime_config", "macro.elementary.to_primitive"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.4240427, "supported_languages": null}, "macro.elementary.get_all_vars": {"name": "get_all_vars", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/dbt_artifacts/upload_dbt_invocation.sql", "original_file_path": "macros/edr/dbt_artifacts/upload_dbt_invocation.sql", "unique_id": "macro.elementary.get_all_vars", "macro_sql": "\n\n{%- macro get_all_vars() -%}\n {% set all_vars = {} %}\n {% set config = elementary.get_runtime_config() %}\n {%- if config.vars -%}\n {% do all_vars.update(config.vars.to_dict()) %}\n {%- endif -%}\n {% do all_vars.update(elementary.get_invocation_vars()) %}\n {{- return(all_vars) -}}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.elementary.get_runtime_config", "macro.elementary.get_invocation_vars"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.4247057, "supported_languages": null}, "macro.elementary.get_orchestrator": {"name": "get_orchestrator", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/dbt_artifacts/upload_dbt_invocation.sql", "original_file_path": "macros/edr/dbt_artifacts/upload_dbt_invocation.sql", "unique_id": "macro.elementary.get_orchestrator", "macro_sql": "{% macro get_orchestrator() %}\n {% set var_value = elementary.get_var(\"orchestrator\", [\"ORCHESTRATOR\", \"DBT_ORCHESTRATOR\"])%}\n {% if var_value %}\n {% do return(var_value) %}\n {% endif %}\n {% set orchestrator_env_map = {\n \"airflow\": [\"AIRFLOW_HOME\"],\n \"dbt_cloud\": [\"DBT_CLOUD_PROJECT_ID\"],\n \"github_actions\": [\"GITHUB_ACTIONS\"],\n } %}\n {% for orchestrator, env_vars in orchestrator_env_map.items() %}\n {% if elementary.get_first_env_var(env_vars) %}\n {% do return(orchestrator) %}\n {% endif %}\n {% endfor %}\n {% do return(none) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.get_var", "macro.elementary.get_first_env_var"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.425932, "supported_languages": null}, "macro.elementary.get_job_url": {"name": "get_job_url", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/dbt_artifacts/upload_dbt_invocation.sql", "original_file_path": "macros/edr/dbt_artifacts/upload_dbt_invocation.sql", "unique_id": "macro.elementary.get_job_url", "macro_sql": "{% macro get_job_url(orchestrator, job_id) %}\n {% set var_value = elementary.get_var(\"job_url\", [\"JOB_URL\", \"DBT_JOB_URL\"]) %}\n {% if var_value %}\n {% do return(var_value) %}\n {% endif %}\n {% if orchestrator == 'airflow' %}\n {% set server_url = elementary.get_var('airflow_url', [\"AIRFLOW_URL\"]) %}\n {% set airflow_job_url = server_url ~ \"/dags/\" ~ job_id ~ \"/grid\" %}\n {% do return(airflow_job_url) %}\n {% elif orchestrator == 'dbt_cloud' %}\n {% set account_id = elementary.get_var('account_id', ['DBT_ACCOUNT_ID']) %}\n {% set dbt_cloud_project_id = elementary.get_first_env_var(['DBT_CLOUD_PROJECT_ID']) %}\n {% set dbt_cloud_job_id = elementary.get_first_env_var(['DBT_CLOUD_JOB_ID']) %}\n\n {% set dbt_cloud_job_url = \"https://cloud.getdbt.com/deploy/\" ~ account_id ~ \"/projects/\" ~ dbt_cloud_project_id ~ \"/jobs/\" ~ dbt_cloud_job_id %}\n {% do return(dbt_cloud_job_url) %}\n {% elif orchestrator == 'github_actions' %}\n {% set server_url = elementary.get_first_env_var([\"GITHUB_SERVER_URL\"]) %}\n {% set repository = elementary.get_first_env_var([\"GITHUB_REPOSITORY\"]) %}\n {% set run_id = elementary.get_first_env_var([\"GITHUB_RUN_ID\"]) %}\n\n {% set github_job_url = server_url ~ \"/\" ~ repository ~ \"/actions/runs/\" ~ run_id %}\n {% do return(github_job_url) %}\n {% endif %}\n {% do return(none) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.get_var", "macro.elementary.get_first_env_var"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.428796, "supported_languages": null}, "macro.elementary.get_job_run_url": {"name": "get_job_run_url", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/dbt_artifacts/upload_dbt_invocation.sql", "original_file_path": "macros/edr/dbt_artifacts/upload_dbt_invocation.sql", "unique_id": "macro.elementary.get_job_run_url", "macro_sql": "{% macro get_job_run_url(orchestrator, job_id, job_run_id) %}\n {% set var_value = elementary.get_var(\"job_run_url\", [\"JOB_RUN_URL\", \"DBT_JOB_RUN_URL\"]) %}\n {% if var_value %}\n {% do return(var_value) %}\n {% endif %}\n {% if orchestrator == 'airflow' %}\n {% set server_url = elementary.get_var('airflow_url', [\"AIRFLOW_URL\"]) %}\n {% set airflow_job_url = server_url ~ \"/dags/\" ~ job_id ~ \"/grid?dag_run_id=\" ~ job_run_id %}\n {% do return(airflow_job_url) %}\n {% elif orchestrator == 'dbt_cloud' %}\n {% set account_id = elementary.get_var('account_id', ['DBT_ACCOUNT_ID']) %}\n {% set dbt_cloud_project_id = elementary.get_first_env_var(['DBT_CLOUD_PROJECT_ID']) %}\n {% set dbt_cloud_run_id = elementary.get_first_env_var(['DBT_CLOUD_RUN_ID']) %}\n\n {% set dbt_cloud_job_url = \"https://cloud.getdbt.com/deploy/\" ~ account_id ~ \"/projects/\" ~ dbt_cloud_project_id ~ \"/runs/\" ~ dbt_cloud_run_id %}\n {% do return(dbt_cloud_job_url) %}\n {% elif orchestrator == 'github_actions' %}\n {% set server_url = elementary.get_first_env_var([\"GITHUB_SERVER_URL\"]) %}\n {% set repository = elementary.get_first_env_var([\"GITHUB_REPOSITORY\"]) %}\n {% set run_id = elementary.get_first_env_var([\"GITHUB_RUN_ID\"]) %}\n\n {% set github_job_url = server_url ~ \"/\" ~ repository ~ \"/actions/runs/\" ~ run_id %}\n {% do return(github_job_url) %}\n {% endif %}\n {% do return(none) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.get_var", "macro.elementary.get_first_env_var"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.431375, "supported_languages": null}, "macro.elementary.get_dbt_invocations_empty_table_query": {"name": "get_dbt_invocations_empty_table_query", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/dbt_artifacts/upload_dbt_invocation.sql", "original_file_path": "macros/edr/dbt_artifacts/upload_dbt_invocation.sql", "unique_id": "macro.elementary.get_dbt_invocations_empty_table_query", "macro_sql": "{% macro get_dbt_invocations_empty_table_query() %}\n {{ return(elementary.empty_table([\n ('invocation_id', 'long_string'),\n ('job_id', 'long_string'),\n ('job_name', 'long_string'),\n ('job_run_id', 'long_string'),\n ('run_started_at', 'string'),\n ('run_completed_at', 'string'),\n ('generated_at', 'string'),\n ('created_at', 'timestamp'),\n ('command', 'string'),\n ('dbt_version', 'string'),\n ('elementary_version', 'string'),\n ('full_refresh', 'boolean'),\n ('invocation_vars', 'long_string'),\n ('vars', 'long_string'),\n ('target_name', 'string'),\n ('target_database', 'string'),\n ('target_schema', 'string'),\n ('target_profile_name', 'string'),\n ('threads', 'int'),\n ('selected', 'long_string'),\n ('yaml_selector', 'long_string'),\n ('project_id', 'string'),\n ('project_name', 'string'),\n ('env', 'string'),\n ('env_id', 'string'),\n ('cause_category', 'string'),\n ('cause', 'long_string'),\n ('pull_request_id', 'string'),\n ('git_sha', 'string'),\n ('orchestrator', 'string'),\n ('dbt_user', 'string'),\n ('job_url', 'string'),\n ('job_run_url', 'string'),\n ('account_id', 'string'),\n ('target_adapter_specific_fields', 'long_string')\n ])) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.empty_table"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.4337883, "supported_languages": null}, "macro.elementary.upload_dbt_artifacts": {"name": "upload_dbt_artifacts", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/dbt_artifacts/upload_dbt_artifacts.sql", "original_file_path": "macros/edr/dbt_artifacts/upload_dbt_artifacts.sql", "unique_id": "macro.elementary.upload_dbt_artifacts", "macro_sql": "{% macro upload_dbt_artifacts() %}\n {% if execute and results %}\n {% set model_upload_func_map = {\n \"dbt_models\": elementary.upload_dbt_models,\n \"dbt_tests\": elementary.upload_dbt_tests,\n \"dbt_sources\": elementary.upload_dbt_sources,\n \"dbt_snapshots\": elementary.upload_dbt_snapshots,\n \"dbt_metrics\": elementary.upload_dbt_metrics,\n \"dbt_exposures\": elementary.upload_dbt_exposures,\n \"dbt_seeds\": elementary.upload_dbt_seeds,\n }\n %}\n\n {% if not elementary.get_config_var('disable_dbt_columns_autoupload') %}\n {% do model_upload_func_map.update({\"dbt_columns\": elementary.upload_dbt_columns}) %}\n {% endif %}\n\n {% set artifacts_hashes = elementary.get_artifacts_hashes() %}\n {% do elementary.file_log(\"Uploading dbt artifacts.\") %}\n {% for artifacts_model, upload_artifacts_func in model_upload_func_map.items() %}\n {% if not elementary.get_result_node(artifacts_model) %}\n {% if elementary.get_elementary_relation(artifacts_model) %}\n {% if artifacts_hashes is not none %}\n {% do upload_artifacts_func(should_commit=true, metadata_hashes=artifacts_hashes.get(artifacts_model, [])) %}\n {% else %}\n {% do upload_artifacts_func(should_commit=true) %}\n {% endif %}\n {% endif %}\n {% else %}\n {% do elementary.file_log('[{}] Artifacts already ran.'.format(artifacts_model)) %}\n {% endif %}\n {% endfor %}\n {% do elementary.file_log(\"Uploaded dbt artifacts.\") %}\n {% endif %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.get_config_var", "macro.elementary.get_artifacts_hashes", "macro.elementary.file_log", "macro.elementary.get_result_node", "macro.elementary.get_elementary_relation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.4375126, "supported_languages": null}, "macro.elementary.get_artifacts_hashes": {"name": "get_artifacts_hashes", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/dbt_artifacts/upload_dbt_artifacts.sql", "original_file_path": "macros/edr/dbt_artifacts/upload_dbt_artifacts.sql", "unique_id": "macro.elementary.get_artifacts_hashes", "macro_sql": "{% macro get_artifacts_hashes() %}\n {# The stored hashes are only needed if it can be compared later to the local hashes. #}\n {% if not local_md5 %}\n {% do return(none) %}\n {% endif %}\n\n {% set artifacts_hash_relation = elementary.get_elementary_relation('dbt_artifacts_hashes') %}\n {% if not artifacts_hash_relation %}\n {% do return(none) %}\n {% endif %}\n\n {% set stored_artifacts_query %}\n select artifacts_model, metadata_hash from {{ artifacts_hash_relation }}\n order by metadata_hash\n {% endset %}\n {% set artifacts_hashes_results = elementary.run_query(stored_artifacts_query) %}\n {% set artifact_agate_hashes = artifacts_hashes_results.group_by(\"artifacts_model\") %}\n {% set artifacts_hashes = {} %}\n {% for artifacts_model, metadata_hashes in artifact_agate_hashes.items() %}\n {% do artifacts_hashes.update({artifacts_model: metadata_hashes.columns[\"metadata_hash\"]}) %}\n {% endfor %}\n {% do return(artifacts_hashes) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.get_elementary_relation", "macro.elementary.run_query", "macro.dbt_utils.group_by"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.4390156, "supported_languages": null}, "macro.elementary.upload_source_freshness": {"name": "upload_source_freshness", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/dbt_artifacts/upload_source_freshness.sql", "original_file_path": "macros/edr/dbt_artifacts/upload_source_freshness.sql", "unique_id": "macro.elementary.upload_source_freshness", "macro_sql": "{% macro upload_source_freshness() %}\n {% if not flags.Path %}\n {% do exceptions.raise_compiler_error(\"Unable to upload source freshness using this operation on dbt 1.3.2 onwards.\") %}\n {% endif %}\n\n {% set source_freshness_results_relation = ref('dbt_source_freshness_results') %}\n {% set sources_json_path = flags.Path(elementary.get_runtime_config().target_path).joinpath('sources.json') %}\n {% if not sources_json_path.exists() %}\n {% do exceptions.raise_compiler_error('Source freshness artifact (sources.json) does not exist, please run `dbt source freshness`.') %}\n {% endif %}\n {% set source_freshness_results_dicts = fromjson(sources_json_path.read_text())['results'] %}\n {% do elementary.upload_artifacts_to_table(source_freshness_results_relation, source_freshness_results_dicts, elementary.flatten_source_freshness, append=True, should_commit=True) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.get_runtime_config", "macro.elementary.upload_artifacts_to_table"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.44225, "supported_languages": null}, "macro.elementary.flatten_source_freshness": {"name": "flatten_source_freshness", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/dbt_artifacts/upload_source_freshness.sql", "original_file_path": "macros/edr/dbt_artifacts/upload_source_freshness.sql", "unique_id": "macro.elementary.flatten_source_freshness", "macro_sql": "{% macro flatten_source_freshness(node_dict) %}\n {% set compile_timing = {} %}\n {% set execute_timing = {} %}\n {% for timing in node_dict['timing'] %}\n {% if timing['name'] == 'compile' %}\n {% do compile_timing.update(timing) %}\n {% elif timing['name'] == 'execute' %}\n {% do execute_timing.update(timing) %}\n {% endif %}\n {% endfor %}\n {% set metadata_dict = elementary.safe_get_with_default(node_dict, 'metadata', {}) %}\n {% set criteria_dict = elementary.safe_get_with_default(node_dict, 'criteria', {}) %}\n {% set source_freshness_invocation_id = metadata_dict.get('invocation_id', invocation_id) %}\n {% set flatten_source_freshness_dict = {\n 'source_freshness_execution_id': [source_freshness_invocation_id, node_dict.get('unique_id')] | join('.'),\n 'unique_id': node_dict.get('unique_id'),\n 'max_loaded_at': node_dict.get('max_loaded_at'),\n 'snapshotted_at': node_dict.get('snapshotted_at'),\n 'max_loaded_at_time_ago_in_s': node_dict.get('max_loaded_at_time_ago_in_s'),\n 'status': node_dict.get('status'),\n 'error': node_dict.get('error'),\n 'warn_after': criteria_dict.get('warn_after'),\n 'error_after': criteria_dict.get('error_after'),\n 'filter': criteria_dict.get('filter'),\n 'generated_at': elementary.datetime_now_utc_as_string(),\n 'invocation_id': source_freshness_invocation_id,\n 'compile_started_at': compile_timing.get('started_at'),\n 'compile_completed_at': compile_timing.get('completed_at'),\n 'execute_started_at': execute_timing.get('started_at'),\n 'execute_completed_at': execute_timing.get('completed_at'),\n } %}\n {{ return(flatten_source_freshness_dict) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.safe_get_with_default", "macro.elementary.datetime_now_utc_as_string"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.4453087, "supported_languages": null}, "macro.elementary.upload_dbt_snapshots": {"name": "upload_dbt_snapshots", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/dbt_artifacts/upload_dbt_snapshots.sql", "original_file_path": "macros/edr/dbt_artifacts/upload_dbt_snapshots.sql", "unique_id": "macro.elementary.upload_dbt_snapshots", "macro_sql": "{%- macro upload_dbt_snapshots(should_commit=false, metadata_hashes=none) -%}\n {% set relation = elementary.get_elementary_relation('dbt_snapshots') %}\n {% if execute and relation %}\n {% set snapshots = graph.nodes.values() | selectattr('resource_type', '==', 'snapshot') %}\n {% do elementary.upload_artifacts_to_table(relation, snapshots, elementary.flatten_model, should_commit=should_commit, metadata_hashes=metadata_hashes) %}\n {%- endif -%}\n {{- return('') -}}\n{%- endmacro -%}", "depends_on": {"macros": ["macro.elementary.get_elementary_relation", "macro.elementary.upload_artifacts_to_table"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.4464273, "supported_languages": null}, "macro.elementary.upload_dbt_columns": {"name": "upload_dbt_columns", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/dbt_artifacts/upload_dbt_columns.sql", "original_file_path": "macros/edr/dbt_artifacts/upload_dbt_columns.sql", "unique_id": "macro.elementary.upload_dbt_columns", "macro_sql": "{%- macro upload_dbt_columns(should_commit=false, metadata_hashes=none) -%}\n {% set relation = elementary.get_elementary_relation('dbt_columns') %}\n {% if execute and relation %}\n {% set tables = graph.nodes.values() | list + graph.sources.values() | list %}\n {% do elementary.upload_artifacts_to_table(relation, tables, elementary.flatten_table_columns, should_commit=should_commit, metadata_hashes=metadata_hashes) %}\n {%- endif -%}\n {{- return('') -}}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.elementary.get_elementary_relation", "macro.elementary.upload_artifacts_to_table"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.4505064, "supported_languages": null}, "macro.elementary.get_dbt_columns_empty_table_query": {"name": "get_dbt_columns_empty_table_query", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/dbt_artifacts/upload_dbt_columns.sql", "original_file_path": "macros/edr/dbt_artifacts/upload_dbt_columns.sql", "unique_id": "macro.elementary.get_dbt_columns_empty_table_query", "macro_sql": "{% macro get_dbt_columns_empty_table_query() %}\n {% set columns = [\n ('unique_id', 'string'),\n ('parent_unique_id', 'string'),\n ('name', 'string'),\n ('data_type', 'string'),\n ('tags', 'long_string'),\n ('meta', 'long_string'),\n ('database_name', 'string'),\n ('schema_name', 'string'),\n ('table_name', 'string'),\n ('description', 'long_string'),\n ('resource_type', 'string'),\n ('generated_at', 'string'),\n ('metadata_hash', 'string'),\n ] %}\n {% set dbt_columns_empty_table_query = elementary.empty_table(columns) %}\n {{ return(dbt_columns_empty_table_query) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.empty_table"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.451766, "supported_languages": null}, "macro.elementary.flatten_table_columns": {"name": "flatten_table_columns", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/dbt_artifacts/upload_dbt_columns.sql", "original_file_path": "macros/edr/dbt_artifacts/upload_dbt_columns.sql", "unique_id": "macro.elementary.flatten_table_columns", "macro_sql": "{% macro flatten_table_columns(table_node) %}\n {% set column_nodes = table_node.get(\"columns\") %}\n {% if not column_nodes %}\n {% do return(none) %}\n {% endif %}\n\n {% set flattened_columns = [] %}\n {% for column_node in column_nodes.values() %}\n {% set flat_column = elementary.flatten_column(table_node, column_node) %}\n {% if not elementary.get_config_var('upload_only_columns_with_descriptions') or flat_column['description'] %}\n {% do flattened_columns.append(flat_column) %}\n {% endif %}\n {% endfor %}\n {% do return(flattened_columns) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.flatten_column", "macro.elementary.get_config_var"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.4529665, "supported_languages": null}, "macro.elementary.flatten_column": {"name": "flatten_column", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/dbt_artifacts/upload_dbt_columns.sql", "original_file_path": "macros/edr/dbt_artifacts/upload_dbt_columns.sql", "unique_id": "macro.elementary.flatten_column", "macro_sql": "{% macro flatten_column(table_node, column_node) %}\n {% set config_dict = elementary.safe_get_with_default(column_node, 'config', {}) %}\n {% set config_meta_dict = elementary.safe_get_with_default(config_dict, 'meta', {}) %}\n {% set meta_dict = elementary.safe_get_with_default(column_node, 'meta', {}) %}\n {% do meta_dict.update(config_meta_dict) %}\n {% set config_tags = elementary.safe_get_with_default(config_dict, 'tags', []) %}\n {% set global_tags = elementary.safe_get_with_default(column_node, 'tags', []) %}\n {% set meta_tags = elementary.safe_get_with_default(meta_dict, 'tags', []) %}\n {% set tags = elementary.union_lists(config_tags, global_tags) %}\n {% set tags = elementary.union_lists(tags, meta_tags) %}\n {% set flatten_column_metadata_dict = {\n 'parent_unique_id': table_node.get('unique_id'),\n 'unique_id': \"column.{}.{}\".format(table_node.get('unique_id'), column_node.get('name')),\n 'name': column_node.get('name'),\n 'data_type': column_node.get('data_type'),\n 'tags': elementary.filter_none_and_sort(tags),\n 'meta': meta_dict,\n 'description': column_node.get('description') or none,\n 'database_name': table_node.get('database'),\n 'schema_name': table_node.get('schema'),\n 'table_name': table_node.get('alias'),\n 'resource_type': table_node.get('resource_type'),\n 'generated_at': elementary.datetime_now_utc_as_string(),\n } %}\n {% do flatten_column_metadata_dict.update({\"metadata_hash\": elementary.get_artifact_metadata_hash(flatten_column_metadata_dict)}) %}\n {% do return(flatten_column_metadata_dict) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.safe_get_with_default", "macro.elementary.union_lists", "macro.elementary.filter_none_and_sort", "macro.elementary.datetime_now_utc_as_string", "macro.elementary.get_artifact_metadata_hash"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.4561121, "supported_languages": null}, "macro.elementary.upload_dbt_exposures": {"name": "upload_dbt_exposures", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/dbt_artifacts/upload_dbt_exposures.sql", "original_file_path": "macros/edr/dbt_artifacts/upload_dbt_exposures.sql", "unique_id": "macro.elementary.upload_dbt_exposures", "macro_sql": "{%- macro upload_dbt_exposures(should_commit=false, metadata_hashes=none) -%}\n {% set relation = elementary.get_elementary_relation('dbt_exposures') %}\n {% if execute and relation %}\n {% set exposures = graph.exposures.values() | selectattr('resource_type', '==', 'exposure') %}\n {% do elementary.upload_artifacts_to_table(relation, exposures, elementary.flatten_exposure, should_commit=should_commit, metadata_hashes=metadata_hashes) %}\n {%- endif -%}\n {{- return('') -}}\n{%- endmacro -%}\n\n\n\n", "depends_on": {"macros": ["macro.elementary.get_elementary_relation", "macro.elementary.upload_artifacts_to_table"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.4618819, "supported_languages": null}, "macro.elementary.get_dbt_exposures_empty_table_query": {"name": "get_dbt_exposures_empty_table_query", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/dbt_artifacts/upload_dbt_exposures.sql", "original_file_path": "macros/edr/dbt_artifacts/upload_dbt_exposures.sql", "unique_id": "macro.elementary.get_dbt_exposures_empty_table_query", "macro_sql": "{% macro get_dbt_exposures_empty_table_query() %}\n {% set dbt_exposures_empty_table_query = elementary.empty_table([('unique_id', 'string'),\n ('name', 'string'),\n ('maturity', 'string'),\n ('type', 'string'),\n ('owner_email', 'string'),\n ('owner_name', 'string'),\n ('url', 'long_string'),\n ('depends_on_macros', 'long_string'),\n ('depends_on_nodes', 'long_string'),\n ('depends_on_columns', 'long_string'),\n ('description', 'long_string'),\n ('tags', 'long_string'),\n ('meta', 'long_string'),\n ('package_name', 'string'),\n ('original_path', 'long_string'),\n ('path', 'string'),\n ('generated_at', 'string'),\n ('metadata_hash', 'string'),\n ('label', 'string'),\n ('raw_queries', 'long_string'),\n ]) %}\n {{ return(dbt_exposures_empty_table_query) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.empty_table"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.4634762, "supported_languages": null}, "macro.elementary.flatten_exposure": {"name": "flatten_exposure", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/dbt_artifacts/upload_dbt_exposures.sql", "original_file_path": "macros/edr/dbt_artifacts/upload_dbt_exposures.sql", "unique_id": "macro.elementary.flatten_exposure", "macro_sql": "{% macro flatten_exposure(node_dict) %}\n {% set owner_dict = elementary.safe_get_with_default(node_dict, 'owner', {}) %}\n {% set depends_on_dict = elementary.safe_get_with_default(node_dict, 'depends_on', {}) %}\n {% set meta_dict = elementary.safe_get_with_default(node_dict, 'meta', {}) %}\n {% set tags = elementary.safe_get_with_default(node_dict, 'tags', []) %}\n {% set flatten_exposure_metadata_dict = {\n 'unique_id': node_dict.get('unique_id'),\n 'name': node_dict.get('name'),\n 'label': node_dict.get('label'),\n 'maturity': node_dict.get('maturity'),\n 'type': node_dict.get('type'),\n 'owner_email': owner_dict.get('email'),\n 'owner_name': owner_dict.get('name'),\n 'url': node_dict.get('url'),\n 'depends_on_macros': elementary.filter_none_and_sort(depends_on_dict.get('macros', [])),\n 'depends_on_nodes': elementary.filter_none_and_sort(depends_on_dict.get('nodes', [])),\n 'description': node_dict.get('description'),\n 'tags': elementary.filter_none_and_sort(tags),\n 'meta': meta_dict,\n 'package_name': node_dict.get('package_name'),\n 'original_path': node_dict.get('original_file_path'),\n 'path': node_dict.get('path'),\n 'generated_at': elementary.datetime_now_utc_as_string()\n }%}\n {% do flatten_exposure_metadata_dict.update({\"metadata_hash\": elementary.get_artifact_metadata_hash(flatten_exposure_metadata_dict)}) %}\n {{ return(flatten_exposure_metadata_dict) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.safe_get_with_default", "macro.elementary.filter_none_and_sort", "macro.elementary.datetime_now_utc_as_string", "macro.elementary.get_artifact_metadata_hash"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.4661982, "supported_languages": null}, "macro.elementary.upload_run_results": {"name": "upload_run_results", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/dbt_artifacts/upload_run_results.sql", "original_file_path": "macros/edr/dbt_artifacts/upload_run_results.sql", "unique_id": "macro.elementary.upload_run_results", "macro_sql": "{% macro upload_run_results() %}\n {% set relation = elementary.get_elementary_relation('dbt_run_results') %}\n {% if execute and relation %}\n {{ elementary.file_log(\"Uploading run results.\") }}\n {% do elementary.upload_artifacts_to_table(relation, results, elementary.flatten_run_result, append=True, should_commit=True, on_query_exceed=elementary.on_run_result_query_exceed) %}\n {{ elementary.file_log(\"Uploaded run results successfully.\") }}\n {% endif %}\n {{ return ('') }}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.get_elementary_relation", "macro.elementary.file_log", "macro.elementary.upload_artifacts_to_table"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.4738636, "supported_languages": null}, "macro.elementary.get_dbt_run_results_empty_table_query": {"name": "get_dbt_run_results_empty_table_query", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/dbt_artifacts/upload_run_results.sql", "original_file_path": "macros/edr/dbt_artifacts/upload_run_results.sql", "unique_id": "macro.elementary.get_dbt_run_results_empty_table_query", "macro_sql": "{% macro get_dbt_run_results_empty_table_query() %}\n {% set dbt_run_results_empty_table_query = elementary.empty_table([('model_execution_id', 'long_string'),\n ('unique_id', 'long_string'),\n ('invocation_id', 'string'),\n ('generated_at', 'string'),\n ('created_at', 'timestamp'),\n ('name', 'long_string'),\n ('message', 'long_string'),\n ('status', 'string'),\n ('resource_type', 'string'),\n ('execution_time', 'float'),\n ('execute_started_at', 'string'),\n ('execute_completed_at', 'string'),\n ('compile_started_at', 'string'),\n ('compile_completed_at', 'string'),\n ('rows_affected', 'bigint'),\n ('full_refresh', 'boolean'),\n ('compiled_code', 'long_string'),\n ('failures', 'bigint'),\n ('query_id', 'string'),\n ('thread_id', 'string'),\n ('materialization', 'string'),\n ('adapter_response', 'string')\n ]) %}\n {{ return(dbt_run_results_empty_table_query) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.empty_table"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.4755795, "supported_languages": null}, "macro.elementary.flatten_run_result": {"name": "flatten_run_result", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/dbt_artifacts/upload_run_results.sql", "original_file_path": "macros/edr/dbt_artifacts/upload_run_results.sql", "unique_id": "macro.elementary.flatten_run_result", "macro_sql": "{% macro flatten_run_result(run_result) %}\n {% set run_result_dict = run_result.to_dict() %}\n {% set node = elementary.safe_get_with_default(run_result_dict, 'node', {}) %}\n {% set config_dict = elementary.safe_get_with_default(node, 'config', {}) %}\n {% set flatten_run_result_dict = {\n 'model_execution_id': elementary.get_node_execution_id(node),\n 'invocation_id': invocation_id,\n 'unique_id': node.get('unique_id'),\n 'name': node.get('name'),\n 'message': run_result_dict.get('message'),\n 'generated_at': elementary.datetime_now_utc_as_string(),\n 'rows_affected': run_result_dict.get('adapter_response', {}).get('rows_affected'),\n 'execution_time': run_result_dict.get('execution_time'),\n 'status': run_result_dict.get('status'),\n 'resource_type': node.get('resource_type'),\n 'execute_started_at': none,\n 'execute_completed_at': none,\n 'compile_started_at': none,\n 'compile_completed_at': none,\n 'full_refresh': flags.FULL_REFRESH,\n 'compiled_code': elementary.get_compiled_code(node, as_column_value=true),\n 'failures': run_result_dict.get('failures'),\n 'query_id': run_result_dict.get('adapter_response', {}).get('query_id'),\n 'thread_id': run_result_dict.get('thread_id'),\n 'materialization': config_dict.get('materialized'),\n 'adapter_response': run_result_dict.get('adapter_response', {})\n } %}\n\n {% set timings = elementary.safe_get_with_default(run_result_dict, 'timing', []) %}\n {% if timings %}\n {% for timing in timings %}\n {% if timing is mapping %}\n {% if timing.get('name') == 'execute' %}\n {% do flatten_run_result_dict.update({'execute_started_at': timing.get('started_at'), 'execute_completed_at': timing.get('completed_at')}) %}\n {% elif timing.get('name') == 'compile' %}\n {% do flatten_run_result_dict.update({'compile_started_at': timing.get('started_at'), 'compile_completed_at': timing.get('completed_at')}) %}\n {% endif %}\n {% endif %}\n {% endfor %}\n {% endif %}\n {{ return(flatten_run_result_dict) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.safe_get_with_default", "macro.elementary.get_node_execution_id", "macro.elementary.datetime_now_utc_as_string", "macro.elementary.get_compiled_code"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.4794827, "supported_languages": null}, "macro.elementary.on_run_result_query_exceed": {"name": "on_run_result_query_exceed", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/dbt_artifacts/upload_run_results.sql", "original_file_path": "macros/edr/dbt_artifacts/upload_run_results.sql", "unique_id": "macro.elementary.on_run_result_query_exceed", "macro_sql": "{% macro on_run_result_query_exceed(flattened_node) %}\n {% do flattened_node.update({\"compiled_code\": elementary.get_compiled_code_too_long_err_msg()}) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.get_compiled_code_too_long_err_msg"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.4798427, "supported_languages": null}, "macro.elementary.upload_dbt_seeds": {"name": "upload_dbt_seeds", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/dbt_artifacts/upload_dbt_seeds.sql", "original_file_path": "macros/edr/dbt_artifacts/upload_dbt_seeds.sql", "unique_id": "macro.elementary.upload_dbt_seeds", "macro_sql": "{%- macro upload_dbt_seeds(should_commit=false, metadata_hashes=none) -%}\n {% set relation = elementary.get_elementary_relation('dbt_seeds') %}\n {% if execute and relation %}\n {% set seeds = graph.nodes.values() | selectattr('resource_type', '==', 'seed') %}\n {% do elementary.upload_artifacts_to_table(relation, seeds, elementary.flatten_seed, should_commit=should_commit, metadata_hashes=metadata_hashes) %}\n {%- endif -%}\n {{- return('') -}}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.elementary.get_elementary_relation", "macro.elementary.upload_artifacts_to_table"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.4857688, "supported_languages": null}, "macro.elementary.get_dbt_seeds_empty_table_query": {"name": "get_dbt_seeds_empty_table_query", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/dbt_artifacts/upload_dbt_seeds.sql", "original_file_path": "macros/edr/dbt_artifacts/upload_dbt_seeds.sql", "unique_id": "macro.elementary.get_dbt_seeds_empty_table_query", "macro_sql": "{% macro get_dbt_seeds_empty_table_query() %}\n {% set dbt_seeds_empty_table_query = elementary.empty_table([('unique_id', 'string'),\n ('alias', 'string'),\n ('checksum', 'string'),\n ('tags', 'long_string'),\n ('meta', 'long_string'),\n ('owner', 'string'),\n ('database_name', 'string'),\n ('schema_name', 'string'),\n ('description', 'long_string'),\n ('name', 'string'),\n ('package_name', 'string'),\n ('original_path', 'long_string'),\n ('path', 'string'),\n ('generated_at', 'string'),\n ('metadata_hash', 'string'),\n ]) %}\n {{ return(dbt_seeds_empty_table_query) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.empty_table"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.4870307, "supported_languages": null}, "macro.elementary.flatten_seed": {"name": "flatten_seed", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/dbt_artifacts/upload_dbt_seeds.sql", "original_file_path": "macros/edr/dbt_artifacts/upload_dbt_seeds.sql", "unique_id": "macro.elementary.flatten_seed", "macro_sql": "{% macro flatten_seed(node_dict) %}\n {% set checksum_dict = elementary.safe_get_with_default(node_dict, 'checksum', {}) %}\n {% set config_dict = elementary.safe_get_with_default(node_dict, 'config', {}) %}\n {% set depends_on_dict = elementary.safe_get_with_default(node_dict, 'depends_on', {}) %}\n\n {% set config_meta_dict = elementary.safe_get_with_default(config_dict, 'meta', {}) %}\n {% set meta_dict = elementary.safe_get_with_default(node_dict, 'meta', {}) %}\n {% do meta_dict.update(config_meta_dict) %}\n {% set formatted_owner = [] %}\n {% set raw_owner = meta_dict.get('owner') or config_dict.get('owner') %}\n {% if raw_owner is string %}\n {% set owners = raw_owner.split(',') %}\n {% for owner in owners %}\n {% do formatted_owner.append(owner | trim) %}\n {% endfor %}\n {% elif raw_owner is iterable %}\n {% do formatted_owner.extend(raw_owner) %}\n {% endif %}\n {% set config_tags = elementary.safe_get_with_default(config_dict, 'tags', []) %}\n {% set global_tags = elementary.safe_get_with_default(node_dict, 'tags', []) %}\n {% set meta_tags = elementary.safe_get_with_default(meta_dict, 'tags', []) %}\n {% set tags = elementary.union_lists(config_tags, global_tags) %}\n {% set tags = elementary.union_lists(tags, meta_tags) %}\n\n {% set flatten_seed_metadata_dict = {\n 'unique_id': node_dict.get('unique_id'),\n 'alias': node_dict.get('alias'),\n 'checksum': checksum_dict.get('checksum'),\n 'tags': elementary.filter_none_and_sort(tags),\n 'meta': meta_dict,\n 'owner': elementary.filter_none_and_sort(formatted_owner),\n 'database_name': node_dict.get('database'),\n 'schema_name': node_dict.get('schema'),\n 'description': node_dict.get('description'),\n 'name': node_dict.get('name'),\n 'package_name': node_dict.get('package_name'),\n 'original_path': node_dict.get('original_file_path'),\n 'path': node_dict.get('path'),\n 'generated_at': elementary.datetime_now_utc_as_string()\n }%}\n {% do flatten_seed_metadata_dict.update({\"metadata_hash\": elementary.get_artifact_metadata_hash(flatten_seed_metadata_dict)}) %}\n {{ return(flatten_seed_metadata_dict) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.safe_get_with_default", "macro.elementary.union_lists", "macro.elementary.filter_none_and_sort", "macro.elementary.datetime_now_utc_as_string", "macro.elementary.get_artifact_metadata_hash"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.4913197, "supported_languages": null}, "macro.elementary.upload_artifacts_to_table": {"name": "upload_artifacts_to_table", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/dbt_artifacts/upload_artifacts_to_table.sql", "original_file_path": "macros/edr/dbt_artifacts/upload_artifacts_to_table.sql", "unique_id": "macro.elementary.upload_artifacts_to_table", "macro_sql": "{% macro upload_artifacts_to_table(table_relation, artifacts, flatten_artifact_callback, append=False, should_commit=False, metadata_hashes=None, on_query_exceed=none) %}\n {% set flatten_artifact_dicts = [] %}\n {% do elementary.file_log(\"[{}] Flattening the artifacts.\".format(table_relation.identifier)) %}\n {% for artifact in artifacts %}\n {% set flatten_artifact = flatten_artifact_callback(artifact) %}\n {% if flatten_artifact is mapping %}\n {% do flatten_artifact_dicts.append(flatten_artifact) %}\n {% elif flatten_artifact is iterable %}\n {% do flatten_artifact_dicts.extend(flatten_artifact) %}\n {% endif %}\n {% endfor %}\n {% do elementary.file_log(\"[{}] Flattened {} artifacts.\".format(table_relation.identifier, flatten_artifact_dicts | length)) %}\n\n {% if append %}\n {# In append mode, just insert, and no need to be atomic #}\n {% do elementary.insert_rows(table_relation, flatten_artifact_dicts, should_commit, elementary.get_config_var('dbt_artifacts_chunk_size'), on_query_exceed) %}\n {% else %}\n {% if metadata_hashes is not none and elementary.get_config_var(\"cache_artifacts\") %}\n {% do elementary.file_log(\"[{}] Comparing the artifacts state.\".format(table_relation.identifier)) %}\n {% set new_metadata_hashes = flatten_artifact_dicts | map(attribute=\"metadata_hash\") | sort %}\n {% if new_metadata_hashes == metadata_hashes %}\n {% do elementary.file_log(\"[{}] Artifacts did not change.\".format(table_relation.identifier)) %}\n {% else %}\n {% do elementary.file_log(\"[{}] Artifacts changed.\".format(table_relation.identifier)) %}\n {% set upload_artifacts_method = elementary.get_config_var(\"upload_artifacts_method\") %}\n {% if upload_artifacts_method == \"diff\" %}\n {% set added_artifacts = flatten_artifact_dicts | rejectattr(\"metadata_hash\", \"in\", metadata_hashes) | list %}\n {% set removed_artifact_hashes = metadata_hashes | reject(\"in\", new_metadata_hashes) | list %}\n {% do elementary.delete_and_insert(table_relation, insert_rows=added_artifacts, delete_values=removed_artifact_hashes, delete_column_key=\"metadata_hash\") %}\n {% elif upload_artifacts_method == \"replace\" %}\n {% do elementary.replace_table_data(table_relation, flatten_artifact_dicts) %}\n {% else %}\n {% do exceptions.raise_compiler_error(\"Invalid var('upload_artifacts_method') provided.\") %}\n {% endif %}\n {% endif %}\n {% else %}\n {% do elementary.replace_table_data(table_relation, flatten_artifact_dicts) %}\n {% endif %}\n {% endif %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.file_log", "macro.elementary.insert_rows", "macro.elementary.get_config_var", "macro.elementary.delete_and_insert", "macro.elementary.replace_table_data"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.4966247, "supported_languages": null}, "macro.elementary.get_information_schema_columns_query": {"name": "get_information_schema_columns_query", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/dbt_artifacts/dbt_columns/get_information_schema_columns_query.sql", "original_file_path": "macros/edr/dbt_artifacts/dbt_columns/get_information_schema_columns_query.sql", "unique_id": "macro.elementary.get_information_schema_columns_query", "macro_sql": "{% macro get_information_schema_columns_query(is_model_build_context=true) %}\n {% if is_model_build_context %}\n {% set get_relation = ref %}\n {% else %}\n {% set get_relation = elementary.get_elementary_relation %}\n {% endif %}\n\n with dbt_models_data as (\n select\n database_name,\n schema_name,\n alias as table_name\n from {{ get_relation('dbt_models') }}\n ),\n\n dbt_snapshots_data as (\n select\n database_name,\n schema_name,\n alias as table_name\n from {{ get_relation('dbt_snapshots') }}\n ),\n\n dbt_sources_data as (\n select\n database_name,\n schema_name,\n name as table_name\n from {{ get_relation('dbt_sources') }}\n ),\n\n dbt_seeds_data as (\n select\n database_name,\n schema_name,\n name as table_name\n from {{ get_relation('dbt_seeds') }}\n ),\n\n tables_information as (\n select * from dbt_models_data\n union all\n select * from dbt_sources_data\n union all\n select * from dbt_snapshots_data\n union all\n select * from dbt_seeds_data\n ),\n\n columns_information as (\n {{ elementary.get_columns_in_project() }}\n ),\n\n information_schema_columns as (\n select col_info.*\n from tables_information tbl_info\n join columns_information col_info\n on (lower(tbl_info.database_name) = lower(col_info.database_name) and\n lower(tbl_info.schema_name) = lower(col_info.schema_name) and\n lower(tbl_info.table_name) = lower(col_info.table_name)\n )\n )\n\n select *\n from information_schema_columns\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.get_columns_in_project"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.4984193, "supported_languages": null}, "macro.elementary.get_information_schema_columns_materialized": {"name": "get_information_schema_columns_materialized", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/dbt_artifacts/dbt_columns/get_information_schema_columns_materialized.sql", "original_file_path": "macros/edr/dbt_artifacts/dbt_columns/get_information_schema_columns_materialized.sql", "unique_id": "macro.elementary.get_information_schema_columns_materialized", "macro_sql": "{% macro get_information_schema_columns_materialized() %}\n {% if var(\"sync\", false) %}\n {% do return(\"table\") %}\n {% endif %}\n {% do return(\"view\") %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.4989862, "supported_languages": null}, "macro.elementary.dbt_model_run_result_description": {"name": "dbt_model_run_result_description", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/alerts/dbt_run_results_description.sql", "original_file_path": "macros/edr/alerts/dbt_run_results_description.sql", "unique_id": "macro.elementary.dbt_model_run_result_description", "macro_sql": "{% macro dbt_model_run_result_description() %}\n 'The model ' || name || ' returned ' || status || ' at ' || generated_at || ' on run ' || invocation_id\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.4991877, "supported_languages": null}, "macro.elementary.anomaly_detection_description": {"name": "anomaly_detection_description", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/alerts/anomaly_detection_description.sql", "original_file_path": "macros/edr/alerts/anomaly_detection_description.sql", "unique_id": "macro.elementary.anomaly_detection_description", "macro_sql": "{% macro anomaly_detection_description() %}\n case\n when dimension is not null then {{ elementary.dimension_metric_description() }}\n when metric_name = 'freshness' then {{ elementary.freshness_description() }}\n when column_name is null then {{ elementary.table_metric_description() }}\n when column_name is not null then {{ elementary.column_metric_description() }}\n else null\n end as anomaly_description\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.dimension_metric_description", "macro.elementary.freshness_description", "macro.elementary.table_metric_description", "macro.elementary.column_metric_description"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.5007617, "supported_languages": null}, "macro.elementary.freshness_description": {"name": "freshness_description", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/alerts/anomaly_detection_description.sql", "original_file_path": "macros/edr/alerts/anomaly_detection_description.sql", "unique_id": "macro.elementary.freshness_description", "macro_sql": "{% macro freshness_description() %}\n 'Last update was at ' || anomalous_value || ', ' || {{ elementary.edr_cast_as_string('abs(round(' ~ elementary.edr_cast_as_numeric('metric_value/3600') ~ ', 2))') }} || ' hours ago. Usually the table is updated within ' || {{ elementary.edr_cast_as_string('abs(round(' ~ elementary.edr_cast_as_numeric('training_avg/3600') ~ ', 2))') }} || ' hours.'\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.edr_cast_as_string", "macro.elementary.edr_cast_as_numeric"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.5012715, "supported_languages": null}, "macro.elementary.table_metric_description": {"name": "table_metric_description", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/alerts/anomaly_detection_description.sql", "original_file_path": "macros/edr/alerts/anomaly_detection_description.sql", "unique_id": "macro.elementary.table_metric_description", "macro_sql": "{% macro table_metric_description() %}\n 'The last ' || metric_name || ' value is ' || {{ elementary.edr_cast_as_string('round(' ~ elementary.edr_cast_as_numeric('metric_value') ~ ', 3)') }} ||\n '. The average for this metric is ' || {{ elementary.edr_cast_as_string('round(' ~ elementary.edr_cast_as_numeric('training_avg') ~ ', 3)') }} || '.'\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.edr_cast_as_string", "macro.elementary.edr_cast_as_numeric"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.5017524, "supported_languages": null}, "macro.elementary.column_metric_description": {"name": "column_metric_description", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/alerts/anomaly_detection_description.sql", "original_file_path": "macros/edr/alerts/anomaly_detection_description.sql", "unique_id": "macro.elementary.column_metric_description", "macro_sql": "{% macro column_metric_description() %}\n 'In column ' || column_name || ', the last ' || metric_name || ' value is ' || {{ elementary.edr_cast_as_string('round(' ~ elementary.edr_cast_as_numeric('metric_value') ~ ', 3)') }} ||\n '. The average for this metric is ' || {{ elementary.edr_cast_as_string('round(' ~ elementary.edr_cast_as_numeric('training_avg') ~ ', 3)') }} || '.'\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.edr_cast_as_string", "macro.elementary.edr_cast_as_numeric"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.5022311, "supported_languages": null}, "macro.elementary.dimension_metric_description": {"name": "dimension_metric_description", "resource_type": "macro", "package_name": "elementary", "path": "macros/edr/alerts/anomaly_detection_description.sql", "original_file_path": "macros/edr/alerts/anomaly_detection_description.sql", "unique_id": "macro.elementary.dimension_metric_description", "macro_sql": "{% macro dimension_metric_description() %}\n 'The last ' || metric_name || ' value for dimension ' || dimension || ' - ' ||\n case when dimension_value is null then 'NULL' else dimension_value end || ' is ' || {{ elementary.edr_cast_as_string('round(' ~ elementary.edr_cast_as_numeric('metric_value') ~ ', 3)') }} ||\n '. The average for this metric is ' || {{ elementary.edr_cast_as_string('round(' ~ elementary.edr_cast_as_numeric('training_avg') ~ ', 3)') }} || '.'\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.edr_cast_as_string", "macro.elementary.edr_cast_as_numeric"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.5027153, "supported_languages": null}, "macro.elementary.generate_elementary_cli_profile": {"name": "generate_elementary_cli_profile", "resource_type": "macro", "package_name": "elementary", "path": "macros/commands/generate_elementary_cli_profile.sql", "original_file_path": "macros/commands/generate_elementary_cli_profile.sql", "unique_id": "macro.elementary.generate_elementary_cli_profile", "macro_sql": "{% macro generate_elementary_cli_profile(method=none) %}\n {% set profile_parameters = elementary.generate_elementary_profile_args(method) %}\n {% if profile_parameters is string %}\n {% set profile = profile_parameters %}\n {% else %}\n {% set profile = elementary.cli_profile_from_parameters(profile_parameters)%}\n {% endif %}\n {{ log('\\n' ~ profile, info=True) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.generate_elementary_profile_args", "macro.elementary.cli_profile_from_parameters"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.5039785, "supported_languages": null}, "macro.elementary.cli_profile_from_parameters": {"name": "cli_profile_from_parameters", "resource_type": "macro", "package_name": "elementary", "path": "macros/commands/generate_elementary_cli_profile.sql", "original_file_path": "macros/commands/generate_elementary_cli_profile.sql", "unique_id": "macro.elementary.cli_profile_from_parameters", "macro_sql": "{% macro cli_profile_from_parameters(parameters) %}\nelementary:\n outputs:\n default:\n {% for parameter in parameters -%}\n {%- set key = parameter[\"name\"] -%}\n {%- set value = parameter[\"value\"] -%}\n {%- if value is string -%}\n {%- set value = '\"' ~ value ~ '\"' -%}\n {%- endif -%}\n {{ key }}: {{ value }}{% if parameter[\"comment\"] %} # {{ parameter[\"comment\"] }}{% endif %}\n {% endfor -%}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.504843, "supported_languages": null}, "macro.elementary.delete_duplicate_rows": {"name": "delete_duplicate_rows", "resource_type": "macro", "package_name": "elementary", "path": "macros/commands/delete_duplicate_rows.sql", "original_file_path": "macros/commands/delete_duplicate_rows.sql", "unique_id": "macro.elementary.delete_duplicate_rows", "macro_sql": "{% macro delete_duplicate_rows(model_unique_id) %}\n {% do return(adapter.dispatch(\"delete_duplicate_rows\", \"elementary\")(model_unique_id)) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.postgres__delete_duplicate_rows"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.5059748, "supported_languages": null}, "macro.elementary.postgres__delete_duplicate_rows": {"name": "postgres__delete_duplicate_rows", "resource_type": "macro", "package_name": "elementary", "path": "macros/commands/delete_duplicate_rows.sql", "original_file_path": "macros/commands/delete_duplicate_rows.sql", "unique_id": "macro.elementary.postgres__delete_duplicate_rows", "macro_sql": "{% macro postgres__delete_duplicate_rows(model_unique_id) %}\n {% set node = graph.nodes[model_unique_id] %}\n {% set relation = adapter.get_relation(database=node.database, schema=node.schema, identifier=node.alias) %}\n {% if relation is none %}\n {% do print(\"Relation '{}' does not exist.\".format(node.relation_name)) %}\n {% do return([]) %}\n {% endif %}\n\n {% set column_names = adapter.get_columns_in_relation(relation) | map(attribute=\"name\") | map(\"lower\") | list %}\n\n {% set query %}\n DELETE FROM {{ relation }} AS t1\n USING {{ relation }} AS t2\n WHERE t1.ctid < t2.ctid\n {% for col in column_names %}\n AND t1.{{ col }} = t2.{{ col }}\n {% endfor %}\n {% endset %}\n {% do elementary.run_query(query) %}\n {% do adapter.commit() %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.5075371, "supported_languages": null}, "macro.elementary.default__delete_duplicate_rows": {"name": "default__delete_duplicate_rows", "resource_type": "macro", "package_name": "elementary", "path": "macros/commands/delete_duplicate_rows.sql", "original_file_path": "macros/commands/delete_duplicate_rows.sql", "unique_id": "macro.elementary.default__delete_duplicate_rows", "macro_sql": "{% macro default__delete_duplicate_rows(model_unique_id) %}\n {{ exceptions.raise_compiler_error(\"This macro is not supported on '{}'.\".format(target.type)) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.5079622, "supported_languages": null}, "macro.elementary.create_elementary_user": {"name": "create_elementary_user", "resource_type": "macro", "package_name": "elementary", "path": "macros/commands/create_elementary_user.sql", "original_file_path": "macros/commands/create_elementary_user.sql", "unique_id": "macro.elementary.create_elementary_user", "macro_sql": "{% macro create_elementary_user(user=\"elementary\", password=none, role=\"ELEMENTARY_ROLE\") %}\n {% if password is none %}\n {% set password = elementary.generate_password() %}\n {% endif %}\n {% set profile_parameters = elementary.generate_elementary_profile_args(overwrite_values={\n \"user\": user,\n \"password\": password,\n \"role\": role\n }) %}\n {% set profile_parameters_dict = {} %}\n {% for parameter in profile_parameters %}\n {% set profile_parameters_dict = profile_parameters_dict.update({parameter[\"name\"]: parameter[\"value\"]}) %}\n {% endfor %}\n {% set profile_creation_query = elementary.get_profile_creation_query(profile_parameters_dict) %}\n {% do print(\"\\nPlease run the following query in your database to create the Elementary user:\\n\" ~ profile_creation_query) %}\n {% do print(\"\\nAfter that, use the following parameters when configuring your environment\\n\") %}\n {% for parameter in profile_parameters %}\n {% if parameter[\"name\"] != \"threads\" %} {# threads is not a parameter for the environment #}\n {% do print(parameter[\"name\"]|capitalize ~ \": \" ~ parameter[\"value\"]) %}\n {% endif %}\n {% endfor %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.generate_password", "macro.elementary.generate_elementary_profile_args", "macro.elementary.get_profile_creation_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.5108478, "supported_languages": null}, "macro.elementary.generate_password": {"name": "generate_password", "resource_type": "macro", "package_name": "elementary", "path": "macros/commands/create_elementary_user.sql", "original_file_path": "macros/commands/create_elementary_user.sql", "unique_id": "macro.elementary.generate_password", "macro_sql": "{% macro generate_password() %}\n {# Heavily inspired by https://gist.github.com/benwalio/8598cf9f642271ffdaf3daa82c1802cb #}\n {% set characters = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'] %}\n {% set ns = namespace(placeholder=\"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\", password=\"\") %}\n {% for x in ns.placeholder %}\n {% set ns.password = [ns.password, (x | replace('x', characters | random ))] | join %}\n {% endfor %}\n {% do return(ns.password) %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.512883, "supported_languages": null}, "macro.elementary.generate_schema_baseline_test": {"name": "generate_schema_baseline_test", "resource_type": "macro", "package_name": "elementary", "path": "macros/commands/generate_schema_baseline_test.sql", "original_file_path": "macros/commands/generate_schema_baseline_test.sql", "unique_id": "macro.elementary.generate_schema_baseline_test", "macro_sql": "{% macro generate_schema_baseline_test(name=none, include_sources=True, include_models=False, fail_on_added=False, enforce_types=False) %}\n {% if name %}\n {{ generate_schema_baseline_test_for_node(name, fail_on_added=fail_on_added, enforce_types=enforce_types) }}\n {% else %}\n {{ generate_schema_baseline_test_for_all_nodes(include_sources=include_sources, include_models=include_models,\n fail_on_added=fail_on_added, enforce_types=enforce_types) }}\n {% endif %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.generate_schema_baseline_test_for_node", "macro.elementary.generate_schema_baseline_test_for_all_nodes"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.5158875, "supported_languages": null}, "macro.elementary.generate_schema_baseline_test_for_all_nodes": {"name": "generate_schema_baseline_test_for_all_nodes", "resource_type": "macro", "package_name": "elementary", "path": "macros/commands/generate_schema_baseline_test.sql", "original_file_path": "macros/commands/generate_schema_baseline_test.sql", "unique_id": "macro.elementary.generate_schema_baseline_test_for_all_nodes", "macro_sql": "{% macro generate_schema_baseline_test_for_all_nodes(include_sources=True, include_models=False, fail_on_added=False, enforce_types=False) %}\n {% set nodes = elementary.get_nodes_from_graph() %}\n {% for node in nodes %}\n {% if node.package_name != 'elementary' and\n ((include_sources and node.resource_type == 'source') or\n (include_models and node.resource_type == 'model')) %}\n {% do print(\"Generating schema changes from baseline test for {} '{}':\".format(node.resource_type, node.name)) %}\n {{ generate_schema_baseline_test_for_node(node, fail_on_added=fail_on_added, enforce_types=enforce_types) }}\n {% do print('----------------------------------') %}\n {% endif %}\n {% endfor %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.get_nodes_from_graph", "macro.elementary.generate_schema_baseline_test_for_node"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.5171392, "supported_languages": null}, "macro.elementary.generate_schema_baseline_test_for_node": {"name": "generate_schema_baseline_test_for_node", "resource_type": "macro", "package_name": "elementary", "path": "macros/commands/generate_schema_baseline_test.sql", "original_file_path": "macros/commands/generate_schema_baseline_test.sql", "unique_id": "macro.elementary.generate_schema_baseline_test_for_node", "macro_sql": "{% macro generate_schema_baseline_test_for_node(node, fail_on_added=False, enforce_types=False) %}\n {% if node is string %}\n {% set node_name = node %}\n {% set node = elementary.get_node_by_name(node_name) %}\n\n {% if not node %}\n {% do print(\"Could not find any model or source by the name '{}'!\".format(node_name)) %}\n {% do return(none) %}\n {% endif %}\n {% endif %}\n\n {% if node.resource_type not in [\"source\", \"model\"] %}\n {% do print(\"Only sources and models are supported for this macro, supplied node type: '{}'\".format(node.resource_type)) %}\n {% do return(none) %}\n {% endif %}\n\n {% set node_relation = get_relation_from_node(node) %}\n {% if not node_relation %}\n {% do print(\"Table not found in the DB! Cannot create schema test.\") %}\n {% do return(none) %}\n {% endif %}\n\n {% set columns = adapter.get_columns_in_relation(node_relation) %}\n\n {% set test_params = {} %}\n {% if fail_on_added %}\n {% do test_params.update({\"fail_on_added\": \"true\"}) %}\n {% endif %}\n {% if enforce_types %}\n {% do test_params.update({\"enforce_types\": \"true\"}) %}\n {% endif %}\n\n {# Common yaml for sources and models #}\n {% set common_yaml %}\n - name: {{ node.name }}\n columns:\n {%- for column in columns %}\n - name: {{ column.name }}\n data_type: {{ elementary.get_column_data_type(column) }}\n {% endfor %}\n tests:\n - elementary.schema_changes_from_baseline\n {%- if test_params %}:\n {%- for param, param_val in test_params.items() %}\n {{param}}: {{param_val}}\n {%- endfor -%}\n {% endif -%}\n {% endset %}\n\n {% set full_yaml %}\n {%- if node.resource_type == 'source' %}\nsources:\n - name: {{ node.source_name }}\n tables:\n {{- common_yaml }}\n {% else %}\nmodels:\n {{- common_yaml }}\n {% endif -%}\n {% endset %}\n\n {% do print(full_yaml) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.get_node_by_name", "macro.elementary.get_relation_from_node", "macro.elementary.get_column_data_type"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.5204966, "supported_languages": null}, "macro.elementary.enforce_project_configurations": {"name": "enforce_project_configurations", "resource_type": "macro", "package_name": "elementary", "path": "macros/commands/enforce_project_configurations.sql", "original_file_path": "macros/commands/enforce_project_configurations.sql", "unique_id": "macro.elementary.enforce_project_configurations", "macro_sql": "{%- macro enforce_project_configurations(enforce_owners=true, enforce_tags=false, enforce_description=false, required_meta_keys=none, required_config_keys=none, include_sources=true) -%}\n {% if not required_meta_keys %}\n {% set required_meta_keys = [] %}\n {% endif %}\n {% if not required_config_keys %}\n {% set required_config_keys = [] %}\n {% endif %}\n\n {# enforcing source params #}\n {%- if include_sources -%}\n {% set sources = graph.sources.values() | selectattr('resource_type', '==', 'source') %}\n {% set sources_passed = elementary.enforce_configuration(sources, elementary.flatten_source, enforce_owners, enforce_tags, enforce_description, required_meta_keys, required_config_keys) %}\n {%- endif -%}\n\n {# enforcing model params #}\n {% set models = graph.nodes.values() | selectattr('resource_type', '==', 'model') %}\n {% set models_passed = elementary.enforce_configuration(models, elementary.flatten_model, enforce_owners, enforce_tags, enforce_description, required_meta_keys, required_config_keys) %}\n\n {%- if not models_passed or (include_sources and not sources_passed) -%}\n {{ exceptions.raise_compiler_error(\"Found issues in project configurations\") }}\n {%- endif -%}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.elementary.enforce_configuration"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.525597, "supported_languages": null}, "macro.elementary.get_enforcement_param": {"name": "get_enforcement_param", "resource_type": "macro", "package_name": "elementary", "path": "macros/commands/enforce_project_configurations.sql", "original_file_path": "macros/commands/enforce_project_configurations.sql", "unique_id": "macro.elementary.get_enforcement_param", "macro_sql": "{%- macro get_enforcement_param(node, enforcement_param_name, enforcement_param_arg_value) -%}\n {% do return(node.meta.get(enforcement_param_name) or node.config.get(enforcement_param_name) or elementary.get_config_var(enforcement_param_name) or enforcement_param_arg_value) %}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.elementary.get_config_var"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.526093, "supported_languages": null}, "macro.elementary.enforce_configuration": {"name": "enforce_configuration", "resource_type": "macro", "package_name": "elementary", "path": "macros/commands/enforce_project_configurations.sql", "original_file_path": "macros/commands/enforce_project_configurations.sql", "unique_id": "macro.elementary.enforce_configuration", "macro_sql": "{%- macro enforce_configuration(nodes, flatten_callback, enforce_owners, enforce_tags, enforce_description, required_meta_keys, required_config_keys) -%}\n {% set validation_result = {'success': true} %}\n {% for node in nodes -%}\n {% set flattened_node = flatten_callback(node) %}\n {%- if flattened_node.package_name == project_name -%}\n {% set enforce_owners = elementary.get_enforcement_param(node, 'enforce_owners', enforce_owners) %}\n {% set enforce_tags = elementary.get_enforcement_param(node, 'enforce_tags', enforce_tags) %}\n {% set enforce_description = elementary.get_enforcement_param(node, 'enforce_description', enforce_description) %}\n {% set required_meta_keys = elementary.get_enforcement_param(node, 'required_meta_keys', required_meta_keys) %}\n {% set required_config_keys = elementary.get_enforcement_param(node, 'required_config_keys', required_config_keys) %}\n\n {%- if enforce_owners and flattened_node.owner | length == 0 -%}\n {% do elementary.edr_log(node.resource_type ~ \" \" ~ node.name ~ \" does not have an owner\") %}\n {% do validation_result.update({'success': false}) %}\n {%- endif -%}\n\n {%- if enforce_tags and flattened_node.tags | length == 0 -%}\n {% do elementary.edr_log(node.resource_type ~ \" \" ~ node.name ~ \" does not have tags\") %}\n {% do validation_result.update({'success': false}) %}\n {%- endif -%}\n\n {%- if enforce_description and not flattened_node.description -%}\n {% do elementary.edr_log(node.resource_type ~ \" \" ~ node.name ~ \" does not have a description\") %}\n {% do validation_result.update({'success': false}) %}\n {%- endif -%}\n\n {%- if required_meta_keys | length > 0 -%}\n {%- for meta_param in required_meta_keys -%}\n {%- if meta_param not in flattened_node.meta -%}\n {% do elementary.edr_log(node.resource_type ~ \" \" ~ node.name ~ \" does not have required meta param \" ~ meta_param) %}\n {% do validation_result.update({'success': false}) %}\n {%- endif -%}\n {%- endfor -%}\n {%- endif -%}\n\n {%- if required_config_keys | length > 0 -%}\n {%- for config_param in required_config_keys -%}\n {# flattened node doesn't have a config yet, using node instead #}\n {% set config_dict = elementary.safe_get_with_default(node, 'config', {}) %}\n {%- if config_dict is not none -%}\n {%- if config_param not in config_dict -%}\n {% do elementary.edr_log(node.resource_type ~ \" \" ~ node.name ~ \" does not have required config param \" ~ config_param) %}\n {% do validation_result.update({'success': false}) %}\n {%- endif -%}\n {%- endif -%}\n {%- endfor -%}\n {%- endif -%}\n {%- endif -%}\n {%- endfor -%}\n {{- return(validation_result['success']) -}}\n{%- endmacro -%}", "depends_on": {"macros": ["macro.elementary.get_enforcement_param", "macro.elementary.edr_log", "macro.elementary.safe_get_with_default"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.530574, "supported_languages": null}, "macro.elementary.dump_table": {"name": "dump_table", "resource_type": "macro", "package_name": "elementary", "path": "macros/commands/dump_table.sql", "original_file_path": "macros/commands/dump_table.sql", "unique_id": "macro.elementary.dump_table", "macro_sql": "{% macro dump_table(model_unique_id, output_path, exclude_deprecated_columns=true, timestamp_column=none, since=none, days_back=7, dedup=false) %}\n {% set node = graph.nodes.get(model_unique_id) %}\n {% if not node %}\n {% do print(\"Node '{}' does not exist.\".format(model_unique_id)) %}\n {% do return([]) %}\n {% endif %}\n\n {% set relation = api.Relation.create(database=node.database, schema=node.schema, identifier=node.alias) %}\n {% set column_names = adapter.get_columns_in_relation(relation) | map(attribute=\"name\") | map(\"lower\") | list %}\n {% if not column_names %}\n {% do print(\"Relation '{}' does not exist.\".format(node.relation_name)) %}\n {% do return([]) %}\n {% endif %}\n\n {% if exclude_deprecated_columns %}\n {% set deprecated_column_names = node.meta.get(\"deprecated_columns\", []) | map(attribute=\"name\") | map(\"lower\") | list %}\n {% set column_names = column_names | reject(\"in\", deprecated_column_names) | list %}\n {% endif %}\n\n {% set dedup_by_column = node.meta.dedup_by_column or \"unique_id\" %}\n {% set order_by_dedup_column = \"generated_at\" %}\n {% set query %}\n {% if dedup and (dedup_by_column in column_names) and (order_by_dedup_column in column_names) %}\n {{ elementary.dedup_by_column_query(dedup_by_column, order_by_dedup_column, column_names, relation) }}\n {% else %}\n select {{ elementary.escape_select(column_names) }} from {{ relation }}\n {% endif %}\n {% if timestamp_column %}\n {% if since %}\n where {{ elementary.edr_cast_as_timestamp(timestamp_column) }} > {{ elementary.edr_cast_as_timestamp(elementary.edr_quote(since)) }}\n {% else %}\n where {{ elementary.edr_datediff(elementary.edr_cast_as_timestamp(timestamp_column), elementary.edr_current_timestamp(), 'day') }} < {{ days_back }}\n {% endif %}\n {% endif %}\n {% endset %}\n {% set results = elementary.run_query(query) %}\n {% do results.to_csv(output_path) %}\n {% do return(results.column_names) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.dedup_by_column_query", "macro.elementary.escape_select", "macro.elementary.edr_cast_as_timestamp", "macro.elementary.edr_quote", "macro.elementary.edr_datediff", "macro.elementary.edr_current_timestamp", "macro.elementary.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.5369883, "supported_languages": null}, "macro.elementary.dedup_by_column_query": {"name": "dedup_by_column_query", "resource_type": "macro", "package_name": "elementary", "path": "macros/commands/dump_table.sql", "original_file_path": "macros/commands/dump_table.sql", "unique_id": "macro.elementary.dedup_by_column_query", "macro_sql": "{% macro dedup_by_column_query(dedup_by_column, order_by_dedup_column, column_names, relation) %}\n with indexed_relation as (\n select \n {{ elementary.escape_select(column_names) }}, \n row_number() over (partition by {{ dedup_by_column }} order by {{ order_by_dedup_column }} desc) as row_index\n from {{ relation }}\n ),\n\n deduped_relation as (\n select {{ elementary.escape_select(column_names) }}\n from indexed_relation\n where row_index = 1\n )\n\n select {{ elementary.escape_select(column_names) }}\n from deduped_relation\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.escape_select"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.537602, "supported_languages": null}, "macro.elementary.generate_json_schema_test": {"name": "generate_json_schema_test", "resource_type": "macro", "package_name": "elementary", "path": "macros/commands/generate_json_schema_test.sql", "original_file_path": "macros/commands/generate_json_schema_test.sql", "unique_id": "macro.elementary.generate_json_schema_test", "macro_sql": "{% macro generate_json_schema_test(node_name, column_name) %}\n {% if target.type not in ['snowflake', 'bigquery'] %}\n {% do exceptions.raise_compiler_error(\"JSON schema test generation is not supported for target: {}\".format(target.type)) %}\n {% endif %}\n\n {% set node = elementary.get_node_by_name(node_name) %}\n {% if node.resource_type not in [\"source\", \"model\"] %}\n {% do exceptions.raise_compiler_error(\"Only sources and models are supported for this macro, supplied node type: '{}'\".format(node.resource_type)) %}\n {% endif %}\n\n {% set node_relation = get_relation_from_node(node) %}\n {% if not elementary.column_exists_in_relation(node_relation, column_name) %}\n {% do exceptions.raise_compiler_error(\"Column '{}' does not exist in {} '{}'!\".format(column_name, node.resource_type, node_name)) %}\n {% endif %}\n\n {% set elementary_database_name, elementary_schema_name = elementary.get_package_database_and_schema() %}\n\n {% do node.config.update({\"packages\": [\"genson\"]}) %}\n {% do node.update({'database': elementary_database_name, 'schema': elementary_schema_name}) %}\n {% if node.resource_type == 'source' %}\n {# Source nodes don't have alias, and submit_python_job expects it #}\n {% do node.update({'alias': \"jsonschemagen_{}_{}\".format(node.source_name, node.name)}) %}\n {% endif %}\n\n {% set output_table = api.Relation.create(database=elementary_database_name, schema=elementary_schema_name,\n identifier='json_schema_tmp__' ~ node.alias).quote(false, false, false) %}\n\n {% set gen_json_schema_func = elementary.generate_json_schema_py_func(column_name) %}\n {% set node_relation = node_relation.quote(false, false, false) %}\n {% set compiled_py_code = adapter.dispatch('compile_py_code', 'elementary')(node_relation, gen_json_schema_func,\n output_table, code_type='function') %}\n\n {% do elementary.run_python(node, compiled_py_code) %}\n {% set json_schema = elementary.result_value('select result from {}'.format(output_table)) %}\n {% if json_schema == 'genson_not_installed' %}\n {% do exceptions.raise_compiler_error(\"The 'genson' python library is missing from your warehouse.\\n\\n\"\n \"This macro relies on the 'genson' python library for generating JSON schemas. Please follow dbt's instructions here: \\n\"\n \"https://docs.getdbt.com/docs/building-a-dbt-project/building-models/python-models#specific-data-warehouses\\n\"\n \"regarding how to install python packages for a {} warehouse.\".format(target.type)\n ) %}\n {% endif %}\n\n {% if not json_schema %}\n {% do exceptions.raise_compiler_error(\"Not a valid JSON column: {}\".format(column_name)) %}\n {% endif %}\n\n {% set json_schema = fromjson(json_schema) %}\n {% do json_schema.pop('$schema', None) %}\n\n {% set testyaml %}\ncolumns:\n - name: {{ column_name }}\n tests:\n - elementary.json_schema:\n {{ toyaml(json_schema) | indent(10) }}\n {% endset %}\n\n {% do print(\"Please add the following test to your {} configuration for the column {}:\".format(node.resource_type, column_name)) %}\n {% do print(testyaml) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.get_node_by_name", "macro.elementary.get_relation_from_node", "macro.elementary.column_exists_in_relation", "macro.elementary.get_package_database_and_schema", "macro.elementary.generate_json_schema_py_func", "macro.elementary.default__compile_py_code", "macro.elementary.run_python", "macro.elementary.result_value"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.544545, "supported_languages": null}, "macro.elementary.generate_json_schema_py_func": {"name": "generate_json_schema_py_func", "resource_type": "macro", "package_name": "elementary", "path": "macros/commands/generate_json_schema_test.sql", "original_file_path": "macros/commands/generate_json_schema_test.sql", "unique_id": "macro.elementary.generate_json_schema_py_func", "macro_sql": "{% macro generate_json_schema_py_func(column_name) %}\nimport json\ntry:\n import genson\nexcept ImportError:\n genson = None\n\ndef get_column_name_in_df(df, column_name):\n matching = [col for col in df.columns if col.lower() == column_name.lower()]\n if len(matching) > 1:\n # Case matters, switch to case-sensitive match\n matching = [col for col in df.columns if col == column_name]\n\n if len(matching) == 0:\n raise Exception(\"No column with the name: {}\".format(col))\n return matching[0]\n\ndef func(model_df, ref, session):\n if genson is None:\n return \"genson_not_installed\"\n\n model_df = model_df.toPandas()\n builder = genson.SchemaBuilder()\n column_name = get_column_name_in_df(model_df, \"{{ column_name }}\")\n for val in set(model_df[column_name]):\n if val == \"\" or val is None:\n continue\n try:\n builder.add_object(json.loads(val))\n except json.JSONDecodeError:\n # Not a valid json column, no schema\n return None\n return builder.to_schema()\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.5448973, "supported_languages": null}, "macro.elementary.get_missing_elementary_models_err_msg": {"name": "get_missing_elementary_models_err_msg", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/missing_elementary_models.sql", "original_file_path": "macros/utils/missing_elementary_models.sql", "unique_id": "macro.elementary.get_missing_elementary_models_err_msg", "macro_sql": "{% macro get_missing_elementary_models_err_msg() %}\n {% set elementary_db, elementary_schema = elementary.get_package_database_and_schema() %}\n {% do return(\"Missing Elementary models in '{}.{}'. Please run 'dbt run -s elementary --target {}'.\".format(elementary_db, elementary_schema, target.name)) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.get_package_database_and_schema"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.5456026, "supported_languages": null}, "macro.elementary.warn_missing_elementary_models": {"name": "warn_missing_elementary_models", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/missing_elementary_models.sql", "original_file_path": "macros/utils/missing_elementary_models.sql", "unique_id": "macro.elementary.warn_missing_elementary_models", "macro_sql": "{% macro warn_missing_elementary_models() %}\n {% do exceptions.warn(elementary.get_missing_elementary_models_err_msg()) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.get_missing_elementary_models_err_msg"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.54587, "supported_languages": null}, "macro.elementary.raise_missing_elementary_models": {"name": "raise_missing_elementary_models", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/missing_elementary_models.sql", "original_file_path": "macros/utils/missing_elementary_models.sql", "unique_id": "macro.elementary.raise_missing_elementary_models", "macro_sql": "{% macro raise_missing_elementary_models() %}\n {% do exceptions.raise_compiler_error(elementary.get_missing_elementary_models_err_msg()) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.get_missing_elementary_models_err_msg"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.5461342, "supported_languages": null}, "macro.elementary.is_test_command": {"name": "is_test_command", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/command_type_utils.sql", "original_file_path": "macros/utils/command_type_utils.sql", "unique_id": "macro.elementary.is_test_command", "macro_sql": "{% macro is_test_command() %}\n {% do return(flags.WHICH in ['test', 'build', 'retry']) %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.5466437, "supported_languages": null}, "macro.elementary.is_run_command": {"name": "is_run_command", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/command_type_utils.sql", "original_file_path": "macros/utils/command_type_utils.sql", "unique_id": "macro.elementary.is_run_command", "macro_sql": "{% macro is_run_command() %}\n {% do return(flags.WHICH in ['run', 'build', 'retry']) %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.5469668, "supported_languages": null}, "macro.elementary.is_docs_command": {"name": "is_docs_command", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/command_type_utils.sql", "original_file_path": "macros/utils/command_type_utils.sql", "unique_id": "macro.elementary.is_docs_command", "macro_sql": "{% macro is_docs_command() %}\n {% do return(flags.WHICH in ['generate', 'serve']) %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.547282, "supported_languages": null}, "macro.elementary.get_common_test_config": {"name": "get_common_test_config", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/common_test_configs.sql", "original_file_path": "macros/utils/common_test_configs.sql", "unique_id": "macro.elementary.get_common_test_config", "macro_sql": "{% macro get_common_test_config(flattened_test) %}\n {% set test_name = flattened_test[\"short_name\"] %}\n {% set test_namespace = flattened_test[\"test_namespace\"] %}\n {% do return(elementary.get_common_test_config_by_namespace_and_name(test_namespace, test_name)) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.get_common_test_config_by_namespace_and_name"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.5852952, "supported_languages": null}, "macro.elementary.get_common_test_config_by_namespace_and_name": {"name": "get_common_test_config_by_namespace_and_name", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/common_test_configs.sql", "original_file_path": "macros/utils/common_test_configs.sql", "unique_id": "macro.elementary.get_common_test_config_by_namespace_and_name", "macro_sql": "{% macro get_common_test_config_by_namespace_and_name(test_namespace, test_name) %}\n {% set common_tests_configs_mapping = elementary.get_common_tests_configs_mapping() %}\n {% if test_namespace is none %}\n {% set test_namespace = \"dbt\" %}\n {% endif %}\n {% if test_namespace in common_tests_configs_mapping %}\n {% if test_name in common_tests_configs_mapping[test_namespace] %}\n {% do return(common_tests_configs_mapping[test_namespace][test_name]) %}\n {% endif %}\n {% endif %}\n {% do return(none) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.get_common_tests_configs_mapping"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.586215, "supported_languages": null}, "macro.elementary.get_common_tests_configs_mapping": {"name": "get_common_tests_configs_mapping", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/common_test_configs.sql", "original_file_path": "macros/utils/common_test_configs.sql", "unique_id": "macro.elementary.get_common_tests_configs_mapping", "macro_sql": "{% macro get_common_tests_configs_mapping() %}\n {#\n Configurations for common tests (dbt builtins, dbt_utils, dbt_expectations, etc)\n The format of the mapping is:\n {\n : {\n : \n }\n }\n The config may contain:\n description: A human readable description of the test.\n failed_row_count_calc: SQL expression to get the number of failed rows from the test result.\n quality_dimension: The quality dimension of the test, see https://www.getdbt.com/blog/data-quality-dimensions/ for details.\n #}\n {% set common_tests_configs_mapping = {\n \"dbt\": {\n \"not_null\": {\n \"description\": \"This test validates that there are no `null` values present in a column.\",\n \"quality_dimension\": \"completeness\",\n \"failed_row_count_calc\": \"count(*)\"\n },\n \"relationships\": {\n \"description\": \"This test validates that all of the records in a child table have a corresponding record in a parent table. This property is referred to as \\\"referential integrity\\\".\",\n \"quality_dimension\": \"consistency\",\n \"failed_row_count_calc\": \"count(*)\"\n },\n \"unique\": {\n \"description\": \"This test validates that there are no duplicate values present in a field.\",\n \"quality_dimension\": \"uniqueness\",\n \"failed_row_count_calc\": \"sum(n_records)\"\n },\n \"accepted_values\": {\n \"description\": \"This test validates that all of the values in a column are present in a supplied list of `values`. If any values other than those provided in the list are present, then the test will fail.\",\n \"quality_dimension\": \"validity\",\n \"failed_row_count_calc\": \"sum(n_records)\"\n }\n },\n \"dbt_expectations\": {\n \"expect_column_values_to_not_be_null\": {\n \"description\": \"Expect column values to not be null.\",\n \"quality_dimension\": \"completeness\",\n \"failed_row_count_calc\": \"count(*)\"\n },\n \"expect_column_values_to_be_null\": {\n \"description\": \"Expect column values to be null.\",\n \"quality_dimension\": \"completeness\",\n \"failed_row_count_calc\": \"count(*)\"\n },\n \"expect_column_values_to_be_in_set\": {\n \"description\": \"Expect each column value to be in a given set.\",\n \"quality_dimension\": \"validity\",\n \"failed_row_count_calc\": \"count(*)\"\n },\n \"expect_column_values_to_be_between\": {\n \"description\": \"Expect each column value to be between two values.\",\n \"quality_dimension\": \"validity\",\n \"failed_row_count_calc\": \"count(*)\"\n },\n \"expect_column_values_to_not_be_in_set\": {\n \"description\": \"Expect each column value not to be in a given set.\",\n \"quality_dimension\": \"validity\",\n \"failed_row_count_calc\": \"count(*)\"\n },\n \"expect_column_values_to_be_increasing\": {\n \"description\": \"Expect column values to be increasing. If `strictly: True`, then this expectation is only satisfied if each consecutive value is strictly increasing \\u2013 equal values are treated as failures.\",\n \"quality_dimension\": \"accuracy\",\n \"failed_row_count_calc\": \"count(*)\"\n },\n \"expect_column_values_to_be_decreasing\": {\n \"description\": \"Expect column values to be decreasing. If `strictly=True`, then this expectation is only satisfied if each consecutive value is strictly decreasing \\u2013 equal values are treated as failures.\",\n \"quality_dimension\": \"accuracy\",\n \"failed_row_count_calc\": \"count(*)\"\n },\n \"expect_column_value_lengths_to_be_between\": {\n \"description\": \"Expect column entries to be strings with length between a min_value value and a max_value value (inclusive).\",\n \"quality_dimension\": \"validity\",\n \"failed_row_count_calc\": \"count(*)\"\n },\n \"expect_column_value_lengths_to_equal\": {\n \"description\": \"Expect column entries to be strings with length equal to the provided value.\",\n \"quality_dimension\": \"validity\",\n \"failed_row_count_calc\": \"count(*)\"\n },\n \"expect_column_values_to_match_regex\": {\n \"description\": \"Expect column entries to be strings that match a given regular expression. Valid matches can be found anywhere in the string, for example \\\"[at]+\\\" will identify the following strings as expected: \\\"cat\\\", \\\"hat\\\", \\\"aa\\\", \\\"a\\\", and \\\"t\\\", and the following strings as unexpected: \\\"fish\\\", \\\"dog\\\". Optionally, `is_raw` indicates the `regex` pattern is a \\\"raw\\\" string and should be escaped. The default is `False`.\",\n \"quality_dimension\": \"validity\",\n \"failed_row_count_calc\": \"count(*)\"\n },\n \"expect_column_values_to_not_match_regex\": {\n \"description\": \"Expect column entries to be strings that do NOT match a given regular expression. The regex must not match any portion of the provided string. For example, \\\"[at]+\\\" would identify the following strings as expected: \\\"fish\\u201d, \\\"dog\\u201d, and the following as unexpected: \\\"cat\\u201d, \\\"hat\\u201d. Optionally, `is_raw` indicates the `regex` pattern is a \\\"raw\\\" string and should be escaped. The default is `False`.\",\n \"quality_dimension\": \"validity\",\n \"failed_row_count_calc\": \"count(*)\"\n },\n \"expect_column_values_to_match_regex_list\": {\n \"description\": \"Expect the column entries to be strings that can be matched to either any of or all of a list of regular expressions. Matches can be anywhere in the string. Optionally, `is_raw` indicates the `regex` patterns are \\\"raw\\\" strings and should be escaped. The default is `False`.\",\n \"quality_dimension\": \"validity\",\n \"failed_row_count_calc\": \"count(*)\"\n },\n \"expect_column_values_to_not_match_regex_list\": {\n \"description\": \"Expect the column entries to be strings that do not match any of a list of regular expressions. Matches can be anywhere in the string. Optionally, `is_raw` indicates the `regex` patterns are \\\"raw\\\" strings and should be escaped. The default is `False`.\",\n \"quality_dimension\": \"validity\",\n \"failed_row_count_calc\": \"count(*)\"\n },\n \"expect_column_values_to_match_like_pattern\": {\n \"description\": \"Expect column entries to be strings that match a given SQL like pattern.\",\n \"quality_dimension\": \"validity\",\n \"failed_row_count_calc\": \"count(*)\"\n },\n \"expect_column_values_to_not_match_like_pattern\": {\n \"description\": \"Expect column entries to be strings that do not match a given SQL like pattern.\",\n \"quality_dimension\": \"validity\",\n \"failed_row_count_calc\": \"count(*)\"\n },\n \"expect_column_values_to_match_like_pattern_list\": {\n \"description\": \"Expect the column entries to be strings that match any of a list of SQL like patterns.\",\n \"quality_dimension\": \"validity\",\n \"failed_row_count_calc\": \"count(*)\"\n },\n \"expect_column_values_to_not_match_like_pattern_list\": {\n \"description\": \"Expect the column entries to be strings that do not match any of a list of SQL like patterns.\",\n \"quality_dimension\": \"validity\",\n \"failed_row_count_calc\": \"count(*)\"\n },\n \"expect_column_pair_values_A_to_be_greater_than_B\": {\n \"description\": \"Expect values in column A to be greater than column B.\",\n \"quality_dimension\": \"accuracy\",\n \"failed_row_count_calc\": \"count(*)\"\n },\n \"expect_column_pair_values_to_be_equal\": {\n \"description\": \"Expect the values in column A to be the same as column B.\",\n \"quality_dimension\": \"accuracy\",\n \"failed_row_count_calc\": \"count(*)\"\n },\n \"expect_column_pair_values_to_be_in_set\": {\n \"description\": \"Expect paired values from columns A and B to belong to a set of valid pairs. Note: value pairs are expressed as lists within lists\",\n \"quality_dimension\": \"validity\",\n \"failed_row_count_calc\": \"count(*)\"\n },\n \"expect_select_column_values_to_be_unique_within_record\": {\n \"description\": \"Expect the values for each record to be unique across the columns listed. Note that records can be duplicated.\",\n \"quality_dimension\": \"validity\",\n \"failed_row_count_calc\": \"count(*)\"\n },\n \"expect_column_values_to_be_unique\": {\n \"description\": \"Expect each column value to be unique.\"\n },\n \"expect_compound_columns_to_be_unique\": {\n \"description\": \"Expect that the columns are unique together, e.g. a multi-column primary key.\"\n },\n \"expect_column_to_exist\": {\n \"description\": \"Expect the specified column to exist.\"\n },\n \"expect_row_values_to_have_recent_data\": {\n \"description\": \"Expect the model to have rows that are at least as recent as the defined interval prior to the current timestamp. Optionally gives the possibility to apply filters on the results.\"\n },\n \"expect_grouped_row_values_to_have_recent_data\": {\n \"description\": \"Expect the model to have grouped rows that are at least as recent as the defined interval prior to the current timestamp. Use this to test whether there is recent data for each grouped row defined by `group_by` (which is a list of columns) and a `timestamp_column`. Optionally gives the possibility to apply filters on the results.\"\n },\n \"expect_table_column_count_to_be_between\": {\n \"description\": \"Expect the number of columns in a model to be between two values.\"\n },\n \"expect_table_column_count_to_equal_other_table\": {\n \"description\": \"Expect the number of columns in a model to match another model.\"\n },\n \"expect_table_columns_to_not_contain_set\": {\n \"description\": \"Expect the columns in a model not to contain a given list.\"\n },\n \"expect_table_columns_to_contain_set\": {\n \"description\": \"Expect the columns in a model to contain a given list.\"\n },\n \"expect_table_column_count_to_equal\": {\n \"description\": \"Expect the number of columns in a model to be equal to `expected_number_of_columns`.\"\n },\n \"expect_table_columns_to_match_ordered_list\": {\n \"description\": \"Expect the columns to exactly match a specified list.\"\n },\n \"expect_table_columns_to_match_set\": {\n \"description\": \"Expect the columns in a model to match a given list.\"\n },\n \"expect_table_row_count_to_be_between\": {\n \"description\": \"Expect the number of rows in a model to be between two values.\"\n },\n \"expect_table_row_count_to_equal_other_table\": {\n \"description\": \"Expect the number of rows in a model match another model.\"\n },\n \"expect_table_row_count_to_equal_other_table_times_factor\": {\n \"description\": \"Expect the number of rows in a model to match another model times a preconfigured factor.\"\n },\n \"expect_table_row_count_to_equal\": {\n \"description\": \"Expect the number of rows in a model to be equal to expected_number_of_rows.\"\n },\n \"expect_column_values_to_be_of_type\": {\n \"description\": \"Expect a column to be of a specified data type.\"\n },\n \"expect_column_values_to_be_in_type_list\": {\n \"description\": \"Expect a column to be one of a specified type list.\"\n },\n \"expect_column_values_to_have_consistent_casing\": {\n \"description\": \"Expect a column to have consistent casing. By setting `display_inconsistent_columns` to true, the number of inconsistent values in the column will be displayed in the terminal whereas the inconsistent values themselves will be returned if the SQL compiled test is run.\"\n },\n \"expect_column_distinct_count_to_equal\": {\n \"description\": \"Expect the number of distinct column values to be equal to a given value.\"\n },\n \"expect_column_distinct_count_to_be_greater_than\": {\n \"description\": \"Expect the number of distinct column values to be greater than a given value.\"\n },\n \"expect_column_distinct_count_to_be_less_than\": {\n \"description\": \"Expect the number of distinct column values to be less than a given value.\"\n },\n \"expect_column_distinct_values_to_be_in_set\": {\n \"description\": \"Expect the set of distinct column values to be contained by a given set.\"\n },\n \"expect_column_distinct_values_to_contain_set\": {\n \"description\": \"Expect the set of distinct column values to contain a given set. In contrast to `expect_column_values_to_be_in_set` this ensures not that all column values are members of the given set but that values from the set must be present in the column.\"\n },\n \"expect_column_distinct_values_to_equal_set\": {\n \"description\": \"Expect the set of distinct column values to equal a given set. In contrast to `expect_column_distinct_values_to_contain_set` this ensures not only that a certain set of values are present in the column but that these and only these values are present.\"\n },\n \"expect_column_distinct_count_to_equal_other_table\": {\n \"description\": \"Expect the number of distinct column values to be equal to number of distinct values in another model.\"\n },\n \"expect_column_mean_to_be_between\": {\n \"description\": \"Expect the column mean to be between a min_value value and a max_value value (inclusive).\"\n },\n \"expect_column_median_to_be_between\": {\n \"description\": \"Expect the column median to be between a min_value value and a max_value value (inclusive).\"\n },\n \"expect_column_quantile_values_to_be_between\": {\n \"description\": \"Expect specific provided column quantiles to be between provided min_value and max_value values.\"\n },\n \"expect_column_stdev_to_be_between\": {\n \"description\": \"Expect the column standard deviation to be between a min_value value and a max_value value. Uses sample standard deviation (normalized by N-1).\"\n },\n \"expect_column_unique_value_count_to_be_between\": {\n \"description\": \"Expect the number of unique values to be between a min_value value and a max_value value.\"\n },\n \"expect_column_proportion_of_unique_values_to_be_between\": {\n \"description\": \"Expect the proportion of unique values to be between a min_value value and a max_value value. For example, in a column containing [1, 2, 2, 3, 3, 3, 4, 4, 4, 4], there are 4 unique values and 10 total values for a proportion of 0.4.\"\n },\n \"expect_column_most_common_value_to_be_in_set\": {\n \"description\": \"Expect the most common value to be within the designated value set.\"\n },\n \"expect_column_max_to_be_between\": {\n \"description\": \"Expect the column max to be between a min and max value.\"\n },\n \"expect_column_min_to_be_between\": {\n \"description\": \"Expect the column min to be between a min and max value.\"\n },\n \"expect_column_sum_to_be_between\": {\n \"description\": \"Expect the column to sum to be between a min and max value.\"\n },\n \"expect_multicolumn_sum_to_equal\": {\n \"description\": \"Expects that sum of all rows for a set of columns is equal to a specific value\"\n },\n \"expect_column_values_to_be_within_n_moving_stdevs\": {\n \"description\": \"A simple anomaly test based on the assumption that differences between periods in a given time series follow a log-normal distribution. Thus, we would expect the logged differences (vs N periods ago) in metric values to be within Z sigma away from a moving average. By applying a list of columns in the `group_by` parameter, you can also test for deviations within a group.\"\n },\n \"expect_column_values_to_be_within_n_stdevs\": {\n \"description\": \"Expects (optionally grouped & summed) metric values to be within Z sigma away from the column average\"\n },\n \"expect_row_values_to_have_data_for_every_n_datepart\": {\n \"description\": \"Expects model to have values for every grouped `date_part`.\"\n }\n },\n \"dbt_utils\": {\n \"equal_rowcount\": {\n \"quality_dimension\": \"consistency\",\n \"failed_row_count_calc\": \"sum(diff_count)\"\n },\n \"fewer_rows_than\": {\n \"quality_dimension\": \"consistency\",\n \"failed_row_count_calc\": \"sum(row_count_delta)\"\n },\n \"expression_is_true\": {\n \"quality_dimension\": \"accuracy\",\n \"failed_row_count_calc\": \"count(*)\"\n },\n \"not_empty_string\": {\n \"quality_dimension\": \"completeness\",\n \"failed_row_count_calc\": \"count(*)\"\n },\n \"cardinality_equality\": {\n \"quality_dimension\": \"consistency\",\n \"failed_row_count_calc\": \"sum(num_rows)\"\n },\n \"sequential_values\": {\n \"quality_dimension\": \"accuracy\",\n \"failed_row_count_calc\": \"count(*)\"\n },\n \"accepted_range\": {\n \"quality_dimension\": \"validity\",\n \"failed_row_count_calc\": \"count(*)\"\n }\n },\n \"elementary\": {\n \"schema_changes\": {\n \"description\": \"Monitors schema changes on the table of deleted, added, type changed columns over time. The test will fail if the table's schema changed from the previous execution of the test.\"\n },\n \"schema_changes_from_baseline\": {\n \"description\": \"Compares the table's schema against a baseline contract of columns defined in the table's configuration.\"\n },\n \"json_schema\": {\n \"quality_dimension\": \"validity\",\n \"failed_row_count_calc\": \"count(*)\",\n \"description\": \"This test validates that the data in a column is valid according to a JSON schema.\"\n },\n \"volume_anomalies\": {\n \"description\": \"Monitors the row count of your table over time.\"\n },\n \"freshness_anomalies\": {\n \"description\": \"Monitors the freshness of your table over time, as the expected time between data updates.\"\n },\n \"event_freshness_anomalies\": {\n \"description\": \"Monitors the freshness of event data over time, as the expected time it takes each event to load, that is, the time between when the event actually occurs (the event timestamp), and when it is loaded to the database (the update timestamp).\"\n },\n \"dimension_anomalies\": {\n \"description\": \"Monitors the frequency of values in the configured dimensions over time.\"\n },\n \"all_columns_anomalies\": {\n \"description\": \"Column-level anomaly monitors (null_count, null_percent, zero_count, string_length, variance, etc.) on all the columns of the table. The test checks the data type of each column and only executes monitors that are relevant to it.\"\n },\n \"column_anomalies\": {\n \"description\": \"Column-level anomaly monitors (null_count, null_percent, zero_count, string_length, variance, etc.) on the column according to its data type.\"\n },\n \"exposure_schema_validity\": {\n \"description\": \"Column level exposure validation according to the meta.columns property in exposures.yml\"\n }\n }\n } %}\n {% do return(common_tests_configs_mapping) %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.5971756, "supported_languages": null}, "macro.elementary.edr_percent": {"name": "edr_percent", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/percent_query.sql", "original_file_path": "macros/utils/percent_query.sql", "unique_id": "macro.elementary.edr_percent", "macro_sql": "{% macro edr_percent(value, total) %}\n {% set value = elementary.edr_cast_as_float(value) %}\n {% set total = elementary.edr_cast_as_float(total) %}\n {% set query %}\n round({{ elementary.edr_cast_as_numeric('{} / nullif({}, 0) * 100.0'.format(value, total)) }}, 3)\n {% endset %}\n {% do return(query) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.edr_cast_as_float", "macro.elementary.edr_cast_as_numeric"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.5983346, "supported_languages": null}, "macro.elementary.edr_not_percent": {"name": "edr_not_percent", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/percent_query.sql", "original_file_path": "macros/utils/percent_query.sql", "unique_id": "macro.elementary.edr_not_percent", "macro_sql": "{% macro edr_not_percent(value, total) %}\n {% set value = elementary.edr_cast_as_float(value) %}\n {% set total = elementary.edr_cast_as_float(total) %}\n {% set query %}\n round({{ elementary.edr_cast_as_numeric('100 - ({} / nullif({}, 0) * 100.0)'.format(value, total)) }}, 3)\n {% endset %}\n {% do return(query) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.edr_cast_as_float", "macro.elementary.edr_cast_as_numeric"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.5990586, "supported_languages": null}, "macro.elementary.log_macro_results": {"name": "log_macro_results", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/log_macro_results.sql", "original_file_path": "macros/utils/log_macro_results.sql", "unique_id": "macro.elementary.log_macro_results", "macro_sql": "{% macro log_macro_results(macro_name, macro_args=none) %}\n {% if macro_args is none %}\n {% set macro_args = {} %}\n {% endif %}\n {%- set package_and_macro_name = macro_name.split('.') %}\n {%- if package_and_macro_name | length == 1 %}\n {% set macro = context[macro_name] %}\n {%- elif package_and_macro_name | length == 2 %}\n {%- set package_name, macro_name = package_and_macro_name %}\n {% set macro = context[package_name][macro_name] %}\n {%- else %}\n {% do exceptions.raise_compiler_error(\"Received invalid macro name: {}\".format(macro_name)) %}\n {% endif %}\n {% set results = macro(**macro_args) %}\n {% if results is not none %}\n {% do elementary.edr_log(tojson(results)) %}\n {% endif %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.edr_log"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.6010492, "supported_languages": null}, "macro.elementary.undefined_dict_keys_to_none": {"name": "undefined_dict_keys_to_none", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/dict_utils/undefined_dict_keys_to_none.sql", "original_file_path": "macros/utils/dict_utils/undefined_dict_keys_to_none.sql", "unique_id": "macro.elementary.undefined_dict_keys_to_none", "macro_sql": "{% macro undefined_dict_keys_to_none(dict) %}\n {% for key in dict %}\n {% if dict[key] is not defined %}\n {% do dict.update({key: none}) %}\n {% endif %}\n {% endfor %}\n {{ return(dict) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.6018038, "supported_languages": null}, "macro.elementary.safe_get_with_default": {"name": "safe_get_with_default", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/dict_utils/safe_get_with_default_value.sql", "original_file_path": "macros/utils/dict_utils/safe_get_with_default_value.sql", "unique_id": "macro.elementary.safe_get_with_default", "macro_sql": "{% macro safe_get_with_default(dict, key, default) %}\n {% set value = dict.get(key) %}\n {% if value is defined and value is not none %}\n {{ return(value) }}\n {% endif %}\n {% if default is defined %}\n {{ return(default) }}\n {% endif %}\n {{ return(none) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.6027138, "supported_languages": null}, "macro.elementary.insensitive_get_dict_value": {"name": "insensitive_get_dict_value", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/dict_utils/insensitive_get_dict_value.sql", "original_file_path": "macros/utils/dict_utils/insensitive_get_dict_value.sql", "unique_id": "macro.elementary.insensitive_get_dict_value", "macro_sql": "{% macro insensitive_get_dict_value(dict, key, default) -%}\n {% set value = elementary.safe_get_with_default(dict, key) %}\n {%- if value is not none -%}\n {{- return(value) -}}\n {%- endif %}\n {% set value = elementary.safe_get_with_default(dict, key.lower()) %}\n {%- if value is not none -%}\n {{- return(value) -}}\n {%- endif %}\n {% set value = elementary.safe_get_with_default(dict, key.upper()) %}\n {%- if value is not none -%}\n {{- return(value) -}}\n {%- endif %}\n {%- if default is defined -%}\n {{- return(default) -}}\n {% else %}\n {{ return(none) }}\n {% endif %}\n{%- endmacro %}", "depends_on": {"macros": ["macro.elementary.safe_get_with_default"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.6044486, "supported_languages": null}, "macro.elementary.split_list_to_chunks": {"name": "split_list_to_chunks", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/list_utils/split_list_to_chunks.sql", "original_file_path": "macros/utils/list_utils/split_list_to_chunks.sql", "unique_id": "macro.elementary.split_list_to_chunks", "macro_sql": "{% macro split_list_to_chunks(item_list, chunk_size=50) %}\n {% set chunks = [] %}\n {% set current_chunk = [] %}\n {% for item in item_list %}\n {% set reminder = loop.index0 % chunk_size %}\n {% if reminder == 0 and current_chunk %}\n {% do chunks.append(current_chunk.copy()) %}\n {% do current_chunk.clear() %}\n {% endif %}\n {% do current_chunk.append(item) %}\n {% endfor %}\n {% if current_chunk %}\n {% do chunks.append(current_chunk) %}\n {% endif %}\n {{ return(chunks) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.6060176, "supported_languages": null}, "macro.elementary.strings_list_to_tuple": {"name": "strings_list_to_tuple", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/list_utils/strings_list_to_tuple.sql", "original_file_path": "macros/utils/list_utils/strings_list_to_tuple.sql", "unique_id": "macro.elementary.strings_list_to_tuple", "macro_sql": "{% macro strings_list_to_tuple(strings) %}\n {%- if strings %}\n ({% for string in strings %} '{{ string }}' {{ \",\" if not loop.last else \"\" }} {% endfor %})\n {%- else %}\n ('')\n {%- endif %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.6066725, "supported_languages": null}, "macro.elementary.lists_intersection": {"name": "lists_intersection", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/list_utils/lists_intersection.sql", "original_file_path": "macros/utils/list_utils/lists_intersection.sql", "unique_id": "macro.elementary.lists_intersection", "macro_sql": "{% macro lists_intersection(list_a, list_b) %}\n {% set new_list = [] %}\n {% for item in list_a %}\n {% if item in list_b %}\n {% do new_list.append(item) %}\n {% endif %}\n {% endfor %}\n {% do return(new_list) %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.6074305, "supported_languages": null}, "macro.elementary.filter_none_and_sort": {"name": "filter_none_and_sort", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/list_utils/filter_none_and_sort.sql", "original_file_path": "macros/utils/list_utils/filter_none_and_sort.sql", "unique_id": "macro.elementary.filter_none_and_sort", "macro_sql": "{% macro filter_none_and_sort(val) %}\n {% do return(val | reject(\"none\") | sort) %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.60779, "supported_languages": null}, "macro.elementary.union_lists": {"name": "union_lists", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/list_utils/union_lists.sql", "original_file_path": "macros/utils/list_utils/union_lists.sql", "unique_id": "macro.elementary.union_lists", "macro_sql": "{% macro union_lists(list1, list2) %}\n {% set union_list = [] %}\n {% do union_list.extend(list1) %}\n {% do union_list.extend(list2) %}\n {{ return(union_list | unique | list) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.6084151, "supported_languages": null}, "macro.elementary.join_list": {"name": "join_list", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/list_utils/join_list.sql", "original_file_path": "macros/utils/list_utils/join_list.sql", "unique_id": "macro.elementary.join_list", "macro_sql": "{% macro join_list(item_list, separator) %}\n {{ return(item_list | join(separator)) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.608743, "supported_languages": null}, "macro.elementary.create_temp_table": {"name": "create_temp_table", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/table_operations/create_temp_table.sql", "original_file_path": "macros/utils/table_operations/create_temp_table.sql", "unique_id": "macro.elementary.create_temp_table", "macro_sql": "{% macro create_temp_table(database_name, schema_name, table_name, sql_query) %}\n {% set temp_table_exists, temp_table_relation = dbt.get_or_create_relation(database=database_name,\n schema=schema_name,\n identifier=table_name,\n type='table') -%}\n {% set temp_table_relation = elementary.edr_make_temp_relation(temp_table_relation) %}\n {% if temp_table_exists %}\n {% do adapter.drop_relation(temp_table_relation) %}\n {% do elementary.run_query(dbt.create_table_as(True, temp_table_relation, sql_query)) %}\n {% else %}\n {% do elementary.run_query(dbt.create_table_as(True, temp_table_relation, sql_query)) %}\n {% endif %}\n {{ return(temp_table_relation) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_or_create_relation", "macro.elementary.edr_make_temp_relation", "macro.elementary.run_query", "macro.dbt.create_table_as"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.6102881, "supported_languages": null}, "macro.elementary.get_timestamped_table_suffix": {"name": "get_timestamped_table_suffix", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/table_operations/get_timestamped_table_suffix.sql", "original_file_path": "macros/utils/table_operations/get_timestamped_table_suffix.sql", "unique_id": "macro.elementary.get_timestamped_table_suffix", "macro_sql": "{% macro get_timestamped_table_suffix() %}\n {% do return(modules.datetime.datetime.utcnow().strftime('__tmp_%Y%m%d%H%M%S%f')) %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.6106806, "supported_languages": null}, "macro.elementary.get_column_in_relation": {"name": "get_column_in_relation", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/table_operations/get_column_in_relation.sql", "original_file_path": "macros/utils/table_operations/get_column_in_relation.sql", "unique_id": "macro.elementary.get_column_in_relation", "macro_sql": "{% macro get_column_in_relation(relation, column_name) %}\n {% set columns = adapter.get_columns_in_relation(relation) %}\n {% for column in columns %}\n {% if column.name == column_name %}\n {% do return(column) %}\n {% endif %}\n {% endfor %}\n {% do return(none) %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.6114707, "supported_languages": null}, "macro.elementary.create_table_like": {"name": "create_table_like", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/table_operations/create_table_like.sql", "original_file_path": "macros/utils/table_operations/create_table_like.sql", "unique_id": "macro.elementary.create_table_like", "macro_sql": "{% macro create_table_like(relation, like_relation, temporary=False, like_columns=none) %}\n {% set empty_table_query %}\n SELECT\n {% if like_columns %}\n {% for column in like_columns %}\n {{ column }}{{ \", \" if not loop.last }}\n {% endfor %}\n {% else %}\n *\n {% endif %}\n FROM {{ like_relation }}\n WHERE 1 = 0\n {% endset %}\n {% do elementary.run_query(dbt.create_table_as(temporary, relation, empty_table_query)) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.run_query", "macro.dbt.create_table_as"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.612593, "supported_languages": null}, "macro.elementary.get_row_count": {"name": "get_row_count", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/table_operations/get_row_count.sql", "original_file_path": "macros/utils/table_operations/get_row_count.sql", "unique_id": "macro.elementary.get_row_count", "macro_sql": "{% macro get_row_count(full_table_name) %}\n\n {% set query_row_count %}\n select count(*) from {{ full_table_name }}\n {% endset %}\n {% if execute %}\n {% set result = elementary.run_query(query_row_count).columns[0].values()[0] %}\n {% endif %}\n {{ return(result) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.6133845, "supported_languages": null}, "macro.elementary.get_relation_max_name_length": {"name": "get_relation_max_name_length", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/table_operations/get_relation_max_length.sql", "original_file_path": "macros/utils/table_operations/get_relation_max_length.sql", "unique_id": "macro.elementary.get_relation_max_name_length", "macro_sql": "{% macro get_relation_max_name_length() %}\n {{ return(adapter.dispatch('get_relation_max_name_length', 'elementary')()) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.postgres__get_relation_max_name_length"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.6141958, "supported_languages": null}, "macro.elementary.default__get_relation_max_name_length": {"name": "default__get_relation_max_name_length", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/table_operations/get_relation_max_length.sql", "original_file_path": "macros/utils/table_operations/get_relation_max_length.sql", "unique_id": "macro.elementary.default__get_relation_max_name_length", "macro_sql": "{% macro default__get_relation_max_name_length(temporary, relation, sql_query) %}\n {{ return(none) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.6145504, "supported_languages": null}, "macro.elementary.snowflake__get_relation_max_name_length": {"name": "snowflake__get_relation_max_name_length", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/table_operations/get_relation_max_length.sql", "original_file_path": "macros/utils/table_operations/get_relation_max_length.sql", "unique_id": "macro.elementary.snowflake__get_relation_max_name_length", "macro_sql": "{% macro snowflake__get_relation_max_name_length(temporary, relation, sql_query) %}\n {{ return(255) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.6148043, "supported_languages": null}, "macro.elementary.redshift__get_relation_max_name_length": {"name": "redshift__get_relation_max_name_length", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/table_operations/get_relation_max_length.sql", "original_file_path": "macros/utils/table_operations/get_relation_max_length.sql", "unique_id": "macro.elementary.redshift__get_relation_max_name_length", "macro_sql": "{% macro redshift__get_relation_max_name_length(temporary, relation, sql_query) %}\n {{ return(127) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.6150582, "supported_languages": null}, "macro.elementary.postgres__get_relation_max_name_length": {"name": "postgres__get_relation_max_name_length", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/table_operations/get_relation_max_length.sql", "original_file_path": "macros/utils/table_operations/get_relation_max_length.sql", "unique_id": "macro.elementary.postgres__get_relation_max_name_length", "macro_sql": "{% macro postgres__get_relation_max_name_length(temporary, relation, sql_query) %}\n {{ return(63) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.6153026, "supported_languages": null}, "macro.elementary.spark__get_relation_max_name_length": {"name": "spark__get_relation_max_name_length", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/table_operations/get_relation_max_length.sql", "original_file_path": "macros/utils/table_operations/get_relation_max_length.sql", "unique_id": "macro.elementary.spark__get_relation_max_name_length", "macro_sql": "{% macro spark__get_relation_max_name_length(temporary, relation, sql_query) %}\n {{ return(127) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.6155474, "supported_languages": null}, "macro.elementary.athena__get_relation_max_name_length": {"name": "athena__get_relation_max_name_length", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/table_operations/get_relation_max_length.sql", "original_file_path": "macros/utils/table_operations/get_relation_max_length.sql", "unique_id": "macro.elementary.athena__get_relation_max_name_length", "macro_sql": "{% macro athena__get_relation_max_name_length(temporary, relation, sql_query) %}\n {{ return(255) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.6157975, "supported_languages": null}, "macro.elementary.table_name_with_suffix": {"name": "table_name_with_suffix", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/table_operations/table_name_with_suffix.sql", "original_file_path": "macros/utils/table_operations/table_name_with_suffix.sql", "unique_id": "macro.elementary.table_name_with_suffix", "macro_sql": "{% macro table_name_with_suffix(table_name, suffix) %}\n {% set relation_max_name_length = elementary.get_relation_max_name_length() %}\n {% if relation_max_name_length %}\n {% set suffix_length = suffix | length %}\n {% set table_name_with_suffix = table_name[:relation_max_name_length - suffix_length] ~ suffix %}\n {% else %}\n {% set table_name_with_suffix = table_name ~ suffix %}\n {% endif %}\n {{ return(table_name_with_suffix) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.get_relation_max_name_length"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.6167748, "supported_languages": null}, "macro.elementary.insert_as_select": {"name": "insert_as_select", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/table_operations/insert_as_select.sql", "original_file_path": "macros/utils/table_operations/insert_as_select.sql", "unique_id": "macro.elementary.insert_as_select", "macro_sql": "{% macro insert_as_select(table_relation, select_query) %}\n {# when calling this macro, you need to add depends on ref comment #}\n {# ref_model and select_query need to have the same columns #}\n\n {%- set insert_query %}\n insert into {{ table_relation }}\n with tmp_table as (\n {{ select_query }}\n )\n select * from tmp_table\n {%- endset %}\n\n {{ return(insert_query) }}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.617377, "supported_languages": null}, "macro.elementary.insert_rows": {"name": "insert_rows", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/table_operations/insert_rows.sql", "original_file_path": "macros/utils/table_operations/insert_rows.sql", "unique_id": "macro.elementary.insert_rows", "macro_sql": "{% macro insert_rows(table_relation, rows, should_commit=false, chunk_size=5000, on_query_exceed=none) %}\n {% if not rows %}\n {{ return(none) }}\n {% endif %}\n\n {% if not table_relation %}\n {% do elementary.warn_missing_elementary_models() %}\n {{ return(none) }}\n {% endif %}\n\n {% set columns = adapter.get_columns_in_relation(table_relation) %}\n {% if not columns %}\n {% set table_name = elementary.relation_to_full_name(table_relation) %}\n {{ elementary.edr_log('Could not extract columns for table - ' ~ table_name ~ ' (might be a permissions issue)') }}\n {{ return(none) }}\n {% endif %}\n\n {{ elementary.file_log('Inserting {} rows to table {}'.format(rows | length, table_relation)) }}\n {% set insert_rows_method = elementary.get_config_var('insert_rows_method') %}\n {% if insert_rows_method == 'max_query_size' %}\n {% set insert_rows_queries = elementary.get_insert_rows_queries(table_relation, columns, rows, on_query_exceed=on_query_exceed) %}\n {% set queries_len = insert_rows_queries | length %}\n {% for insert_query in insert_rows_queries %}\n {% do elementary.file_log(\"[{}/{}] Running insert query.\".format(loop.index, queries_len)) %}\n {% do elementary.run_query(insert_query) %}\n {% endfor %}\n {% elif insert_rows_method == 'chunk' %}\n {% set rows_chunks = elementary.split_list_to_chunks(rows, chunk_size) %}\n {% for rows_chunk in rows_chunks %}\n {% set insert_rows_query = elementary.get_chunk_insert_query(table_relation, columns, rows_chunk) %}\n {% do elementary.run_query(insert_rows_query) %}\n {% endfor %}\n {% else %}\n {% do exceptions.raise_compiler_error(\"Specified invalid value for 'insert_rows_method' var.\") %}\n {% endif %}\n\n {% if should_commit %}\n {% do adapter.commit() %}\n {% endif %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.warn_missing_elementary_models", "macro.elementary.relation_to_full_name", "macro.elementary.edr_log", "macro.elementary.file_log", "macro.elementary.get_config_var", "macro.elementary.get_insert_rows_queries", "macro.elementary.run_query", "macro.elementary.split_list_to_chunks", "macro.elementary.get_chunk_insert_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.630477, "supported_languages": null}, "macro.elementary.get_insert_rows_queries": {"name": "get_insert_rows_queries", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/table_operations/insert_rows.sql", "original_file_path": "macros/utils/table_operations/insert_rows.sql", "unique_id": "macro.elementary.get_insert_rows_queries", "macro_sql": "{% macro get_insert_rows_queries(table_relation, columns, rows, query_max_size=none, on_query_exceed=none) -%}\n {% if not query_max_size %}\n {% set query_max_size = elementary.get_config_var('query_max_size') %}\n {% endif %}\n\n {% set insert_queries = [] %}\n {% set base_insert_query %}\n insert into {{ table_relation }}\n ({%- for column in columns -%}\n {{- column.name -}} {{- \",\" if not loop.last else \"\" -}}\n {%- endfor -%}) values\n {% endset %}\n\n {% set current_query = namespace(data=base_insert_query) %}\n {% for row in rows %}\n {% set row_sql = elementary.render_row_to_sql(row, columns) %}\n {% set query_with_row = current_query.data + (\",\" if not loop.first else \"\") + row_sql %}\n\n {% if query_with_row | length > query_max_size %}\n {% set new_insert_query = base_insert_query + row_sql %}\n\n {# Check if row is too large to fit into an insert query. #}\n {% if new_insert_query | length > query_max_size %}\n {% if on_query_exceed %}\n {% do on_query_exceed(row) %}\n {% set row_sql = elementary.render_row_to_sql(row, columns) %}\n {% set new_insert_query = base_insert_query + row_sql %}\n {% endif %}\n\n {% if new_insert_query | length > query_max_size %}\n {% do elementary.file_log(\"Oversized row for insert_rows: {}\".format(query_with_row)) %}\n {% do exceptions.warn(\"Row to be inserted exceeds var('query_max_size'). Consider increasing its value.\") %}\n {% endif %}\n {% endif %}\n\n {% if current_query.data != base_insert_query %}\n {% do insert_queries.append(current_query.data) %}\n {% endif %}\n {% set current_query.data = new_insert_query %}\n\n {% else %}\n {% set current_query.data = query_with_row %}\n {% endif %}\n {% if loop.last %}\n {% do insert_queries.append(current_query.data) %}\n {% endif %}\n {% endfor %}\n\n {{ return(insert_queries) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.elementary.get_config_var", "macro.elementary.render_row_to_sql", "macro.elementary.file_log"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.633986, "supported_languages": null}, "macro.elementary.render_row_to_sql": {"name": "render_row_to_sql", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/table_operations/insert_rows.sql", "original_file_path": "macros/utils/table_operations/insert_rows.sql", "unique_id": "macro.elementary.render_row_to_sql", "macro_sql": "{% macro render_row_to_sql(row, columns) %}\n {% set rendered_column_values = [] %}\n {% for column in columns %}\n {% if column.name.lower() == \"created_at\" %}\n {% set column_value = elementary.edr_current_timestamp() %}\n {% do rendered_column_values.append(column_value) %}\n {% else %}\n {% set column_value = elementary.insensitive_get_dict_value(row, column.name) %}\n {% set normalized_data_type = elementary.normalize_data_type(column.dtype) %}\n {% do rendered_column_values.append(elementary.render_value(column_value, normalized_data_type)) %}\n\n {% endif %}\n {% endfor %}\n {% set row_sql = \"({})\".format(rendered_column_values | join(\",\")) %}\n {% do return(row_sql) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.edr_current_timestamp", "macro.elementary.insensitive_get_dict_value", "macro.elementary.normalize_data_type", "macro.elementary.render_value"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.635409, "supported_languages": null}, "macro.elementary.get_chunk_insert_query": {"name": "get_chunk_insert_query", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/table_operations/insert_rows.sql", "original_file_path": "macros/utils/table_operations/insert_rows.sql", "unique_id": "macro.elementary.get_chunk_insert_query", "macro_sql": "{% macro get_chunk_insert_query(table_relation, columns, rows) -%}\n {% set insert_rows_query %}\n insert into {{ table_relation }}\n ({%- for column in columns -%}\n {{- column.name -}} {{- \",\" if not loop.last else \"\" -}}\n {%- endfor -%}) values\n {% for row in rows -%}\n ({%- for column in columns -%}\n {%- set column_value = elementary.insensitive_get_dict_value(row, column.name, none) -%}\n {{ elementary.render_value(column_value) }}\n {{- \",\" if not loop.last else \"\" -}}\n {%- endfor -%}) {{- \",\" if not loop.last else \"\" -}}\n {%- endfor -%}\n {% endset %}\n {{ return(insert_rows_query) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.elementary.insensitive_get_dict_value", "macro.elementary.render_value"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.636637, "supported_languages": null}, "macro.elementary.escape_special_chars": {"name": "escape_special_chars", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/table_operations/insert_rows.sql", "original_file_path": "macros/utils/table_operations/insert_rows.sql", "unique_id": "macro.elementary.escape_special_chars", "macro_sql": "{% macro escape_special_chars(string_value) %}\n {{ return(adapter.dispatch('escape_special_chars', 'elementary')(string_value)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.postgres__escape_special_chars"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.637002, "supported_languages": null}, "macro.elementary.default__escape_special_chars": {"name": "default__escape_special_chars", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/table_operations/insert_rows.sql", "original_file_path": "macros/utils/table_operations/insert_rows.sql", "unique_id": "macro.elementary.default__escape_special_chars", "macro_sql": "\n\n{%- macro default__escape_special_chars(string_value) -%}\n {{- return(string_value | replace(\"\\\\\", \"\\\\\\\\\") | replace(\"'\", \"\\\\'\") | replace(\"\\n\", \"\\\\n\") | replace(\"\\r\", \"\\\\r\")) -}}\n{%- endmacro -%}\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.63748, "supported_languages": null}, "macro.elementary.redshift__escape_special_chars": {"name": "redshift__escape_special_chars", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/table_operations/insert_rows.sql", "original_file_path": "macros/utils/table_operations/insert_rows.sql", "unique_id": "macro.elementary.redshift__escape_special_chars", "macro_sql": "{%- macro redshift__escape_special_chars(string_value) -%}\n {{- return(string_value | replace(\"\\\\\", \"\\\\\\\\\") | replace(\"'\", \"\\\\'\") | replace(\"\\n\", \"\\\\n\") | replace(\"\\r\", \"\\\\r\")) -}}\n{%- endmacro -%}\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.6379573, "supported_languages": null}, "macro.elementary.postgres__escape_special_chars": {"name": "postgres__escape_special_chars", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/table_operations/insert_rows.sql", "original_file_path": "macros/utils/table_operations/insert_rows.sql", "unique_id": "macro.elementary.postgres__escape_special_chars", "macro_sql": "{%- macro postgres__escape_special_chars(string_value) -%}\n {{- return(string_value | replace(\"'\", \"''\")) -}}\n{%- endmacro -%}\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.638242, "supported_languages": null}, "macro.elementary.athena__escape_special_chars": {"name": "athena__escape_special_chars", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/table_operations/insert_rows.sql", "original_file_path": "macros/utils/table_operations/insert_rows.sql", "unique_id": "macro.elementary.athena__escape_special_chars", "macro_sql": "{%- macro athena__escape_special_chars(string_value) -%}\n {{- return(string_value | replace(\"'\", \"''\")) -}}\n{%- endmacro -%}\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.6385276, "supported_languages": null}, "macro.elementary.render_value": {"name": "render_value", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/table_operations/insert_rows.sql", "original_file_path": "macros/utils/table_operations/insert_rows.sql", "unique_id": "macro.elementary.render_value", "macro_sql": "{%- macro render_value(value, data_type) -%}\n {%- if value is defined and value is not none -%}\n {%- if value is number -%}\n {{- value -}}\n {%- elif value is string and data_type == 'timestamp' -%}\n {{- elementary.edr_cast_as_timestamp(elementary.edr_quote(value)) -}}\n {%- elif value is string -%}\n '{{- elementary.escape_special_chars(value) -}}'\n {%- elif value is mapping or value is sequence -%}\n '{{- elementary.escape_special_chars(tojson(value)) -}}'\n {%- else -%}\n NULL\n {%- endif -%}\n {%- else -%}\n NULL\n {%- endif -%}\n{%- endmacro -%}", "depends_on": {"macros": ["macro.elementary.edr_cast_as_timestamp", "macro.elementary.edr_quote", "macro.elementary.escape_special_chars"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.6395984, "supported_languages": null}, "macro.elementary.create_or_replace": {"name": "create_or_replace", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/table_operations/create_or_replace.sql", "original_file_path": "macros/utils/table_operations/create_or_replace.sql", "unique_id": "macro.elementary.create_or_replace", "macro_sql": "{% macro create_or_replace(temporary, relation, sql_query) %}\n {{ return(adapter.dispatch('create_or_replace', 'elementary')(temporary, relation, sql_query)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.postgres__create_or_replace"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.6407597, "supported_languages": null}, "macro.elementary.default__create_or_replace": {"name": "default__create_or_replace", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/table_operations/create_or_replace.sql", "original_file_path": "macros/utils/table_operations/create_or_replace.sql", "unique_id": "macro.elementary.default__create_or_replace", "macro_sql": "{% macro default__create_or_replace(temporary, relation, sql_query) %}\n {% do elementary.run_query(dbt.create_table_as(temporary, relation, sql_query)) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.run_query", "macro.dbt.create_table_as"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.6411521, "supported_languages": null}, "macro.elementary.redshift__create_or_replace": {"name": "redshift__create_or_replace", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/table_operations/create_or_replace.sql", "original_file_path": "macros/utils/table_operations/create_or_replace.sql", "unique_id": "macro.elementary.redshift__create_or_replace", "macro_sql": "{% macro redshift__create_or_replace(temporary, relation, sql_query) %}\n {% do dbt.drop_relation_if_exists(relation) %}\n {% do elementary.run_query(dbt.create_table_as(temporary, relation, sql_query)) %}\n {% do adapter.commit() %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.drop_relation_if_exists", "macro.elementary.run_query", "macro.dbt.create_table_as"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.6416795, "supported_languages": null}, "macro.elementary.postgres__create_or_replace": {"name": "postgres__create_or_replace", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/table_operations/create_or_replace.sql", "original_file_path": "macros/utils/table_operations/create_or_replace.sql", "unique_id": "macro.elementary.postgres__create_or_replace", "macro_sql": "{% macro postgres__create_or_replace(temporary, relation, sql_query) %}\n {% do elementary.run_query(\"BEGIN\") %}\n {% do dbt.drop_relation_if_exists(relation) %}\n {% do elementary.run_query(dbt.create_table_as(temporary, relation, sql_query)) %}\n {% do elementary.run_query(\"COMMIT\") %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.run_query", "macro.dbt.drop_relation_if_exists", "macro.dbt.create_table_as"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.6423259, "supported_languages": null}, "macro.elementary.spark__create_or_replace": {"name": "spark__create_or_replace", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/table_operations/create_or_replace.sql", "original_file_path": "macros/utils/table_operations/create_or_replace.sql", "unique_id": "macro.elementary.spark__create_or_replace", "macro_sql": "{% macro spark__create_or_replace(temporary, relation, sql_query) %}\n {% do dbt.drop_relation_if_exists(relation) %}\n {% do elementary.run_query(dbt.create_table_as(temporary, relation, sql_query)) %}\n {% do adapter.commit() %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.drop_relation_if_exists", "macro.elementary.run_query", "macro.dbt.create_table_as"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.642851, "supported_languages": null}, "macro.elementary.athena__create_or_replace": {"name": "athena__create_or_replace", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/table_operations/create_or_replace.sql", "original_file_path": "macros/utils/table_operations/create_or_replace.sql", "unique_id": "macro.elementary.athena__create_or_replace", "macro_sql": "{% macro athena__create_or_replace(temporary, relation, sql_query) %}\n {% do dbt.drop_relation_if_exists(relation) %}\n {% do elementary.run_query(dbt.create_table_as(temporary, relation, sql_query)) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.drop_relation_if_exists", "macro.elementary.run_query", "macro.dbt.create_table_as"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.6433058, "supported_languages": null}, "macro.elementary.create_intermediate_relation": {"name": "create_intermediate_relation", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/table_operations/create_intermediate_relation.sql", "original_file_path": "macros/utils/table_operations/create_intermediate_relation.sql", "unique_id": "macro.elementary.create_intermediate_relation", "macro_sql": "{% macro create_intermediate_relation(base_relation, rows, temporary, like_columns=none) %}\n {% set int_relation = elementary.make_temp_table_relation(base_relation).incorporate(type='table') %}\n\n {% if not elementary.has_temp_table_support() %}\n {% set temporary = false %}\n {% endif %}\n\n {% do elementary.create_table_like(int_relation, base_relation, temporary, like_columns) %}\n {% do elementary.insert_rows(int_relation, rows, should_commit=false, chunk_size=elementary.get_config_var('dbt_artifacts_chunk_size')) %}\n {% do return(int_relation) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.make_temp_table_relation", "macro.elementary.has_temp_table_support", "macro.elementary.create_table_like", "macro.elementary.insert_rows", "macro.elementary.get_config_var"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.6445677, "supported_languages": null}, "macro.elementary.edr_make_temp_relation": {"name": "edr_make_temp_relation", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/table_operations/make_temp_relation.sql", "original_file_path": "macros/utils/table_operations/make_temp_relation.sql", "unique_id": "macro.elementary.edr_make_temp_relation", "macro_sql": "{% macro edr_make_temp_relation(base_relation, suffix=none) %}\n {% do return(adapter.dispatch(\"edr_make_temp_relation\", \"elementary\")(base_relation, suffix)) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.default__edr_make_temp_relation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.6464932, "supported_languages": null}, "macro.elementary.default__edr_make_temp_relation": {"name": "default__edr_make_temp_relation", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/table_operations/make_temp_relation.sql", "original_file_path": "macros/utils/table_operations/make_temp_relation.sql", "unique_id": "macro.elementary.default__edr_make_temp_relation", "macro_sql": "{% macro default__edr_make_temp_relation(base_relation, suffix) %}\n {% do return(dbt.make_temp_relation(base_relation, suffix)) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.make_temp_relation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.6468165, "supported_languages": null}, "macro.elementary.spark__edr_make_temp_relation": {"name": "spark__edr_make_temp_relation", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/table_operations/make_temp_relation.sql", "original_file_path": "macros/utils/table_operations/make_temp_relation.sql", "unique_id": "macro.elementary.spark__edr_make_temp_relation", "macro_sql": "{% macro spark__edr_make_temp_relation(base_relation, suffix) %}\n {% set tmp_identifier = elementary.table_name_with_suffix(base_relation.identifier, suffix) %}\n {% set tmp_relation = base_relation.incorporate(path = {\n \"schema\": none,\n \"identifier\": tmp_identifier\n }) -%}\n\n {% do return(tmp_relation) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.table_name_with_suffix"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.6474426, "supported_languages": null}, "macro.elementary.databricks__edr_make_temp_relation": {"name": "databricks__edr_make_temp_relation", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/table_operations/make_temp_relation.sql", "original_file_path": "macros/utils/table_operations/make_temp_relation.sql", "unique_id": "macro.elementary.databricks__edr_make_temp_relation", "macro_sql": "{% macro databricks__edr_make_temp_relation(base_relation, suffix) %}\n {% do return(dbt.make_temp_relation(base_relation, suffix)) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.make_temp_relation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.6477618, "supported_languages": null}, "macro.elementary.make_temp_view_relation": {"name": "make_temp_view_relation", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/table_operations/make_temp_relation.sql", "original_file_path": "macros/utils/table_operations/make_temp_relation.sql", "unique_id": "macro.elementary.make_temp_view_relation", "macro_sql": "{% macro make_temp_view_relation(base_relation, suffix=none) %}\n {% if not suffix %}\n {% set suffix = elementary.get_timestamped_table_suffix() %}\n {% endif %}\n\n {% do return(elementary.edr_make_temp_relation(base_relation, suffix)) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.get_timestamped_table_suffix", "macro.elementary.edr_make_temp_relation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.6482873, "supported_languages": null}, "macro.elementary.make_temp_table_relation": {"name": "make_temp_table_relation", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/table_operations/make_temp_relation.sql", "original_file_path": "macros/utils/table_operations/make_temp_relation.sql", "unique_id": "macro.elementary.make_temp_table_relation", "macro_sql": "{% macro make_temp_table_relation(base_relation, suffix=none) %}\n {% if not suffix %}\n {% set suffix = elementary.get_timestamped_table_suffix() %}\n {% endif %}\n\n {% do return(adapter.dispatch(\"make_temp_table_relation\", \"elementary\")(base_relation, suffix)) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.get_timestamped_table_suffix", "macro.elementary.default__make_temp_table_relation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.6490357, "supported_languages": null}, "macro.elementary.default__make_temp_table_relation": {"name": "default__make_temp_table_relation", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/table_operations/make_temp_relation.sql", "original_file_path": "macros/utils/table_operations/make_temp_relation.sql", "unique_id": "macro.elementary.default__make_temp_table_relation", "macro_sql": "{% macro default__make_temp_table_relation(base_relation, suffix) %}\n {% do return(elementary.edr_make_temp_relation(base_relation, suffix)) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.edr_make_temp_relation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.6493604, "supported_languages": null}, "macro.elementary.databricks__make_temp_table_relation": {"name": "databricks__make_temp_table_relation", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/table_operations/make_temp_relation.sql", "original_file_path": "macros/utils/table_operations/make_temp_relation.sql", "unique_id": "macro.elementary.databricks__make_temp_table_relation", "macro_sql": "{% macro databricks__make_temp_table_relation(base_relation, suffix) %}\n {% set tmp_identifier = elementary.table_name_with_suffix(base_relation.identifier, suffix) %}\n {% set tmp_relation = api.Relation.create(\n identifier=tmp_identifier,\n schema=base_relation.schema,\n database=base_relation.database,\n type='table') %}\n {% do return(tmp_relation) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.table_name_with_suffix"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.6500268, "supported_languages": null}, "macro.elementary.has_temp_table_support": {"name": "has_temp_table_support", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/table_operations/has_temp_table_support.sql", "original_file_path": "macros/utils/table_operations/has_temp_table_support.sql", "unique_id": "macro.elementary.has_temp_table_support", "macro_sql": "{% macro has_temp_table_support() %}\n {% do return(adapter.dispatch(\"has_temp_table_support\", \"elementary\")()) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.default__has_temp_table_support"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.6505034, "supported_languages": null}, "macro.elementary.default__has_temp_table_support": {"name": "default__has_temp_table_support", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/table_operations/has_temp_table_support.sql", "original_file_path": "macros/utils/table_operations/has_temp_table_support.sql", "unique_id": "macro.elementary.default__has_temp_table_support", "macro_sql": "{% macro default__has_temp_table_support() %}\n {% do return(true) %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.6507318, "supported_languages": null}, "macro.elementary.spark__has_temp_table_support": {"name": "spark__has_temp_table_support", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/table_operations/has_temp_table_support.sql", "original_file_path": "macros/utils/table_operations/has_temp_table_support.sql", "unique_id": "macro.elementary.spark__has_temp_table_support", "macro_sql": "{% macro spark__has_temp_table_support() %}\n {% do return(false) %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.6509495, "supported_languages": null}, "macro.elementary.delete_and_insert": {"name": "delete_and_insert", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/table_operations/delete_and_insert.sql", "original_file_path": "macros/utils/table_operations/delete_and_insert.sql", "unique_id": "macro.elementary.delete_and_insert", "macro_sql": "{% macro delete_and_insert(relation, insert_rows=none, delete_values=none, delete_column_key=none) %}\n {% do elementary.file_log(\"Deleting from and inserting to: {}\".format(relation)) %}\n {% set delete_rows = [] %}\n {% for delete_val in delete_values %}\n {% do delete_rows.append({delete_column_key: delete_val}) %}\n {% endfor %}\n\n {% if delete_values %}\n {% set delete_relation = elementary.create_intermediate_relation(relation, delete_rows, temporary=True, like_columns=[delete_column_key]) %}\n {% endif %}\n\n {% if insert_rows %}\n {% set insert_relation = elementary.create_intermediate_relation(relation, insert_rows, temporary=True) %}\n {% endif %}\n\n {% if not insert_relation and not delete_relation %}\n {% do return(none) %}\n {% endif %}\n\n {% set queries = elementary.get_delete_and_insert_queries(relation, insert_relation, delete_relation, delete_column_key) %}\n {% for query in queries %}\n {% do elementary.run_query(query) %}\n {% endfor %}\n\n {# Make sure we delete the temp tables we created #}\n {% if delete_relation %}\n {% do adapter.drop_relation(delete_relation) %}\n {% endif %}\n {% if insert_relation %}\n {% do adapter.drop_relation(insert_relation) %}\n {% endif %}\n\n {% do elementary.file_log(\"Finished deleting from and inserting to: {}\".format(relation)) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.file_log", "macro.elementary.create_intermediate_relation", "macro.elementary.get_delete_and_insert_queries", "macro.elementary.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.657496, "supported_languages": null}, "macro.elementary.get_delete_and_insert_queries": {"name": "get_delete_and_insert_queries", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/table_operations/delete_and_insert.sql", "original_file_path": "macros/utils/table_operations/delete_and_insert.sql", "unique_id": "macro.elementary.get_delete_and_insert_queries", "macro_sql": "{% macro get_delete_and_insert_queries(relation, insert_relation, delete_relation, delete_column_key) %}\n {% do return(adapter.dispatch(\"get_delete_and_insert_queries\", \"elementary\")(relation, insert_relation, delete_relation, delete_column_key)) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.default__get_delete_and_insert_queries"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.6579654, "supported_languages": null}, "macro.elementary.default__get_delete_and_insert_queries": {"name": "default__get_delete_and_insert_queries", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/table_operations/delete_and_insert.sql", "original_file_path": "macros/utils/table_operations/delete_and_insert.sql", "unique_id": "macro.elementary.default__get_delete_and_insert_queries", "macro_sql": "{% macro default__get_delete_and_insert_queries(relation, insert_relation, delete_relation, delete_column_key) %}\n {% set query %}\n begin transaction;\n {% if delete_relation %}\n delete from {{ relation }}\n where\n {{ delete_column_key }} is null\n or {{ delete_column_key }} in (select {{ delete_column_key }} from {{ delete_relation }});\n {% endif %}\n {% if insert_relation %}\n insert into {{ relation }} select * from {{ insert_relation }};\n {% endif %}\n commit;\n {% endset %}\n {% do return([query]) %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.658739, "supported_languages": null}, "macro.elementary.spark__get_delete_and_insert_queries": {"name": "spark__get_delete_and_insert_queries", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/table_operations/delete_and_insert.sql", "original_file_path": "macros/utils/table_operations/delete_and_insert.sql", "unique_id": "macro.elementary.spark__get_delete_and_insert_queries", "macro_sql": "{% macro spark__get_delete_and_insert_queries(relation, insert_relation, delete_relation, delete_column_key) %}\n {% set queries = [] %}\n\n {# Calling `is_delta` raises an error if `metadata` is None - https://github.com/databricks/dbt-databricks/blob/33dca4b66b05f268741030b33659d34ff69591c1/dbt/adapters/databricks/relation.py#L71 #}\n {% if delete_relation and relation.metadata and relation.is_delta %}\n {% set delete_query %}\n merge into {{ relation }} as source\n using {{ delete_relation }} as target\n on (source.{{ delete_column_key }} = target.{{ delete_column_key }}) or source.{{ delete_column_key }} is null\n when matched then delete;\n {% endset %}\n {% do queries.append(delete_query) %}\n\n {% elif delete_relation %}\n {% set delete_query %}\n delete from {{ relation }}\n where\n {{ delete_column_key }} is null\n or {{ delete_column_key }} in (select {{ delete_column_key }} from {{ delete_relation }});\n {% endset %}\n {% do queries.append(delete_query) %}\n {% endif %}\n\n {% if insert_relation %}\n {% set insert_query %}\n insert into {{ relation }} select * from {{ insert_relation }};\n {% endset %}\n {% do queries.append(insert_query) %}\n {% endif %}\n\n {% do return(queries) %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.660316, "supported_languages": null}, "macro.elementary.athena__get_delete_and_insert_queries": {"name": "athena__get_delete_and_insert_queries", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/table_operations/delete_and_insert.sql", "original_file_path": "macros/utils/table_operations/delete_and_insert.sql", "unique_id": "macro.elementary.athena__get_delete_and_insert_queries", "macro_sql": "{% macro athena__get_delete_and_insert_queries(relation, insert_relation, delete_relation, delete_column_key) %}\n {% set queries = [] %}\n\n {% if delete_relation %}\n {% set delete_query %}\n delete from {{ relation }}\n where\n {{ delete_column_key }} is null\n or {{ delete_column_key }} in (select {{ delete_column_key }} from {{ delete_relation }});\n {% endset %}\n {% do queries.append(delete_query) %}\n {% endif %}\n\n {% if insert_relation %}\n {% set insert_query %}\n insert into {{ relation }} select * from {{ insert_relation }};\n {% endset %}\n {% do queries.append(insert_query) %}\n {% endif %}\n\n {% do return(queries) %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.6614432, "supported_languages": null}, "macro.elementary.get_columns_and_types": {"name": "get_columns_and_types", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/table_operations/get_columns_and_types.sql", "original_file_path": "macros/utils/table_operations/get_columns_and_types.sql", "unique_id": "macro.elementary.get_columns_and_types", "macro_sql": "{% macro get_columns_and_types(table_name, schema_name = none, database_name = none) %}\n\n {# dbt models can be found with identifier only #}\n {# for non-dbt tables database_name and schema_name are required #}\n\n {%- if not database_name %}\n {%- set database_name = elementary.target_database() %}\n {%- endif %}\n {%- if not schema_name %}\n {%- set schema_name = target.schema %}\n {%- endif %}\n\n {%- set columns = [] %}\n\n {%- set relation = adapter.get_relation(\n database=database_name,\n schema=schema_name,\n identifier=table_name) -%}\n\n {%- set columns_from_relation = adapter.get_columns_in_relation(relation) -%}\n\n {% for column in columns_from_relation %}\n {%- set column_item = {'column_name': column['column'], 'data_type': elementary.normalize_data_type(elementary.get_column_data_type(column))} %}\n {%- do columns.append(column_item) -%}\n {% endfor %}\n\n {{ return(columns) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.target_database", "macro.elementary.normalize_data_type", "macro.elementary.get_column_data_type"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.6633775, "supported_languages": null}, "macro.elementary.replace_table_data": {"name": "replace_table_data", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/table_operations/replace_table_data.sql", "original_file_path": "macros/utils/table_operations/replace_table_data.sql", "unique_id": "macro.elementary.replace_table_data", "macro_sql": "{% macro replace_table_data(relation, rows) %}\n {{ return(adapter.dispatch('replace_table_data', 'elementary')(relation, rows)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.postgres__replace_table_data"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.6645281, "supported_languages": null}, "macro.elementary.default__replace_table_data": {"name": "default__replace_table_data", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/table_operations/replace_table_data.sql", "original_file_path": "macros/utils/table_operations/replace_table_data.sql", "unique_id": "macro.elementary.default__replace_table_data", "macro_sql": "{% macro default__replace_table_data(relation, rows) %}\n {% set intermediate_relation = elementary.create_intermediate_relation(relation, rows, temporary=True) %}\n {% do elementary.run_query(dbt.create_table_as(False, relation, 'select * from {}'.format(intermediate_relation))) %}\n {% do adapter.drop_relation(intermediate_relation) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.create_intermediate_relation", "macro.elementary.run_query", "macro.dbt.create_table_as"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.6652348, "supported_languages": null}, "macro.elementary.databricks__replace_table_data": {"name": "databricks__replace_table_data", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/table_operations/replace_table_data.sql", "original_file_path": "macros/utils/table_operations/replace_table_data.sql", "unique_id": "macro.elementary.databricks__replace_table_data", "macro_sql": "{% macro databricks__replace_table_data(relation, rows) %}\n {% do dbt.truncate_relation(relation) %}\n {% do elementary.insert_rows(relation, rows, should_commit=false, chunk_size=elementary.get_config_var('dbt_artifacts_chunk_size')) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.truncate_relation", "macro.elementary.insert_rows", "macro.elementary.get_config_var"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.6657584, "supported_languages": null}, "macro.elementary.spark__replace_table_data": {"name": "spark__replace_table_data", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/table_operations/replace_table_data.sql", "original_file_path": "macros/utils/table_operations/replace_table_data.sql", "unique_id": "macro.elementary.spark__replace_table_data", "macro_sql": "{% macro spark__replace_table_data(relation, rows) %}\n {% call statement('truncate_relation') -%}\n delete from {{ relation }} where 1=1\n {%- endcall %}\n {% do elementary.insert_rows(relation, rows, should_commit=false, chunk_size=elementary.get_config_var('dbt_artifacts_chunk_size')) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement", "macro.elementary.insert_rows", "macro.elementary.get_config_var"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.666322, "supported_languages": null}, "macro.elementary.postgres__replace_table_data": {"name": "postgres__replace_table_data", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/table_operations/replace_table_data.sql", "original_file_path": "macros/utils/table_operations/replace_table_data.sql", "unique_id": "macro.elementary.postgres__replace_table_data", "macro_sql": "{% macro postgres__replace_table_data(relation, rows) %}\n {% set intermediate_relation = elementary.create_intermediate_relation(relation, rows, temporary=True) %}\n\n {% set query %}\n begin transaction;\n delete from {{ relation }}; -- truncate supported in Redshift transactions, but causes an immediate commit\n insert into {{ relation }} select * from {{ intermediate_relation }};\n commit;\n {% endset %}\n {% do elementary.run_query(query) %}\n\n {% do adapter.drop_relation(intermediate_relation) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.create_intermediate_relation", "macro.elementary.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.6670413, "supported_languages": null}, "macro.elementary.athena__replace_table_data": {"name": "athena__replace_table_data", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/table_operations/replace_table_data.sql", "original_file_path": "macros/utils/table_operations/replace_table_data.sql", "unique_id": "macro.elementary.athena__replace_table_data", "macro_sql": "{% macro athena__replace_table_data(relation, rows) %}\n {% call statement('truncate_relation') -%}\n delete from {{ relation }}\n {%- endcall %}\n {% do elementary.insert_rows(relation, rows, should_commit=false, chunk_size=elementary.get_config_var('dbt_artifacts_chunk_size')) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement", "macro.elementary.insert_rows", "macro.elementary.get_config_var"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.6675897, "supported_languages": null}, "macro.elementary.delete_if_incremental": {"name": "delete_if_incremental", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/table_operations/delete_if_incremental.sql", "original_file_path": "macros/utils/table_operations/delete_if_incremental.sql", "unique_id": "macro.elementary.delete_if_incremental", "macro_sql": "{% macro delete_if_incremental(where_clause) %}\n\n {% set query%}\n delete from {{ this }}\n where {{ where_clause }}\n {% endset %}\n\n {% if is_incremental() %}\n {% do elementary.run_query(query) %}\n {% endif %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_unit_testing.is_incremental", "macro.elementary.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.6682386, "supported_languages": null}, "macro.elementary.relation_exists": {"name": "relation_exists", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/table_operations/relation_exists.sql", "original_file_path": "macros/utils/table_operations/relation_exists.sql", "unique_id": "macro.elementary.relation_exists", "macro_sql": "{% macro relation_exists(relation) %}\n {%- set loaded_relation = load_relation(relation) -%}\n {% if loaded_relation is not none %}\n {{ return(True) }}\n {% endif %}\n {{ return(False) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.load_relation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.6688297, "supported_languages": null}, "macro.elementary.merge_sql": {"name": "merge_sql", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/table_operations/merge_sql.sql", "original_file_path": "macros/utils/table_operations/merge_sql.sql", "unique_id": "macro.elementary.merge_sql", "macro_sql": "{% macro merge_sql(target_relation, tmp_relation, unique_key, dest_columns, incremental_predicates=none) -%}\n {{ return(adapter.dispatch('merge_sql', 'elementary')(target_relation, tmp_relation, unique_key, dest_columns, incremental_predicates)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.elementary.postgres__merge_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.6707385, "supported_languages": null}, "macro.elementary.default__merge_sql": {"name": "default__merge_sql", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/table_operations/merge_sql.sql", "original_file_path": "macros/utils/table_operations/merge_sql.sql", "unique_id": "macro.elementary.default__merge_sql", "macro_sql": "{% macro default__merge_sql(target_relation, tmp_relation, unique_key, dest_columns, incremental_predicates) %}\n {% set macro = dbt.get_merge_sql %}\n {% if \"incremental_predicates\" in macro.get_macro().arguments %}\n {% do return(macro(target_relation, tmp_relation, unique_key, dest_columns, incremental_predicates)) %}\n {% endif %}\n {% do return(macro(target_relation, tmp_relation, unique_key, dest_columns)) %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.6716568, "supported_languages": null}, "macro.elementary.postgres__merge_sql": {"name": "postgres__merge_sql", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/table_operations/merge_sql.sql", "original_file_path": "macros/utils/table_operations/merge_sql.sql", "unique_id": "macro.elementary.postgres__merge_sql", "macro_sql": "{% macro postgres__merge_sql(target_relation, tmp_relation, unique_key, dest_columns, incremental_predicates) %}\n {% set macro = dbt.get_delete_insert_merge_sql %}\n {% if \"incremental_predicates\" in macro.get_macro().arguments %}\n {% do return(macro(target_relation, tmp_relation, unique_key, dest_columns, incremental_predicates)) %}\n {% endif %}\n {% do return(macro(target_relation, tmp_relation, unique_key, dest_columns)) %}\n {{ return(merge_sql) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.672531, "supported_languages": null}, "macro.elementary.athena__merge_sql": {"name": "athena__merge_sql", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/table_operations/merge_sql.sql", "original_file_path": "macros/utils/table_operations/merge_sql.sql", "unique_id": "macro.elementary.athena__merge_sql", "macro_sql": "{% macro athena__merge_sql(target_relation, tmp_relation, unique_key, dest_columns, incremental_predicates) %}\n\n {% set query %}\n merge into {{ target_relation }} as target using {{ tmp_relation }} as src\n ON (target.{{unique_key}} = src.{{ unique_key}})\n when matched\n then update set\n {%- for col in dest_columns %}\n {{ col.column }} = src.{{ col.column }} {{ \", \" if not loop.last }}\n {%- endfor %}\n when not matched\n then insert (\n {%- for col in dest_columns %}\n {{ col.column }} {{ \", \" if not loop.last }}\n {%- endfor %}\n\n )\n values (\n {%- for col in dest_columns %}\n src.{{ col.column }} {{ \", \" if not loop.last }}\n {%- endfor %}\n )\n {% endset %}\n {% do return(query) %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.6738088, "supported_languages": null}, "macro.elementary.remove_rows": {"name": "remove_rows", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/table_operations/remove_rows.sql", "original_file_path": "macros/utils/table_operations/remove_rows.sql", "unique_id": "macro.elementary.remove_rows", "macro_sql": "{% macro remove_rows(table_name) %}\n\n {% set remove_rows_query %}\n delete from {{ table_name }}\n {% endset %}\n {% do elementary.run_query(remove_rows_query) %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.6742837, "supported_languages": null}, "macro.elementary.get_result_node": {"name": "get_result_node", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/graph/get_result_node.sql", "original_file_path": "macros/utils/graph/get_result_node.sql", "unique_id": "macro.elementary.get_result_node", "macro_sql": "{% macro get_result_node(identifier, package_name='elementary') %}\n {% for result in results %}\n {% if result.node.identifier == identifier %}\n {% if package_name %}\n {% if result.node.package_name == package_name %}\n {{ return(result.node) }}\n {% endif %}\n {% else %}\n {{ return(result.node) }}\n {% endif %}\n {% endif %}\n {% endfor %}\n {{ return(none) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.6754205, "supported_languages": null}, "macro.elementary.get_elementary_relation": {"name": "get_elementary_relation", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/graph/get_elementary_relation.sql", "original_file_path": "macros/utils/graph/get_elementary_relation.sql", "unique_id": "macro.elementary.get_elementary_relation", "macro_sql": "{% macro get_elementary_relation(identifier) %}\n {%- if execute %}\n {%- set identifier_node = elementary.get_node('model.elementary.' ~ identifier) %}\n {%- if identifier_node -%}\n {%- set identifier_alias = elementary.safe_get_with_default(identifier_node, 'alias', identifier) %}\n {% set elementary_database, elementary_schema = identifier_node.database, identifier_node.schema %}\n {%- else -%}\n {% set identifier_alias = identifier %}\n {% set elementary_database, elementary_schema = elementary.get_package_database_and_schema() %}\n {%- endif -%}\n {% if this and this.database == elementary_database and this.schema == elementary_schema and this.identifier == identifier_alias %}\n {% do return(this) %}\n {% endif %}\n {% do return(adapter.get_relation(elementary_database, elementary_schema, identifier_alias)) %}\n {%- endif %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.get_node", "macro.elementary.safe_get_with_default", "macro.elementary.get_package_database_and_schema"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.6772604, "supported_languages": null}, "macro.elementary.get_table_name_from_node": {"name": "get_table_name_from_node", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/graph/get_table_name_from_node.sql", "original_file_path": "macros/utils/graph/get_table_name_from_node.sql", "unique_id": "macro.elementary.get_table_name_from_node", "macro_sql": "{% macro get_table_name_from_node(node) %}\n {% if node.identifier %}\n {% set table_name = node.identifier %}\n {% elif node.alias %}\n {% set table_name = node.alias %}\n {% else %}\n {% set table_name = node.name %}\n {% endif %}\n {{ return(table_name) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.6780896, "supported_languages": null}, "macro.elementary.get_relation_from_node": {"name": "get_relation_from_node", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/graph/get_relation_from_node.sql", "original_file_path": "macros/utils/graph/get_relation_from_node.sql", "unique_id": "macro.elementary.get_relation_from_node", "macro_sql": "{% macro get_relation_from_node(node) %}\n {% do return(adapter.get_relation(database=node.database,\n schema=node.schema,\n identifier=elementary.get_table_name_from_node(node))) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.get_table_name_from_node"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.6786034, "supported_languages": null}, "macro.elementary.get_node": {"name": "get_node", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/graph/get_node.sql", "original_file_path": "macros/utils/graph/get_node.sql", "unique_id": "macro.elementary.get_node", "macro_sql": "{% macro get_node(node_unique_id) %}\n {# First let's try to find it in regular nodes #}\n {%- set node = graph.nodes.get(node_unique_id) -%}\n {%- if not node -%}\n {# If not found let's try to find it in source nodes #}\n {%- set node = graph.sources.get(node_unique_id) -%}\n {%- endif -%}\n {{ return(node) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.6792808, "supported_languages": null}, "macro.elementary.set_cache": {"name": "set_cache", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/graph/set_cache.sql", "original_file_path": "macros/utils/graph/set_cache.sql", "unique_id": "macro.elementary.set_cache", "macro_sql": "{% macro set_cache(entry, val) %}\n {% if execute %}\n {% do graph.get(\"elementary\", {}).update({entry: val}) %}\n {% endif %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.679829, "supported_languages": null}, "macro.elementary.column_exists_in_relation": {"name": "column_exists_in_relation", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/graph/column_exists_in_relation.sql", "original_file_path": "macros/utils/graph/column_exists_in_relation.sql", "unique_id": "macro.elementary.column_exists_in_relation", "macro_sql": "{% macro column_exists_in_relation(relation, column_name) %}\n {% set columns = adapter.get_columns_in_relation(relation) %}\n {% for column in columns %}\n {% if column.name.lower() == column_name.lower() %}\n {% do return(true) %}\n {% endif %}\n {% endfor %}\n {% do return(false) %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.680683, "supported_languages": null}, "macro.elementary.get_elementary_config_from_node": {"name": "get_elementary_config_from_node", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/graph/get_elementary_config_from_node.sql", "original_file_path": "macros/utils/graph/get_elementary_config_from_node.sql", "unique_id": "macro.elementary.get_elementary_config_from_node", "macro_sql": "{% macro get_elementary_config_from_node(node) %}\n {% set res = {} %}\n {% set node_config = node.get('config') %}\n {% if node_config %}\n {% set elementary_config = node.config.get('elementary') %}\n {% if elementary_config and elementary_config is mapping %}\n {% do res.update(elementary_config) %}\n {% endif %}\n {% set config_meta = node.config.get('meta') %}\n {% if config_meta and config_meta is mapping %}\n {% set elementary_config = config_meta.get('elementary') %}\n {% if elementary_config and elementary_config is mapping %}\n {% do res.update(elementary_config) %}\n {% endif %}\n {% endif %}\n {% endif %}\n {% set node_meta = node.get('meta') %}\n {% if node_meta and node_meta is mapping %}\n {% set elementary_config = node_meta.get('elementary') %}\n {% if elementary_config and elementary_config is mapping %}\n {% do res.update(elementary_config) %}\n {% endif %}\n {% endif %}\n {{ return(res) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.6834314, "supported_languages": null}, "macro.elementary.is_incremental_model": {"name": "is_incremental_model", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/graph/is_incremental_model.sql", "original_file_path": "macros/utils/graph/is_incremental_model.sql", "unique_id": "macro.elementary.is_incremental_model", "macro_sql": "{% macro is_incremental_model(model_node, source_included=false) %}\n {% do return(\n (source_included and model_node.resource_type == \"source\")\n or\n (model_node.resource_type == \"model\" and model_node.config.materialized == \"incremental\")\n ) %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.6840355, "supported_languages": null}, "macro.elementary.get_package_database_and_schema": {"name": "get_package_database_and_schema", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/graph/get_package_database_and_schema.sql", "original_file_path": "macros/utils/graph/get_package_database_and_schema.sql", "unique_id": "macro.elementary.get_package_database_and_schema", "macro_sql": "{% macro get_package_database_and_schema(package_name='elementary') %}\n {% if execute %}\n {% set node_in_package = graph.nodes.values()\n | selectattr(\"resource_type\", \"==\", \"model\")\n | selectattr(\"package_name\", \"==\", package_name) | first %}\n {% if node_in_package %}\n {{ return([node_in_package.database, node_in_package.schema]) }}\n {% endif %}\n {% endif %}\n {{ return([none, none]) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.685168, "supported_languages": null}, "macro.elementary.get_node_execution_id": {"name": "get_node_execution_id", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/graph/get_node_execution_id.sql", "original_file_path": "macros/utils/graph/get_node_execution_id.sql", "unique_id": "macro.elementary.get_node_execution_id", "macro_sql": "{% macro get_node_execution_id(node) %}\n {% set node_execution_id = [invocation_id, node.get('unique_id')] | join('.') %}\n {{ return(node_execution_id) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.6856809, "supported_languages": null}, "macro.elementary.get_parent_model_unique_ids_from_test_node": {"name": "get_parent_model_unique_ids_from_test_node", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/graph/get_parent_model_unique_ids_from_test_node.sql", "original_file_path": "macros/utils/graph/get_parent_model_unique_ids_from_test_node.sql", "unique_id": "macro.elementary.get_parent_model_unique_ids_from_test_node", "macro_sql": "{% macro get_parent_model_unique_ids_from_test_node(test_node) %}\n {% set nodes_in_current_package = [] %}\n {% set test_depends_on = test_node.get('depends_on') %}\n {% if test_depends_on %}\n {% set depends_on_nodes = test_depends_on.get('nodes') %}\n {% if depends_on_nodes %}\n {% set current_package_name = test_node.get('package_name') %}\n {% if current_package_name %}\n {% set current_package_name = '.' ~ current_package_name ~ '.' %}\n {% for node in depends_on_nodes %}\n {% if current_package_name in node %}\n {% do nodes_in_current_package.append(node) %}\n {% endif %}\n {% endfor %}\n {% endif %}\n {% endif %}\n {% endif %}\n {{ return(nodes_in_current_package) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.6875494, "supported_languages": null}, "macro.elementary.get_nodes_from_graph": {"name": "get_nodes_from_graph", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/graph/get_nodes_from_graph.sql", "original_file_path": "macros/utils/graph/get_nodes_from_graph.sql", "unique_id": "macro.elementary.get_nodes_from_graph", "macro_sql": "{% macro get_nodes_from_graph() %}\n {% set nodes = [] %}\n {% do nodes.extend(graph.sources.values()) %}\n {% do nodes.extend(graph.nodes.values()) %}\n {{ return(nodes) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.6881897, "supported_languages": null}, "macro.elementary.get_cache": {"name": "get_cache", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/graph/get_cache.sql", "original_file_path": "macros/utils/graph/get_cache.sql", "unique_id": "macro.elementary.get_cache", "macro_sql": "{% macro get_cache(entry, default=none) %}\n {% if execute %}\n {{ return(graph.get(\"elementary\", {}).get(entry, default)) }}\n {% endif %}\n {{ return(none) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.6888304, "supported_languages": null}, "macro.elementary.get_model_database_and_schema_from_test_node": {"name": "get_model_database_and_schema_from_test_node", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/graph/get_model_database_and_schema_from_test_node.sql", "original_file_path": "macros/utils/graph/get_model_database_and_schema_from_test_node.sql", "unique_id": "macro.elementary.get_model_database_and_schema_from_test_node", "macro_sql": "{% macro get_model_database_and_schema_from_test_node(test_node) %}\n {% set test_database = test_node.get('database') %}\n {% set test_schema = test_node.get('schema') %}\n {% set config_dict = elementary.safe_get_with_default(test_node, 'config', {}) %}\n {% set test_schema_sufix = config_dict.get('schema') %}\n {% if test_schema and test_schema_sufix %}\n {% set test_schema = test_schema | replace('_' ~ test_schema_sufix, '') %}\n {% endif %}\n {{ return([test_database, test_schema]) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.safe_get_with_default"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.6901052, "supported_languages": null}, "macro.elementary.is_ephemeral_model": {"name": "is_ephemeral_model", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/graph/is_ephemeral_model.sql", "original_file_path": "macros/utils/graph/is_ephemeral_model.sql", "unique_id": "macro.elementary.is_ephemeral_model", "macro_sql": "{% macro is_ephemeral_model(model_relation) %}\n {% do return(\n model_relation.is_cte\n ) %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.690419, "supported_languages": null}, "macro.elementary.get_node_by_name": {"name": "get_node_by_name", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/graph/get_node_by_name.sql", "original_file_path": "macros/utils/graph/get_node_by_name.sql", "unique_id": "macro.elementary.get_node_by_name", "macro_sql": "{% macro get_node_by_name(name) %}\n {%- set nodes = elementary.get_nodes_from_graph() -%}\n {% for node in nodes %}\n {% if node.name == name %}\n {% do return(node) %}\n {% endif %}\n {% endfor %}\n {{ return(none) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.get_nodes_from_graph"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.6911688, "supported_languages": null}, "macro.elementary.get_nodes_by_unique_ids": {"name": "get_nodes_by_unique_ids", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/graph/get_nodes_by_unique_ids.sql", "original_file_path": "macros/utils/graph/get_nodes_by_unique_ids.sql", "unique_id": "macro.elementary.get_nodes_by_unique_ids", "macro_sql": "{% macro get_nodes_by_unique_ids(unique_ids) %}\n {% set nodes = []%}\n {% if execute %}\n {% if unique_ids and unique_ids is iterable %}\n {% for unique_id in unique_ids %}\n {% set node = elementary.get_node(unique_id) %}\n {% if node %}\n {% do nodes.append(node) %}\n {% endif %}\n {% endfor %}\n {% endif %}\n {% endif %}\n {{ return(nodes) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.get_node"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.6924624, "supported_languages": null}, "macro.elementary.get_rendered_ref": {"name": "get_rendered_ref", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/graph/get_rendered_ref.sql", "original_file_path": "macros/utils/graph/get_rendered_ref.sql", "unique_id": "macro.elementary.get_rendered_ref", "macro_sql": "{% macro get_rendered_ref(ref_string) %}\n {% set lowered_ref_string = ref_string | lower %}\n {% set match = modules.re.match(\"(ref\\('(?P.+)'\\))\", lowered_ref_string, modules.re.IGNORECASE) %}\n {% if not match %}\n {% do return(lowered_ref_string) %}\n {% else %}\n {% do return(ref(match.groupdict()['ref_identifier'])['include']()) %}\n {% endif %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.6935093, "supported_languages": null}, "macro.elementary.get_compiled_code": {"name": "get_compiled_code", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/graph/get_compiled_code.sql", "original_file_path": "macros/utils/graph/get_compiled_code.sql", "unique_id": "macro.elementary.get_compiled_code", "macro_sql": "{% macro get_compiled_code(node, as_column_value=false) %}\n {% set compiled_code = adapter.dispatch(\"get_compiled_code\", \"elementary\")(node) %}\n \n {% set max_column_size = elementary.get_column_size() %}\n {% if as_column_value and max_column_size and compiled_code and compiled_code | length > max_column_size %}\n {% do return(elementary.get_compiled_code_too_long_err_msg()) %}\n {% endif %}\n \n {% do return(compiled_code) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.default__get_compiled_code", "macro.elementary.get_column_size", "macro.elementary.get_compiled_code_too_long_err_msg"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.6949186, "supported_languages": null}, "macro.elementary.default__get_compiled_code": {"name": "default__get_compiled_code", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/graph/get_compiled_code.sql", "original_file_path": "macros/utils/graph/get_compiled_code.sql", "unique_id": "macro.elementary.default__get_compiled_code", "macro_sql": "{% macro default__get_compiled_code(node) %}\n {% do return(node.get('compiled_code') or node.get('compiled_sql')) %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.6952865, "supported_languages": null}, "macro.elementary.redshift__get_compiled_code": {"name": "redshift__get_compiled_code", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/graph/get_compiled_code.sql", "original_file_path": "macros/utils/graph/get_compiled_code.sql", "unique_id": "macro.elementary.redshift__get_compiled_code", "macro_sql": "{% macro redshift__get_compiled_code(node) %}\n {% set compiled_code = node.get('compiled_code') or node.get('compiled_sql') %}\n {% if not compiled_code %}\n {% do return(none) %}\n {% else %}\n {% do return(compiled_code.replace(\"%\", \"%%\")) %}\n {% endif %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.replace"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.6959815, "supported_languages": null}, "macro.elementary.get_compiled_code_too_long_err_msg": {"name": "get_compiled_code_too_long_err_msg", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/graph/get_compiled_code.sql", "original_file_path": "macros/utils/graph/get_compiled_code.sql", "unique_id": "macro.elementary.get_compiled_code_too_long_err_msg", "macro_sql": "{% macro get_compiled_code_too_long_err_msg() %}\n {% do return(\"Compiled code is too long.\") %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.6962159, "supported_languages": null}, "macro.elementary.is_column_timestamp": {"name": "is_column_timestamp", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/data_types/is_column_timestamp.sql", "original_file_path": "macros/utils/data_types/is_column_timestamp.sql", "unique_id": "macro.elementary.is_column_timestamp", "macro_sql": "{% macro is_column_timestamp(table_relation,timestamp_column,timestamp_column_data_type) %}\n {%- if timestamp_column_data_type == 'string' %}\n {%- set is_timestamp = elementary.try_cast_column_to_timestamp(table_relation, timestamp_column) %}\n {%- elif timestamp_column_data_type == 'timestamp' %}\n {%- set is_timestamp = true %}\n {%- else %}\n {%- set is_timestamp = false %}\n {%- endif %}\n {{ return(is_timestamp) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.try_cast_column_to_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.6971152, "supported_languages": null}, "macro.elementary.is_primitive": {"name": "is_primitive", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/data_types/data_type.sql", "original_file_path": "macros/utils/data_types/data_type.sql", "unique_id": "macro.elementary.is_primitive", "macro_sql": "{% macro is_primitive(val) %}\n {% do return (\n val is none or\n val is boolean or\n val is number or\n val is string\n ) %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.700701, "supported_languages": null}, "macro.elementary.edr_type_bool": {"name": "edr_type_bool", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/data_types/data_type.sql", "original_file_path": "macros/utils/data_types/data_type.sql", "unique_id": "macro.elementary.edr_type_bool", "macro_sql": "\n\n{%- macro edr_type_bool() -%}\n {{ return(adapter.dispatch('edr_type_bool', 'elementary')()) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.elementary.default__edr_type_bool"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.701012, "supported_languages": null}, "macro.elementary.default__edr_type_bool": {"name": "default__edr_type_bool", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/data_types/data_type.sql", "original_file_path": "macros/utils/data_types/data_type.sql", "unique_id": "macro.elementary.default__edr_type_bool", "macro_sql": "{% macro default__edr_type_bool() %}\n {% do return(\"boolean\") %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.7012386, "supported_languages": null}, "macro.elementary.bigquery__edr_type_bool": {"name": "bigquery__edr_type_bool", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/data_types/data_type.sql", "original_file_path": "macros/utils/data_types/data_type.sql", "unique_id": "macro.elementary.bigquery__edr_type_bool", "macro_sql": "{% macro bigquery__edr_type_bool() %}\n {% do return(\"BOOL\") %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.70146, "supported_languages": null}, "macro.elementary.edr_type_string": {"name": "edr_type_string", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/data_types/data_type.sql", "original_file_path": "macros/utils/data_types/data_type.sql", "unique_id": "macro.elementary.edr_type_string", "macro_sql": "\n\n\n{%- macro edr_type_string() -%}\n {{ return(adapter.dispatch('edr_type_string', 'elementary')()) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.elementary.postgres__edr_type_string"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.7017403, "supported_languages": null}, "macro.elementary.default__edr_type_string": {"name": "default__edr_type_string", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/data_types/data_type.sql", "original_file_path": "macros/utils/data_types/data_type.sql", "unique_id": "macro.elementary.default__edr_type_string", "macro_sql": "{% macro default__edr_type_string() %}\n {# Redshift #}\n {% do return(\"varchar(4096)\") %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.7019742, "supported_languages": null}, "macro.elementary.postgres__edr_type_string": {"name": "postgres__edr_type_string", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/data_types/data_type.sql", "original_file_path": "macros/utils/data_types/data_type.sql", "unique_id": "macro.elementary.postgres__edr_type_string", "macro_sql": "{% macro postgres__edr_type_string() %}\n {% if var(\"sync\", false) %}\n {% do return(\"text\") %}\n {% else %}\n {% do return(\"varchar(4096)\") %}\n {% endif %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.7024426, "supported_languages": null}, "macro.elementary.snowflake__edr_type_string": {"name": "snowflake__edr_type_string", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/data_types/data_type.sql", "original_file_path": "macros/utils/data_types/data_type.sql", "unique_id": "macro.elementary.snowflake__edr_type_string", "macro_sql": "{% macro snowflake__edr_type_string() %}\n {# Default max varchar size in Snowflake is 16MB #}\n {% do return(\"varchar\") %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.7026772, "supported_languages": null}, "macro.elementary.bigquery__edr_type_string": {"name": "bigquery__edr_type_string", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/data_types/data_type.sql", "original_file_path": "macros/utils/data_types/data_type.sql", "unique_id": "macro.elementary.bigquery__edr_type_string", "macro_sql": "{% macro bigquery__edr_type_string() %}\n {# Default max string size in Bigquery is 65K #}\n {% do return(\"string\") %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.7029066, "supported_languages": null}, "macro.elementary.spark__edr_type_string": {"name": "spark__edr_type_string", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/data_types/data_type.sql", "original_file_path": "macros/utils/data_types/data_type.sql", "unique_id": "macro.elementary.spark__edr_type_string", "macro_sql": "{% macro spark__edr_type_string() %}\n {% do return(\"string\") %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.7031217, "supported_languages": null}, "macro.elementary.athena__edr_type_string": {"name": "athena__edr_type_string", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/data_types/data_type.sql", "original_file_path": "macros/utils/data_types/data_type.sql", "unique_id": "macro.elementary.athena__edr_type_string", "macro_sql": "{% macro athena__edr_type_string() %}\n {% do return(\"varchar\") %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.7033365, "supported_languages": null}, "macro.elementary.edr_type_long_string": {"name": "edr_type_long_string", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/data_types/data_type.sql", "original_file_path": "macros/utils/data_types/data_type.sql", "unique_id": "macro.elementary.edr_type_long_string", "macro_sql": "\n\n\n\n\n{%- macro edr_type_long_string() -%}\n {{ return(adapter.dispatch('edr_type_long_string', 'elementary')()) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.elementary.postgres__edr_type_long_string"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.7037058, "supported_languages": null}, "macro.elementary.default__edr_type_long_string": {"name": "default__edr_type_long_string", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/data_types/data_type.sql", "original_file_path": "macros/utils/data_types/data_type.sql", "unique_id": "macro.elementary.default__edr_type_long_string", "macro_sql": "{%- macro default__edr_type_long_string() -%}\n {# Snowflake, Bigquery, Databricks #}\n {% do return(elementary.edr_type_string()) %}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.elementary.edr_type_string"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.7039545, "supported_languages": null}, "macro.elementary.redshift__edr_type_long_string": {"name": "redshift__edr_type_long_string", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/data_types/data_type.sql", "original_file_path": "macros/utils/data_types/data_type.sql", "unique_id": "macro.elementary.redshift__edr_type_long_string", "macro_sql": "{%- macro redshift__edr_type_long_string() -%}\n {% set long_string = 'varchar(' ~ elementary.get_config_var('long_string_size') ~ ')' %}\n {{ return(long_string) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.elementary.get_config_var"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.7043023, "supported_languages": null}, "macro.elementary.postgres__edr_type_long_string": {"name": "postgres__edr_type_long_string", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/data_types/data_type.sql", "original_file_path": "macros/utils/data_types/data_type.sql", "unique_id": "macro.elementary.postgres__edr_type_long_string", "macro_sql": "{%- macro postgres__edr_type_long_string() -%}\n {% set long_string = 'text' %}\n {{ return(long_string) }}\n{%- endmacro -%}\n\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.7045956, "supported_languages": null}, "macro.elementary.edr_type_bigint": {"name": "edr_type_bigint", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/data_types/data_type.sql", "original_file_path": "macros/utils/data_types/data_type.sql", "unique_id": "macro.elementary.edr_type_bigint", "macro_sql": "{% macro edr_type_bigint() %}\n {% set macro = dbt.type_bigint or dbt_utils.type_bigint %}\n {% if not macro %}\n {{ exceptions.raise_compiler_error(\"Did not find a `type_bigint` macro.\") }}\n {% endif %}\n {{ return(macro()) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.7051353, "supported_languages": null}, "macro.elementary.edr_type_float": {"name": "edr_type_float", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/data_types/data_type.sql", "original_file_path": "macros/utils/data_types/data_type.sql", "unique_id": "macro.elementary.edr_type_float", "macro_sql": "{% macro edr_type_float() %}\n {% set macro = dbt.type_float or dbt_utils.type_float %}\n {% if not macro %}\n {{ exceptions.raise_compiler_error(\"Did not find a `type_float` macro.\") }}\n {% endif %}\n {{ return(macro()) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.7056556, "supported_languages": null}, "macro.elementary.edr_type_int": {"name": "edr_type_int", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/data_types/data_type.sql", "original_file_path": "macros/utils/data_types/data_type.sql", "unique_id": "macro.elementary.edr_type_int", "macro_sql": "{% macro edr_type_int() %}\n {% set macro = dbt.type_int or dbt_utils.type_int %}\n {% if not macro %}\n {{ exceptions.raise_compiler_error(\"Did not find a `type_int` macro.\") }}\n {% endif %}\n {{ return(macro()) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.7061722, "supported_languages": null}, "macro.elementary.edr_type_timestamp": {"name": "edr_type_timestamp", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/data_types/data_type.sql", "original_file_path": "macros/utils/data_types/data_type.sql", "unique_id": "macro.elementary.edr_type_timestamp", "macro_sql": "{% macro edr_type_timestamp() %}\n {{ return(adapter.dispatch('edr_type_timestamp', 'elementary')()) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.default__edr_type_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.7064655, "supported_languages": null}, "macro.elementary.default__edr_type_timestamp": {"name": "default__edr_type_timestamp", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/data_types/data_type.sql", "original_file_path": "macros/utils/data_types/data_type.sql", "unique_id": "macro.elementary.default__edr_type_timestamp", "macro_sql": "{% macro default__edr_type_timestamp() %}\n {% set macro = dbt.type_timestamp or dbt_utils.type_timestamp %}\n {% if not macro %}\n {{ exceptions.raise_compiler_error(\"Did not find a `type_timestamp` macro.\") }}\n {% endif %}\n {{ return(macro()) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.7069767, "supported_languages": null}, "macro.elementary.edr_type_numeric": {"name": "edr_type_numeric", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/data_types/data_type.sql", "original_file_path": "macros/utils/data_types/data_type.sql", "unique_id": "macro.elementary.edr_type_numeric", "macro_sql": "{% macro edr_type_numeric() %}\n {% set macro = dbt.type_numeric or dbt_utils.type_numeric %}\n {% if not macro %}\n {{ exceptions.raise_compiler_error(\"Did not find a `type_numeric` macro.\") }}\n {% endif %}\n {{ return(macro()) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.7074854, "supported_languages": null}, "macro.elementary.edr_type_date": {"name": "edr_type_date", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/data_types/data_type.sql", "original_file_path": "macros/utils/data_types/data_type.sql", "unique_id": "macro.elementary.edr_type_date", "macro_sql": "{% macro edr_type_date() %}\n {{ return(adapter.dispatch('edr_type_date', 'elementary')()) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.default__edr_type_date"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.707774, "supported_languages": null}, "macro.elementary.default__edr_type_date": {"name": "default__edr_type_date", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/data_types/data_type.sql", "original_file_path": "macros/utils/data_types/data_type.sql", "unique_id": "macro.elementary.default__edr_type_date", "macro_sql": "{% macro default__edr_type_date() %}\n date\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.7079074, "supported_languages": null}, "macro.elementary.athena__edr_type_timestamp": {"name": "athena__edr_type_timestamp", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/data_types/data_type.sql", "original_file_path": "macros/utils/data_types/data_type.sql", "unique_id": "macro.elementary.athena__edr_type_timestamp", "macro_sql": "{% macro athena__edr_type_timestamp() %}\n {%- set config = model.get('config', {}) -%}\n {%- set table_type = config.get('table_type', 'hive') -%}\n {%- if table_type == 'iceberg' -%}\n timestamp(6)\n {%- else -%}\n timestamp\n {%- endif -%}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.7084358, "supported_languages": null}, "macro.elementary.normalize_data_type": {"name": "normalize_data_type", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/data_types/normalize_data_type.sql", "original_file_path": "macros/utils/data_types/normalize_data_type.sql", "unique_id": "macro.elementary.normalize_data_type", "macro_sql": "{% macro normalize_data_type(data_type) %}\n\n {# In case data type has precision info - e.g. decimal is in the format decimal(p,s) #}\n {%- if '(' in data_type %}\n {%- set data_type = data_type.split('(')[0] %}\n {%- endif %}\n\n {%- if data_type is defined and data_type is not none %}\n {%- if data_type in elementary.data_type_list('string') %}\n {{ return('string') }}\n {%- elif data_type in elementary.data_type_list('numeric') %}\n {{ return('numeric') }}\n {%- elif data_type in elementary.data_type_list('timestamp') %}\n {{ return('timestamp') }}\n {%- elif data_type in elementary.data_type_list(\"boolean\") %}\n {{ return(\"boolean\") }}\n {%- else %}\n {{ return('other') }}\n {% endif %}\n {%- endif %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.data_type_list"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.7103577, "supported_languages": null}, "macro.elementary.get_column_size": {"name": "get_column_size", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/data_types/data_size.sql", "original_file_path": "macros/utils/data_types/data_size.sql", "unique_id": "macro.elementary.get_column_size", "macro_sql": "{% macro get_column_size() %}\n {{ return(adapter.dispatch('get_column_size', 'elementary')()) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.postgres__get_column_size"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.7109995, "supported_languages": null}, "macro.elementary.default__get_column_size": {"name": "default__get_column_size", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/data_types/data_size.sql", "original_file_path": "macros/utils/data_types/data_size.sql", "unique_id": "macro.elementary.default__get_column_size", "macro_sql": "{% macro default__get_column_size() %}\n {{ return(elementary.get_config_var('long_string_size')) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.get_config_var"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.7112567, "supported_languages": null}, "macro.elementary.postgres__get_column_size": {"name": "postgres__get_column_size", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/data_types/data_size.sql", "original_file_path": "macros/utils/data_types/data_size.sql", "unique_id": "macro.elementary.postgres__get_column_size", "macro_sql": "{% macro postgres__get_column_size() %}\n {{ return(none) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.7114599, "supported_languages": null}, "macro.elementary.snowflake__get_column_size": {"name": "snowflake__get_column_size", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/data_types/data_size.sql", "original_file_path": "macros/utils/data_types/data_size.sql", "unique_id": "macro.elementary.snowflake__get_column_size", "macro_sql": "{% macro snowflake__get_column_size() %}\n {{ return(16777216) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.7116637, "supported_languages": null}, "macro.elementary.bigquery__get_column_size": {"name": "bigquery__get_column_size", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/data_types/data_size.sql", "original_file_path": "macros/utils/data_types/data_size.sql", "unique_id": "macro.elementary.bigquery__get_column_size", "macro_sql": "{% macro bigquery__get_column_size() %}\n {{ return(10485760) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.7118645, "supported_languages": null}, "macro.elementary.redshift__get_column_size": {"name": "redshift__get_column_size", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/data_types/data_size.sql", "original_file_path": "macros/utils/data_types/data_size.sql", "unique_id": "macro.elementary.redshift__get_column_size", "macro_sql": "{% macro redshift__get_column_size() %}\n {{ return(65535) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.7120702, "supported_languages": null}, "macro.elementary.null_int": {"name": "null_int", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/data_types/null_as.sql", "original_file_path": "macros/utils/data_types/null_as.sql", "unique_id": "macro.elementary.null_int", "macro_sql": "{%- macro null_int() -%}\n cast(null as {{ elementary.edr_type_int() }})\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.elementary.edr_type_int"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.7125602, "supported_languages": null}, "macro.elementary.null_timestamp": {"name": "null_timestamp", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/data_types/null_as.sql", "original_file_path": "macros/utils/data_types/null_as.sql", "unique_id": "macro.elementary.null_timestamp", "macro_sql": "{%- macro null_timestamp() -%}\n cast(null as {{ elementary.edr_type_timestamp() }})\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.elementary.edr_type_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.71276, "supported_languages": null}, "macro.elementary.null_float": {"name": "null_float", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/data_types/null_as.sql", "original_file_path": "macros/utils/data_types/null_as.sql", "unique_id": "macro.elementary.null_float", "macro_sql": "{%- macro null_float() -%}\n cast(null as {{ elementary.edr_type_float() }})\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.elementary.edr_type_float"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.713089, "supported_languages": null}, "macro.elementary.null_string": {"name": "null_string", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/data_types/null_as.sql", "original_file_path": "macros/utils/data_types/null_as.sql", "unique_id": "macro.elementary.null_string", "macro_sql": "{% macro null_string() %}\n cast(null as {{ elementary.edr_type_string() }})\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.edr_type_string"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.7132893, "supported_languages": null}, "macro.elementary.null_boolean": {"name": "null_boolean", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/data_types/null_as.sql", "original_file_path": "macros/utils/data_types/null_as.sql", "unique_id": "macro.elementary.null_boolean", "macro_sql": "{% macro null_boolean() %} \n cast(null as {{ elementary.edr_type_bool() }}) \n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.edr_type_bool"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.7134838, "supported_languages": null}, "macro.elementary.get_normalized_data_type": {"name": "get_normalized_data_type", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/data_types/get_normalized_data_type.sql", "original_file_path": "macros/utils/data_types/get_normalized_data_type.sql", "unique_id": "macro.elementary.get_normalized_data_type", "macro_sql": "{% macro get_normalized_data_type(exact_data_type) %}\n {% if exact_data_type is none %}\n {{ return (exact_data_type) }}\n {% endif %}\n {% set exact_data_type_uppercase = exact_data_type | upper %}\n {% set result = adapter.dispatch('get_normalized_data_type','elementary')(exact_data_type_uppercase) %}\n {{ return(result) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.postgres__get_normalized_data_type"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.7166266, "supported_languages": null}, "macro.elementary.default__get_normalized_data_type": {"name": "default__get_normalized_data_type", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/data_types/get_normalized_data_type.sql", "original_file_path": "macros/utils/data_types/get_normalized_data_type.sql", "unique_id": "macro.elementary.default__get_normalized_data_type", "macro_sql": "{% macro default__get_normalized_data_type(exact_data_type) %}\n {{return (exact_data_type) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.716847, "supported_languages": null}, "macro.elementary.bigquery__get_normalized_data_type": {"name": "bigquery__get_normalized_data_type", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/data_types/get_normalized_data_type.sql", "original_file_path": "macros/utils/data_types/get_normalized_data_type.sql", "unique_id": "macro.elementary.bigquery__get_normalized_data_type", "macro_sql": "{% macro bigquery__get_normalized_data_type(exact_data_type) %}\n{# BigQuery has no concept of data type synonyms,\n see https://cloud.google.com/bigquery/docs/reference/standard-sql/data-types #}\n {% set exact_data_type_to_data_type_returned_by_the_info_schema = {'BOOLEAN': 'BOOL'} %}\n {%- if exact_data_type in exact_data_type_to_data_type_returned_by_the_info_schema%}\n {{ return (exact_data_type_to_data_type_returned_by_the_info_schema[exact_data_type])}}\n {%- else %}\n {{return (exact_data_type) }}\n {%- endif%}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.7174683, "supported_languages": null}, "macro.elementary.snowflake__get_normalized_data_type": {"name": "snowflake__get_normalized_data_type", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/data_types/get_normalized_data_type.sql", "original_file_path": "macros/utils/data_types/get_normalized_data_type.sql", "unique_id": "macro.elementary.snowflake__get_normalized_data_type", "macro_sql": "{% macro snowflake__get_normalized_data_type(exact_data_type) %}\n{# understanding Snowflake data type synonyms:\n https://docs.snowflake.com/en/sql-reference/intro-summary-data-types.html #}\n {% set exact_data_type_to_data_type_returned_by_the_info_schema = {'VARCHAR': 'TEXT',\n 'STRING': 'TEXT',\n 'NVARCHAR': 'TEXT',\n 'NUMERIC': 'NUMBER',\n 'DECIMAL': 'NUMBER',\n 'INT':'NUMBER',\n 'INTEGER':'NUMBER',\n 'SMALLINT':'NUMBER',\n 'BIGINT':'NUMBER',\n 'TINYINT':'NUMBER',\n 'BYTEINT':'NUMBER',\n 'REAL': 'FLOAT',\n 'DOUBLE':'FLOAT',\n 'DOUBLE PRECISION': 'FLOAT'\n }%}\n {%- if exact_data_type in exact_data_type_to_data_type_returned_by_the_info_schema%}\n {{ return (exact_data_type_to_data_type_returned_by_the_info_schema[exact_data_type])}}\n {%- else %}\n {{return (exact_data_type) }}\n {%- endif%}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.7186003, "supported_languages": null}, "macro.elementary.spark__get_normalized_data_type": {"name": "spark__get_normalized_data_type", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/data_types/get_normalized_data_type.sql", "original_file_path": "macros/utils/data_types/get_normalized_data_type.sql", "unique_id": "macro.elementary.spark__get_normalized_data_type", "macro_sql": "{% macro spark__get_normalized_data_type(exact_data_type) %}\n{# spark also has no concept of data type synonyms :\n see https://spark.apache.org/docs/latest/sql-ref-datatypes.html #}\n {{return (exact_data_type) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.7188401, "supported_languages": null}, "macro.elementary.redshift__get_normalized_data_type": {"name": "redshift__get_normalized_data_type", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/data_types/get_normalized_data_type.sql", "original_file_path": "macros/utils/data_types/get_normalized_data_type.sql", "unique_id": "macro.elementary.redshift__get_normalized_data_type", "macro_sql": "{% macro redshift__get_normalized_data_type(exact_data_type) %}\n{# understanding Redshift data type synonyms:\n https://docs.aws.amazon.com/redshift/latest/dg/c_Supported_data_types.html #}\n {% set exact_data_type_to_data_type_returned_by_the_info_schema = {'INT2':\t'SMALLINT',\n 'INT':\t'INTEGER',\n 'INT4':\t'INTEGER',\n 'INT8':\t'BIGINT',\n 'NUMERIC':\t'DECIMAL',\n 'FLOAT4':\t'REAL',\n 'FLOAT8':\t'DOUBLE PRECISION',\n 'FLOAT':\t'DOUBLE PRECISION',\n 'BOOL':\t'BOOLEAN',\n 'CHARACTER':\t'CHAR',\n 'NCHAR':\t'CHAR',\n 'BPCHAR':\t'CHAR',\n 'VARCHAR': 'CHARACTER VARYING',\n 'NVARCHAR':\t'CHARACTER VARYING',\n 'TEXT':\t'CHARACTER VARYING',\n 'TIMESTAMP': 'TIMESTAMP WITHOUT TIME ZONE',\n 'TIMESTAMPTZ': 'TIMESTAMP WITH TIME ZONE',\n 'TIME': 'TIME WITHOUT TIME ZONE',\n 'TIME WITH TIME ZONE':\t'TIMETZ',\n 'VARBINARY': 'BINARY VARYING',\n 'VARBYTE': 'BINARY VARYING'} %}\n {%- if exact_data_type in exact_data_type_to_data_type_returned_by_the_info_schema%}\n {{ return (exact_data_type_to_data_type_returned_by_the_info_schema[exact_data_type])}}\n {%- else %}\n {{return (exact_data_type) }}\n {%- endif%}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.720265, "supported_languages": null}, "macro.elementary.postgres__get_normalized_data_type": {"name": "postgres__get_normalized_data_type", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/data_types/get_normalized_data_type.sql", "original_file_path": "macros/utils/data_types/get_normalized_data_type.sql", "unique_id": "macro.elementary.postgres__get_normalized_data_type", "macro_sql": "{% macro postgres__get_normalized_data_type(exact_data_type) %}\n{# understanding Postgres data type synonyms:\n https://www.postgresql.org/docs/current/datatype.html #}\n {% set exact_data_type_to_data_type_returned_by_the_info_schema = {'BIGINT': 'INT8',\n 'BIGSERIAL': 'SERIAL8',\n 'BIT VARYING': 'VARBIT',\n 'BOOLEAN': 'BOOL',\n 'CHARACTER': 'CHAR',\n 'CHARACTER VARYING': 'VARCHAR',\n 'DOUBLE PRECISION': 'FLOAT8',\n 'INTEGER': 'INT, INT4',\n 'NUMERIC': 'DECIMAL',\n 'REAL': 'FLOAT4',\n 'SMALLINT': 'INT2',\n 'SMALLSERIAL': 'SERIAL2',\n 'SERIAL': 'SERIAL4',\n 'TIME WITH TIME ZONE': 'TIMETZ',\n 'TIMESTAMP WITH TIME ZONE': 'TIMESTAMPTZ'} %}\n {%- if exact_data_type in exact_data_type_to_data_type_returned_by_the_info_schema%}\n {{ return (exact_data_type_to_data_type_returned_by_the_info_schema[exact_data_type])}}\n {%- else %}\n {{return (exact_data_type) }}\n {%- endif%}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.7214754, "supported_languages": null}, "macro.elementary.try_cast_column_to_timestamp": {"name": "try_cast_column_to_timestamp", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/data_types/try_cast_column_to_timestamp.sql", "original_file_path": "macros/utils/data_types/try_cast_column_to_timestamp.sql", "unique_id": "macro.elementary.try_cast_column_to_timestamp", "macro_sql": "{% macro try_cast_column_to_timestamp(table_relation, timestamp_column) %}\n {{ return(adapter.dispatch('try_cast_column_to_timestamp', 'elementary')(table_relation, timestamp_column)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.elementary.postgres__try_cast_column_to_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.7223067, "supported_languages": null}, "macro.elementary.default__try_cast_column_to_timestamp": {"name": "default__try_cast_column_to_timestamp", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/data_types/try_cast_column_to_timestamp.sql", "original_file_path": "macros/utils/data_types/try_cast_column_to_timestamp.sql", "unique_id": "macro.elementary.default__try_cast_column_to_timestamp", "macro_sql": "{% macro default__try_cast_column_to_timestamp(table_relation, timestamp_column) %}\n {# We try casting for Snowflake, Bigquery and Databricks as these support safe cast and the query will not fail if the cast fails #}\n {%- set query %}\n select {{ elementary.edr_safe_cast(timestamp_column, elementary.edr_type_timestamp()) }} as timestamp_column\n from {{ table_relation }}\n where {{ timestamp_column }} is not null\n limit 1\n {%- endset %}\n\n {%- set result = elementary.result_value(query) %}\n {%- if result is not none %}\n {{ return(true) }}\n {%- endif %}\n {{ return(false) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.edr_safe_cast", "macro.elementary.edr_type_timestamp", "macro.elementary.result_value"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.7231276, "supported_languages": null}, "macro.elementary.postgres__try_cast_column_to_timestamp": {"name": "postgres__try_cast_column_to_timestamp", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/data_types/try_cast_column_to_timestamp.sql", "original_file_path": "macros/utils/data_types/try_cast_column_to_timestamp.sql", "unique_id": "macro.elementary.postgres__try_cast_column_to_timestamp", "macro_sql": "{% macro postgres__try_cast_column_to_timestamp(table_relation, timestamp_column) %}\n {{ return(false) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.7233717, "supported_languages": null}, "macro.elementary.to_primitive": {"name": "to_primitive", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/data_types/to_primitive.sql", "original_file_path": "macros/utils/data_types/to_primitive.sql", "unique_id": "macro.elementary.to_primitive", "macro_sql": "{% macro to_primitive(val) %}\n {% if elementary.is_primitive(val) %}\n {% do return(val) %}\n\n {% elif val is mapping %}\n {% set new_dict = {} %}\n {% for k, v in val.items() %}\n {% do new_dict.update({k: elementary.to_primitive(v)}) %}\n {% endfor %}\n {% do return(new_dict) %}\n\n {% elif val is iterable %}\n {% set new_list = [] %}\n {% for item in val %}\n {% do new_list.append(elementary.to_primitive(item)) %}\n {% endfor %}\n {% do return(new_list) %}\n\n {% else %}\n {% do return(val | string) %}\n {% endif %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.is_primitive", "macro.elementary.to_primitive"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.7253358, "supported_languages": null}, "macro.elementary.edr_cast_as_timestamp": {"name": "edr_cast_as_timestamp", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/data_types/cast_column.sql", "original_file_path": "macros/utils/data_types/cast_column.sql", "unique_id": "macro.elementary.edr_cast_as_timestamp", "macro_sql": "{%- macro edr_cast_as_timestamp(timestamp_field) -%}\n {{ return(adapter.dispatch('edr_cast_as_timestamp', 'elementary')(timestamp_field)) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.elementary.default__edr_cast_as_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.7276316, "supported_languages": null}, "macro.elementary.default__edr_cast_as_timestamp": {"name": "default__edr_cast_as_timestamp", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/data_types/cast_column.sql", "original_file_path": "macros/utils/data_types/cast_column.sql", "unique_id": "macro.elementary.default__edr_cast_as_timestamp", "macro_sql": "{%- macro default__edr_cast_as_timestamp(timestamp_field) -%}\n cast({{ timestamp_field }} as {{ elementary.edr_type_timestamp() }})\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.elementary.edr_type_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.727896, "supported_languages": null}, "macro.elementary.athena__edr_cast_as_timestamp": {"name": "athena__edr_cast_as_timestamp", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/data_types/cast_column.sql", "original_file_path": "macros/utils/data_types/cast_column.sql", "unique_id": "macro.elementary.athena__edr_cast_as_timestamp", "macro_sql": "\n{%- macro athena__edr_cast_as_timestamp(timestamp_field) -%}\n coalesce(\n try_cast({{ timestamp_field }} as {{ elementary.edr_type_timestamp() }}),\n cast(from_iso8601_timestamp(cast({{ timestamp_field }} AS {{ elementary.edr_type_string() }})) AS {{ elementary.edr_type_timestamp() }})\n )\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.elementary.edr_type_timestamp", "macro.elementary.edr_type_string"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.7283332, "supported_languages": null}, "macro.elementary.edr_cast_as_float": {"name": "edr_cast_as_float", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/data_types/cast_column.sql", "original_file_path": "macros/utils/data_types/cast_column.sql", "unique_id": "macro.elementary.edr_cast_as_float", "macro_sql": "{%- macro edr_cast_as_float(column) -%}\n cast({{ column }} as {{ elementary.edr_type_float() }})\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.elementary.edr_type_float"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.728583, "supported_languages": null}, "macro.elementary.edr_cast_as_numeric": {"name": "edr_cast_as_numeric", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/data_types/cast_column.sql", "original_file_path": "macros/utils/data_types/cast_column.sql", "unique_id": "macro.elementary.edr_cast_as_numeric", "macro_sql": "{%- macro edr_cast_as_numeric(column) -%}\n cast({{ column }} as {{ elementary.edr_type_numeric() }})\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.elementary.edr_type_numeric"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.7288275, "supported_languages": null}, "macro.elementary.edr_cast_as_int": {"name": "edr_cast_as_int", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/data_types/cast_column.sql", "original_file_path": "macros/utils/data_types/cast_column.sql", "unique_id": "macro.elementary.edr_cast_as_int", "macro_sql": "{%- macro edr_cast_as_int(column) -%}\n cast({{ column }} as {{ elementary.edr_type_int() }})\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.elementary.edr_type_int"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.7292178, "supported_languages": null}, "macro.elementary.edr_cast_as_string": {"name": "edr_cast_as_string", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/data_types/cast_column.sql", "original_file_path": "macros/utils/data_types/cast_column.sql", "unique_id": "macro.elementary.edr_cast_as_string", "macro_sql": "{%- macro edr_cast_as_string(column) -%}\n cast({{ column }} as {{ elementary.edr_type_string() }})\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.elementary.edr_type_string"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.72947, "supported_languages": null}, "macro.elementary.edr_cast_as_long_string": {"name": "edr_cast_as_long_string", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/data_types/cast_column.sql", "original_file_path": "macros/utils/data_types/cast_column.sql", "unique_id": "macro.elementary.edr_cast_as_long_string", "macro_sql": "{%- macro edr_cast_as_long_string(column) -%}\n cast({{ column }} as {{ elementary.edr_type_long_string() }})\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.elementary.edr_type_long_string"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.7297173, "supported_languages": null}, "macro.elementary.edr_cast_as_bool": {"name": "edr_cast_as_bool", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/data_types/cast_column.sql", "original_file_path": "macros/utils/data_types/cast_column.sql", "unique_id": "macro.elementary.edr_cast_as_bool", "macro_sql": "{%- macro edr_cast_as_bool(column) -%}\n cast({{ column }} as {{ elementary.edr_type_bool() }})\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.elementary.edr_type_bool"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.7299602, "supported_languages": null}, "macro.elementary.const_as_string": {"name": "const_as_string", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/data_types/cast_column.sql", "original_file_path": "macros/utils/data_types/cast_column.sql", "unique_id": "macro.elementary.const_as_string", "macro_sql": "{%- macro const_as_string(string) -%}\n cast('{{ string }}' as {{ elementary.edr_type_string() }})\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.elementary.edr_type_string"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.730204, "supported_languages": null}, "macro.elementary.edr_cast_as_date": {"name": "edr_cast_as_date", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/data_types/cast_column.sql", "original_file_path": "macros/utils/data_types/cast_column.sql", "unique_id": "macro.elementary.edr_cast_as_date", "macro_sql": "{%- macro edr_cast_as_date(timestamp_field) -%}\n {{ return(adapter.dispatch('edr_cast_as_date', 'elementary')(timestamp_field)) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.elementary.default__edr_cast_as_date"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.730516, "supported_languages": null}, "macro.elementary.default__edr_cast_as_date": {"name": "default__edr_cast_as_date", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/data_types/cast_column.sql", "original_file_path": "macros/utils/data_types/cast_column.sql", "unique_id": "macro.elementary.default__edr_cast_as_date", "macro_sql": "{%- macro default__edr_cast_as_date(timestamp_field) -%}\n cast({{ timestamp_field }} as {{ elementary.edr_type_date() }})\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.elementary.edr_type_date"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.730763, "supported_languages": null}, "macro.elementary.bigquery__edr_cast_as_date": {"name": "bigquery__edr_cast_as_date", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/data_types/cast_column.sql", "original_file_path": "macros/utils/data_types/cast_column.sql", "unique_id": "macro.elementary.bigquery__edr_cast_as_date", "macro_sql": "\n{%- macro bigquery__edr_cast_as_date(timestamp_field) -%}\n cast({{ elementary.edr_cast_as_timestamp(timestamp_field) }} as {{ elementary.edr_type_date() }})\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.elementary.edr_cast_as_timestamp", "macro.elementary.edr_type_date"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.7310534, "supported_languages": null}, "macro.elementary.athena__edr_cast_as_date": {"name": "athena__edr_cast_as_date", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/data_types/cast_column.sql", "original_file_path": "macros/utils/data_types/cast_column.sql", "unique_id": "macro.elementary.athena__edr_cast_as_date", "macro_sql": "\n{%- macro athena__edr_cast_as_date(timestamp_field) -%}\n coalesce(\n try_cast({{ timestamp_field }} as {{ elementary.edr_type_date() }}),\n cast(from_iso8601_timestamp(cast({{ timestamp_field }} AS {{ elementary.edr_type_string() }})) AS {{ elementary.edr_type_date() }})\n )\n{%- endmacro -%}\n\n\n", "depends_on": {"macros": ["macro.elementary.edr_type_date", "macro.elementary.edr_type_string"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.7314534, "supported_languages": null}, "macro.elementary.const_as_text": {"name": "const_as_text", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/data_types/cast_column.sql", "original_file_path": "macros/utils/data_types/cast_column.sql", "unique_id": "macro.elementary.const_as_text", "macro_sql": "{%- macro const_as_text(string) -%}\n {{ return(adapter.dispatch('const_as_text', 'elementary')(string)) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.elementary.default__const_as_text"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.7317586, "supported_languages": null}, "macro.elementary.default__const_as_text": {"name": "default__const_as_text", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/data_types/cast_column.sql", "original_file_path": "macros/utils/data_types/cast_column.sql", "unique_id": "macro.elementary.default__const_as_text", "macro_sql": "{%- macro default__const_as_text(string) -%}\n {{ elementary.const_as_string(string) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.elementary.const_as_string"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.7319741, "supported_languages": null}, "macro.elementary.redshift__const_as_text": {"name": "redshift__const_as_text", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/data_types/cast_column.sql", "original_file_path": "macros/utils/data_types/cast_column.sql", "unique_id": "macro.elementary.redshift__const_as_text", "macro_sql": "{%- macro redshift__const_as_text(string) -%}\n '{{ string }}'::text\n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.732153, "supported_languages": null}, "macro.elementary.get_column_data_type": {"name": "get_column_data_type", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/data_types/get_column_data_type.sql", "original_file_path": "macros/utils/data_types/get_column_data_type.sql", "unique_id": "macro.elementary.get_column_data_type", "macro_sql": "{% macro get_column_data_type(column_relation) %}\n {% set data_type = adapter.dispatch('get_column_data_type','elementary')(column_relation) %}\n {{ return(data_type) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.default__get_column_data_type"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.7327483, "supported_languages": null}, "macro.elementary.default__get_column_data_type": {"name": "default__get_column_data_type", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/data_types/get_column_data_type.sql", "original_file_path": "macros/utils/data_types/get_column_data_type.sql", "unique_id": "macro.elementary.default__get_column_data_type", "macro_sql": "{% macro default__get_column_data_type(column_relation) %}\n {{return (column_relation[\"dtype\"]) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.7330246, "supported_languages": null}, "macro.elementary.bigquery__get_column_data_type": {"name": "bigquery__get_column_data_type", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/data_types/get_column_data_type.sql", "original_file_path": "macros/utils/data_types/get_column_data_type.sql", "unique_id": "macro.elementary.bigquery__get_column_data_type", "macro_sql": "{% macro bigquery__get_column_data_type(column_relation) %}\n {{return (column_relation[\"data_type\"]) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.7332826, "supported_languages": null}, "macro.elementary.data_type_list": {"name": "data_type_list", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/data_types/data_type_list.sql", "original_file_path": "macros/utils/data_types/data_type_list.sql", "unique_id": "macro.elementary.data_type_list", "macro_sql": "{% macro data_type_list(data_type) %}\n {% set result = adapter.dispatch('data_type_list','elementary')(data_type) %}\n {{ return(result) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.default__data_type_list"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.738612, "supported_languages": null}, "macro.elementary.default__data_type_list": {"name": "default__data_type_list", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/data_types/data_type_list.sql", "original_file_path": "macros/utils/data_types/data_type_list.sql", "unique_id": "macro.elementary.default__data_type_list", "macro_sql": "{% macro default__data_type_list(data_type) %}\n\n {% set string_list = ['character varying','varchar','character','char','text','nchar','bpchar','string'] | list %}\n {% set numeric_list = ['integer', 'bigint','smallint','decimal','numeric','real','double precision','enum','int2','int4','int','int8','float8','float'] | list %}\n {% set timestamp_list = ['date', 'timestamp','timestamptz','timestamp without time zone','timestamp with time zone'] | list %}\n\n {%- if data_type == 'string' %}\n {{ return(string_list) }}\n {%- elif data_type == 'numeric' %}\n {{ return(numeric_list) }}\n {%- elif data_type == 'timestamp' %}\n {{ return(timestamp_list) }}\n {%- else %}\n {{ return([]) }}\n {%- endif %}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.740224, "supported_languages": null}, "macro.elementary.bigquery__data_type_list": {"name": "bigquery__data_type_list", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/data_types/data_type_list.sql", "original_file_path": "macros/utils/data_types/data_type_list.sql", "unique_id": "macro.elementary.bigquery__data_type_list", "macro_sql": "{% macro bigquery__data_type_list(data_type) %}\n\n {% set string_list = ['STRING'] | list %}\n {% set numeric_list = ['INT64','NUMERIC','BIGNUMERIC','FLOAT64','INTEGER'] | list %}\n {% set timestamp_list = ['DATE','DATETIME','TIMESTAMP'] | list %}\n {% set boolean_list = [\"BOOL\", \"BOOLEAN\"] | list %}\n\n {%- if data_type == 'string' %}\n {{ return(string_list) }}\n {%- elif data_type == 'numeric' %}\n {{ return(numeric_list) }}\n {%- elif data_type == 'timestamp' %}\n {{ return(timestamp_list) }}\n {%- elif data_type == \"boolean\" %} \n {{ return(boolean_list) }}\n {%- else %}\n {{ return([]) }}\n {%- endif %}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.741651, "supported_languages": null}, "macro.elementary.snowflake__data_type_list": {"name": "snowflake__data_type_list", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/data_types/data_type_list.sql", "original_file_path": "macros/utils/data_types/data_type_list.sql", "unique_id": "macro.elementary.snowflake__data_type_list", "macro_sql": "{% macro snowflake__data_type_list(data_type) %}\n\n {% set string_list = ['VARCHAR','CHAR','CHARACTER','STRING','TEXT'] | list %}\n {% set numeric_list = ['NUMBER','DECIMAL','NUMERIC','INT','INTEGER','BIGINT','SMALLINT','TINYINT','BYTEINT','FLOAT','FLOAT4','FLOAT8','DOUBLE','DOUBLE PRECISION','REAL'] | list %}\n {% set timestamp_list = ['DATE','DATETIME','TIME','TIMESTAMP','TIMESTAMP_LTZ','TIMESTAMP_NTZ','TIMESTAMP_TZ'] | list %}\n\n {%- if data_type == 'string' %}\n {{ return(string_list) }}\n {%- elif data_type == 'numeric' %}\n {{ return(numeric_list) }}\n {%- elif data_type == 'timestamp' %}\n {{ return(timestamp_list) }}\n {%- else %}\n {{ return([]) }}\n {%- endif %}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.7431128, "supported_languages": null}, "macro.elementary.spark__data_type_list": {"name": "spark__data_type_list", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/data_types/data_type_list.sql", "original_file_path": "macros/utils/data_types/data_type_list.sql", "unique_id": "macro.elementary.spark__data_type_list", "macro_sql": "{% macro spark__data_type_list(data_type) %}\n\n {% set string_list = ['string'] | list %}\n {% set numeric_list = ['int','bigint','smallint','tinyint','float','double','long','short','decimal'] | list %}\n {% set timestamp_list = ['timestamp','date'] | list %}\n\n {%- if data_type == 'string' %}\n {{ return(string_list) }}\n {%- elif data_type == 'numeric' %}\n {{ return(numeric_list) }}\n {%- elif data_type == 'timestamp' %}\n {{ return(timestamp_list) }}\n {%- else %}\n {{ return([]) }}\n {%- endif %}\n \n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.7443116, "supported_languages": null}, "macro.elementary.athena__data_type_list": {"name": "athena__data_type_list", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/data_types/data_type_list.sql", "original_file_path": "macros/utils/data_types/data_type_list.sql", "unique_id": "macro.elementary.athena__data_type_list", "macro_sql": "{% macro athena__data_type_list(data_type) %}\n\n {% set string_list = ['string', 'varchar', 'char'] | list %}\n {% set numeric_list = ['int','integer','bigint','smallint','tinyint','float','real','double','decimal'] | list %}\n {% set timestamp_list = ['timestamp','date'] | list %}\n\n {%- if data_type == 'string' %}\n {{ return(string_list) }}\n {%- elif data_type == 'numeric' %}\n {{ return(numeric_list) }}\n {%- elif data_type == 'timestamp' %}\n {{ return(timestamp_list) }}\n {%- else %}\n {{ return([]) }}\n {%- endif %}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.7455812, "supported_languages": null}, "macro.elementary.run_query": {"name": "run_query", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/run_queries/run_query.sql", "original_file_path": "macros/utils/run_queries/run_query.sql", "unique_id": "macro.elementary.run_query", "macro_sql": "{% macro run_query(query, lowercase_column_names=True) %}\n {% set query_result = dbt.run_query(query) %}\n {% if lowercase_column_names %}\n {% set lowercased_column_names = {} %}\n {% for column_name in query_result.column_names %}\n {% do lowercased_column_names.update({column_name: column_name.lower()}) %}\n {% endfor %}\n {% set query_result = query_result.rename(lowercased_column_names) %}\n {% endif %}\n\n {% do return(query_result) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.7467678, "supported_languages": null}, "macro.elementary.result_column_to_list": {"name": "result_column_to_list", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/run_queries/result_column_to_list.sql", "original_file_path": "macros/utils/run_queries/result_column_to_list.sql", "unique_id": "macro.elementary.result_column_to_list", "macro_sql": "{% macro result_column_to_list(single_column_query) %}\n {% set query_result = elementary.run_query(single_column_query) %}\n {% do return(query_result.columns[0]) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.7472458, "supported_languages": null}, "macro.elementary.union_macro_queries": {"name": "union_macro_queries", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/run_queries/union_macro_queries.sql", "original_file_path": "macros/utils/run_queries/union_macro_queries.sql", "unique_id": "macro.elementary.union_macro_queries", "macro_sql": "{% macro union_macro_queries(param_list, query_macro) %}\n {% for param in param_list %}\n ({{ query_macro(param) }})\n {% if not loop.last %}\n union all\n {% endif %}\n {% endfor %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.7478127, "supported_languages": null}, "macro.elementary.result_value": {"name": "result_value", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/run_queries/result_value.sql", "original_file_path": "macros/utils/run_queries/result_value.sql", "unique_id": "macro.elementary.result_value", "macro_sql": "{% macro result_value(single_column_query) %}\n {% set result = elementary.run_query(single_column_query) %}\n {% if not result %}\n {% do return(none) %}\n {% endif %}\n {% do return(result[0][0]) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.7485647, "supported_languages": null}, "macro.elementary.render_run_query": {"name": "render_run_query", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/run_queries/render_run_query.sql", "original_file_path": "macros/utils/run_queries/render_run_query.sql", "unique_id": "macro.elementary.render_run_query", "macro_sql": "{% macro render_run_query(prerendered_query) %}\n {% set results = elementary.run_query(render(prerendered_query)) %}\n {% do return(elementary.agate_to_dicts(results)) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.run_query", "macro.elementary.agate_to_dicts"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.7490764, "supported_languages": null}, "macro.elementary.agate_to_dicts": {"name": "agate_to_dicts", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/run_queries/agate_to_dicts.sql", "original_file_path": "macros/utils/run_queries/agate_to_dicts.sql", "unique_id": "macro.elementary.agate_to_dicts", "macro_sql": "{% macro agate_to_dicts(agate_table) %}\n {% set column_types = agate_table.column_types %}\n {% set serializable_rows = [] %}\n {% for agate_row in agate_table.rows %}\n {% set serializable_row = {} %}\n {% for col_name, col_value in agate_row.items() %}\n {% set serializable_col_value = column_types[loop.index0].jsonify(col_value) %}\n {% set serializable_col_name = col_name | lower %}\n {% do serializable_row.update({serializable_col_name: serializable_col_value}) %}\n {% endfor %}\n {% do serializable_rows.append(serializable_row) %}\n {% endfor %}\n {{ return(serializable_rows) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.7506115, "supported_languages": null}, "macro.elementary.agate_to_json": {"name": "agate_to_json", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/run_queries/agate_to_json.sql", "original_file_path": "macros/utils/run_queries/agate_to_json.sql", "unique_id": "macro.elementary.agate_to_json", "macro_sql": "{% macro agate_to_json(agate_table) %}\n {% set serializable_rows = elementary.agate_to_dicts(agate_table) %}\n {{ return(tojson(serializable_rows)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.agate_to_dicts"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.751057, "supported_languages": null}, "macro.elementary.list_concat_with_separator": {"name": "list_concat_with_separator", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/sql_utils/list_concat_with_separator.sql", "original_file_path": "macros/utils/sql_utils/list_concat_with_separator.sql", "unique_id": "macro.elementary.list_concat_with_separator", "macro_sql": "{% macro list_concat_with_separator(item_list, separator, handle_nulls = true) %}\n {% set new_list = [] %}\n {% for item in item_list %}\n {% set new_item = elementary.edr_quote(item) %}\n {% if handle_nulls %}\n {% set new_item = \"case when \" ~ elementary.edr_cast_as_string(item) ~ \" is null then 'NULL' else \" ~ elementary.edr_cast_as_string(item) ~ \" end\" %}\n {% endif %}\n {% do new_list.append(new_item) %}\n {% if not loop.last %}\n {% do new_list.append(elementary.edr_quote(separator)) %}\n {% endif %}\n {% endfor %}\n {{ return(elementary.join_list(new_list, \" || \")) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.edr_quote", "macro.elementary.edr_cast_as_string", "macro.elementary.join_list"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.752664, "supported_languages": null}, "macro.elementary.escape_select": {"name": "escape_select", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/sql_utils/escape_select.sql", "original_file_path": "macros/utils/sql_utils/escape_select.sql", "unique_id": "macro.elementary.escape_select", "macro_sql": "{% macro escape_select(column_names) %}\n {% do return(adapter.dispatch('escape_select', 'elementary')(column_names)) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.default__escape_select"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.753218, "supported_languages": null}, "macro.elementary.default__escape_select": {"name": "default__escape_select", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/sql_utils/escape_select.sql", "original_file_path": "macros/utils/sql_utils/escape_select.sql", "unique_id": "macro.elementary.default__escape_select", "macro_sql": "{% macro default__escape_select(column_names) %}\n {% do return(column_names | join(',')) %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.753504, "supported_languages": null}, "macro.elementary.redshift__escape_select": {"name": "redshift__escape_select", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/sql_utils/escape_select.sql", "original_file_path": "macros/utils/sql_utils/escape_select.sql", "unique_id": "macro.elementary.redshift__escape_select", "macro_sql": "{% macro redshift__escape_select(column_names) %}\n {% do return('\\\"' + column_names | join('\\\", \\\"') + '\\\"') %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.7538288, "supported_languages": null}, "macro.elementary.to_sql_list": {"name": "to_sql_list", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/sql_utils/to_sql_list.sql", "original_file_path": "macros/utils/sql_utils/to_sql_list.sql", "unique_id": "macro.elementary.to_sql_list", "macro_sql": "{% macro to_sql_list(ls) %}\n {% set rendered_items = [] %}\n {% for item in ls %}\n {% do rendered_items.append(elementary.render_value(item)) %}\n {% endfor %}\n\n({{ rendered_items | join(', ') }})\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.render_value"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.7545133, "supported_languages": null}, "macro.elementary.arithmetic_max": {"name": "arithmetic_max", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/sql_utils/min_max.sql", "original_file_path": "macros/utils/sql_utils/min_max.sql", "unique_id": "macro.elementary.arithmetic_max", "macro_sql": "{% macro arithmetic_max(val1, val2) %}\n (0.5 * ({{ val1 }} + {{ val2 }} + abs({{ val1 }} - {{ val2 }})))\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.754978, "supported_languages": null}, "macro.elementary.arithmetic_min": {"name": "arithmetic_min", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/sql_utils/min_max.sql", "original_file_path": "macros/utils/sql_utils/min_max.sql", "unique_id": "macro.elementary.arithmetic_min", "macro_sql": "{% macro arithmetic_min(val1, val2) %}\n (0.5 * ({{ val1 }} + {{ val2 }} - abs({{ val1 }} - {{ val2 }})))\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.7552772, "supported_languages": null}, "macro.elementary.get_profile_creation_query": {"name": "get_profile_creation_query", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/cross_db_utils/get_profile_creation_query.sql", "original_file_path": "macros/utils/cross_db_utils/get_profile_creation_query.sql", "unique_id": "macro.elementary.get_profile_creation_query", "macro_sql": "{% macro get_profile_creation_query(parameters) %}\n {% do return(adapter.dispatch(\"get_profile_creation_query\", \"elementary\")(parameters)) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.postgres__get_profile_creation_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.7580945, "supported_languages": null}, "macro.elementary.snowflake__get_profile_creation_query": {"name": "snowflake__get_profile_creation_query", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/cross_db_utils/get_profile_creation_query.sql", "original_file_path": "macros/utils/cross_db_utils/get_profile_creation_query.sql", "unique_id": "macro.elementary.snowflake__get_profile_creation_query", "macro_sql": "{% macro snowflake__get_profile_creation_query(parameters) %}\n-- Set credentials as variables\nSET elementary_database = '{{ parameters[\"database\"] }}';\nSET elementary_schema = '{{ parameters[\"schema\"] }}';\nSET elementary_warehouse = '{{ parameters[\"warehouse\"] }}';\nSET elementary_role = '{{ parameters[\"role\"] }}';\nSET elementary_username = '{{ parameters[\"user\"] }}';\nSET elementary_password = '{{ parameters[\"password\"] }}';\n\n-- Account admin role required to set up permissions below\nUSE ROLE ACCOUNTADMIN;\n\n-- Create elementary user and role\nCREATE OR REPLACE USER IDENTIFIER($elementary_username) PASSWORD = $elementary_password;\nCREATE OR REPLACE ROLE IDENTIFIER($elementary_role);\nGRANT ROLE IDENTIFIER($elementary_role) TO USER IDENTIFIER($elementary_username);\n\n-- Grant elementary role access to the supplied warehouse\nGRANT USAGE ON WAREHOUSE IDENTIFIER($elementary_warehouse) TO ROLE IDENTIFIER($elementary_role);\n\n-- Read access to elementary schema\nSET elementary_schema_fqn = $elementary_database || '.' || $elementary_schema;\nGRANT SELECT ON ALL TABLES IN SCHEMA IDENTIFIER($elementary_schema_fqn) TO ROLE IDENTIFIER($elementary_role);\nGRANT SELECT ON FUTURE TABLES IN SCHEMA IDENTIFIER($elementary_schema_fqn) TO ROLE IDENTIFIER($elementary_role);\nGRANT SELECT ON ALL VIEWS IN SCHEMA IDENTIFIER($elementary_schema_fqn) TO ROLE IDENTIFIER($elementary_role);\nGRANT SELECT ON FUTURE VIEWS IN SCHEMA IDENTIFIER($elementary_schema_fqn) TO ROLE IDENTIFIER($elementary_role);\n\n-- Information schema access\nCREATE OR REPLACE PROCEDURE ELEMENTARY_GRANT_INFO_SCHEMA_ACCESS(database_name STRING, role_name STRING)\n RETURNS VARCHAR\n LANGUAGE SQL\n AS\n $$\n BEGIN\n GRANT USAGE,MONITOR ON DATABASE IDENTIFIER(:database_name) TO ROLE IDENTIFIER(:role_name);\n GRANT USAGE,MONITOR ON ALL SCHEMAS IN DATABASE IDENTIFIER(:database_name) TO ROLE IDENTIFIER(:role_name);\n GRANT USAGE,MONITOR ON FUTURE SCHEMAS IN DATABASE IDENTIFIER(:database_name) TO ROLE IDENTIFIER(:role_name);\n\n GRANT REFERENCES ON ALL TABLES IN DATABASE IDENTIFIER(:database_name) TO ROLE IDENTIFIER(:role_name);\n GRANT REFERENCES ON ALL VIEWS IN DATABASE IDENTIFIER(:database_name) TO ROLE IDENTIFIER(:role_name);\n GRANT REFERENCES ON ALL EXTERNAL TABLES IN DATABASE IDENTIFIER(:database_name) TO ROLE IDENTIFIER(:role_name);\n\n GRANT REFERENCES ON FUTURE TABLES IN DATABASE IDENTIFIER(:database_name) TO ROLE IDENTIFIER(:role_name);\n GRANT REFERENCES ON FUTURE VIEWS IN DATABASE IDENTIFIER(:database_name) TO ROLE IDENTIFIER(:role_name);\n GRANT REFERENCES ON FUTURE EXTERNAL TABLES IN DATABASE IDENTIFIER(:database_name) TO ROLE IDENTIFIER(:role_name);\n END;\n $$\n;\n\n{%- set databases = elementary.get_configured_databases_from_graph()%}\n{% for database in databases %}\n{#\n 'snowflake' database is excluded because it does not support granting individual privileges (we ask for relevant access to it\n via the database roles below)\n see: https://docs.snowflake.com/en/sql-reference/account-usage#enabling-the-snowflake-database-usage-for-other-roles\n#}\n {%- if database | lower != 'snowflake' -%}\nCALL ELEMENTARY_GRANT_INFO_SCHEMA_ACCESS('{{ database }}', $elementary_role);\n {%- endif -%}\n{% endfor %}\n\n-- Query history access\nCREATE OR REPLACE PROCEDURE ELEMENTARY_GRANT_QUERY_HISTORY_ACCESS(role_name STRING)\n RETURNS VARCHAR\n LANGUAGE SQL\n AS\n $$\n BEGIN\n GRANT DATABASE ROLE SNOWFLAKE.OBJECT_VIEWER TO ROLE IDENTIFIER(:role_name);\n GRANT DATABASE ROLE SNOWFLAKE.USAGE_VIEWER TO ROLE IDENTIFIER(:role_name);\n GRANT DATABASE ROLE SNOWFLAKE.GOVERNANCE_VIEWER TO ROLE IDENTIFIER(:role_name);\n\n LET warehouses_rs RESULTSET := (SHOW WAREHOUSES);\n LET warehouses_cur CURSOR FOR warehouses_rs;\n FOR warehouse_row IN warehouses_cur DO\n LET warehouse_name VARCHAR := warehouse_row.\"name\";\n GRANT MONITOR ON WAREHOUSE IDENTIFIER(:warehouse_name) TO ROLE IDENTIFIER(:role_name);\n END FOR;\n END;\n $$\n;\nCALL ELEMENTARY_GRANT_QUERY_HISTORY_ACCESS($elementary_role);\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.get_configured_databases_from_graph"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.7595527, "supported_languages": null}, "macro.elementary.redshift__get_profile_creation_query": {"name": "redshift__get_profile_creation_query", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/cross_db_utils/get_profile_creation_query.sql", "original_file_path": "macros/utils/cross_db_utils/get_profile_creation_query.sql", "unique_id": "macro.elementary.redshift__get_profile_creation_query", "macro_sql": "{% macro redshift__get_profile_creation_query(parameters) %}\n-- Create redshift user with unrestricted access to query history (allows Elementary to see queries generated by\n-- any user)\nCREATE USER {{ parameters[\"user\"] }} WITH PASSWORD '{{ parameters[\"password\"] }}' SYSLOG ACCESS UNRESTRICTED;\n\n-- Grant read access to the Elementary schema\nGRANT USAGE ON SCHEMA {{ parameters[\"schema\"] }} TO {{ parameters[\"user\"] }};\nGRANT SELECT ON ALL TABLES IN SCHEMA {{ parameters[\"schema\"] }} TO {{ parameters[\"user\"] }};\nALTER DEFAULT PRIVILEGES IN SCHEMA {{ parameters[\"schema\"] }} GRANT SELECT ON TABLES TO {{ parameters[\"user\"] }};\n\n-- Grant metadata access to tables in the warehouse\nGRANT SELECT ON svv_table_info to {{ parameters[\"user\"] }};\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.7603376, "supported_languages": null}, "macro.elementary.postgres__get_profile_creation_query": {"name": "postgres__get_profile_creation_query", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/cross_db_utils/get_profile_creation_query.sql", "original_file_path": "macros/utils/cross_db_utils/get_profile_creation_query.sql", "unique_id": "macro.elementary.postgres__get_profile_creation_query", "macro_sql": "{% macro postgres__get_profile_creation_query(parameters) %}\n-- Create postgres user\nCREATE USER {{ parameters[\"user\"] }} WITH PASSWORD '{{ parameters[\"password\"] }}';\n\n-- Grant read access to the Elementary schema\nGRANT USAGE ON SCHEMA {{ parameters[\"schema\"] }} TO {{ parameters[\"user\"] }};\nGRANT SELECT ON ALL TABLES IN SCHEMA {{ parameters[\"schema\"] }} TO {{ parameters[\"user\"] }};\nALTER DEFAULT PRIVILEGES IN SCHEMA {{ parameters[\"schema\"] }} GRANT SELECT ON TABLES TO {{ parameters[\"user\"] }};\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.7610388, "supported_languages": null}, "macro.elementary.default__get_profile_creation_query": {"name": "default__get_profile_creation_query", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/cross_db_utils/get_profile_creation_query.sql", "original_file_path": "macros/utils/cross_db_utils/get_profile_creation_query.sql", "unique_id": "macro.elementary.default__get_profile_creation_query", "macro_sql": "{% macro default__get_profile_creation_query(parameters) %}\n {% do exceptions.raise_compiler_error('User creation not supported through sql using ' ~ target.type) %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.7613268, "supported_languages": null}, "macro.elementary.target_database": {"name": "target_database", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/cross_db_utils/target_database.sql", "original_file_path": "macros/utils/cross_db_utils/target_database.sql", "unique_id": "macro.elementary.target_database", "macro_sql": "{% macro target_database() -%}\n {{ return(adapter.dispatch('target_database', 'elementary')()) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.elementary.default__target_database"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.7619786, "supported_languages": null}, "macro.elementary.default__target_database": {"name": "default__target_database", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/cross_db_utils/target_database.sql", "original_file_path": "macros/utils/cross_db_utils/target_database.sql", "unique_id": "macro.elementary.default__target_database", "macro_sql": "{% macro default__target_database() %}\n {% do return(target.dbname) %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.7622073, "supported_languages": null}, "macro.elementary.spark__target_database": {"name": "spark__target_database", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/cross_db_utils/target_database.sql", "original_file_path": "macros/utils/cross_db_utils/target_database.sql", "unique_id": "macro.elementary.spark__target_database", "macro_sql": "{% macro spark__target_database() %}\n {% do return(target.catalog or none) %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.7624624, "supported_languages": null}, "macro.elementary.snowflake__target_database": {"name": "snowflake__target_database", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/cross_db_utils/target_database.sql", "original_file_path": "macros/utils/cross_db_utils/target_database.sql", "unique_id": "macro.elementary.snowflake__target_database", "macro_sql": "{% macro snowflake__target_database() %}\n {% do return(target.database) %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.76269, "supported_languages": null}, "macro.elementary.bigquery__target_database": {"name": "bigquery__target_database", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/cross_db_utils/target_database.sql", "original_file_path": "macros/utils/cross_db_utils/target_database.sql", "unique_id": "macro.elementary.bigquery__target_database", "macro_sql": "{% macro bigquery__target_database() %}\n {% do return(target.project) %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.7629216, "supported_languages": null}, "macro.elementary.athena__target_database": {"name": "athena__target_database", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/cross_db_utils/target_database.sql", "original_file_path": "macros/utils/cross_db_utils/target_database.sql", "unique_id": "macro.elementary.athena__target_database", "macro_sql": "{% macro athena__target_database() %}\n {% do return(target.database) %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.76315, "supported_languages": null}, "macro.elementary.edr_time_trunc": {"name": "edr_time_trunc", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/cross_db_utils/time_trunc.sql", "original_file_path": "macros/utils/cross_db_utils/time_trunc.sql", "unique_id": "macro.elementary.edr_time_trunc", "macro_sql": "{% macro edr_time_trunc(date_part, date_expression) -%}\n {{ return(adapter.dispatch('edr_time_trunc', 'elementary') (date_part, date_expression)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.elementary.default__edr_time_trunc"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.7637403, "supported_languages": null}, "macro.elementary.default__edr_time_trunc": {"name": "default__edr_time_trunc", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/cross_db_utils/time_trunc.sql", "original_file_path": "macros/utils/cross_db_utils/time_trunc.sql", "unique_id": "macro.elementary.default__edr_time_trunc", "macro_sql": "{% macro default__edr_time_trunc(date_part, date_expression) %}\n date_trunc('{{date_part}}', cast({{ date_expression }} as {{ elementary.edr_type_timestamp() }}))\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.edr_type_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.764035, "supported_languages": null}, "macro.elementary.bigquery__edr_time_trunc": {"name": "bigquery__edr_time_trunc", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/cross_db_utils/time_trunc.sql", "original_file_path": "macros/utils/cross_db_utils/time_trunc.sql", "unique_id": "macro.elementary.bigquery__edr_time_trunc", "macro_sql": "{% macro bigquery__edr_time_trunc(date_part, date_expression) %}\n timestamp_trunc(cast({{ date_expression }} as timestamp), {{ date_part }})\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.7642655, "supported_languages": null}, "macro.elementary.generate_elementary_profile_args": {"name": "generate_elementary_profile_args", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/cross_db_utils/generate_elementary_profile_args.sql", "original_file_path": "macros/utils/cross_db_utils/generate_elementary_profile_args.sql", "unique_id": "macro.elementary.generate_elementary_profile_args", "macro_sql": "{% macro generate_elementary_profile_args(method=none, overwrite_values=none) %}\n {#\n Returns a list of parameters for elementary profile.\n Each parameter consists of a dict consisting of: \n name\n value\n comment\n #}\n {% set elementary_database, elementary_schema = elementary.get_package_database_and_schema() %}\n {% set parameters = adapter.dispatch('generate_elementary_profile_args', 'elementary')(method, elementary_database, elementary_schema) %}\n {% if overwrite_values %}\n {% for parameter in parameters %}\n {% if parameter[\"name\"] in overwrite_values %}\n {% do parameter.update({\"value\": overwrite_values[parameter[\"name\"]]}) %}\n {% endif %}\n {% endfor %}\n {% endif %}\n {% do return(parameters) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.get_package_database_and_schema", "macro.elementary.postgres__generate_elementary_profile_args"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.7706985, "supported_languages": null}, "macro.elementary._parameter": {"name": "_parameter", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/cross_db_utils/generate_elementary_profile_args.sql", "original_file_path": "macros/utils/cross_db_utils/generate_elementary_profile_args.sql", "unique_id": "macro.elementary._parameter", "macro_sql": "{% macro _parameter(name, value, comment=none) %}\n {% do return({\"name\": name, \"value\": value, \"comment\": comment}) %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.7711415, "supported_languages": null}, "macro.elementary.snowflake__generate_elementary_profile_args": {"name": "snowflake__generate_elementary_profile_args", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/cross_db_utils/generate_elementary_profile_args.sql", "original_file_path": "macros/utils/cross_db_utils/generate_elementary_profile_args.sql", "unique_id": "macro.elementary.snowflake__generate_elementary_profile_args", "macro_sql": "{% macro snowflake__generate_elementary_profile_args(method, elementary_database, elementary_schema) %}\n {% do return([\n _parameter(\"type\", target.type),\n _parameter(\"account\", target.account),\n _parameter(\"user\", target.user),\n _parameter(\"password\", \"\"),\n _parameter(\"role\", target.role),\n _parameter(\"warehouse\", target.warehouse),\n _parameter(\"database\", elementary_database),\n _parameter(\"schema\", elementary_schema),\n _parameter(\"threads\", target.threads),\n ]) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary._parameter"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.772146, "supported_languages": null}, "macro.elementary.bigquery__generate_elementary_profile_args": {"name": "bigquery__generate_elementary_profile_args", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/cross_db_utils/generate_elementary_profile_args.sql", "original_file_path": "macros/utils/cross_db_utils/generate_elementary_profile_args.sql", "unique_id": "macro.elementary.bigquery__generate_elementary_profile_args", "macro_sql": "{% macro bigquery__generate_elementary_profile_args(method, elementary_database, elementary_schema) %}\n {% set parameters = [\n _parameter(\"type\", target.type),\n _parameter(\"project\", elementary_database),\n _parameter(\"dataset\", elementary_schema)\n ] %}\n {% if method == 'service-account' %}\n {% do parameters.append(_parameter(\"method\", \"service-account\")) %}\n {% do parameters.append(_parameter(\"keyfile\", \"\")) %}\n {% elif method == \"github-actions\" %}\n {% do parameters.append(_parameter(\"method\", \"service-account\")) %}\n {% do parameters.append(_parameter(\"keyfile\", \"/tmp/bigquery_keyfile.json\", \"Do not change this, supply `bigquery-keyfile` in `.github/workflows/elementary.yml`\")) %}\n {% else %}\n {% do parameters.append(_parameter(\"method\", \"\", \"Configure your auth method and add the required fields according to https://docs.getdbt.com/reference/warehouse-setups/bigquery-setup#authentication-methods\")) %}\n {% endif %}\n {% do parameters.append(_parameter(\"threads\", target.threads)) %}\n {% do return(parameters) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary._parameter"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.7740424, "supported_languages": null}, "macro.elementary.postgres__generate_elementary_profile_args": {"name": "postgres__generate_elementary_profile_args", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/cross_db_utils/generate_elementary_profile_args.sql", "original_file_path": "macros/utils/cross_db_utils/generate_elementary_profile_args.sql", "unique_id": "macro.elementary.postgres__generate_elementary_profile_args", "macro_sql": "{% macro postgres__generate_elementary_profile_args(method, elementary_database, elementary_schema) %}\n {% do return([\n _parameter(\"type\", target.type),\n _parameter(\"host\", target.host),\n _parameter(\"port\", target.port),\n _parameter(\"user\", target.user),\n _parameter(\"password\", \"\"),\n _parameter(\"dbname\", elementary_database),\n _parameter(\"schema\", elementary_schema),\n _parameter(\"threads\", target.threads),\n ]) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary._parameter"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.7749722, "supported_languages": null}, "macro.elementary.databricks__generate_elementary_profile_args": {"name": "databricks__generate_elementary_profile_args", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/cross_db_utils/generate_elementary_profile_args.sql", "original_file_path": "macros/utils/cross_db_utils/generate_elementary_profile_args.sql", "unique_id": "macro.elementary.databricks__generate_elementary_profile_args", "macro_sql": "{% macro databricks__generate_elementary_profile_args(method, elementary_database, elementary_schema) %}\n {% set parameters = [\n _parameter(\"type\", target.type),\n _parameter(\"host\", target.host),\n _parameter(\"http_path\", target.http_path),\n ] %}\n {% if elementary_database %}\n {% do parameters.append(_parameter(\"catalog\", elementary_database)) %}\n {% endif %}\n {% do parameters.extend([\n _parameter(\"schema\", elementary_schema),\n _parameter(\"token\", \"\"),\n _parameter(\"threads\", target.threads),\n ]) %}\n {% do return(parameters) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary._parameter"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.7761328, "supported_languages": null}, "macro.elementary.spark__generate_elementary_profile_args": {"name": "spark__generate_elementary_profile_args", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/cross_db_utils/generate_elementary_profile_args.sql", "original_file_path": "macros/utils/cross_db_utils/generate_elementary_profile_args.sql", "unique_id": "macro.elementary.spark__generate_elementary_profile_args", "macro_sql": "{% macro spark__generate_elementary_profile_args(method, elementary_database, elementary_schema) %}\n {% set parameters = [\n _parameter(\"type\", target.type),\n _parameter(\"host\", target.host),\n _parameter(\"http_path\", \"\")\n ] %}\n {% if elementary_database %}\n {% do parameters.append(_parameter(\"catalog\", elementary_database)) %}\n {% endif %}\n {% do parameters.extend([\n _parameter(\"schema\", elementary_schema),\n _parameter(\"token\", \"\"),\n _parameter(\"threads\", target.threads),\n ]) %}\n {% do return(parameters) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary._parameter"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.7772973, "supported_languages": null}, "macro.elementary.athena__generate_elementary_cli_profile": {"name": "athena__generate_elementary_cli_profile", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/cross_db_utils/generate_elementary_profile_args.sql", "original_file_path": "macros/utils/cross_db_utils/generate_elementary_profile_args.sql", "unique_id": "macro.elementary.athena__generate_elementary_cli_profile", "macro_sql": "{% macro athena__generate_elementary_cli_profile(method, elementary_database, elementary_schema) %}\n {% set parameters = [\n _parameter(\"type\", target.type),\n _parameter(\"s3_staging_dir\", target.s3_staging_dir),\n _parameter(\"region_name\", target.region_name),\n _parameter(\"database\", target.database),\n _parameter(\"aws_profile_name\", target.aws_profile_name),\n _parameter(\"work_group\", target.work_group),\n _parameter(\"aws_access_key_id\", \"\"),\n _parameter(\"aws_secret_access_key\", \"\"),\n ] %}\n\n {% if elementary_database %}\n {% do parameters.append(_parameter(\"catalog\", elementary_database)) %}\n {% endif %}\n\n {% do parameters.extend([\n _parameter(\"schema\", elementary_schema),\n _parameter(\"token\", \"\"),\n _parameter(\"threads\", target.threads),\n ]) %}\n {% do return(parameters) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary._parameter"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.778851, "supported_languages": null}, "macro.elementary.default__generate_elementary_profile_args": {"name": "default__generate_elementary_profile_args", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/cross_db_utils/generate_elementary_profile_args.sql", "original_file_path": "macros/utils/cross_db_utils/generate_elementary_profile_args.sql", "unique_id": "macro.elementary.default__generate_elementary_profile_args", "macro_sql": "{% macro default__generate_elementary_profile_args(method, elementary_database, elementary_schema) %}\nAdapter \"{{ target.type }}\" is not supported on Elementary.\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.779093, "supported_languages": null}, "macro.elementary.edr_to_char": {"name": "edr_to_char", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/cross_db_utils/to_char.sql", "original_file_path": "macros/utils/cross_db_utils/to_char.sql", "unique_id": "macro.elementary.edr_to_char", "macro_sql": "{% macro edr_to_char(column, format) -%}\n {{ return(adapter.dispatch('edr_to_char', 'elementary')(column, format)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.elementary.default__edr_to_char"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.7798414, "supported_languages": null}, "macro.elementary.default__edr_to_char": {"name": "default__edr_to_char", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/cross_db_utils/to_char.sql", "original_file_path": "macros/utils/cross_db_utils/to_char.sql", "unique_id": "macro.elementary.default__edr_to_char", "macro_sql": "{% macro default__edr_to_char(column, format) %}\n to_char({{ column }} {%- if format %}, '{{ format }}'){%- else %}, 'YYYY-MM-DD HH:MI:SS'){%- endif %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.7801862, "supported_languages": null}, "macro.elementary.bigquery__edr_to_char": {"name": "bigquery__edr_to_char", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/cross_db_utils/to_char.sql", "original_file_path": "macros/utils/cross_db_utils/to_char.sql", "unique_id": "macro.elementary.bigquery__edr_to_char", "macro_sql": "{% macro bigquery__edr_to_char(column, format) %}\n cast({{ column }} as STRING {%- if format %} FORMAT '{{ format }}'){%- else %}){%- endif %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.7805278, "supported_languages": null}, "macro.elementary.spark__edr_to_char": {"name": "spark__edr_to_char", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/cross_db_utils/to_char.sql", "original_file_path": "macros/utils/cross_db_utils/to_char.sql", "unique_id": "macro.elementary.spark__edr_to_char", "macro_sql": "{% macro spark__edr_to_char(column, format) %}\n date_format({{ column }} {%- if format %}, '{{ format }}'){%- else %}, 'YYYY-MM-DD HH:MI:SS'){%- endif %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.7808874, "supported_languages": null}, "macro.elementary.edr_hour_of_week_expression": {"name": "edr_hour_of_week_expression", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/cross_db_utils/hour_of_week.sql", "original_file_path": "macros/utils/cross_db_utils/hour_of_week.sql", "unique_id": "macro.elementary.edr_hour_of_week_expression", "macro_sql": "{% macro edr_hour_of_week_expression(date_expr) %}\n {{ return(adapter.dispatch('edr_hour_of_week_expression','elementary')(elementary.edr_cast_as_timestamp(date_expr))) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.postgres__edr_hour_of_week_expression", "macro.elementary.edr_cast_as_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.782309, "supported_languages": null}, "macro.elementary.default__edr_hour_of_week_expression": {"name": "default__edr_hour_of_week_expression", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/cross_db_utils/hour_of_week.sql", "original_file_path": "macros/utils/cross_db_utils/hour_of_week.sql", "unique_id": "macro.elementary.default__edr_hour_of_week_expression", "macro_sql": "{% macro default__edr_hour_of_week_expression(date_expr) %}\n concat(cast(DATE_FORMAT({{ date_expr }}, 'EEEE') as {{ elementary.edr_type_string() }}), cast(HOUR({{ date_expr }}) as {{ elementary.edr_type_string() }}))\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.edr_type_string"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.7826507, "supported_languages": null}, "macro.elementary.bigquery__edr_hour_of_week_expression": {"name": "bigquery__edr_hour_of_week_expression", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/cross_db_utils/hour_of_week.sql", "original_file_path": "macros/utils/cross_db_utils/hour_of_week.sql", "unique_id": "macro.elementary.bigquery__edr_hour_of_week_expression", "macro_sql": "{% macro bigquery__edr_hour_of_week_expression(date_expr) %}\n concat(cast(FORMAT_DATE('%A', {{ date_expr }}) as {{ elementary.edr_type_string() }}), cast(EXTRACT(hour from {{ date_expr }}) as {{ elementary.edr_type_string() }}))\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.edr_type_string"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.7829874, "supported_languages": null}, "macro.elementary.postgres__edr_hour_of_week_expression": {"name": "postgres__edr_hour_of_week_expression", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/cross_db_utils/hour_of_week.sql", "original_file_path": "macros/utils/cross_db_utils/hour_of_week.sql", "unique_id": "macro.elementary.postgres__edr_hour_of_week_expression", "macro_sql": "{% macro postgres__edr_hour_of_week_expression(date_expr) %}\n concat(cast(to_char({{ date_expr }}, 'Day') as {{ elementary.edr_type_string() }}), cast(EXTRACT(hour from {{ date_expr }}) as {{ elementary.edr_type_string() }}))\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.edr_type_string"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.7833257, "supported_languages": null}, "macro.elementary.redshift__edr_hour_of_week_expression": {"name": "redshift__edr_hour_of_week_expression", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/cross_db_utils/hour_of_week.sql", "original_file_path": "macros/utils/cross_db_utils/hour_of_week.sql", "unique_id": "macro.elementary.redshift__edr_hour_of_week_expression", "macro_sql": "{% macro redshift__edr_hour_of_week_expression(date_expr) %}\n concat(trim(' ' FROM to_char({{ date_expr }}, 'Day')), cast(EXTRACT(hour from {{ date_expr }}) as {{ elementary.edr_type_string() }}))\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.edr_type_string"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.7836032, "supported_languages": null}, "macro.elementary.snowflake__edr_hour_of_week_expression": {"name": "snowflake__edr_hour_of_week_expression", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/cross_db_utils/hour_of_week.sql", "original_file_path": "macros/utils/cross_db_utils/hour_of_week.sql", "unique_id": "macro.elementary.snowflake__edr_hour_of_week_expression", "macro_sql": "{% macro snowflake__edr_hour_of_week_expression(date_expr) %}\n concat(cast(DECODE (EXTRACT('dayofweek',{{ date_expr }}),\n 1 , 'Monday',\n 2 , 'Tuesday',\n 3 , 'Wednesday',\n 4 , 'Thursday',\n 5 , 'Friday',\n 6 , 'Saturday',\n 0 , 'Sunday'\n ) as {{ elementary.edr_type_string() }}), cast(HOUR({{ date_expr }}) as {{ elementary.edr_type_string() }}))\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.edr_type_string"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.7839608, "supported_languages": null}, "macro.elementary.athena__edr_hour_of_week_expression": {"name": "athena__edr_hour_of_week_expression", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/cross_db_utils/hour_of_week.sql", "original_file_path": "macros/utils/cross_db_utils/hour_of_week.sql", "unique_id": "macro.elementary.athena__edr_hour_of_week_expression", "macro_sql": "{% macro athena__edr_hour_of_week_expression(date_expr) %}\n DATE_FORMAT({{ date_expr }}, '%W%H')\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.7841406, "supported_languages": null}, "macro.elementary.edr_safe_cast": {"name": "edr_safe_cast", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/cross_db_utils/safe_cast.sql", "original_file_path": "macros/utils/cross_db_utils/safe_cast.sql", "unique_id": "macro.elementary.edr_safe_cast", "macro_sql": "{% macro edr_safe_cast(field, type) %}\n {{ return(adapter.dispatch('edr_safe_cast', 'elementary') (field, type)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.default__edr_safe_cast"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.7847698, "supported_languages": null}, "macro.elementary.default__edr_safe_cast": {"name": "default__edr_safe_cast", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/cross_db_utils/safe_cast.sql", "original_file_path": "macros/utils/cross_db_utils/safe_cast.sql", "unique_id": "macro.elementary.default__edr_safe_cast", "macro_sql": "{% macro default__edr_safe_cast(field, type) %}\n {% set macro = dbt.safe_cast or dbt_utils.safe_cast %}\n {% if not macro %}\n {{ exceptions.raise_compiler_error(\"Did not find a `safe_cast` macro.\") }}\n {% endif %}\n {{ return(macro(field, type)) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.7853825, "supported_languages": null}, "macro.elementary.spark__edr_safe_cast": {"name": "spark__edr_safe_cast", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/cross_db_utils/safe_cast.sql", "original_file_path": "macros/utils/cross_db_utils/safe_cast.sql", "unique_id": "macro.elementary.spark__edr_safe_cast", "macro_sql": "{% macro spark__edr_safe_cast(field, type) %}\n try_cast({{field}} as {{type}})\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.785626, "supported_languages": null}, "macro.elementary.edr_timeadd": {"name": "edr_timeadd", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/cross_db_utils/timeadd.sql", "original_file_path": "macros/utils/cross_db_utils/timeadd.sql", "unique_id": "macro.elementary.edr_timeadd", "macro_sql": "{% macro edr_timeadd(date_part, number, timestamp_expression) -%}\n {{ return(adapter.dispatch('edr_timeadd', 'elementary')(date_part, number, timestamp_expression)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.elementary.postgres__edr_timeadd"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.787156, "supported_languages": null}, "macro.elementary.default__edr_timeadd": {"name": "default__edr_timeadd", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/cross_db_utils/timeadd.sql", "original_file_path": "macros/utils/cross_db_utils/timeadd.sql", "unique_id": "macro.elementary.default__edr_timeadd", "macro_sql": "{% macro default__edr_timeadd(date_part, number, timestamp_expression) %}\n dateadd({{ date_part }}, {{ elementary.edr_cast_as_int(number) }}, {{ elementary.edr_cast_as_timestamp(timestamp_expression) }})\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.edr_cast_as_int", "macro.elementary.edr_cast_as_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.7875369, "supported_languages": null}, "macro.elementary.bigquery__edr_timeadd": {"name": "bigquery__edr_timeadd", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/cross_db_utils/timeadd.sql", "original_file_path": "macros/utils/cross_db_utils/timeadd.sql", "unique_id": "macro.elementary.bigquery__edr_timeadd", "macro_sql": "{% macro bigquery__edr_timeadd(date_part, number, timestamp_expression) %}\n {%- if date_part | lower in ['second', 'minute', 'hour', 'day'] %}\n timestamp_add({{ elementary.edr_cast_as_timestamp(timestamp_expression) }}, INTERVAL {{ elementary.edr_cast_as_int(number) }} {{ date_part }})\n {%- elif date_part | lower in ['week', 'month', 'quarter', 'year'] %}\n date_add({{ elementary.edr_cast_as_date(timestamp_expression) }}, INTERVAL {{ elementary.edr_cast_as_int(number) }} {{ date_part }})\n {%- else %}\n {{ exceptions.raise_compiler_error(\"Unsupported date_part in edr_timeadd: \".format(date_part)) }}\n {%- endif %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.edr_cast_as_timestamp", "macro.elementary.edr_cast_as_int", "macro.elementary.edr_cast_as_date"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.7888033, "supported_languages": null}, "macro.elementary.postgres__edr_timeadd": {"name": "postgres__edr_timeadd", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/cross_db_utils/timeadd.sql", "original_file_path": "macros/utils/cross_db_utils/timeadd.sql", "unique_id": "macro.elementary.postgres__edr_timeadd", "macro_sql": "{% macro postgres__edr_timeadd(date_part, number, timestamp_expression) %}\n {{ elementary.edr_cast_as_timestamp(timestamp_expression) }} + {{ elementary.edr_cast_as_int(number) }} * INTERVAL '1 {{ date_part }}'\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.edr_cast_as_timestamp", "macro.elementary.edr_cast_as_int"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.78921, "supported_languages": null}, "macro.elementary.redshift__edr_timeadd": {"name": "redshift__edr_timeadd", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/cross_db_utils/timeadd.sql", "original_file_path": "macros/utils/cross_db_utils/timeadd.sql", "unique_id": "macro.elementary.redshift__edr_timeadd", "macro_sql": "{% macro redshift__edr_timeadd(date_part, number, timestamp_expression) %}\n dateadd({{ date_part }}, {{ elementary.edr_cast_as_int(number) }}, {{ elementary.edr_cast_as_timestamp(timestamp_expression) }})\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.edr_cast_as_int", "macro.elementary.edr_cast_as_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.7895808, "supported_languages": null}, "macro.elementary.athena__edr_timeadd": {"name": "athena__edr_timeadd", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/cross_db_utils/timeadd.sql", "original_file_path": "macros/utils/cross_db_utils/timeadd.sql", "unique_id": "macro.elementary.athena__edr_timeadd", "macro_sql": "{% macro athena__edr_timeadd(date_part, number, timestamp_expression) %}\n date_add('{{ date_part }}', {{ elementary.edr_cast_as_int(number) }}, {{ elementary.edr_cast_as_timestamp(timestamp_expression) }})\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.edr_cast_as_int", "macro.elementary.edr_cast_as_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.7899501, "supported_languages": null}, "macro.elementary.contains": {"name": "contains", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/cross_db_utils/contains.sql", "original_file_path": "macros/utils/cross_db_utils/contains.sql", "unique_id": "macro.elementary.contains", "macro_sql": "{% macro contains(string, string_to_search,case_sensitive=False) -%}\n {{ adapter.dispatch('contains', 'elementary') (string, string_to_search, case_sensitive) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.elementary.postgres__contains"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.7911923, "supported_languages": null}, "macro.elementary.default__contains": {"name": "default__contains", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/cross_db_utils/contains.sql", "original_file_path": "macros/utils/cross_db_utils/contains.sql", "unique_id": "macro.elementary.default__contains", "macro_sql": "{% macro default__contains(string, string_to_search, case_sensitive) %}\n {%- if case_sensitive %}\n contains({{ string }}, '{{ string_to_search }}')\n {%- else %}\n contains(lower({{ string }}), lower('{{ string_to_search }}'))\n {%- endif %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.7916164, "supported_languages": null}, "macro.elementary.bigquery__contains": {"name": "bigquery__contains", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/cross_db_utils/contains.sql", "original_file_path": "macros/utils/cross_db_utils/contains.sql", "unique_id": "macro.elementary.bigquery__contains", "macro_sql": "{% macro bigquery__contains(string, string_to_search, case_sensitive) %}\n {%- if case_sensitive %}\n contains_substr({{ string }}, '{{ string_to_search }}')\n {%- else %}\n {%- set string_to_search = string_to_search | lower %}\n contains_substr(lower({{ string }}), '{{ string_to_search }}')\n {%- endif %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.7921126, "supported_languages": null}, "macro.elementary.postgres__contains": {"name": "postgres__contains", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/cross_db_utils/contains.sql", "original_file_path": "macros/utils/cross_db_utils/contains.sql", "unique_id": "macro.elementary.postgres__contains", "macro_sql": "{% macro postgres__contains(string, string_to_search, case_sensitive) %}\n {%- if case_sensitive %}\n case when\n {{ string }} like '%{{ string_to_search }}%' then true\n else false end\n {%- else %}\n case when\n lower({{ string }}) like lower('%{{ string_to_search }}%') then true\n else false end\n {%- endif %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.792538, "supported_languages": null}, "macro.elementary.edr_current_timestamp": {"name": "edr_current_timestamp", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/cross_db_utils/current_timestamp.sql", "original_file_path": "macros/utils/cross_db_utils/current_timestamp.sql", "unique_id": "macro.elementary.edr_current_timestamp", "macro_sql": "{% macro edr_current_timestamp() -%}\n {{ adapter.dispatch('edr_current_timestamp','elementary')() }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.elementary.default__edr_current_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.7944655, "supported_languages": null}, "macro.elementary.default__edr_current_timestamp": {"name": "default__edr_current_timestamp", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/cross_db_utils/current_timestamp.sql", "original_file_path": "macros/utils/cross_db_utils/current_timestamp.sql", "unique_id": "macro.elementary.default__edr_current_timestamp", "macro_sql": "{% macro default__edr_current_timestamp() -%}\n {% set macro = dbt.current_timestamp_backcompat or dbt_utils.current_timestamp %}\n {% if not macro %}\n {{ exceptions.raise_compiler_error(\"Did not find a `current_timestamp` macro.\") }}\n {% endif %}\n {{ return(macro()) }}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.794978, "supported_languages": null}, "macro.elementary.databricks__edr_current_timestamp": {"name": "databricks__edr_current_timestamp", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/cross_db_utils/current_timestamp.sql", "original_file_path": "macros/utils/cross_db_utils/current_timestamp.sql", "unique_id": "macro.elementary.databricks__edr_current_timestamp", "macro_sql": "{% macro databricks__edr_current_timestamp() -%}\n {% set macro = dbt.current_timestamp_backcompat or dbt_utils.current_timestamp %}\n {% if not macro %}\n {{ exceptions.raise_compiler_error(\"Did not find a `current_timestamp` macro.\") }}\n {% endif %}\n {{ return(macro()) }}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.7954817, "supported_languages": null}, "macro.elementary.spark__edr_current_timestamp": {"name": "spark__edr_current_timestamp", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/cross_db_utils/current_timestamp.sql", "original_file_path": "macros/utils/cross_db_utils/current_timestamp.sql", "unique_id": "macro.elementary.spark__edr_current_timestamp", "macro_sql": "{% macro spark__edr_current_timestamp() %}\n cast(current_timestamp() as timestamp)\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.795622, "supported_languages": null}, "macro.elementary.edr_current_timestamp_in_utc": {"name": "edr_current_timestamp_in_utc", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/cross_db_utils/current_timestamp.sql", "original_file_path": "macros/utils/cross_db_utils/current_timestamp.sql", "unique_id": "macro.elementary.edr_current_timestamp_in_utc", "macro_sql": "{% macro edr_current_timestamp_in_utc() -%}\n {{ adapter.dispatch('edr_current_timestamp_in_utc','elementary')() }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.elementary.default__edr_current_timestamp_in_utc"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.7958663, "supported_languages": null}, "macro.elementary.default__edr_current_timestamp_in_utc": {"name": "default__edr_current_timestamp_in_utc", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/cross_db_utils/current_timestamp.sql", "original_file_path": "macros/utils/cross_db_utils/current_timestamp.sql", "unique_id": "macro.elementary.default__edr_current_timestamp_in_utc", "macro_sql": "{% macro default__edr_current_timestamp_in_utc() -%}\n {% set macro = dbt.current_timestamp_in_utc_backcompat or dbt_utils.current_timestamp_in_utc %}\n {% if not macro %}\n {{ exceptions.raise_compiler_error(\"Did not find a `current_timestamp_in_utc` macro.\") }}\n {% endif %}\n {{ return(macro()) }}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.7963684, "supported_languages": null}, "macro.elementary.databricks__edr_current_timestamp_in_utc": {"name": "databricks__edr_current_timestamp_in_utc", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/cross_db_utils/current_timestamp.sql", "original_file_path": "macros/utils/cross_db_utils/current_timestamp.sql", "unique_id": "macro.elementary.databricks__edr_current_timestamp_in_utc", "macro_sql": "{% macro databricks__edr_current_timestamp_in_utc() -%}\n {% set macro = dbt.current_timestamp_in_utc_backcompat or dbt_utils.current_timestamp_in_utc %}\n {% if not macro %}\n {{ exceptions.raise_compiler_error(\"Did not find a `current_timestamp_in_utc` macro.\") }}\n {% endif %}\n {{ return(macro()) }}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.7968972, "supported_languages": null}, "macro.elementary.spark__edr_current_timestamp_in_utc": {"name": "spark__edr_current_timestamp_in_utc", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/cross_db_utils/current_timestamp.sql", "original_file_path": "macros/utils/cross_db_utils/current_timestamp.sql", "unique_id": "macro.elementary.spark__edr_current_timestamp_in_utc", "macro_sql": "{% macro spark__edr_current_timestamp_in_utc() %}\n cast(unix_timestamp() as timestamp)\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.797043, "supported_languages": null}, "macro.elementary.athena__edr_current_timestamp": {"name": "athena__edr_current_timestamp", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/cross_db_utils/current_timestamp.sql", "original_file_path": "macros/utils/cross_db_utils/current_timestamp.sql", "unique_id": "macro.elementary.athena__edr_current_timestamp", "macro_sql": "{% macro athena__edr_current_timestamp() -%}\n CURRENT_TIMESTAMP\n{%- endmacro -%}\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.7971768, "supported_languages": null}, "macro.elementary.athena__edr_current_timestamp_in_utc": {"name": "athena__edr_current_timestamp_in_utc", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/cross_db_utils/current_timestamp.sql", "original_file_path": "macros/utils/cross_db_utils/current_timestamp.sql", "unique_id": "macro.elementary.athena__edr_current_timestamp_in_utc", "macro_sql": "{% macro athena__edr_current_timestamp_in_utc() -%}\n cast(CURRENT_TIMESTAMP AT TIME ZONE 'utc' AS TIMESTAMP)\n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.797311, "supported_languages": null}, "macro.elementary.edr_hour_of_day_expression": {"name": "edr_hour_of_day_expression", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/cross_db_utils/hour_of_day.sql", "original_file_path": "macros/utils/cross_db_utils/hour_of_day.sql", "unique_id": "macro.elementary.edr_hour_of_day_expression", "macro_sql": "{% macro edr_hour_of_day_expression(date_expr) %}\n {{ return(adapter.dispatch('edr_hour_of_day_expression','elementary')(elementary.edr_cast_as_timestamp(date_expr))) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.postgres__edr_hour_of_day_expression", "macro.elementary.edr_cast_as_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.7980428, "supported_languages": null}, "macro.elementary.default__edr_hour_of_day_expression": {"name": "default__edr_hour_of_day_expression", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/cross_db_utils/hour_of_day.sql", "original_file_path": "macros/utils/cross_db_utils/hour_of_day.sql", "unique_id": "macro.elementary.default__edr_hour_of_day_expression", "macro_sql": "{% macro default__edr_hour_of_day_expression(date_expr) %}\n HOUR({{ date_expr }})\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.7982366, "supported_languages": null}, "macro.elementary.bigquery__edr_hour_of_day_expression": {"name": "bigquery__edr_hour_of_day_expression", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/cross_db_utils/hour_of_day.sql", "original_file_path": "macros/utils/cross_db_utils/hour_of_day.sql", "unique_id": "macro.elementary.bigquery__edr_hour_of_day_expression", "macro_sql": "{% macro bigquery__edr_hour_of_day_expression(date_expr) %}\n EXTRACT(hour from {{ date_expr }})\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.7984169, "supported_languages": null}, "macro.elementary.postgres__edr_hour_of_day_expression": {"name": "postgres__edr_hour_of_day_expression", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/cross_db_utils/hour_of_day.sql", "original_file_path": "macros/utils/cross_db_utils/hour_of_day.sql", "unique_id": "macro.elementary.postgres__edr_hour_of_day_expression", "macro_sql": "{% macro postgres__edr_hour_of_day_expression(date_expr) %}\n EXTRACT(hour from {{ date_expr }})\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.798606, "supported_languages": null}, "macro.elementary.redshift__edr_hour_of_day_expression": {"name": "redshift__edr_hour_of_day_expression", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/cross_db_utils/hour_of_day.sql", "original_file_path": "macros/utils/cross_db_utils/hour_of_day.sql", "unique_id": "macro.elementary.redshift__edr_hour_of_day_expression", "macro_sql": "{% macro redshift__edr_hour_of_day_expression(date_expr) %}\n EXTRACT(hour from {{ date_expr }})\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.7988908, "supported_languages": null}, "macro.elementary.snowflake__edr_hour_of_day_expression": {"name": "snowflake__edr_hour_of_day_expression", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/cross_db_utils/hour_of_day.sql", "original_file_path": "macros/utils/cross_db_utils/hour_of_day.sql", "unique_id": "macro.elementary.snowflake__edr_hour_of_day_expression", "macro_sql": "{% macro snowflake__edr_hour_of_day_expression(date_expr) %}\n HOUR({{ date_expr }})\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.7990773, "supported_languages": null}, "macro.elementary.edr_quote": {"name": "edr_quote", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/cross_db_utils/quote_column.sql", "original_file_path": "macros/utils/cross_db_utils/quote_column.sql", "unique_id": "macro.elementary.edr_quote", "macro_sql": "{% macro edr_quote(str) %}\n {% set escaped_str = elementary.escape_special_chars(str) %}\n {% do return(\"'{}'\".format(escaped_str)) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.escape_special_chars"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.7997937, "supported_languages": null}, "macro.elementary.dict_to_quoted_json": {"name": "dict_to_quoted_json", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/cross_db_utils/quote_column.sql", "original_file_path": "macros/utils/cross_db_utils/quote_column.sql", "unique_id": "macro.elementary.dict_to_quoted_json", "macro_sql": "{% macro dict_to_quoted_json(d) %}\n {% do return(elementary.edr_cast_as_string(elementary.edr_quote(tojson(d, sort_keys=true)))) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.edr_cast_as_string", "macro.elementary.edr_quote"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.8001742, "supported_languages": null}, "macro.elementary.edr_quote_column": {"name": "edr_quote_column", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/cross_db_utils/quote_column.sql", "original_file_path": "macros/utils/cross_db_utils/quote_column.sql", "unique_id": "macro.elementary.edr_quote_column", "macro_sql": "\n\n{%- macro edr_quote_column(column_name) -%}\n {% if adapter.quote(column_name[1:-1]) == column_name %}\n {{ return(column_name) }}\n {% else %}\n {% set quoted_column = adapter.quote(column_name) %}\n {{ return(quoted_column) }}\n {% endif %}\n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.8008006, "supported_languages": null}, "macro.elementary.schema_exists": {"name": "schema_exists", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/cross_db_utils/schema_exists.sql", "original_file_path": "macros/utils/cross_db_utils/schema_exists.sql", "unique_id": "macro.elementary.schema_exists", "macro_sql": "{% macro schema_exists(database, schema) %}\n {% do return(adapter.dispatch(\"schema_exists\", \"elementary\")(database, schema)) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.postgres__schema_exists"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.8017569, "supported_languages": null}, "macro.elementary.snowflake__schema_exists": {"name": "snowflake__schema_exists", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/cross_db_utils/schema_exists.sql", "original_file_path": "macros/utils/cross_db_utils/schema_exists.sql", "unique_id": "macro.elementary.snowflake__schema_exists", "macro_sql": "{% macro snowflake__schema_exists(database, schema) %}\n {% set database_sql %}\n show databases like '{{ database }}'\n {% endset %}\n {% set database_exists = elementary.run_query(database_sql)|length > 0 %}\n {% if not database_exists %}\n {% do return(false) %}\n {% endif %}\n {% do return(adapter.check_schema_exists(database, schema)) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.8025208, "supported_languages": null}, "macro.elementary.postgres__schema_exists": {"name": "postgres__schema_exists", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/cross_db_utils/schema_exists.sql", "original_file_path": "macros/utils/cross_db_utils/schema_exists.sql", "unique_id": "macro.elementary.postgres__schema_exists", "macro_sql": "{% macro postgres__schema_exists(database, schema) %}\n {% if database != target.database %}\n {# Cross db operations not supported in postgres #}\n {% do return(false) %}\n {% endif %}\n {% do return(adapter.check_schema_exists(database, schema)) %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.8030572, "supported_languages": null}, "macro.elementary.bigquery__schema_exists": {"name": "bigquery__schema_exists", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/cross_db_utils/schema_exists.sql", "original_file_path": "macros/utils/cross_db_utils/schema_exists.sql", "unique_id": "macro.elementary.bigquery__schema_exists", "macro_sql": "{% macro bigquery__schema_exists(database, schema) %}\n {% if database != target.project %}\n {# Cannot check for non-existing database in bigquery through sql (only api), assume it exists #}\n {% do return(true) %}\n {% endif %}\n {% do return(adapter.check_schema_exists(database, schema)) %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.8035853, "supported_languages": null}, "macro.elementary.default__schema_exists": {"name": "default__schema_exists", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/cross_db_utils/schema_exists.sql", "original_file_path": "macros/utils/cross_db_utils/schema_exists.sql", "unique_id": "macro.elementary.default__schema_exists", "macro_sql": "{% macro default__schema_exists(database, schema) %}\n {% do return(adapter.check_schema_exists(database, schema)) %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.8039017, "supported_languages": null}, "macro.elementary.edr_date_trunc": {"name": "edr_date_trunc", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/cross_db_utils/date_trunc.sql", "original_file_path": "macros/utils/cross_db_utils/date_trunc.sql", "unique_id": "macro.elementary.edr_date_trunc", "macro_sql": "{% macro edr_date_trunc(date_part, date_expression) -%}\n {{ return(adapter.dispatch('edr_date_trunc', 'elementary') (date_part, date_expression)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.elementary.default__edr_date_trunc"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.8045328, "supported_languages": null}, "macro.elementary.default__edr_date_trunc": {"name": "default__edr_date_trunc", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/cross_db_utils/date_trunc.sql", "original_file_path": "macros/utils/cross_db_utils/date_trunc.sql", "unique_id": "macro.elementary.default__edr_date_trunc", "macro_sql": "{% macro default__edr_date_trunc(datepart, date_expression) %}\n {% set macro = dbt.date_trunc or dbt_utils.date_trunc %}\n {% if not macro %}\n {{ exceptions.raise_compiler_error(\"Did not find a `date_trunc` macro.\") }}\n {% endif %}\n {{ return(macro(datepart, date_expression)) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.805144, "supported_languages": null}, "macro.elementary.bigquery__edr_date_trunc": {"name": "bigquery__edr_date_trunc", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/cross_db_utils/date_trunc.sql", "original_file_path": "macros/utils/cross_db_utils/date_trunc.sql", "unique_id": "macro.elementary.bigquery__edr_date_trunc", "macro_sql": "{% macro bigquery__edr_date_trunc(date_part, date_expression) %}\n timestamp_trunc(cast({{ date_expression }} as timestamp), {{ date_part }})\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.805384, "supported_languages": null}, "macro.elementary.get_default_incremental_strategy": {"name": "get_default_incremental_strategy", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/cross_db_utils/incremental_strategy.sql", "original_file_path": "macros/utils/cross_db_utils/incremental_strategy.sql", "unique_id": "macro.elementary.get_default_incremental_strategy", "macro_sql": "{% macro get_default_incremental_strategy() %}\n {% do return(adapter.dispatch(\"get_default_incremental_strategy\", \"elementary\")()) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.default__get_default_incremental_strategy"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.8058608, "supported_languages": null}, "macro.elementary.athena__get_default_incremental_strategy": {"name": "athena__get_default_incremental_strategy", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/cross_db_utils/incremental_strategy.sql", "original_file_path": "macros/utils/cross_db_utils/incremental_strategy.sql", "unique_id": "macro.elementary.athena__get_default_incremental_strategy", "macro_sql": "\n\n{%- macro athena__get_default_incremental_strategy() %}\n {% do return(\"merge\") %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.806092, "supported_languages": null}, "macro.elementary.default__get_default_incremental_strategy": {"name": "default__get_default_incremental_strategy", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/cross_db_utils/incremental_strategy.sql", "original_file_path": "macros/utils/cross_db_utils/incremental_strategy.sql", "unique_id": "macro.elementary.default__get_default_incremental_strategy", "macro_sql": "{% macro default__get_default_incremental_strategy() %}\n {% do return(none) %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.8063169, "supported_languages": null}, "macro.elementary.sql_union_distinct": {"name": "sql_union_distinct", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/cross_db_utils/sql_union_distinct.sql", "original_file_path": "macros/utils/cross_db_utils/sql_union_distinct.sql", "unique_id": "macro.elementary.sql_union_distinct", "macro_sql": "{% macro sql_union_distinct() %}\nunion {% if target.type == \"bigquery\" %} distinct {% endif %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.8066504, "supported_languages": null}, "macro.elementary.can_query_relation": {"name": "can_query_relation", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/cross_db_utils/can_query_relation.sql", "original_file_path": "macros/utils/cross_db_utils/can_query_relation.sql", "unique_id": "macro.elementary.can_query_relation", "macro_sql": "{% macro can_query_relation(relation) %}\n {% do return(adapter.dispatch(\"can_query_relation\", \"elementary\")(relation)) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.default__can_query_relation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.8072793, "supported_languages": null}, "macro.elementary.bigquery__can_query_relation": {"name": "bigquery__can_query_relation", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/cross_db_utils/can_query_relation.sql", "original_file_path": "macros/utils/cross_db_utils/can_query_relation.sql", "unique_id": "macro.elementary.bigquery__can_query_relation", "macro_sql": "{% macro bigquery__can_query_relation(relation) %}\n {% set query %}\n begin\n select 1\n from {{ relation }}\n limit 1;\n exception when error then\n select 0;\n end\n {% endset %}\n {% set result = elementary.result_value(query) %}\n {% do return(result == 1) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.result_value"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.807779, "supported_languages": null}, "macro.elementary.default__can_query_relation": {"name": "default__can_query_relation", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/cross_db_utils/can_query_relation.sql", "original_file_path": "macros/utils/cross_db_utils/can_query_relation.sql", "unique_id": "macro.elementary.default__can_query_relation", "macro_sql": "{% macro default__can_query_relation(relation) %}\n {% do exceptions.raise_compiler_error(\"'can_query_relation' not implemented on '{}'.\".format(target.type)) %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.8084571, "supported_languages": null}, "macro.elementary.edr_dateadd": {"name": "edr_dateadd", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/cross_db_utils/dateadd.sql", "original_file_path": "macros/utils/cross_db_utils/dateadd.sql", "unique_id": "macro.elementary.edr_dateadd", "macro_sql": "{% macro edr_dateadd(datepart, interval, from_date_or_timestamp) %}\n {% set macro = dbt.dateadd or dbt_utils.dateadd %}\n {% if not macro %}\n {{ exceptions.raise_compiler_error(\"Did not find a `dateadd` macro.\") }}\n {% endif %}\n {{ return(macro(datepart, interval, from_date_or_timestamp)) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.809217, "supported_languages": null}, "macro.elementary.edr_datediff": {"name": "edr_datediff", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/cross_db_utils/datediff.sql", "original_file_path": "macros/utils/cross_db_utils/datediff.sql", "unique_id": "macro.elementary.edr_datediff", "macro_sql": "{% macro edr_datediff(first_date, second_date, date_part) %}\n {{ return(adapter.dispatch('edr_datediff', 'elementary')(first_date, second_date, date_part)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.default__edr_datediff"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.8164833, "supported_languages": null}, "macro.elementary.default__edr_datediff": {"name": "default__edr_datediff", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/cross_db_utils/datediff.sql", "original_file_path": "macros/utils/cross_db_utils/datediff.sql", "unique_id": "macro.elementary.default__edr_datediff", "macro_sql": "{% macro default__edr_datediff(first_date, second_date, date_part) %}\n {% set macro = dbt.datediff or dbt_utils.datediff %}\n {% if not macro %}\n {{ exceptions.raise_compiler_error(\"Did not find a `datediff` macro.\") }}\n {% endif %}\n {{ return(macro(first_date, second_date, date_part)) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.8171136, "supported_languages": null}, "macro.elementary.bigquery__edr_datediff": {"name": "bigquery__edr_datediff", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/cross_db_utils/datediff.sql", "original_file_path": "macros/utils/cross_db_utils/datediff.sql", "unique_id": "macro.elementary.bigquery__edr_datediff", "macro_sql": "{% macro bigquery__edr_datediff(first_date, second_date, date_part) %}\n {%- if date_part | lower in ['second', 'minute', 'hour', 'day'] %}\n timestamp_diff({{ second_date }}, {{ first_date }}, {{ date_part }})\n {%- elif date_part | lower in ['week', 'month', 'quarter', 'year'] %}\n {% set macro = dbt.datediff or dbt_utils.datediff %}\n {% if not macro %}\n {{ exceptions.raise_compiler_error(\"Did not find a `datediff` macro.\") }}\n {% endif %}\n {{ return(macro(elementary.edr_cast_as_date(first_date), elementary.edr_cast_as_date(second_date), date_part)) }}\n {%- else %}\n {{ exceptions.raise_compiler_error(\"Unsupported date_part in edr_datediff: \".format(date_part)) }}\n {%- endif %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.edr_cast_as_date"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.8184605, "supported_languages": null}, "macro.elementary.spark__edr_datediff": {"name": "spark__edr_datediff", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/cross_db_utils/datediff.sql", "original_file_path": "macros/utils/cross_db_utils/datediff.sql", "unique_id": "macro.elementary.spark__edr_datediff", "macro_sql": "{% macro spark__edr_datediff(first_date, second_date, datepart) %}\n {%- if datepart in ['day', 'week', 'month', 'quarter', 'year'] -%}\n\n {# make sure the dates are real, otherwise raise an error asap #}\n {% set first_date = assert_not_null('date', first_date) %}\n {% set second_date = assert_not_null('date', second_date) %}\n\n {%- endif -%}\n\n {%- if datepart == 'day' -%}\n\n datediff({{second_date}}, {{first_date}})\n\n {%- elif datepart == 'week' -%}\n\n case when {{first_date}} < {{second_date}}\n then floor(datediff({{second_date}}, {{first_date}})/7)\n else ceil(datediff({{second_date}}, {{first_date}})/7)\n end\n\n -- did we cross a week boundary (Sunday)?\n + case\n when {{first_date}} < {{second_date}} and dayofweek({{second_date}}) < dayofweek({{first_date}}) then 1\n when {{first_date}} > {{second_date}} and dayofweek({{second_date}}) > dayofweek({{first_date}}) then -1\n else 0 end\n\n {%- elif datepart == 'month' -%}\n\n case when {{first_date}} < {{second_date}}\n then floor(months_between(date({{second_date}}), date({{first_date}})))\n else ceil(months_between(date({{second_date}}), date({{first_date}})))\n end\n\n -- did we cross a month boundary?\n + case\n when {{first_date}} < {{second_date}} and dayofmonth({{second_date}}) < dayofmonth({{first_date}}) then 1\n when {{first_date}} > {{second_date}} and dayofmonth({{second_date}}) > dayofmonth({{first_date}}) then -1\n else 0 end\n\n {%- elif datepart == 'quarter' -%}\n\n case when {{first_date}} < {{second_date}}\n then floor(months_between(date({{second_date}}), date({{first_date}}))/3)\n else ceil(months_between(date({{second_date}}), date({{first_date}}))/3)\n end\n\n -- did we cross a quarter boundary?\n + case\n when {{first_date}} < {{second_date}} and (\n (dayofyear({{second_date}}) - (quarter({{second_date}}) * 365/4))\n < (dayofyear({{first_date}}) - (quarter({{first_date}}) * 365/4))\n ) then 1\n when {{first_date}} > {{second_date}} and (\n (dayofyear({{second_date}}) - (quarter({{second_date}}) * 365/4))\n > (dayofyear({{first_date}}) - (quarter({{first_date}}) * 365/4))\n ) then -1\n else 0 end\n\n {%- elif datepart == 'year' -%}\n\n year({{second_date}}) - year({{first_date}})\n\n {%- elif datepart in ('hour', 'minute', 'second', 'millisecond', 'microsecond') -%}\n\n {%- set divisor -%}\n {%- if datepart == 'hour' -%} 3600\n {%- elif datepart == 'minute' -%} 60\n {%- elif datepart == 'second' -%} 1\n {%- elif datepart == 'millisecond' -%} (1/1000)\n {%- elif datepart == 'microsecond' -%} (1/1000000)\n {%- endif -%}\n {%- endset -%}\n\n case when {{first_date}} < {{second_date}}\n then floor((\n {# make sure the timestamps are real, otherwise raise an error asap #}\n {{ assert_not_null('to_unix_timestamp', assert_not_null('to_timestamp', second_date)) }}\n - {{ assert_not_null('to_unix_timestamp', assert_not_null('to_timestamp', first_date)) }}\n ) / {{divisor}})\n else ceil((\n {{ assert_not_null('to_unix_timestamp', assert_not_null('to_timestamp', second_date)) }}\n - {{ assert_not_null('to_unix_timestamp', assert_not_null('to_timestamp', first_date)) }}\n ) / {{divisor}})\n end\n\n {% if datepart == 'millisecond' %}\n + cast(date_format({{second_date}}, 'SSS') as int)\n - cast(date_format({{first_date}}, 'SSS') as int)\n {% endif %}\n\n {% if datepart == 'microsecond' %}\n {% set capture_str = '[0-9]{4}-[0-9]{2}-[0-9]{2}.[0-9]{2}:[0-9]{2}:[0-9]{2}.([0-9]{6})' %}\n -- Spark doesn't really support microseconds, so this is a massive hack!\n -- It will only work if the timestamp-string is of the format\n -- 'yyyy-MM-dd-HH mm.ss.SSSSSS'\n + cast(regexp_extract({{second_date}}, '{{capture_str}}', 1) as int)\n - cast(regexp_extract({{first_date}}, '{{capture_str}}', 1) as int)\n {% endif %}\n\n {%- else -%}\n\n {{ exceptions.raise_compiler_error(\"macro datediff not implemented for datepart ~ '\" ~ datepart ~ \"' ~ on Spark\") }}\n\n {%- endif -%}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.82317, "supported_languages": null}, "macro.elementary.athena__edr_datediff": {"name": "athena__edr_datediff", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/cross_db_utils/datediff.sql", "original_file_path": "macros/utils/cross_db_utils/datediff.sql", "unique_id": "macro.elementary.athena__edr_datediff", "macro_sql": "{% macro athena__edr_datediff(first_date, second_date, date_part) %}\n {% set macro = dbt.datediff or dbt_utils.datediff %}\n {% if not macro %}\n {{ exceptions.raise_compiler_error(\"Did not find a `datediff` macro.\") }}\n {% endif %}\n {{ return(macro(elementary.edr_cast_as_timestamp(first_date), elementary.edr_cast_as_timestamp(second_date), date_part)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.edr_cast_as_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.8239074, "supported_languages": null}, "macro.elementary.edr_concat": {"name": "edr_concat", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/cross_db_utils/concat.sql", "original_file_path": "macros/utils/cross_db_utils/concat.sql", "unique_id": "macro.elementary.edr_concat", "macro_sql": "{%- macro edr_concat(val1, val2) -%}\n concat({{ elementary.edr_cast_as_string(val1) }}, {{ elementary.edr_cast_as_string(val2) }})\n{%- endmacro -%}", "depends_on": {"macros": ["macro.elementary.edr_cast_as_string"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.8243215, "supported_languages": null}, "macro.elementary.edr_day_of_week_expression": {"name": "edr_day_of_week_expression", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/cross_db_utils/day_of_week.sql", "original_file_path": "macros/utils/cross_db_utils/day_of_week.sql", "unique_id": "macro.elementary.edr_day_of_week_expression", "macro_sql": "{% macro edr_day_of_week_expression(date_expr) %}\n {{ return(adapter.dispatch('edr_day_of_week_expression','elementary')(elementary.edr_cast_as_date(date_expr))) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.postgres__edr_day_of_week_expression", "macro.elementary.edr_cast_as_date"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.8251207, "supported_languages": null}, "macro.elementary.default__edr_day_of_week_expression": {"name": "default__edr_day_of_week_expression", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/cross_db_utils/day_of_week.sql", "original_file_path": "macros/utils/cross_db_utils/day_of_week.sql", "unique_id": "macro.elementary.default__edr_day_of_week_expression", "macro_sql": "{% macro default__edr_day_of_week_expression(date_expr) %}\n DATE_FORMAT({{ date_expr }}, 'EEEE')\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.8253155, "supported_languages": null}, "macro.elementary.bigquery__edr_day_of_week_expression": {"name": "bigquery__edr_day_of_week_expression", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/cross_db_utils/day_of_week.sql", "original_file_path": "macros/utils/cross_db_utils/day_of_week.sql", "unique_id": "macro.elementary.bigquery__edr_day_of_week_expression", "macro_sql": "{% macro bigquery__edr_day_of_week_expression(date_expr) %}\n FORMAT_DATE('%A', {{ date_expr }})\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.8255, "supported_languages": null}, "macro.elementary.postgres__edr_day_of_week_expression": {"name": "postgres__edr_day_of_week_expression", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/cross_db_utils/day_of_week.sql", "original_file_path": "macros/utils/cross_db_utils/day_of_week.sql", "unique_id": "macro.elementary.postgres__edr_day_of_week_expression", "macro_sql": "{% macro postgres__edr_day_of_week_expression(date_expr) %}\n to_char({{ date_expr }}, 'Day')\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.8256788, "supported_languages": null}, "macro.elementary.redshift__edr_day_of_week_expression": {"name": "redshift__edr_day_of_week_expression", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/cross_db_utils/day_of_week.sql", "original_file_path": "macros/utils/cross_db_utils/day_of_week.sql", "unique_id": "macro.elementary.redshift__edr_day_of_week_expression", "macro_sql": "{% macro redshift__edr_day_of_week_expression(date_expr) %}\n{# Redshift returns the days padded with whitespaces to width of 9 #}\n trim(' ' FROM to_char({{ date_expr }}, 'Day'))\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.8258696, "supported_languages": null}, "macro.elementary.snowflake__edr_day_of_week_expression": {"name": "snowflake__edr_day_of_week_expression", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/cross_db_utils/day_of_week.sql", "original_file_path": "macros/utils/cross_db_utils/day_of_week.sql", "unique_id": "macro.elementary.snowflake__edr_day_of_week_expression", "macro_sql": "{% macro snowflake__edr_day_of_week_expression(date_expr) %}\n{# copied from Snowflake help docs: https://docs.snowflake.com/en/user-guide/date-time-examples #}\n DECODE (EXTRACT('dayofweek',{{ date_expr }}),\n 1 , 'Monday',\n 2 , 'Tuesday',\n 3 , 'Wednesday',\n 4 , 'Thursday',\n 5 , 'Friday',\n 6 , 'Saturday',\n 0 , 'Sunday'\n )\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.826079, "supported_languages": null}, "macro.elementary.athena__edr_day_of_week_expression": {"name": "athena__edr_day_of_week_expression", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/cross_db_utils/day_of_week.sql", "original_file_path": "macros/utils/cross_db_utils/day_of_week.sql", "unique_id": "macro.elementary.athena__edr_day_of_week_expression", "macro_sql": "{% macro athena__edr_day_of_week_expression(date_expr) %}\n DATE_FORMAT({{ date_expr }}, '%W')\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.8262558, "supported_languages": null}, "macro.elementary.generate_surrogate_key": {"name": "generate_surrogate_key", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/cross_db_utils/generate_surrogate_key.sql", "original_file_path": "macros/utils/cross_db_utils/generate_surrogate_key.sql", "unique_id": "macro.elementary.generate_surrogate_key", "macro_sql": "\n\n\n{%- macro generate_surrogate_key(fields) -%}\n {% set concat_macro = dbt.concat or dbt_utils.concat %}\n {% set hash_macro = dbt.hash or dbt_utils.hash %}\n\n {% set default_null_value = \"\" %}\n {%- set field_sqls = [] -%}\n {%- for field in fields -%}\n {%- do field_sqls.append(\n \"coalesce(cast(\" ~ field ~ \" as \" ~ elementary.edr_type_string() ~ \"), '\" ~ default_null_value ~\"')\"\n ) -%}\n {%- if not loop.last %}\n {%- do field_sqls.append(\"'-'\") -%}\n {%- endif -%}\n {%- endfor -%}\n {{ hash_macro(concat_macro(field_sqls)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.edr_type_string"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.8276818, "supported_languages": null}, "macro.elementary.get_default_table_type": {"name": "get_default_table_type", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/cross_db_utils/table_type.sql", "original_file_path": "macros/utils/cross_db_utils/table_type.sql", "unique_id": "macro.elementary.get_default_table_type", "macro_sql": "{% macro get_default_table_type() %}\n {% do return(adapter.dispatch(\"get_default_table_type\", \"elementary\")()) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.default__get_default_table_type"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.828143, "supported_languages": null}, "macro.elementary.athena__get_default_table_type": {"name": "athena__get_default_table_type", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/cross_db_utils/table_type.sql", "original_file_path": "macros/utils/cross_db_utils/table_type.sql", "unique_id": "macro.elementary.athena__get_default_table_type", "macro_sql": "\n\n{%- macro athena__get_default_table_type() %}\n {% do return(\"iceberg\") %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.8283684, "supported_languages": null}, "macro.elementary.default__get_default_table_type": {"name": "default__get_default_table_type", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/cross_db_utils/table_type.sql", "original_file_path": "macros/utils/cross_db_utils/table_type.sql", "unique_id": "macro.elementary.default__get_default_table_type", "macro_sql": "{% macro default__get_default_table_type() %}\n {% do return(none) %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.828588, "supported_languages": null}, "macro.elementary.edr_multi_value_in": {"name": "edr_multi_value_in", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/cross_db_utils/multi_value_in.sql", "original_file_path": "macros/utils/cross_db_utils/multi_value_in.sql", "unique_id": "macro.elementary.edr_multi_value_in", "macro_sql": "{% macro edr_multi_value_in(source_cols, target_cols, target_table) %}\n {% do return(adapter.dispatch('edr_multi_value_in', 'elementary') (source_cols, target_cols, target_table)) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.default__edr_multi_value_in"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.8299394, "supported_languages": null}, "macro.elementary.default__edr_multi_value_in": {"name": "default__edr_multi_value_in", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/cross_db_utils/multi_value_in.sql", "original_file_path": "macros/utils/cross_db_utils/multi_value_in.sql", "unique_id": "macro.elementary.default__edr_multi_value_in", "macro_sql": "\n\n{%- macro default__edr_multi_value_in(source_cols, target_cols, target_table) -%}\n (\n {%- for val in source_cols -%}\n {{ val }}\n {%- if not loop.last %}, {% endif %}\n {%- endfor %}\n ) in (\n select {% for val in target_cols -%}\n {{ val }}\n {%- if not loop.last %}, {% endif %}\n {%- endfor %}\n from {{ target_table }}\n )\n{%- endmacro -%}\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.8306093, "supported_languages": null}, "macro.elementary.bigquery__edr_multi_value_in": {"name": "bigquery__edr_multi_value_in", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/cross_db_utils/multi_value_in.sql", "original_file_path": "macros/utils/cross_db_utils/multi_value_in.sql", "unique_id": "macro.elementary.bigquery__edr_multi_value_in", "macro_sql": "{%- macro bigquery__edr_multi_value_in(source_cols, target_cols, target_table) -%}\n -- BigQuery doesn't support multi-value IN, so we emulate it with CONCAT\n concat(\n {%- for val in source_cols -%}\n {{ elementary.edr_cast_as_string(val) -}}\n {%- if not loop.last %}, {% endif %}\n {%- endfor %}\n ) in (\n select concat({%- for val in target_cols -%}\n {{ elementary.edr_cast_as_string(val) -}}\n {%- if not loop.last %}, {% endif %}\n {%- endfor %})\n from {{ target_table }}\n )\n{%- endmacro -%}", "depends_on": {"macros": ["macro.elementary.edr_cast_as_string"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.8314195, "supported_languages": null}, "macro.elementary.timediff": {"name": "timediff", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/cross_db_utils/timediff.sql", "original_file_path": "macros/utils/cross_db_utils/timediff.sql", "unique_id": "macro.elementary.timediff", "macro_sql": "{% macro timediff(timepart, first_timestamp, second_timestamp) -%}\n {{ return(adapter.dispatch('timediff', 'elementary')(timepart, first_timestamp, second_timestamp)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.elementary.default__timediff"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.8320305, "supported_languages": null}, "macro.elementary.default__timediff": {"name": "default__timediff", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/cross_db_utils/timediff.sql", "original_file_path": "macros/utils/cross_db_utils/timediff.sql", "unique_id": "macro.elementary.default__timediff", "macro_sql": "{% macro default__timediff(timepart, first_timestamp, second_timestamp) %}\n {{ elementary.edr_datediff(first_timestamp, second_timestamp, timepart)}}\n{% endmacro %}", "depends_on": {"macros": ["macro.elementary.edr_datediff"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.8323302, "supported_languages": null}, "macro.elementary.bigquery__timediff": {"name": "bigquery__timediff", "resource_type": "macro", "package_name": "elementary", "path": "macros/utils/cross_db_utils/timediff.sql", "original_file_path": "macros/utils/cross_db_utils/timediff.sql", "unique_id": "macro.elementary.bigquery__timediff", "macro_sql": "{% macro bigquery__timediff(timepart, first_timestamp, second_timestamp) %}\n timestamp_diff({{ second_timestamp }}, {{ first_timestamp }}, {{ timepart }})\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1733549921.8326046, "supported_languages": null}}, "docs": {"doc.dbt.__overview__": {"name": "__overview__", "resource_type": "doc", "package_name": "dbt", "path": "overview.md", "original_file_path": "docs/overview.md", "unique_id": "doc.dbt.__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 `--select` 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/introduction)?\n- Read the [dbt viewpoint](https://docs.getdbt.com/docs/viewpoint)\n- [Installation](https://docs.getdbt.com/docs/installation)\n- Join the [dbt Community](https://www.getdbt.com/community/) for questions and discussion"}}, "exposures": {}, "metrics": {}, "groups": {}, "selectors": {}, "disabled": {}, "parent_map": {"model.dbt_testing_example.body_mass_indexes": ["model.dbt_testing_example.int_weight_measurements_with_latest_height"], "model.dbt_testing_example.stg_gym_app__height": ["source.dbt_testing_example.gym_app.raw_height"], "model.dbt_testing_example.stg_gym_app__weight": ["source.dbt_testing_example.gym_app.raw_weight"], "model.dbt_testing_example.int_weight_measurements_with_latest_height": ["model.dbt_testing_example.stg_gym_app__height", "model.dbt_testing_example.stg_gym_app__weight"], "test.dbt_testing_example.body_mass_indexes_component_test": ["model.dbt_testing_example.body_mass_indexes"], "test.dbt_testing_example.body_mass_indexes_unit_test": ["model.dbt_testing_example.body_mass_indexes"], "test.dbt_testing_example.stg_gym_app__height_unit_test": ["model.dbt_testing_example.stg_gym_app__height"], "test.dbt_testing_example.stg_gym_app__weight_unit_test": ["model.dbt_testing_example.stg_gym_app__weight"], "test.dbt_testing_example.int_weight_measurements_with_latest_height_unit_test": ["model.dbt_testing_example.int_weight_measurements_with_latest_height"], "seed.dbt_testing_example.raw_weight": [], "seed.dbt_testing_example.raw_height": [], "model.elementary.metadata": [], "model.elementary.monitors_runs": ["model.elementary.data_monitoring_metrics"], "model.elementary.schema_columns_snapshot": [], "model.elementary.anomaly_threshold_sensitivity": ["model.elementary.metrics_anomaly_score"], "model.elementary.metrics_anomaly_score": ["model.elementary.data_monitoring_metrics"], "model.elementary.data_monitoring_metrics": [], "model.elementary.elementary_test_results": [], "model.elementary.test_result_rows": ["model.elementary.elementary_test_results"], "model.elementary.job_run_results": ["model.elementary.dbt_invocations"], "model.elementary.snapshot_run_results": ["model.elementary.dbt_run_results", "model.elementary.dbt_snapshots"], "model.elementary.model_run_results": ["model.elementary.dbt_models", "model.elementary.dbt_run_results"], "model.elementary.dbt_source_freshness_results": [], "model.elementary.dbt_snapshots": [], "model.elementary.enriched_columns": ["model.elementary.dbt_columns", "model.elementary.information_schema_columns"], "model.elementary.dbt_metrics": [], "model.elementary.dbt_sources": [], "model.elementary.dbt_tests": [], "model.elementary.dbt_artifacts_hashes": ["model.elementary.dbt_columns", "model.elementary.dbt_exposures", "model.elementary.dbt_metrics", "model.elementary.dbt_models", "model.elementary.dbt_seeds", "model.elementary.dbt_snapshots", "model.elementary.dbt_sources", "model.elementary.dbt_tests"], "model.elementary.dbt_models": [], "model.elementary.dbt_exposures": [], "model.elementary.dbt_seeds": [], "model.elementary.information_schema_columns": ["model.elementary.dbt_models", "model.elementary.dbt_seeds", "model.elementary.dbt_snapshots", "model.elementary.dbt_sources"], "model.elementary.dbt_invocations": [], "model.elementary.dbt_columns": [], "model.elementary.dbt_run_results": [], "model.elementary.alerts_anomaly_detection": ["model.elementary.elementary_test_results"], "model.elementary.alerts_dbt_tests": ["model.elementary.elementary_test_results"], "model.elementary.alerts_schema_changes": ["model.elementary.elementary_test_results"], "model.elementary.alerts_dbt_source_freshness": ["model.elementary.dbt_source_freshness_results", "model.elementary.dbt_sources"], "model.elementary.alerts_dbt_models": ["model.elementary.model_run_results", "model.elementary.snapshot_run_results"], "operation.elementary.elementary-on-run-start-0": [], "operation.elementary.elementary-on-run-end-0": [], "test.dbt_testing_example.relationships_body_mass_indexes_user_id__user_id__source_gym_app_raw_height_.d338d193c2": ["model.dbt_testing_example.body_mass_indexes", "source.dbt_testing_example.gym_app.raw_height"], "test.dbt_testing_example.relationships_body_mass_indexes_user_id__user_id__source_gym_app_raw_weight_.1ef253afa0": ["model.dbt_testing_example.body_mass_indexes", "source.dbt_testing_example.gym_app.raw_weight"], "test.dbt_testing_example.elementary_schema_changes_body_mass_indexes_.5e7b3caf3a": ["model.dbt_testing_example.body_mass_indexes"], "test.dbt_testing_example.elementary_volume_anomalies_body_mass_indexes_.c1d889d103": ["model.dbt_testing_example.body_mass_indexes"], "test.dbt_testing_example.elementary_freshness_anomalies_body_mass_indexes_hour__2__processed_at.e39d6b3299": ["model.dbt_testing_example.body_mass_indexes"], "test.dbt_testing_example.dbt_expectations_source_expect_column_values_to_be_of_type_gym_app_raw_height_height_unit__text.c82161c012": ["source.dbt_testing_example.gym_app.raw_height"], "test.dbt_testing_example.source_accepted_values_gym_app_raw_height_height_unit__cm__inches.f4af351a08": ["source.dbt_testing_example.gym_app.raw_height"], "test.dbt_testing_example.source_not_null_gym_app_raw_height_user_id.4fb45a730a": ["source.dbt_testing_example.gym_app.raw_height"], "test.dbt_testing_example.dbt_expectations_source_expect_column_values_to_be_of_type_gym_app_raw_height_user_id__integer.14569ac5f0": ["source.dbt_testing_example.gym_app.raw_height"], "test.dbt_testing_example.source_not_null_gym_app_raw_height_height.e7ed26fbfe": ["source.dbt_testing_example.gym_app.raw_height"], "test.dbt_testing_example.dbt_expectations_source_expect_column_values_to_be_of_type_gym_app_raw_height_height__double_precision.1f5b371f9e": ["source.dbt_testing_example.gym_app.raw_height"], "test.dbt_testing_example.dbt_utils_source_accepted_range_gym_app_raw_height_height__False__0.0dd5e14a3d": ["source.dbt_testing_example.gym_app.raw_height"], "test.dbt_testing_example.dbt_expectations_source_expect_column_values_to_be_of_type_gym_app_raw_weight_measurement_unit__text.7271116707": ["source.dbt_testing_example.gym_app.raw_weight"], "test.dbt_testing_example.source_accepted_values_gym_app_raw_weight_measurement_unit__kg__pounds.0e8337c1da": ["source.dbt_testing_example.gym_app.raw_weight"], "test.dbt_testing_example.source_not_null_gym_app_raw_weight_user_id.e854c4fcc8": ["source.dbt_testing_example.gym_app.raw_weight"], "test.dbt_testing_example.dbt_expectations_source_expect_column_values_to_be_of_type_gym_app_raw_weight_user_id__integer.feda35ce32": ["source.dbt_testing_example.gym_app.raw_weight"], "test.dbt_testing_example.source_not_null_gym_app_raw_weight_weight.3cc3503e9d": ["source.dbt_testing_example.gym_app.raw_weight"], "test.dbt_testing_example.dbt_expectations_source_expect_column_values_to_be_of_type_gym_app_raw_weight_weight__double_precision.0c34285381": ["source.dbt_testing_example.gym_app.raw_weight"], "test.dbt_testing_example.dbt_utils_source_accepted_range_gym_app_raw_weight_weight__False__0.2147fe640d": ["source.dbt_testing_example.gym_app.raw_weight"], "source.dbt_testing_example.gym_app.raw_height": [], "source.dbt_testing_example.gym_app.raw_weight": []}, "child_map": {"model.dbt_testing_example.body_mass_indexes": ["test.dbt_testing_example.body_mass_indexes_component_test", "test.dbt_testing_example.body_mass_indexes_unit_test", "test.dbt_testing_example.elementary_freshness_anomalies_body_mass_indexes_hour__2__processed_at.e39d6b3299", "test.dbt_testing_example.elementary_schema_changes_body_mass_indexes_.5e7b3caf3a", "test.dbt_testing_example.elementary_volume_anomalies_body_mass_indexes_.c1d889d103", "test.dbt_testing_example.relationships_body_mass_indexes_user_id__user_id__source_gym_app_raw_height_.d338d193c2", "test.dbt_testing_example.relationships_body_mass_indexes_user_id__user_id__source_gym_app_raw_weight_.1ef253afa0"], "model.dbt_testing_example.stg_gym_app__height": ["model.dbt_testing_example.int_weight_measurements_with_latest_height", "test.dbt_testing_example.stg_gym_app__height_unit_test"], "model.dbt_testing_example.stg_gym_app__weight": ["model.dbt_testing_example.int_weight_measurements_with_latest_height", "test.dbt_testing_example.stg_gym_app__weight_unit_test"], "model.dbt_testing_example.int_weight_measurements_with_latest_height": ["model.dbt_testing_example.body_mass_indexes", "test.dbt_testing_example.int_weight_measurements_with_latest_height_unit_test"], "test.dbt_testing_example.body_mass_indexes_component_test": [], "test.dbt_testing_example.body_mass_indexes_unit_test": [], "test.dbt_testing_example.stg_gym_app__height_unit_test": [], "test.dbt_testing_example.stg_gym_app__weight_unit_test": [], "test.dbt_testing_example.int_weight_measurements_with_latest_height_unit_test": [], "seed.dbt_testing_example.raw_weight": [], "seed.dbt_testing_example.raw_height": [], "model.elementary.metadata": [], "model.elementary.monitors_runs": [], "model.elementary.schema_columns_snapshot": [], "model.elementary.anomaly_threshold_sensitivity": [], "model.elementary.metrics_anomaly_score": ["model.elementary.anomaly_threshold_sensitivity"], "model.elementary.data_monitoring_metrics": ["model.elementary.metrics_anomaly_score", "model.elementary.monitors_runs"], "model.elementary.elementary_test_results": ["model.elementary.alerts_anomaly_detection", "model.elementary.alerts_dbt_tests", "model.elementary.alerts_schema_changes", "model.elementary.test_result_rows"], "model.elementary.test_result_rows": [], "model.elementary.job_run_results": [], "model.elementary.snapshot_run_results": ["model.elementary.alerts_dbt_models"], "model.elementary.model_run_results": ["model.elementary.alerts_dbt_models"], "model.elementary.dbt_source_freshness_results": ["model.elementary.alerts_dbt_source_freshness"], "model.elementary.dbt_snapshots": ["model.elementary.dbt_artifacts_hashes", "model.elementary.information_schema_columns", "model.elementary.snapshot_run_results"], "model.elementary.enriched_columns": [], "model.elementary.dbt_metrics": ["model.elementary.dbt_artifacts_hashes"], "model.elementary.dbt_sources": ["model.elementary.alerts_dbt_source_freshness", "model.elementary.dbt_artifacts_hashes", "model.elementary.information_schema_columns"], "model.elementary.dbt_tests": ["model.elementary.dbt_artifacts_hashes"], "model.elementary.dbt_artifacts_hashes": [], "model.elementary.dbt_models": ["model.elementary.dbt_artifacts_hashes", "model.elementary.information_schema_columns", "model.elementary.model_run_results"], "model.elementary.dbt_exposures": ["model.elementary.dbt_artifacts_hashes"], "model.elementary.dbt_seeds": ["model.elementary.dbt_artifacts_hashes", "model.elementary.information_schema_columns"], "model.elementary.information_schema_columns": ["model.elementary.enriched_columns"], "model.elementary.dbt_invocations": ["model.elementary.job_run_results"], "model.elementary.dbt_columns": ["model.elementary.dbt_artifacts_hashes", "model.elementary.enriched_columns"], "model.elementary.dbt_run_results": ["model.elementary.model_run_results", "model.elementary.snapshot_run_results"], "model.elementary.alerts_anomaly_detection": [], "model.elementary.alerts_dbt_tests": [], "model.elementary.alerts_schema_changes": [], "model.elementary.alerts_dbt_source_freshness": [], "model.elementary.alerts_dbt_models": [], "operation.elementary.elementary-on-run-start-0": [], "operation.elementary.elementary-on-run-end-0": [], "test.dbt_testing_example.relationships_body_mass_indexes_user_id__user_id__source_gym_app_raw_height_.d338d193c2": [], "test.dbt_testing_example.relationships_body_mass_indexes_user_id__user_id__source_gym_app_raw_weight_.1ef253afa0": [], "test.dbt_testing_example.elementary_schema_changes_body_mass_indexes_.5e7b3caf3a": [], "test.dbt_testing_example.elementary_volume_anomalies_body_mass_indexes_.c1d889d103": [], "test.dbt_testing_example.elementary_freshness_anomalies_body_mass_indexes_hour__2__processed_at.e39d6b3299": [], "test.dbt_testing_example.dbt_expectations_source_expect_column_values_to_be_of_type_gym_app_raw_height_height_unit__text.c82161c012": [], "test.dbt_testing_example.source_accepted_values_gym_app_raw_height_height_unit__cm__inches.f4af351a08": [], "test.dbt_testing_example.source_not_null_gym_app_raw_height_user_id.4fb45a730a": [], "test.dbt_testing_example.dbt_expectations_source_expect_column_values_to_be_of_type_gym_app_raw_height_user_id__integer.14569ac5f0": [], "test.dbt_testing_example.source_not_null_gym_app_raw_height_height.e7ed26fbfe": [], "test.dbt_testing_example.dbt_expectations_source_expect_column_values_to_be_of_type_gym_app_raw_height_height__double_precision.1f5b371f9e": [], "test.dbt_testing_example.dbt_utils_source_accepted_range_gym_app_raw_height_height__False__0.0dd5e14a3d": [], "test.dbt_testing_example.dbt_expectations_source_expect_column_values_to_be_of_type_gym_app_raw_weight_measurement_unit__text.7271116707": [], "test.dbt_testing_example.source_accepted_values_gym_app_raw_weight_measurement_unit__kg__pounds.0e8337c1da": [], "test.dbt_testing_example.source_not_null_gym_app_raw_weight_user_id.e854c4fcc8": [], "test.dbt_testing_example.dbt_expectations_source_expect_column_values_to_be_of_type_gym_app_raw_weight_user_id__integer.feda35ce32": [], "test.dbt_testing_example.source_not_null_gym_app_raw_weight_weight.3cc3503e9d": [], "test.dbt_testing_example.dbt_expectations_source_expect_column_values_to_be_of_type_gym_app_raw_weight_weight__double_precision.0c34285381": [], "test.dbt_testing_example.dbt_utils_source_accepted_range_gym_app_raw_weight_weight__False__0.2147fe640d": [], "source.dbt_testing_example.gym_app.raw_height": ["model.dbt_testing_example.stg_gym_app__height", "test.dbt_testing_example.dbt_expectations_source_expect_column_values_to_be_of_type_gym_app_raw_height_height__double_precision.1f5b371f9e", "test.dbt_testing_example.dbt_expectations_source_expect_column_values_to_be_of_type_gym_app_raw_height_height_unit__text.c82161c012", "test.dbt_testing_example.dbt_expectations_source_expect_column_values_to_be_of_type_gym_app_raw_height_user_id__integer.14569ac5f0", "test.dbt_testing_example.dbt_utils_source_accepted_range_gym_app_raw_height_height__False__0.0dd5e14a3d", "test.dbt_testing_example.relationships_body_mass_indexes_user_id__user_id__source_gym_app_raw_height_.d338d193c2", "test.dbt_testing_example.source_accepted_values_gym_app_raw_height_height_unit__cm__inches.f4af351a08", "test.dbt_testing_example.source_not_null_gym_app_raw_height_height.e7ed26fbfe", "test.dbt_testing_example.source_not_null_gym_app_raw_height_user_id.4fb45a730a"], "source.dbt_testing_example.gym_app.raw_weight": ["model.dbt_testing_example.stg_gym_app__weight", "test.dbt_testing_example.dbt_expectations_source_expect_column_values_to_be_of_type_gym_app_raw_weight_measurement_unit__text.7271116707", "test.dbt_testing_example.dbt_expectations_source_expect_column_values_to_be_of_type_gym_app_raw_weight_user_id__integer.feda35ce32", "test.dbt_testing_example.dbt_expectations_source_expect_column_values_to_be_of_type_gym_app_raw_weight_weight__double_precision.0c34285381", "test.dbt_testing_example.dbt_utils_source_accepted_range_gym_app_raw_weight_weight__False__0.2147fe640d", "test.dbt_testing_example.relationships_body_mass_indexes_user_id__user_id__source_gym_app_raw_weight_.1ef253afa0", "test.dbt_testing_example.source_accepted_values_gym_app_raw_weight_measurement_unit__kg__pounds.0e8337c1da", "test.dbt_testing_example.source_not_null_gym_app_raw_weight_user_id.e854c4fcc8", "test.dbt_testing_example.source_not_null_gym_app_raw_weight_weight.3cc3503e9d"]}, "group_map": {}, "saved_queries": {}, "semantic_models": {}}
\ No newline at end of file
diff --git a/docs/partial_parse.msgpack b/docs/partial_parse.msgpack
new file mode 100644
index 0000000..79ee18f
Binary files /dev/null and b/docs/partial_parse.msgpack differ
diff --git a/docs/run_results.json b/docs/run_results.json
new file mode 100644
index 0000000..ff5c366
--- /dev/null
+++ b/docs/run_results.json
@@ -0,0 +1 @@
+{"metadata": {"dbt_schema_version": "https://schemas.getdbt.com/dbt/run-results/v5.json", "dbt_version": "1.7.11", "generated_at": "2024-12-07T05:38:49.510423Z", "invocation_id": "bd20d4ff-d6c5-4850-b106-ab1d2c6241c2", "env": {}}, "results": [{"status": "success", "timing": [{"name": "compile", "started_at": "2024-12-07T05:38:46.959767Z", "completed_at": "2024-12-07T05:38:47.005771Z"}, {"name": "execute", "started_at": "2024-12-07T05:38:47.007166Z", "completed_at": "2024-12-07T05:38:47.007184Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.05472254753112793, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.dbt_testing_example.stg_gym_app__height", "compiled": true, "compiled_code": "with\n\nsource as (\n\n select * from \"neondb\".\"dbt_testing_example\".\"raw_height\"\n\n),\n\nrenamed as (\n\n select\n TO_DATE(date, 'DD/MM/YYYY') as created_date,\n user_id,\n height,\n height_unit as measurement_unit\n from source\n\n)\n\nselect * from renamed", "relation_name": "\"neondb\".\"dbt_testing_example\".\"stg_gym_app__height\""}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-12-07T05:38:46.991000Z", "completed_at": "2024-12-07T05:38:47.007754Z"}, {"name": "execute", "started_at": "2024-12-07T05:38:47.012409Z", "completed_at": "2024-12-07T05:38:47.012416Z"}], "thread_id": "Thread-4 (worker)", "execution_time": 0.05698704719543457, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.elementary.dbt_columns", "compiled": true, "compiled_code": "\n\nselect * from (\n select\n \n \n cast('dummy_string' as varchar(4096)) as unique_id\n\n,\n \n cast('dummy_string' as varchar(4096)) as parent_unique_id\n\n,\n \n cast('dummy_string' as varchar(4096)) as name\n\n,\n \n cast('dummy_string' as varchar(4096)) as data_type\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as tags\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as meta\n\n,\n \n cast('dummy_string' as varchar(4096)) as database_name\n\n,\n \n cast('dummy_string' as varchar(4096)) as schema_name\n\n,\n \n cast('dummy_string' as varchar(4096)) as table_name\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as description\n\n,\n \n cast('dummy_string' as varchar(4096)) as resource_type\n\n,\n \n cast('dummy_string' as varchar(4096)) as generated_at\n\n,\n \n cast('dummy_string' as varchar(4096)) as metadata_hash\n\n\n ) as empty_table\n where 1 = 0", "relation_name": "\"neondb\".\"dbt_testing_example_elementary\".\"dbt_columns\""}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-12-07T05:38:46.970137Z", "completed_at": "2024-12-07T05:38:47.008279Z"}, {"name": "execute", "started_at": "2024-12-07T05:38:47.013074Z", "completed_at": "2024-12-07T05:38:47.013081Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.05984330177307129, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.dbt_testing_example.stg_gym_app__weight", "compiled": true, "compiled_code": "with\n\nsource as (\n\n select * from \"neondb\".\"dbt_testing_example\".\"raw_weight\"\n\n),\n\nrenamed as (\n\n select\n TO_DATE(date, 'DD/MM/YYYY') as created_date,\n weight,\n user_id,\n measurement_unit\n from source\n\n)\n\nselect * from renamed", "relation_name": "\"neondb\".\"dbt_testing_example\".\"stg_gym_app__weight\""}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-12-07T05:38:46.974165Z", "completed_at": "2024-12-07T05:38:47.008795Z"}, {"name": "execute", "started_at": "2024-12-07T05:38:47.013619Z", "completed_at": "2024-12-07T05:38:47.013626Z"}], "thread_id": "Thread-3 (worker)", "execution_time": 0.06011056900024414, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.elementary.data_monitoring_metrics", "compiled": true, "compiled_code": "\n\n\n \n \n \n \n select * from (\n select\n \n \n cast('dummy_string' as varchar(4096)) as id\n\n,\n \n cast('dummy_string' as varchar(4096)) as full_table_name\n\n,\n \n cast('dummy_string' as varchar(4096)) as column_name\n\n,\n \n cast('dummy_string' as varchar(4096)) as metric_name\n\n,\n \n cast(123456789.99 as float) as metric_value\n\n,\n \n cast('dummy_string' as varchar(4096)) as source_value\n\n,\n cast('2091-02-17' as timestamp) as bucket_start\n\n,\n cast('2091-02-17' as timestamp) as bucket_end\n\n,\n \n cast(123456789 as integer) as bucket_duration_hours\n\n,\n cast('2091-02-17' as timestamp) as updated_at\n\n,\n \n cast('dummy_string' as varchar(4096)) as dimension\n\n,\n \n cast('dummy_string' as varchar(4096)) as dimension_value\n\n,\n \n cast('dummy_string' as varchar(4096)) as metric_properties\n\n,\n cast('2091-02-17' as timestamp) as created_at\n\n\n ) as empty_table\n where 1 = 0\n", "relation_name": "\"neondb\".\"dbt_testing_example_elementary\".\"data_monitoring_metrics\""}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-12-07T05:38:47.019871Z", "completed_at": "2024-12-07T05:38:47.041581Z"}, {"name": "execute", "started_at": "2024-12-07T05:38:47.100656Z", "completed_at": "2024-12-07T05:38:47.100671Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.08890628814697266, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.elementary.dbt_exposures", "compiled": true, "compiled_code": "\n\nselect * from (\n select\n \n \n cast('dummy_string' as varchar(4096)) as unique_id\n\n,\n \n cast('dummy_string' as varchar(4096)) as name\n\n,\n \n cast('dummy_string' as varchar(4096)) as maturity\n\n,\n \n cast('dummy_string' as varchar(4096)) as type\n\n,\n \n cast('dummy_string' as varchar(4096)) as owner_email\n\n,\n \n cast('dummy_string' as varchar(4096)) as owner_name\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as url\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as depends_on_macros\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as depends_on_nodes\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as depends_on_columns\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as description\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as tags\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as meta\n\n,\n \n cast('dummy_string' as varchar(4096)) as package_name\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as original_path\n\n,\n \n cast('dummy_string' as varchar(4096)) as path\n\n,\n \n cast('dummy_string' as varchar(4096)) as generated_at\n\n,\n \n cast('dummy_string' as varchar(4096)) as metadata_hash\n\n,\n \n cast('dummy_string' as varchar(4096)) as label\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as raw_queries\n\n\n ) as empty_table\n where 1 = 0", "relation_name": "\"neondb\".\"dbt_testing_example_elementary\".\"dbt_exposures\""}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-12-07T05:38:47.042612Z", "completed_at": "2024-12-07T05:38:47.101594Z"}, {"name": "execute", "started_at": "2024-12-07T05:38:47.106363Z", "completed_at": "2024-12-07T05:38:47.106372Z"}], "thread_id": "Thread-4 (worker)", "execution_time": 0.07076811790466309, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.elementary.dbt_invocations", "compiled": true, "compiled_code": "\n\nselect * from (\n select\n \n \n cast('this_is_just_a_long_dummy_string' as text) as invocation_id\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as job_id\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as job_name\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as job_run_id\n\n,\n \n cast('dummy_string' as varchar(4096)) as run_started_at\n\n,\n \n cast('dummy_string' as varchar(4096)) as run_completed_at\n\n,\n \n cast('dummy_string' as varchar(4096)) as generated_at\n\n,\n cast('2091-02-17' as timestamp) as created_at\n\n,\n \n cast('dummy_string' as varchar(4096)) as command\n\n,\n \n cast('dummy_string' as varchar(4096)) as dbt_version\n\n,\n \n cast('dummy_string' as varchar(4096)) as elementary_version\n\n,\n \n cast (True as boolean) as full_refresh\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as invocation_vars\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as vars\n\n,\n \n cast('dummy_string' as varchar(4096)) as target_name\n\n,\n \n cast('dummy_string' as varchar(4096)) as target_database\n\n,\n \n cast('dummy_string' as varchar(4096)) as target_schema\n\n,\n \n cast('dummy_string' as varchar(4096)) as target_profile_name\n\n,\n \n cast(123456789 as integer) as threads\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as selected\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as yaml_selector\n\n,\n \n cast('dummy_string' as varchar(4096)) as project_id\n\n,\n \n cast('dummy_string' as varchar(4096)) as project_name\n\n,\n \n cast('dummy_string' as varchar(4096)) as env\n\n,\n \n cast('dummy_string' as varchar(4096)) as env_id\n\n,\n \n cast('dummy_string' as varchar(4096)) as cause_category\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as cause\n\n,\n \n cast('dummy_string' as varchar(4096)) as pull_request_id\n\n,\n \n cast('dummy_string' as varchar(4096)) as git_sha\n\n,\n \n cast('dummy_string' as varchar(4096)) as orchestrator\n\n,\n \n cast('dummy_string' as varchar(4096)) as dbt_user\n\n,\n \n cast('dummy_string' as varchar(4096)) as job_url\n\n,\n \n cast('dummy_string' as varchar(4096)) as job_run_url\n\n,\n \n cast('dummy_string' as varchar(4096)) as account_id\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as target_adapter_specific_fields\n\n\n ) as empty_table\n where 1 = 0", "relation_name": "\"neondb\".\"dbt_testing_example_elementary\".\"dbt_invocations\""}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-12-07T05:38:47.058026Z", "completed_at": "2024-12-07T05:38:47.102152Z"}, {"name": "execute", "started_at": "2024-12-07T05:38:47.106922Z", "completed_at": "2024-12-07T05:38:47.106928Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.07083916664123535, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.elementary.dbt_metrics", "compiled": true, "compiled_code": "\n\nselect * from (\n select\n \n \n cast('dummy_string' as varchar(4096)) as unique_id\n\n,\n \n cast('dummy_string' as varchar(4096)) as name\n\n,\n \n cast('dummy_string' as varchar(4096)) as label\n\n,\n \n cast('dummy_string' as varchar(4096)) as model\n\n,\n \n cast('dummy_string' as varchar(4096)) as type\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as sql\n\n,\n \n cast('dummy_string' as varchar(4096)) as timestamp\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as filters\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as time_grains\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as dimensions\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as depends_on_macros\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as depends_on_nodes\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as description\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as tags\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as meta\n\n,\n \n cast('dummy_string' as varchar(4096)) as package_name\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as original_path\n\n,\n \n cast('dummy_string' as varchar(4096)) as path\n\n,\n \n cast('dummy_string' as varchar(4096)) as generated_at\n\n,\n \n cast('dummy_string' as varchar(4096)) as metadata_hash\n\n\n ) as empty_table\n where 1 = 0", "relation_name": "\"neondb\".\"dbt_testing_example_elementary\".\"dbt_metrics\""}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-12-07T05:38:47.083740Z", "completed_at": "2024-12-07T05:38:47.103711Z"}, {"name": "execute", "started_at": "2024-12-07T05:38:47.108153Z", "completed_at": "2024-12-07T05:38:47.108160Z"}], "thread_id": "Thread-3 (worker)", "execution_time": 0.07148194313049316, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.elementary.dbt_models", "compiled": true, "compiled_code": "\n\nselect * from (\n select\n \n \n cast('dummy_string' as varchar(4096)) as unique_id\n\n,\n \n cast('dummy_string' as varchar(4096)) as alias\n\n,\n \n cast('dummy_string' as varchar(4096)) as checksum\n\n,\n \n cast('dummy_string' as varchar(4096)) as materialization\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as tags\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as meta\n\n,\n \n cast('dummy_string' as varchar(4096)) as owner\n\n,\n \n cast('dummy_string' as varchar(4096)) as database_name\n\n,\n \n cast('dummy_string' as varchar(4096)) as schema_name\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as depends_on_macros\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as depends_on_nodes\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as description\n\n,\n \n cast('dummy_string' as varchar(4096)) as name\n\n,\n \n cast('dummy_string' as varchar(4096)) as package_name\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as original_path\n\n,\n \n cast('dummy_string' as varchar(4096)) as path\n\n,\n \n cast('dummy_string' as varchar(4096)) as patch_path\n\n,\n \n cast('dummy_string' as varchar(4096)) as generated_at\n\n,\n \n cast('dummy_string' as varchar(4096)) as metadata_hash\n\n\n ) as empty_table\n where 1 = 0", "relation_name": "\"neondb\".\"dbt_testing_example_elementary\".\"dbt_models\""}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-12-07T05:38:47.113218Z", "completed_at": "2024-12-07T05:38:47.134658Z"}, {"name": "execute", "started_at": "2024-12-07T05:38:47.183118Z", "completed_at": "2024-12-07T05:38:47.183135Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.07811474800109863, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.elementary.dbt_run_results", "compiled": true, "compiled_code": "\n\nselect * from (\n select\n \n \n cast('this_is_just_a_long_dummy_string' as text) as model_execution_id\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as unique_id\n\n,\n \n cast('dummy_string' as varchar(4096)) as invocation_id\n\n,\n \n cast('dummy_string' as varchar(4096)) as generated_at\n\n,\n cast('2091-02-17' as timestamp) as created_at\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as name\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as message\n\n,\n \n cast('dummy_string' as varchar(4096)) as status\n\n,\n \n cast('dummy_string' as varchar(4096)) as resource_type\n\n,\n \n cast(123456789.99 as float) as execution_time\n\n,\n \n cast('dummy_string' as varchar(4096)) as execute_started_at\n\n,\n \n cast('dummy_string' as varchar(4096)) as execute_completed_at\n\n,\n \n cast('dummy_string' as varchar(4096)) as compile_started_at\n\n,\n \n cast('dummy_string' as varchar(4096)) as compile_completed_at\n\n,\n \n cast(31474836478 as bigint) as rows_affected\n\n,\n \n cast (True as boolean) as full_refresh\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as compiled_code\n\n,\n \n cast(31474836478 as bigint) as failures\n\n,\n \n cast('dummy_string' as varchar(4096)) as query_id\n\n,\n \n cast('dummy_string' as varchar(4096)) as thread_id\n\n,\n \n cast('dummy_string' as varchar(4096)) as materialization\n\n,\n \n cast('dummy_string' as varchar(4096)) as adapter_response\n\n\n ) as empty_table\n where 1 = 0", "relation_name": "\"neondb\".\"dbt_testing_example_elementary\".\"dbt_run_results\""}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-12-07T05:38:47.136170Z", "completed_at": "2024-12-07T05:38:47.184069Z"}, {"name": "execute", "started_at": "2024-12-07T05:38:47.188485Z", "completed_at": "2024-12-07T05:38:47.188493Z"}], "thread_id": "Thread-4 (worker)", "execution_time": 0.05927753448486328, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.elementary.dbt_seeds", "compiled": true, "compiled_code": "\n\nselect * from (\n select\n \n \n cast('dummy_string' as varchar(4096)) as unique_id\n\n,\n \n cast('dummy_string' as varchar(4096)) as alias\n\n,\n \n cast('dummy_string' as varchar(4096)) as checksum\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as tags\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as meta\n\n,\n \n cast('dummy_string' as varchar(4096)) as owner\n\n,\n \n cast('dummy_string' as varchar(4096)) as database_name\n\n,\n \n cast('dummy_string' as varchar(4096)) as schema_name\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as description\n\n,\n \n cast('dummy_string' as varchar(4096)) as name\n\n,\n \n cast('dummy_string' as varchar(4096)) as package_name\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as original_path\n\n,\n \n cast('dummy_string' as varchar(4096)) as path\n\n,\n \n cast('dummy_string' as varchar(4096)) as generated_at\n\n,\n \n cast('dummy_string' as varchar(4096)) as metadata_hash\n\n\n ) as empty_table\n where 1 = 0", "relation_name": "\"neondb\".\"dbt_testing_example_elementary\".\"dbt_seeds\""}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-12-07T05:38:47.151204Z", "completed_at": "2024-12-07T05:38:47.184647Z"}, {"name": "execute", "started_at": "2024-12-07T05:38:47.189166Z", "completed_at": "2024-12-07T05:38:47.189174Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.05936408042907715, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.elementary.dbt_snapshots", "compiled": true, "compiled_code": "\n\nselect * from (\n select\n \n \n cast('dummy_string' as varchar(4096)) as unique_id\n\n,\n \n cast('dummy_string' as varchar(4096)) as alias\n\n,\n \n cast('dummy_string' as varchar(4096)) as checksum\n\n,\n \n cast('dummy_string' as varchar(4096)) as materialization\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as tags\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as meta\n\n,\n \n cast('dummy_string' as varchar(4096)) as owner\n\n,\n \n cast('dummy_string' as varchar(4096)) as database_name\n\n,\n \n cast('dummy_string' as varchar(4096)) as schema_name\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as depends_on_macros\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as depends_on_nodes\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as description\n\n,\n \n cast('dummy_string' as varchar(4096)) as name\n\n,\n \n cast('dummy_string' as varchar(4096)) as package_name\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as original_path\n\n,\n \n cast('dummy_string' as varchar(4096)) as path\n\n,\n \n cast('dummy_string' as varchar(4096)) as patch_path\n\n,\n \n cast('dummy_string' as varchar(4096)) as generated_at\n\n,\n \n cast('dummy_string' as varchar(4096)) as metadata_hash\n\n\n ) as empty_table\n where 1 = 0", "relation_name": "\"neondb\".\"dbt_testing_example_elementary\".\"dbt_snapshots\""}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-12-07T05:38:47.168107Z", "completed_at": "2024-12-07T05:38:47.187298Z"}, {"name": "execute", "started_at": "2024-12-07T05:38:47.193188Z", "completed_at": "2024-12-07T05:38:47.193195Z"}], "thread_id": "Thread-3 (worker)", "execution_time": 0.06236457824707031, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.elementary.dbt_source_freshness_results", "compiled": true, "compiled_code": "\n\n\n select * from (\n select\n \n \n cast('dummy_string' as varchar(4096)) as source_freshness_execution_id\n\n,\n \n cast('dummy_string' as varchar(4096)) as unique_id\n\n,\n \n cast('dummy_string' as varchar(4096)) as max_loaded_at\n\n,\n \n cast('dummy_string' as varchar(4096)) as snapshotted_at\n\n,\n \n cast('dummy_string' as varchar(4096)) as generated_at\n\n,\n cast('2091-02-17' as timestamp) as created_at\n\n,\n \n cast(123456789.99 as float) as max_loaded_at_time_ago_in_s\n\n,\n \n cast('dummy_string' as varchar(4096)) as status\n\n,\n \n cast('dummy_string' as varchar(4096)) as error\n\n,\n \n cast('dummy_string' as varchar(4096)) as compile_started_at\n\n,\n \n cast('dummy_string' as varchar(4096)) as compile_completed_at\n\n,\n \n cast('dummy_string' as varchar(4096)) as execute_started_at\n\n,\n \n cast('dummy_string' as varchar(4096)) as execute_completed_at\n\n,\n \n cast('dummy_string' as varchar(4096)) as invocation_id\n\n,\n \n cast('dummy_string' as varchar(4096)) as warn_after\n\n,\n \n cast('dummy_string' as varchar(4096)) as error_after\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as filter\n\n\n ) as empty_table\n where 1 = 0\n", "relation_name": "\"neondb\".\"dbt_testing_example_elementary\".\"dbt_source_freshness_results\""}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-12-07T05:38:47.196400Z", "completed_at": "2024-12-07T05:38:47.217042Z"}, {"name": "execute", "started_at": "2024-12-07T05:38:47.259353Z", "completed_at": "2024-12-07T05:38:47.259371Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.07649493217468262, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.elementary.dbt_sources", "compiled": true, "compiled_code": "\n\nselect * from (\n select\n \n \n cast('dummy_string' as varchar(4096)) as unique_id\n\n,\n \n cast('dummy_string' as varchar(4096)) as database_name\n\n,\n \n cast('dummy_string' as varchar(4096)) as schema_name\n\n,\n \n cast('dummy_string' as varchar(4096)) as source_name\n\n,\n \n cast('dummy_string' as varchar(4096)) as name\n\n,\n \n cast('dummy_string' as varchar(4096)) as identifier\n\n,\n \n cast('dummy_string' as varchar(4096)) as loaded_at_field\n\n,\n \n cast('dummy_string' as varchar(4096)) as freshness_warn_after\n\n,\n \n cast('dummy_string' as varchar(4096)) as freshness_error_after\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as freshness_filter\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as freshness_description\n\n,\n \n cast('dummy_string' as varchar(4096)) as relation_name\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as tags\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as meta\n\n,\n \n cast('dummy_string' as varchar(4096)) as owner\n\n,\n \n cast('dummy_string' as varchar(4096)) as package_name\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as original_path\n\n,\n \n cast('dummy_string' as varchar(4096)) as path\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as source_description\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as description\n\n,\n \n cast('dummy_string' as varchar(4096)) as generated_at\n\n,\n \n cast('dummy_string' as varchar(4096)) as metadata_hash\n\n\n ) as empty_table\n where 1 = 0", "relation_name": "\"neondb\".\"dbt_testing_example_elementary\".\"dbt_sources\""}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-12-07T05:38:47.218258Z", "completed_at": "2024-12-07T05:38:47.259919Z"}, {"name": "execute", "started_at": "2024-12-07T05:38:47.269019Z", "completed_at": "2024-12-07T05:38:47.269028Z"}], "thread_id": "Thread-4 (worker)", "execution_time": 0.05797624588012695, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.elementary.dbt_tests", "compiled": true, "compiled_code": "\n\nselect * from (\n select\n \n \n cast('dummy_string' as varchar(4096)) as unique_id\n\n,\n \n cast('dummy_string' as varchar(4096)) as database_name\n\n,\n \n cast('dummy_string' as varchar(4096)) as schema_name\n\n,\n \n cast('dummy_string' as varchar(4096)) as name\n\n,\n \n cast('dummy_string' as varchar(4096)) as short_name\n\n,\n \n cast('dummy_string' as varchar(4096)) as alias\n\n,\n \n cast('dummy_string' as varchar(4096)) as test_column_name\n\n,\n \n cast('dummy_string' as varchar(4096)) as severity\n\n,\n \n cast('dummy_string' as varchar(4096)) as warn_if\n\n,\n \n cast('dummy_string' as varchar(4096)) as error_if\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as test_params\n\n,\n \n cast('dummy_string' as varchar(4096)) as test_namespace\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as tags\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as model_tags\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as model_owners\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as meta\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as depends_on_macros\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as depends_on_nodes\n\n,\n \n cast('dummy_string' as varchar(4096)) as parent_model_unique_id\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as description\n\n,\n \n cast('dummy_string' as varchar(4096)) as package_name\n\n,\n \n cast('dummy_string' as varchar(4096)) as type\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as original_path\n\n,\n \n cast('dummy_string' as varchar(4096)) as path\n\n,\n \n cast('dummy_string' as varchar(4096)) as generated_at\n\n,\n \n cast('dummy_string' as varchar(4096)) as metadata_hash\n\n,\n \n cast('dummy_string' as varchar(4096)) as quality_dimension\n\n\n ) as empty_table\n where 1 = 0", "relation_name": "\"neondb\".\"dbt_testing_example_elementary\".\"dbt_tests\""}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-12-07T05:38:47.233565Z", "completed_at": "2024-12-07T05:38:47.265698Z"}, {"name": "execute", "started_at": "2024-12-07T05:38:47.270362Z", "completed_at": "2024-12-07T05:38:47.270371Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.05858635902404785, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.elementary.elementary_test_results", "compiled": true, "compiled_code": "\n\n\n select * from (\n select\n \n \n cast('this_is_just_a_long_dummy_string' as text) as id\n\n,\n \n cast('dummy_string' as varchar(4096)) as data_issue_id\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as test_execution_id\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as test_unique_id\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as model_unique_id\n\n,\n \n cast('dummy_string' as varchar(4096)) as invocation_id\n\n,\n cast('2091-02-17' as timestamp) as detected_at\n\n,\n cast('2091-02-17' as timestamp) as created_at\n\n,\n \n cast('dummy_string' as varchar(4096)) as database_name\n\n,\n \n cast('dummy_string' as varchar(4096)) as schema_name\n\n,\n \n cast('dummy_string' as varchar(4096)) as table_name\n\n,\n \n cast('dummy_string' as varchar(4096)) as column_name\n\n,\n \n cast('dummy_string' as varchar(4096)) as test_type\n\n,\n \n cast('dummy_string' as varchar(4096)) as test_sub_type\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as test_results_description\n\n,\n \n cast('dummy_string' as varchar(4096)) as owners\n\n,\n \n cast('dummy_string' as varchar(4096)) as tags\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as test_results_query\n\n,\n \n cast('dummy_string' as varchar(4096)) as other\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as test_name\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as test_params\n\n,\n \n cast('dummy_string' as varchar(4096)) as severity\n\n,\n \n cast('dummy_string' as varchar(4096)) as status\n\n,\n \n cast(31474836478 as bigint) as failures\n\n,\n \n cast('dummy_string' as varchar(4096)) as test_short_name\n\n,\n \n cast('dummy_string' as varchar(4096)) as test_alias\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as result_rows\n\n,\n \n cast(31474836478 as bigint) as failed_row_count\n\n\n ) as empty_table\n where 1 = 0\n", "relation_name": "\"neondb\".\"dbt_testing_example_elementary\".\"elementary_test_results\""}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-12-07T05:38:47.260575Z", "completed_at": "2024-12-07T05:38:47.269756Z"}, {"name": "execute", "started_at": "2024-12-07T05:38:47.274920Z", "completed_at": "2024-12-07T05:38:47.274927Z"}], "thread_id": "Thread-3 (worker)", "execution_time": 0.14800453186035156, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.elementary.metadata", "compiled": true, "compiled_code": "\n\nSELECT\n '0.14.1' as dbt_pkg_version", "relation_name": "\"neondb\".\"dbt_testing_example_elementary\".\"metadata\""}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-12-07T05:38:47.276219Z", "completed_at": "2024-12-07T05:38:47.368207Z"}, {"name": "execute", "started_at": "2024-12-07T05:38:47.390009Z", "completed_at": "2024-12-07T05:38:47.390024Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.12450242042541504, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.elementary.schema_columns_snapshot", "compiled": true, "compiled_code": "\n\n\n select * from (\n select\n \n \n cast('dummy_string' as varchar(4096)) as column_state_id\n\n,\n \n cast('dummy_string' as varchar(4096)) as full_column_name\n\n,\n \n cast('dummy_string' as varchar(4096)) as full_table_name\n\n,\n \n cast('dummy_string' as varchar(4096)) as column_name\n\n,\n \n cast('dummy_string' as varchar(4096)) as data_type\n\n,\n \n cast (True as boolean) as is_new\n\n,\n cast('2091-02-17' as timestamp) as detected_at\n\n,\n cast('2091-02-17' as timestamp) as created_at\n\n\n ) as empty_table\n where 1 = 0\n", "relation_name": "\"neondb\".\"dbt_testing_example_elementary\".\"schema_columns_snapshot\""}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-12-07T05:38:47.390823Z", "completed_at": "2024-12-07T05:38:47.393450Z"}, {"name": "execute", "started_at": "2024-12-07T05:38:47.398122Z", "completed_at": "2024-12-07T05:38:47.398132Z"}], "thread_id": "Thread-3 (worker)", "execution_time": 0.025362253189086914, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.dbt_testing_example.raw_height", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-12-07T05:38:47.369353Z", "completed_at": "2024-12-07T05:38:47.394060Z"}, {"name": "execute", "started_at": "2024-12-07T05:38:47.398664Z", "completed_at": "2024-12-07T05:38:47.398671Z"}], "thread_id": "Thread-4 (worker)", "execution_time": 0.03732657432556152, "adapter_response": {}, "message": null, "failures": null, "unique_id": "operation.elementary.elementary-on-run-end-0", "compiled": true, "compiled_code": "\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-12-07T05:38:47.376465Z", "completed_at": "2024-12-07T05:38:47.394550Z"}, {"name": "execute", "started_at": "2024-12-07T05:38:47.399182Z", "completed_at": "2024-12-07T05:38:47.399191Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.036157846450805664, "adapter_response": {}, "message": null, "failures": null, "unique_id": "operation.elementary.elementary-on-run-start-0", "compiled": true, "compiled_code": "\n \n \n\n \n \n\n \n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-12-07T05:38:47.405342Z", "completed_at": "2024-12-07T05:38:47.408043Z"}, {"name": "execute", "started_at": "2024-12-07T05:38:47.412779Z", "completed_at": "2024-12-07T05:38:47.412786Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.04611921310424805, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.dbt_testing_example.raw_weight", "compiled": null, "compiled_code": null, "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-12-07T05:38:47.427435Z", "completed_at": "2024-12-07T05:38:48.292252Z"}, {"name": "execute", "started_at": "2024-12-07T05:38:48.293324Z", "completed_at": "2024-12-07T05:38:48.293336Z"}], "thread_id": "Thread-4 (worker)", "execution_time": 0.9759011268615723, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_testing_example.dbt_expectations_source_expect_column_values_to_be_of_type_gym_app_raw_height_height_unit__text.c82161c012", "compiled": true, "compiled_code": "with relation_columns as (\n\n \n select\n cast('DATE' as TEXT) as relation_column,\n cast('TEXT' as TEXT) as relation_column_type\n union all\n \n select\n cast('USER_ID' as TEXT) as relation_column,\n cast('INTEGER' as TEXT) as relation_column_type\n union all\n \n select\n cast('HEIGHT' as TEXT) as relation_column,\n cast('DOUBLE PRECISION' as TEXT) as relation_column_type\n union all\n \n select\n cast('HEIGHT_UNIT' as TEXT) as relation_column,\n cast('TEXT' as TEXT) as relation_column_type\n \n \n ),\n test_data as (\n\n select\n *\n from\n relation_columns\n where\n relation_column = 'HEIGHT_UNIT'\n and\n relation_column_type not in ('TEXT')\n\n )\n select *\n from test_data", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-12-07T05:38:47.452144Z", "completed_at": "2024-12-07T05:38:48.305229Z"}, {"name": "execute", "started_at": "2024-12-07T05:38:48.306214Z", "completed_at": "2024-12-07T05:38:48.306222Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.9496855735778809, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_testing_example.dbt_expectations_source_expect_column_values_to_be_of_type_gym_app_raw_weight_measurement_unit__text.7271116707", "compiled": true, "compiled_code": "with relation_columns as (\n\n \n select\n cast('DATE' as TEXT) as relation_column,\n cast('TEXT' as TEXT) as relation_column_type\n union all\n \n select\n cast('USER_ID' as TEXT) as relation_column,\n cast('INTEGER' as TEXT) as relation_column_type\n union all\n \n select\n cast('WEIGHT' as TEXT) as relation_column,\n cast('DOUBLE PRECISION' as TEXT) as relation_column_type\n union all\n \n select\n cast('MEASUREMENT_UNIT' as TEXT) as relation_column,\n cast('TEXT' as TEXT) as relation_column_type\n \n \n ),\n test_data as (\n\n select\n *\n from\n relation_columns\n where\n relation_column = 'MEASUREMENT_UNIT'\n and\n relation_column_type not in ('TEXT')\n\n )\n select *\n from test_data", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-12-07T05:38:47.413341Z", "completed_at": "2024-12-07T05:38:48.329537Z"}, {"name": "execute", "started_at": "2024-12-07T05:38:48.331634Z", "completed_at": "2024-12-07T05:38:48.331644Z"}], "thread_id": "Thread-3 (worker)", "execution_time": 1.0193591117858887, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_testing_example.dbt_expectations_source_expect_column_values_to_be_of_type_gym_app_raw_height_height__double_precision.1f5b371f9e", "compiled": true, "compiled_code": "with relation_columns as (\n\n \n select\n cast('DATE' as TEXT) as relation_column,\n cast('TEXT' as TEXT) as relation_column_type\n union all\n \n select\n cast('USER_ID' as TEXT) as relation_column,\n cast('INTEGER' as TEXT) as relation_column_type\n union all\n \n select\n cast('HEIGHT' as TEXT) as relation_column,\n cast('DOUBLE PRECISION' as TEXT) as relation_column_type\n union all\n \n select\n cast('HEIGHT_UNIT' as TEXT) as relation_column,\n cast('TEXT' as TEXT) as relation_column_type\n \n \n ),\n test_data as (\n\n select\n *\n from\n relation_columns\n where\n relation_column = 'HEIGHT'\n and\n relation_column_type not in ('DOUBLE PRECISION')\n\n )\n select *\n from test_data", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-12-07T05:38:47.436302Z", "completed_at": "2024-12-07T05:38:48.330090Z"}, {"name": "execute", "started_at": "2024-12-07T05:38:48.332205Z", "completed_at": "2024-12-07T05:38:48.332213Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 1.0187180042266846, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_testing_example.dbt_expectations_source_expect_column_values_to_be_of_type_gym_app_raw_height_user_id__integer.14569ac5f0", "compiled": true, "compiled_code": "with relation_columns as (\n\n \n select\n cast('DATE' as TEXT) as relation_column,\n cast('TEXT' as TEXT) as relation_column_type\n union all\n \n select\n cast('USER_ID' as TEXT) as relation_column,\n cast('INTEGER' as TEXT) as relation_column_type\n union all\n \n select\n cast('HEIGHT' as TEXT) as relation_column,\n cast('DOUBLE PRECISION' as TEXT) as relation_column_type\n union all\n \n select\n cast('HEIGHT_UNIT' as TEXT) as relation_column,\n cast('TEXT' as TEXT) as relation_column_type\n \n \n ),\n test_data as (\n\n select\n *\n from\n relation_columns\n where\n relation_column = 'USER_ID'\n and\n relation_column_type not in ('INTEGER')\n\n )\n select *\n from test_data", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-12-07T05:38:48.433088Z", "completed_at": "2024-12-07T05:38:48.445513Z"}, {"name": "execute", "started_at": "2024-12-07T05:38:48.447539Z", "completed_at": "2024-12-07T05:38:48.447551Z"}], "thread_id": "Thread-3 (worker)", "execution_time": 0.018199682235717773, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_testing_example.dbt_utils_source_accepted_range_gym_app_raw_height_height__False__0.0dd5e14a3d", "compiled": true, "compiled_code": "\n\nwith meet_condition as(\n select *\n from \"neondb\".\"dbt_testing_example\".\"raw_height\"\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 -- records with a value >= min_value are permitted. The `not` flips this to find records that don't meet the rule.\n or not height > 0\n)\n\nselect *\nfrom validation_errors\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-12-07T05:38:48.439746Z", "completed_at": "2024-12-07T05:38:48.446057Z"}, {"name": "execute", "started_at": "2024-12-07T05:38:48.448085Z", "completed_at": "2024-12-07T05:38:48.448093Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.018420934677124023, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_testing_example.dbt_utils_source_accepted_range_gym_app_raw_weight_weight__False__0.2147fe640d", "compiled": true, "compiled_code": "\n\nwith meet_condition as(\n select *\n from \"neondb\".\"dbt_testing_example\".\"raw_weight\"\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 -- records with a value >= min_value are permitted. The `not` flips this to find records that don't meet the rule.\n or not weight > 0\n)\n\nselect *\nfrom validation_errors\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-12-07T05:38:48.453985Z", "completed_at": "2024-12-07T05:38:48.465256Z"}, {"name": "execute", "started_at": "2024-12-07T05:38:48.467364Z", "completed_at": "2024-12-07T05:38:48.467376Z"}], "thread_id": "Thread-3 (worker)", "execution_time": 0.01706981658935547, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_testing_example.source_accepted_values_gym_app_raw_height_height_unit__cm__inches.f4af351a08", "compiled": true, "compiled_code": "\n \n \n\nwith all_values as (\n\n select\n height_unit as value_field,\n count(*) as n_records\n\n from \"neondb\".\"dbt_testing_example\".\"raw_height\"\n group by height_unit\n\n)\n\nselect *\nfrom all_values\nwhere value_field not in (\n 'cm','inches'\n)\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-12-07T05:38:48.459849Z", "completed_at": "2024-12-07T05:38:48.465813Z"}, {"name": "execute", "started_at": "2024-12-07T05:38:48.467924Z", "completed_at": "2024-12-07T05:38:48.467933Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.01735711097717285, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_testing_example.source_accepted_values_gym_app_raw_weight_measurement_unit__kg__pounds.0e8337c1da", "compiled": true, "compiled_code": "\n \n \n\nwith all_values as (\n\n select\n measurement_unit as value_field,\n count(*) as n_records\n\n from \"neondb\".\"dbt_testing_example\".\"raw_weight\"\n group by measurement_unit\n\n)\n\nselect *\nfrom all_values\nwhere value_field not in (\n 'kg','pounds'\n)\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-12-07T05:38:48.473848Z", "completed_at": "2024-12-07T05:38:48.489345Z"}, {"name": "execute", "started_at": "2024-12-07T05:38:48.491363Z", "completed_at": "2024-12-07T05:38:48.491375Z"}], "thread_id": "Thread-3 (worker)", "execution_time": 0.02143096923828125, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_testing_example.source_not_null_gym_app_raw_height_height.e7ed26fbfe", "compiled": true, "compiled_code": "\n \n \n\n\n\nselect height\nfrom \"neondb\".\"dbt_testing_example\".\"raw_height\"\nwhere height is null\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-12-07T05:38:48.483300Z", "completed_at": "2024-12-07T05:38:48.489898Z"}, {"name": "execute", "started_at": "2024-12-07T05:38:48.492022Z", "completed_at": "2024-12-07T05:38:48.492031Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.02170085906982422, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_testing_example.source_not_null_gym_app_raw_height_user_id.4fb45a730a", "compiled": true, "compiled_code": "\n \n \n\n\n\nselect user_id\nfrom \"neondb\".\"dbt_testing_example\".\"raw_height\"\nwhere user_id is null\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-12-07T05:38:48.497956Z", "completed_at": "2024-12-07T05:38:48.509055Z"}, {"name": "execute", "started_at": "2024-12-07T05:38:48.511065Z", "completed_at": "2024-12-07T05:38:48.511073Z"}], "thread_id": "Thread-3 (worker)", "execution_time": 0.01670384407043457, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_testing_example.source_not_null_gym_app_raw_weight_user_id.e854c4fcc8", "compiled": true, "compiled_code": "\n \n \n\n\n\nselect user_id\nfrom \"neondb\".\"dbt_testing_example\".\"raw_weight\"\nwhere user_id is null\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-12-07T05:38:48.503310Z", "completed_at": "2024-12-07T05:38:48.509607Z"}, {"name": "execute", "started_at": "2024-12-07T05:38:48.511587Z", "completed_at": "2024-12-07T05:38:48.511593Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.016949892044067383, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_testing_example.source_not_null_gym_app_raw_weight_weight.3cc3503e9d", "compiled": true, "compiled_code": "\n \n \n\n\n\nselect weight\nfrom \"neondb\".\"dbt_testing_example\".\"raw_weight\"\nwhere weight is null\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-12-07T05:38:48.532570Z", "completed_at": "2024-12-07T05:38:48.546778Z"}, {"name": "execute", "started_at": "2024-12-07T05:38:48.547809Z", "completed_at": "2024-12-07T05:38:48.547820Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.032941579818725586, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.dbt_testing_example.int_weight_measurements_with_latest_height", "compiled": true, "compiled_code": "with\n\nheight as (\n\n select * from \"neondb\".\"dbt_testing_example\".\"stg_gym_app__height\"\n\n),\n\nweight as (\n\n select * from \"neondb\".\"dbt_testing_example\".\"stg_gym_app__weight\"\n\n),\n\nenrich_with_lasted_height_recorded_before_the_weight_measurement as (\n\n select\n weight.created_date,\n user_id,\n weight,\n (select height\n from height\n where height.created_date < weight.created_date and\n height.user_id = weight.user_id\n order by height.created_date DESC\n limit 1) as height\n from weight\n)\n\nselect * from enrich_with_lasted_height_recorded_before_the_weight_measurement", "relation_name": "\"neondb\".\"dbt_testing_example\".\"int_weight_measurements_with_latest_height\""}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-12-07T05:38:48.517255Z", "completed_at": "2024-12-07T05:38:48.549833Z"}, {"name": "execute", "started_at": "2024-12-07T05:38:48.552227Z", "completed_at": "2024-12-07T05:38:48.552234Z"}], "thread_id": "Thread-3 (worker)", "execution_time": 0.1214609146118164, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_testing_example.stg_gym_app__height_unit_test", "compiled": true, "compiled_code": "\n\n\n \n \n\n\n \n \n select * from (select 1) as t where 1 = 0\n \n \n\n\nUNION ALL\n\n\n \n \n\n\n \n \n select * from (select 1) as t where 1 = 0\n \n \n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-12-07T05:38:48.552763Z", "completed_at": "2024-12-07T05:38:48.638592Z"}, {"name": "execute", "started_at": "2024-12-07T05:38:48.650406Z", "completed_at": "2024-12-07T05:38:48.650416Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.10093545913696289, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_testing_example.stg_gym_app__weight_unit_test", "compiled": true, "compiled_code": "\n\n\n \n \n\n\n \n \n select * from (select 1) as t where 1 = 0\n \n \n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-12-07T05:38:48.640106Z", "completed_at": "2024-12-07T05:38:48.653235Z"}, {"name": "execute", "started_at": "2024-12-07T05:38:48.660610Z", "completed_at": "2024-12-07T05:38:48.660619Z"}], "thread_id": "Thread-3 (worker)", "execution_time": 0.023645877838134766, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.elementary.metrics_anomaly_score", "compiled": true, "compiled_code": "\n\nwith data_monitoring_metrics as (\n\n select * from \"neondb\".\"dbt_testing_example_elementary\".\"data_monitoring_metrics\"\n\n),\n\ntime_window_aggregation as (\n\n select\n id,\n full_table_name,\n column_name,\n dimension,\n dimension_value,\n metric_name,\n metric_value,\n source_value,\n bucket_start,\n bucket_end,\n bucket_duration_hours,\n updated_at,\n avg(metric_value) over (partition by metric_name, full_table_name, column_name order by bucket_start asc rows between unbounded preceding and current row) as training_avg,\n stddev(metric_value) over (partition by metric_name, full_table_name, column_name order by bucket_start asc rows between unbounded preceding and current row) as training_stddev,\n count(metric_value) over (partition by metric_name, full_table_name, column_name order by bucket_start asc rows between unbounded preceding and current row) as training_set_size,\n last_value(bucket_end) over (partition by metric_name, full_table_name, column_name order by bucket_start asc rows between unbounded preceding and current row) training_end,\n first_value(bucket_end) over (partition by metric_name, full_table_name, column_name order by bucket_start asc rows between unbounded preceding and current row) as training_start\n from data_monitoring_metrics\n group by 1,2,3,4,5,6,7,8,9,10,11,12\n),\n\nmetrics_anomaly_score as (\n\n select\n id,\n full_table_name,\n column_name,\n dimension,\n dimension_value,\n metric_name,\n case\n when training_stddev is null then null\n when training_stddev = 0 then 0\n else (metric_value - training_avg) / (training_stddev)\n end as anomaly_score,\n metric_value as latest_metric_value,\n bucket_start,\n bucket_end,\n training_avg,\n training_stddev,\n training_start,\n training_end,\n training_set_size,\n max(updated_at) as updated_at\n from time_window_aggregation\n where\n metric_value is not null\n and training_avg is not null\n and bucket_end >= \n cast(date_trunc('day', \n current_timestamp::timestamp\n) as timestamp) + cast(-7 as integer) * INTERVAL '1 day'\n\n group by 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15\n order by bucket_end desc\n\n\n),\n\nfinal as (\n\n select\n id,\n full_table_name,\n column_name,\n dimension,\n dimension_value,\n metric_name,\n anomaly_score,\n latest_metric_value,\n bucket_start,\n bucket_end,\n training_avg,\n training_stddev,\n training_start,\n training_end,\n training_set_size,\n updated_at,\n case\n when abs(anomaly_score) > 3 then true\n else false end\n as is_anomaly\n from metrics_anomaly_score\n)\n\nselect * from final", "relation_name": "\"neondb\".\"dbt_testing_example_elementary\".\"metrics_anomaly_score\""}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-12-07T05:38:48.654709Z", "completed_at": "2024-12-07T05:38:48.662783Z"}, {"name": "execute", "started_at": "2024-12-07T05:38:48.664984Z", "completed_at": "2024-12-07T05:38:48.664991Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.022320032119750977, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.elementary.monitors_runs", "compiled": true, "compiled_code": "\n\nwith data_monitoring_metrics as (\n\n select * from \"neondb\".\"dbt_testing_example_elementary\".\"data_monitoring_metrics\"\n\n),\n\nmax_bucket_end as (\n\n select full_table_name,\n column_name,\n metric_name,\n metric_properties,\n max(bucket_end) as last_bucket_end,\n min(bucket_end) as first_bucket_end\n from data_monitoring_metrics\n group by 1,2,3,4\n\n)\n\nselect * from max_bucket_end", "relation_name": "\"neondb\".\"dbt_testing_example_elementary\".\"monitors_runs\""}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-12-07T05:38:48.665506Z", "completed_at": "2024-12-07T05:38:48.677076Z"}, {"name": "execute", "started_at": "2024-12-07T05:38:48.687631Z", "completed_at": "2024-12-07T05:38:48.687643Z"}], "thread_id": "Thread-3 (worker)", "execution_time": 0.025287866592407227, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.elementary.job_run_results", "compiled": true, "compiled_code": "\n\n\n\n\n\nwith jobs as (\n select\n job_name,\n job_id,\n job_run_id,\n \nmin(cast(run_started_at as timestamp))\n as job_run_started_at,\n \nmax(cast(run_completed_at as timestamp))\n as job_run_completed_at,\n \n \n (\n (\n (\n ((\nmax(cast(run_completed_at as timestamp))\n)::date - (\nmin(cast(run_started_at as timestamp))\n)::date)\n * 24 + date_part('hour', (\nmax(cast(run_completed_at as timestamp))\n)::timestamp) - date_part('hour', (\nmin(cast(run_started_at as timestamp))\n)::timestamp))\n * 60 + date_part('minute', (\nmax(cast(run_completed_at as timestamp))\n)::timestamp) - date_part('minute', (\nmin(cast(run_started_at as timestamp))\n)::timestamp))\n * 60 + floor(date_part('second', (\nmax(cast(run_completed_at as timestamp))\n)::timestamp)) - floor(date_part('second', (\nmin(cast(run_started_at as timestamp))\n)::timestamp)))\n \n as job_run_execution_time\n from \"neondb\".\"dbt_testing_example_elementary\".\"dbt_invocations\"\n where job_id is not null\n group by job_name, job_id, job_run_id\n)\n\nselect\n job_name as name,\n job_id as id,\n job_run_id as run_id,\n job_run_started_at as run_started_at,\n job_run_completed_at as run_completed_at,\n job_run_execution_time as run_execution_time\nfrom jobs", "relation_name": "\"neondb\".\"dbt_testing_example_elementary\".\"job_run_results\""}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-12-07T05:38:48.678604Z", "completed_at": "2024-12-07T05:38:48.689951Z"}, {"name": "execute", "started_at": "2024-12-07T05:38:48.692013Z", "completed_at": "2024-12-07T05:38:48.692019Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.022090911865234375, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.elementary.model_run_results", "compiled": true, "compiled_code": "\n\nwith dbt_run_results as (\n select * from \"neondb\".\"dbt_testing_example_elementary\".\"dbt_run_results\"\n),\n\ndbt_models as (\n select * from \"neondb\".\"dbt_testing_example_elementary\".\"dbt_models\"\n)\n\nSELECT\n run_results.model_execution_id,\n run_results.unique_id,\n run_results.invocation_id,\n run_results.query_id,\n run_results.name,\n run_results.generated_at,\n run_results.status,\n run_results.full_refresh,\n run_results.message,\n run_results.execution_time,\n run_results.execute_started_at,\n run_results.execute_completed_at,\n run_results.compile_started_at,\n run_results.compile_completed_at,\n run_results.compiled_code,\n run_results.adapter_response,\n run_results.thread_id,\n models.database_name,\n models.schema_name,\n coalesce(run_results.materialization, models.materialization) as materialization,\n models.tags,\n models.package_name,\n models.path,\n models.original_path,\n models.owner,\n models.alias,\n ROW_NUMBER() OVER (PARTITION BY run_results.unique_id ORDER BY run_results.generated_at DESC) AS model_invocation_reverse_index,\n CASE WHEN FIRST_VALUE(invocation_id) OVER (PARTITION BY \n date_trunc('day', cast(run_results.generated_at as timestamp))\n ORDER BY run_results.generated_at ASC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) = invocation_id\n THEN TRUE\n ELSE FALSE \n END AS is_the_first_invocation_of_the_day,\n CASE WHEN LAST_VALUE(invocation_id) OVER (PARTITION BY \n date_trunc('day', cast(run_results.generated_at as timestamp))\n ORDER BY run_results.generated_at ASC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) = invocation_id\n THEN TRUE\n ELSE FALSE \n END AS is_the_last_invocation_of_the_day\n \nFROM dbt_run_results run_results\nJOIN dbt_models models ON run_results.unique_id = models.unique_id", "relation_name": "\"neondb\".\"dbt_testing_example_elementary\".\"model_run_results\""}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-12-07T05:38:48.692524Z", "completed_at": "2024-12-07T05:38:48.700376Z"}, {"name": "execute", "started_at": "2024-12-07T05:38:48.709392Z", "completed_at": "2024-12-07T05:38:48.709402Z"}], "thread_id": "Thread-3 (worker)", "execution_time": 0.019958019256591797, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.elementary.snapshot_run_results", "compiled": true, "compiled_code": "\n\nwith dbt_run_results as (\n select * from \"neondb\".\"dbt_testing_example_elementary\".\"dbt_run_results\"\n),\n\ndbt_snapshots as (\n select * from \"neondb\".\"dbt_testing_example_elementary\".\"dbt_snapshots\"\n)\n\nSELECT\n run_results.model_execution_id,\n run_results.unique_id,\n run_results.invocation_id,\n run_results.query_id,\n run_results.name,\n run_results.generated_at,\n run_results.status,\n run_results.full_refresh,\n run_results.message,\n run_results.execution_time,\n run_results.execute_started_at,\n run_results.execute_completed_at,\n run_results.compile_started_at,\n run_results.compile_completed_at,\n run_results.compiled_code,\n run_results.adapter_response,\n run_results.thread_id,\n snapshots.database_name,\n snapshots.schema_name,\n coalesce(run_results.materialization, snapshots.materialization) as materialization,\n snapshots.tags,\n snapshots.package_name,\n snapshots.path,\n snapshots.original_path,\n snapshots.owner,\n snapshots.alias\nFROM dbt_run_results run_results\nJOIN dbt_snapshots snapshots ON run_results.unique_id = snapshots.unique_id", "relation_name": "\"neondb\".\"dbt_testing_example_elementary\".\"snapshot_run_results\""}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-12-07T05:38:48.701958Z", "completed_at": "2024-12-07T05:38:48.712473Z"}, {"name": "execute", "started_at": "2024-12-07T05:38:48.734182Z", "completed_at": "2024-12-07T05:38:48.734193Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.03593254089355469, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.elementary.alerts_dbt_source_freshness", "compiled": true, "compiled_code": "\n\nwith results as (\n select * from \"neondb\".\"dbt_testing_example_elementary\".\"dbt_source_freshness_results\"\n),\n\nsources as (\n select * from \"neondb\".\"dbt_testing_example_elementary\".\"dbt_sources\"\n)\n\nselect\n results.source_freshness_execution_id as alert_id,\n results.max_loaded_at,\n results.snapshotted_at,\n cast(results.generated_at as timestamp) as detected_at,\n results.max_loaded_at_time_ago_in_s,\n results.status,\n results.error,\n results.warn_after,\n results.error_after,\n results.filter,\n sources.unique_id,\n sources.database_name,\n sources.schema_name,\n sources.source_name,\n sources.identifier,\n sources.tags,\n sources.meta,\n sources.owner,\n sources.package_name,\n sources.path,\n -- These columns below are deprecated. We add them since this view\n -- was used to be loaded into an incremental model with those columns, their names were later changed\n -- and Databricks doesn't respect `on_schema_change = 'append_new_columns'` properly, as described here -\n -- https://docs.databricks.com/en/delta/update-schema.html#automatic-schema-evolution-for-delta-lake-merge\n results.error_after as freshness_error_after,\n results.warn_after as freshness_warn_after,\n results.filter as freshness_filter\nfrom results\njoin sources on results.unique_id = sources.unique_id\nwhere True and lower(status) != 'pass'", "relation_name": "\"neondb\".\"dbt_testing_example_elementary\".\"alerts_dbt_source_freshness\""}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-12-07T05:38:48.738866Z", "completed_at": "2024-12-07T05:38:48.748697Z"}, {"name": "execute", "started_at": "2024-12-07T05:38:48.749713Z", "completed_at": "2024-12-07T05:38:48.749723Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.01298666000366211, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.elementary.dbt_artifacts_hashes", "compiled": true, "compiled_code": "\n\n\n\n\nselect\n 'dbt_models' as artifacts_model,\n metadata_hash\nfrom \"neondb\".\"dbt_testing_example_elementary\".\"dbt_models\"\n union all \n\nselect\n 'dbt_tests' as artifacts_model,\n metadata_hash\nfrom \"neondb\".\"dbt_testing_example_elementary\".\"dbt_tests\"\n union all \n\nselect\n 'dbt_sources' as artifacts_model,\n metadata_hash\nfrom \"neondb\".\"dbt_testing_example_elementary\".\"dbt_sources\"\n union all \n\nselect\n 'dbt_snapshots' as artifacts_model,\n metadata_hash\nfrom \"neondb\".\"dbt_testing_example_elementary\".\"dbt_snapshots\"\n union all \n\nselect\n 'dbt_metrics' as artifacts_model,\n metadata_hash\nfrom \"neondb\".\"dbt_testing_example_elementary\".\"dbt_metrics\"\n union all \n\nselect\n 'dbt_exposures' as artifacts_model,\n metadata_hash\nfrom \"neondb\".\"dbt_testing_example_elementary\".\"dbt_exposures\"\n union all \n\nselect\n 'dbt_seeds' as artifacts_model,\n metadata_hash\nfrom \"neondb\".\"dbt_testing_example_elementary\".\"dbt_seeds\"\n union all \n\nselect\n 'dbt_columns' as artifacts_model,\n metadata_hash\nfrom \"neondb\".\"dbt_testing_example_elementary\".\"dbt_columns\"\n\n\norder by metadata_hash", "relation_name": "\"neondb\".\"dbt_testing_example_elementary\".\"dbt_artifacts_hashes\""}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-12-07T05:38:48.752714Z", "completed_at": "2024-12-07T05:38:48.761139Z"}, {"name": "execute", "started_at": "2024-12-07T05:38:48.762089Z", "completed_at": "2024-12-07T05:38:48.762097Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.011180877685546875, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.elementary.alerts_anomaly_detection", "compiled": true, "compiled_code": "\n\nwith elementary_test_results as (\n select * from \"neondb\".\"dbt_testing_example_elementary\".\"elementary_test_results\"\n),\n\nalerts_anomaly_detection as (\n select id as alert_id,\n data_issue_id,\n test_execution_id,\n test_unique_id,\n model_unique_id,\n detected_at,\n database_name,\n schema_name,\n table_name,\n column_name,\n test_type as alert_type,\n test_sub_type as sub_type,\n test_results_description as alert_description,\n owners,\n tags,\n test_results_query as alert_results_query,\n other,\n test_name,\n test_short_name,\n test_params,\n severity,\n status,\n result_rows\n from elementary_test_results\n where True and lower(status) != 'pass'and lower(status) != 'skipped'and test_type = 'anomaly_detection'\n)\n\nselect * from alerts_anomaly_detection", "relation_name": "\"neondb\".\"dbt_testing_example_elementary\".\"alerts_anomaly_detection\""}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-12-07T05:38:48.765092Z", "completed_at": "2024-12-07T05:38:48.772918Z"}, {"name": "execute", "started_at": "2024-12-07T05:38:48.773857Z", "completed_at": "2024-12-07T05:38:48.773864Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.010579109191894531, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.elementary.alerts_dbt_tests", "compiled": true, "compiled_code": "\n\nwith elementary_test_results as (\n select * from \"neondb\".\"dbt_testing_example_elementary\".\"elementary_test_results\"\n),\n\nalerts_dbt_tests as (\n select id as alert_id,\n data_issue_id,\n test_execution_id,\n test_unique_id,\n model_unique_id,\n detected_at,\n database_name,\n schema_name,\n table_name,\n column_name,\n test_type as alert_type,\n test_sub_type as sub_type,\n test_results_description as alert_description,\n owners,\n tags,\n test_results_query as alert_results_query,\n other,\n test_name,\n test_short_name,\n test_params,\n severity,\n status,\n result_rows\n from elementary_test_results\n where True and lower(status) != 'pass' and lower(status) != 'skipped' and test_type = 'dbt_test'\n)\n\nselect * from alerts_dbt_tests", "relation_name": "\"neondb\".\"dbt_testing_example_elementary\".\"alerts_dbt_tests\""}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-12-07T05:38:48.776787Z", "completed_at": "2024-12-07T05:38:48.785672Z"}, {"name": "execute", "started_at": "2024-12-07T05:38:48.786602Z", "completed_at": "2024-12-07T05:38:48.786610Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.011605262756347656, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.elementary.alerts_schema_changes", "compiled": true, "compiled_code": "\n\n\nwith elementary_test_results as (\n select * from \"neondb\".\"dbt_testing_example_elementary\".\"elementary_test_results\"\n),\n\nalerts_schema_changes as (\n select id as alert_id,\n data_issue_id,\n test_execution_id,\n test_unique_id,\n model_unique_id,\n detected_at,\n database_name,\n schema_name,\n table_name,\n column_name,\n test_type as alert_type,\n test_sub_type as sub_type,\n test_results_description as alert_description,\n owners,\n tags,\n test_results_query as alert_results_query,\n other,\n test_name,\n test_short_name,\n test_params,\n severity,\n status,\n result_rows\n from elementary_test_results\n where True and lower(status) != 'pass'and lower(status) != 'skipped'and test_type = 'schema_change'\n)\n\nselect * from alerts_schema_changes", "relation_name": "\"neondb\".\"dbt_testing_example_elementary\".\"alerts_schema_changes\""}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-12-07T05:38:48.789541Z", "completed_at": "2024-12-07T05:38:48.799700Z"}, {"name": "execute", "started_at": "2024-12-07T05:38:48.800659Z", "completed_at": "2024-12-07T05:38:48.800668Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.013003110885620117, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.elementary.test_result_rows", "compiled": true, "compiled_code": "\n\n-- depends_on: \"neondb\".\"dbt_testing_example_elementary\".\"elementary_test_results\"\nselect * from (\n select\n \n \n cast('this_is_just_a_long_dummy_string' as text) as elementary_test_results_id\n\n,\n \n cast('this_is_just_a_long_dummy_string' as text) as result_row\n\n,\n cast('2091-02-17' as timestamp) as detected_at\n\n,\n cast('2091-02-17' as timestamp) as created_at\n\n\n ) as empty_table\n where 1 = 0", "relation_name": "\"neondb\".\"dbt_testing_example_elementary\".\"test_result_rows\""}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-12-07T05:38:48.803647Z", "completed_at": "2024-12-07T05:38:48.808678Z"}, {"name": "execute", "started_at": "2024-12-07T05:38:48.809660Z", "completed_at": "2024-12-07T05:38:48.809667Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.007779836654663086, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.dbt_testing_example.body_mass_indexes", "compiled": true, "compiled_code": "with\n\nweights_with_latest_height as (\n\n select * from \"neondb\".\"dbt_testing_example\".\"int_weight_measurements_with_latest_height\"\n\n),\n\nbody_mass_indexes as (\n\n select\n created_date,\n user_id,\n weight,\n height,\n round((weight::numeric / (height::numeric / 100) ^ 2)::numeric, 1) as bmi,\n current_timestamp as processed_at\n from weights_with_latest_height\n)\n\nselect * from body_mass_indexes", "relation_name": "\"neondb\".\"dbt_testing_example\".\"body_mass_indexes\""}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-12-07T05:38:48.812956Z", "completed_at": "2024-12-07T05:38:48.822502Z"}, {"name": "execute", "started_at": "2024-12-07T05:38:48.823481Z", "completed_at": "2024-12-07T05:38:48.823490Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.01244497299194336, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_testing_example.int_weight_measurements_with_latest_height_unit_test", "compiled": true, "compiled_code": "\n\n\n \n \n\n\n \n \n select * from (select 1) as t where 1 = 0\n \n \n\n\nUNION ALL\n\n\n \n \n\n\n \n \n select * from (select 1) as t where 1 = 0\n \n \n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-12-07T05:38:48.826543Z", "completed_at": "2024-12-07T05:38:48.834826Z"}, {"name": "execute", "started_at": "2024-12-07T05:38:48.835777Z", "completed_at": "2024-12-07T05:38:48.835784Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.011043071746826172, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.elementary.anomaly_threshold_sensitivity", "compiled": true, "compiled_code": "\n\nwith metrics_anomaly_score as (\n\n select * from \"neondb\".\"dbt_testing_example_elementary\".\"metrics_anomaly_score\"\n\n),\n\nscore_sensitivity as (\n\n select\n full_table_name,\n column_name,\n metric_name,\n latest_metric_value,\n training_avg as metric_avg,\n training_stddev as metric_stddev,\n anomaly_score,\n case when abs(anomaly_score) >= 1.5 then true else false end as \"is_anomaly_1_5\",\n case when abs(anomaly_score) >= 2 then true else false end as \"is_anomaly_2\",\n case when abs(anomaly_score) >= 2.5 then true else false end as \"is_anomaly_2_5\",\n case when abs(anomaly_score) >= 3 then true else false end as \"is_anomaly_3\",\n case when abs(anomaly_score) >= 3.5 then true else false end as \"is_anomaly_3_5\",\n case when abs(anomaly_score) >= 4 then true else false end as \"is_anomaly_4\",\n case when abs(anomaly_score) >= 4.5 then true else false end as \"is_anomaly_4_5\"\n from metrics_anomaly_score\n where abs(anomaly_score) >= 1.5\n\n)\n\nselect * from score_sensitivity", "relation_name": "\"neondb\".\"dbt_testing_example_elementary\".\"anomaly_threshold_sensitivity\""}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-12-07T05:38:48.838779Z", "completed_at": "2024-12-07T05:38:48.847118Z"}, {"name": "execute", "started_at": "2024-12-07T05:38:48.848074Z", "completed_at": "2024-12-07T05:38:48.848082Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.01109004020690918, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.elementary.alerts_dbt_models", "compiled": true, "compiled_code": "\n\nwith error_models as (\n \n select model_execution_id,\n unique_id,\n invocation_id,\n name,\n generated_at,\n status,\n full_refresh,\n message,\n execution_time,\n execute_started_at,\n execute_completed_at,\n compile_started_at,\n compile_completed_at,\n compiled_code,\n database_name,\n schema_name,\n materialization,\n tags,\n package_name,\n path,\n original_path,\n owner,\n alias \n from \"neondb\".\"dbt_testing_example_elementary\".\"model_run_results\"\n \n union all\n \n select model_execution_id,\n unique_id,\n invocation_id,\n name,\n generated_at,\n status,\n full_refresh,\n message,\n execution_time,\n execute_started_at,\n execute_completed_at,\n compile_started_at,\n compile_completed_at,\n compiled_code,\n database_name,\n schema_name,\n materialization,\n tags,\n package_name,\n path,\n original_path,\n owner,\n alias \n from \"neondb\".\"dbt_testing_example_elementary\".\"snapshot_run_results\"\n)\n\n\nselect model_execution_id as alert_id,\n unique_id,\n cast(generated_at as timestamp) as detected_at,\n database_name,\n materialization,\n path,\n original_path,\n schema_name,\n message,\n owner as owners,\n tags,\n alias,\n status,\n full_refresh\nfrom error_models\nwhere True and lower(status) != 'success'and lower(status) != 'skipped'", "relation_name": "\"neondb\".\"dbt_testing_example_elementary\".\"alerts_dbt_models\""}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-12-07T05:38:48.851082Z", "completed_at": "2024-12-07T05:38:48.858300Z"}, {"name": "execute", "started_at": "2024-12-07T05:38:48.859247Z", "completed_at": "2024-12-07T05:38:48.859254Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.009972333908081055, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_testing_example.body_mass_indexes_component_test", "compiled": true, "compiled_code": "\n\n\n \n \n\n\n \n \n select * from (select 1) as t where 1 = 0\n \n \n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-12-07T05:38:48.862897Z", "completed_at": "2024-12-07T05:38:48.870337Z"}, {"name": "execute", "started_at": "2024-12-07T05:38:48.871275Z", "completed_at": "2024-12-07T05:38:48.871282Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.010456562042236328, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_testing_example.body_mass_indexes_unit_test", "compiled": true, "compiled_code": "\n\n\n \n \n\n\n \n \n select * from (select 1) as t where 1 = 0\n \n \n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-12-07T05:38:48.874254Z", "completed_at": "2024-12-07T05:38:48.880020Z"}, {"name": "execute", "started_at": "2024-12-07T05:38:48.880999Z", "completed_at": "2024-12-07T05:38:48.881005Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.00854349136352539, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_testing_example.elementary_freshness_anomalies_body_mass_indexes_hour__2__processed_at.e39d6b3299", "compiled": true, "compiled_code": "\n \n \n \n\n \n \n with nothing as (select 1 as num)\n select * from nothing where num = 2\n\n\n \n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-12-07T05:38:48.883922Z", "completed_at": "2024-12-07T05:38:48.890135Z"}, {"name": "execute", "started_at": "2024-12-07T05:38:48.891068Z", "completed_at": "2024-12-07T05:38:48.891074Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.008934974670410156, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_testing_example.elementary_schema_changes_body_mass_indexes_.5e7b3caf3a", "compiled": true, "compiled_code": "\n \n\n \n \n with nothing as (select 1 as num)\n select * from nothing where num = 2\n\n\n \n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-12-07T05:38:48.893996Z", "completed_at": "2024-12-07T05:38:48.899509Z"}, {"name": "execute", "started_at": "2024-12-07T05:38:48.900446Z", "completed_at": "2024-12-07T05:38:48.900453Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.008275985717773438, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_testing_example.elementary_volume_anomalies_body_mass_indexes_.c1d889d103", "compiled": true, "compiled_code": "\n \n\n \n \n\n \n \n with nothing as (select 1 as num)\n select * from nothing where num = 2\n\n\n \n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-12-07T05:38:48.903415Z", "completed_at": "2024-12-07T05:38:48.909632Z"}, {"name": "execute", "started_at": "2024-12-07T05:38:48.910574Z", "completed_at": "2024-12-07T05:38:48.910581Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.008957862854003906, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_testing_example.relationships_body_mass_indexes_user_id__user_id__source_gym_app_raw_height_.d338d193c2", "compiled": true, "compiled_code": "\n \n \n\nwith child as (\n select user_id as from_field\n from \"neondb\".\"dbt_testing_example\".\"body_mass_indexes\"\n where user_id is not null\n),\n\nparent as (\n select user_id as to_field\n from \"neondb\".\"dbt_testing_example\".\"raw_height\"\n)\n\nselect\n from_field\n\nfrom child\nleft join parent\n on child.from_field = parent.to_field\n\nwhere parent.to_field is null\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-12-07T05:38:48.913532Z", "completed_at": "2024-12-07T05:38:48.920780Z"}, {"name": "execute", "started_at": "2024-12-07T05:38:48.921773Z", "completed_at": "2024-12-07T05:38:48.921781Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.01007390022277832, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_testing_example.relationships_body_mass_indexes_user_id__user_id__source_gym_app_raw_weight_.1ef253afa0", "compiled": true, "compiled_code": "\n \n \n\nwith child as (\n select user_id as from_field\n from \"neondb\".\"dbt_testing_example\".\"body_mass_indexes\"\n where user_id is not null\n),\n\nparent as (\n select user_id as to_field\n from \"neondb\".\"dbt_testing_example\".\"raw_weight\"\n)\n\nselect\n from_field\n\nfrom child\nleft join parent\n on child.from_field = parent.to_field\n\nwhere parent.to_field is null\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-12-07T05:38:48.402348Z", "completed_at": "2024-12-07T05:38:49.257100Z"}, {"name": "execute", "started_at": "2024-12-07T05:38:49.259369Z", "completed_at": "2024-12-07T05:38:49.259376Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.9523129463195801, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_testing_example.dbt_expectations_source_expect_column_values_to_be_of_type_gym_app_raw_weight_weight__double_precision.0c34285381", "compiled": true, "compiled_code": "with relation_columns as (\n\n \n select\n cast('DATE' as TEXT) as relation_column,\n cast('TEXT' as TEXT) as relation_column_type\n union all\n \n select\n cast('USER_ID' as TEXT) as relation_column,\n cast('INTEGER' as TEXT) as relation_column_type\n union all\n \n select\n cast('WEIGHT' as TEXT) as relation_column,\n cast('DOUBLE PRECISION' as TEXT) as relation_column_type\n union all\n \n select\n cast('MEASUREMENT_UNIT' as TEXT) as relation_column,\n cast('TEXT' as TEXT) as relation_column_type\n \n \n ),\n test_data as (\n\n select\n *\n from\n relation_columns\n where\n relation_column = 'WEIGHT'\n and\n relation_column_type not in ('DOUBLE PRECISION')\n\n )\n select *\n from test_data", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-12-07T05:38:48.387846Z", "completed_at": "2024-12-07T05:38:49.256494Z"}, {"name": "execute", "started_at": "2024-12-07T05:38:49.258768Z", "completed_at": "2024-12-07T05:38:49.258778Z"}], "thread_id": "Thread-4 (worker)", "execution_time": 0.9678511619567871, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.dbt_testing_example.dbt_expectations_source_expect_column_values_to_be_of_type_gym_app_raw_weight_user_id__integer.feda35ce32", "compiled": true, "compiled_code": "with relation_columns as (\n\n \n select\n cast('DATE' as TEXT) as relation_column,\n cast('TEXT' as TEXT) as relation_column_type\n union all\n \n select\n cast('USER_ID' as TEXT) as relation_column,\n cast('INTEGER' as TEXT) as relation_column_type\n union all\n \n select\n cast('WEIGHT' as TEXT) as relation_column,\n cast('DOUBLE PRECISION' as TEXT) as relation_column_type\n union all\n \n select\n cast('MEASUREMENT_UNIT' as TEXT) as relation_column,\n cast('TEXT' as TEXT) as relation_column_type\n \n \n ),\n test_data as (\n\n select\n *\n from\n relation_columns\n where\n relation_column = 'USER_ID'\n and\n relation_column_type not in ('INTEGER')\n\n )\n select *\n from test_data", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-12-07T05:38:48.713938Z", "completed_at": "2024-12-07T05:38:49.493905Z"}, {"name": "execute", "started_at": "2024-12-07T05:38:49.494895Z", "completed_at": "2024-12-07T05:38:49.494905Z"}], "thread_id": "Thread-3 (worker)", "execution_time": 0.7844624519348145, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.elementary.information_schema_columns", "compiled": true, "compiled_code": "\n\n \n \n \n \n\n with dbt_models_data as (\n select\n database_name,\n schema_name,\n alias as table_name\n from \"neondb\".\"dbt_testing_example_elementary\".\"dbt_models\"\n ),\n\n dbt_snapshots_data as (\n select\n database_name,\n schema_name,\n alias as table_name\n from \"neondb\".\"dbt_testing_example_elementary\".\"dbt_snapshots\"\n ),\n\n dbt_sources_data as (\n select\n database_name,\n schema_name,\n name as table_name\n from \"neondb\".\"dbt_testing_example_elementary\".\"dbt_sources\"\n ),\n\n dbt_seeds_data as (\n select\n database_name,\n schema_name,\n name as table_name\n from \"neondb\".\"dbt_testing_example_elementary\".\"dbt_seeds\"\n ),\n\n tables_information as (\n select * from dbt_models_data\n union all\n select * from dbt_sources_data\n union all\n select * from dbt_snapshots_data\n union all\n select * from dbt_seeds_data\n ),\n\n columns_information as (\n \n \n \n \n (\n select\n upper(table_catalog || '.' || table_schema || '.' || table_name) as full_table_name,\n upper(table_catalog) as database_name,\n upper(table_schema) as schema_name,\n upper(table_name) as table_name,\n upper(column_name) as column_name,\n data_type\n from information_schema.columns\n where upper(table_schema) = upper('dbt_testing_example')\n \n)\n \n \n\n\n\n ),\n\n information_schema_columns as (\n select col_info.*\n from tables_information tbl_info\n join columns_information col_info\n on (lower(tbl_info.database_name) = lower(col_info.database_name) and\n lower(tbl_info.schema_name) = lower(col_info.schema_name) and\n lower(tbl_info.table_name) = lower(col_info.table_name)\n )\n )\n\n select *\n from information_schema_columns\n\n", "relation_name": "\"neondb\".\"dbt_testing_example_elementary\".\"information_schema_columns\""}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-12-07T05:38:49.499004Z", "completed_at": "2024-12-07T05:38:49.505352Z"}, {"name": "execute", "started_at": "2024-12-07T05:38:49.506275Z", "completed_at": "2024-12-07T05:38:49.506282Z"}], "thread_id": "Thread-2 (worker)", "execution_time": 0.009094476699829102, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.elementary.enriched_columns", "compiled": true, "compiled_code": "\n\n\nwith information_schema_columns as (\n select\n lower(database_name) as database_name,\n lower(schema_name) as schema_name,\n lower(table_name) as table_name,\n lower(column_name) as name,\n data_type\n from \"neondb\".\"dbt_testing_example_elementary\".\"information_schema_columns\"\n),\n\ndbt_columns as (\n select\n lower(database_name) as database_name,\n lower(schema_name) as schema_name,\n lower(table_name) as table_name,\n lower(name) as name,\n description\n from \"neondb\".\"dbt_testing_example_elementary\".\"dbt_columns\"\n)\n\nselect\n database_name,\n schema_name,\n table_name,\n name,\n data_type,\n description\nfrom information_schema_columns\nleft join dbt_columns using (database_name, schema_name, table_name, name)", "relation_name": "\"neondb\".\"dbt_testing_example_elementary\".\"enriched_columns\""}], "elapsed_time": 4.572760105133057, "args": {"log_format": "default", "vars": {}, "enable_legacy_logger": false, "printer_width": 80, "partial_parse_file_diff": true, "cache_selected_only": false, "log_level": "info", "project_dir": "/__w/dbt-testing-examples/dbt-testing-examples", "profiles_dir": "/__w/dbt-testing-examples/dbt-testing-examples", "use_colors": true, "send_anonymous_usage_stats": true, "static_parser": true, "target_path": "docs", "warn_error_options": {"include": [], "exclude": []}, "macro_debugging": false, "favor_state": false, "target": "test", "print": true, "quiet": false, "exclude": [], "show_resource_report": false, "use_colors_file": true, "indirect_selection": "eager", "populate_cache": true, "compile": true, "partial_parse": true, "log_format_file": "debug", "log_level_file": "debug", "invocation_command": "dbt docs generate --target-path docs --target test", "introspect": true, "defer": false, "select": [], "version_check": true, "log_path": "/__w/dbt-testing-examples/dbt-testing-examples/logs", "static": false, "which": "generate", "empty_catalog": false, "write_json": true, "strict_mode": false, "log_file_max_bytes": 10485760}}
\ No newline at end of file
diff --git a/docs/semantic_manifest.json b/docs/semantic_manifest.json
new file mode 100644
index 0000000..08ef1b7
--- /dev/null
+++ b/docs/semantic_manifest.json
@@ -0,0 +1 @@
+{"semantic_models": [], "metrics": [], "project_configuration": {"time_spine_table_configurations": [], "metadata": null, "dsi_package_version": {"major_version": "0", "minor_version": "4", "patch_version": "4"}}, "saved_queries": []}
\ No newline at end of file