diff --git a/catalog.json b/catalog.json
index 08bb8c29..bf078ba7 100644
--- a/catalog.json
+++ b/catalog.json
@@ -1 +1 @@
-{"metadata": {"dbt_schema_version": "https://schemas.getdbt.com/dbt/catalog/v1.json", "dbt_version": "1.8.5", "generated_at": "2024-08-09T18:45:50.689097Z", "invocation_id": "7a90ab1d-4858-4113-a565-f6d0e653511e", "env": {}}, "nodes": {"model.aspects.course_block_names": {"metadata": {"type": "table", "schema": "xapi", "name": "course_block_names", "database": "", "comment": null, "owner": null}, "columns": {"location": {"type": "String", "index": 1, "name": "location", "comment": null}, "block_name": {"type": "String", "index": 2, "name": "block_name", "comment": null}, "course_key": {"type": "String", "index": 3, "name": "course_key", "comment": null}, "graded": {"type": "Bool", "index": 4, "name": "graded", "comment": null}, "course_order": {"type": "Int32", "index": 5, "name": "course_order", "comment": null}, "display_name_with_location": {"type": "String", "index": 6, "name": "display_name_with_location", "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.aspects.course_block_names"}, "model.aspects.course_names": {"metadata": {"type": "table", "schema": "xapi", "name": "course_names", "database": "", "comment": null, "owner": null}, "columns": {"course_key": {"type": "String", "index": 1, "name": "course_key", "comment": null}, "course_name": {"type": "String", "index": 2, "name": "course_name", "comment": null}, "course_run": {"type": "String", "index": 3, "name": "course_run", "comment": null}, "org": {"type": "String", "index": 4, "name": "org", "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.aspects.course_names"}, "model.aspects.dim_course_blocks": {"metadata": {"type": "view", "schema": "xapi", "name": "dim_course_blocks", "database": "", "comment": null, "owner": null}, "columns": {"org": {"type": "String", "index": 1, "name": "org", "comment": null}, "course_key": {"type": "String", "index": 2, "name": "course_key", "comment": null}, "course_name": {"type": "String", "index": 3, "name": "course_name", "comment": null}, "course_run": {"type": "String", "index": 4, "name": "course_run", "comment": null}, "block_id": {"type": "String", "index": 5, "name": "block_id", "comment": null}, "block_name": {"type": "String", "index": 6, "name": "block_name", "comment": null}, "section_number": {"type": "String", "index": 7, "name": "section_number", "comment": null}, "subsection_number": {"type": "String", "index": 8, "name": "subsection_number", "comment": null}, "hierarchy_location": {"type": "String", "index": 9, "name": "hierarchy_location", "comment": null}, "display_name_with_location": {"type": "String", "index": 10, "name": "display_name_with_location", "comment": null}, "course_order": {"type": "Int32", "index": 11, "name": "course_order", "comment": null}, "graded": {"type": "Bool", "index": 12, "name": "graded", "comment": null}, "block_type": {"type": "String", "index": 13, "name": "block_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.aspects.dim_course_blocks"}, "model.aspects.dim_course_blocks_extended": {"metadata": {"type": "view", "schema": "xapi", "name": "dim_course_blocks_extended", "database": "", "comment": null, "owner": null}, "columns": {"org": {"type": "String", "index": 1, "name": "org", "comment": null}, "course_key": {"type": "String", "index": 2, "name": "course_key", "comment": null}, "course_name": {"type": "String", "index": 3, "name": "course_name", "comment": null}, "course_run": {"type": "String", "index": 4, "name": "course_run", "comment": null}, "block_id": {"type": "String", "index": 5, "name": "block_id", "comment": null}, "block_name": {"type": "String", "index": 6, "name": "block_name", "comment": null}, "section_number": {"type": "String", "index": 7, "name": "section_number", "comment": null}, "subsection_number": {"type": "String", "index": 8, "name": "subsection_number", "comment": null}, "hierarchy_location": {"type": "String", "index": 9, "name": "hierarchy_location", "comment": null}, "display_name_with_location": {"type": "String", "index": 10, "name": "display_name_with_location", "comment": null}, "graded": {"type": "Bool", "index": 11, "name": "graded", "comment": null}, "course_order": {"type": "Int32", "index": 12, "name": "course_order", "comment": null}, "block_type": {"type": "String", "index": 13, "name": "block_type", "comment": null}, "section_with_name": {"type": "String", "index": 14, "name": "section_with_name", "comment": null}, "subsection_with_name": {"type": "String", "index": 15, "name": "subsection_with_name", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.aspects.dim_course_blocks_extended"}, "model.aspects.dim_user_pii": {"metadata": {"type": "view", "schema": "xapi", "name": "dim_user_pii", "database": "", "comment": null, "owner": null}, "columns": {"external_user_id": {"type": "UUID", "index": 1, "name": "external_user_id", "comment": null}, "username": {"type": "String", "index": 2, "name": "username", "comment": null}, "name": {"type": "String", "index": 3, "name": "name", "comment": null}, "email": {"type": "String", "index": 4, "name": "email", "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.aspects.dim_user_pii"}, "model.aspects.enrollment_events": {"metadata": {"type": "table", "schema": "xapi", "name": "enrollment_events", "database": "", "comment": null, "owner": null}, "columns": {"event_id": {"type": "UUID", "index": 1, "name": "event_id", "comment": null}, "emission_time": {"type": "DateTime", "index": 2, "name": "emission_time", "comment": null}, "actor_id": {"type": "String", "index": 3, "name": "actor_id", "comment": null}, "object_id": {"type": "String", "index": 4, "name": "object_id", "comment": null}, "course_key": {"type": "LowCardinality(String)", "index": 5, "name": "course_key", "comment": null}, "org": {"type": "LowCardinality(String)", "index": 6, "name": "org", "comment": null}, "verb_id": {"type": "LowCardinality(String)", "index": 7, "name": "verb_id", "comment": null}, "enrollment_mode": {"type": "LowCardinality(String)", "index": 8, "name": "enrollment_mode", "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.aspects.enrollment_events"}, "model.aspects.fact_enrollment_status": {"metadata": {"type": "table", "schema": "xapi", "name": "fact_enrollment_status", "database": "", "comment": null, "owner": null}, "columns": {"org": {"type": "LowCardinality(String)", "index": 1, "name": "org", "comment": null}, "course_key": {"type": "LowCardinality(String)", "index": 2, "name": "course_key", "comment": null}, "actor_id": {"type": "String", "index": 3, "name": "actor_id", "comment": null}, "enrollment_status": {"type": "String", "index": 4, "name": "enrollment_status", "comment": null}, "enrollment_mode": {"type": "LowCardinality(String)", "index": 5, "name": "enrollment_mode", "comment": null}, "emission_time": {"type": "DateTime", "index": 6, "name": "emission_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.aspects.fact_enrollment_status"}, "model.aspects.fact_enrollments": {"metadata": {"type": "view", "schema": "xapi", "name": "fact_enrollments", "database": "", "comment": null, "owner": null}, "columns": {"emission_time": {"type": "DateTime", "index": 1, "name": "emission_time", "comment": null}, "org": {"type": "LowCardinality(String)", "index": 2, "name": "org", "comment": null}, "course_key": {"type": "LowCardinality(String)", "index": 3, "name": "course_key", "comment": null}, "course_name": {"type": "String", "index": 4, "name": "course_name", "comment": null}, "course_run": {"type": "String", "index": 5, "name": "course_run", "comment": null}, "actor_id": {"type": "String", "index": 6, "name": "actor_id", "comment": null}, "enrollment_mode": {"type": "LowCardinality(String)", "index": 7, "name": "enrollment_mode", "comment": null}, "enrollment_status": {"type": "String", "index": 8, "name": "enrollment_status", "comment": null}, "username": {"type": "String", "index": 9, "name": "username", "comment": null}, "name": {"type": "String", "index": 10, "name": "name", "comment": null}, "email": {"type": "String", "index": 11, "name": "email", "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.aspects.fact_enrollments"}, "model.aspects.fact_instance_actors": {"metadata": {"type": "table", "schema": "xapi", "name": "fact_instance_actors", "database": "", "comment": null, "owner": null}, "columns": {"emission_day": {"type": "DateTime", "index": 1, "name": "emission_day", "comment": null}, "actors_cnt": {"type": "AggregateFunction(uniqCombined, String)", "index": 2, "name": "actors_cnt", "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.aspects.fact_instance_actors"}, "model.aspects.fact_instance_courses": {"metadata": {"type": "table", "schema": "xapi", "name": "fact_instance_courses", "database": "", "comment": null, "owner": null}, "columns": {"emission_hour": {"type": "DateTime", "index": 1, "name": "emission_hour", "comment": null}, "courses_cnt": {"type": "AggregateFunction(uniqCombined, String)", "index": 2, "name": "courses_cnt", "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.aspects.fact_instance_courses"}, "model.aspects.fact_instance_enrollments": {"metadata": {"type": "table", "schema": "xapi", "name": "fact_instance_enrollments", "database": "", "comment": null, "owner": null}, "columns": {"emission_day": {"type": "DateTime", "index": 1, "name": "emission_day", "comment": null}, "course_key": {"type": "LowCardinality(String)", "index": 2, "name": "course_key", "comment": null}, "enrollment_mode": {"type": "LowCardinality(String)", "index": 3, "name": "enrollment_mode", "comment": null}, "enrollment_status": {"type": "String", "index": 4, "name": "enrollment_status", "comment": null}, "course_enrollment_mode_status_cnt": {"type": "UInt64", "index": 5, "name": "course_enrollment_mode_status_cnt", "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.aspects.fact_instance_enrollments"}, "model.aspects.fact_instance_events": {"metadata": {"type": "table", "schema": "xapi", "name": "fact_instance_events", "database": "", "comment": null, "owner": null}, "columns": {"emission_day": {"type": "DateTime", "index": 1, "name": "emission_day", "comment": null}, "events_cnt": {"type": "AggregateFunction(uniqCombined, UUID)", "index": 2, "name": "events_cnt", "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.aspects.fact_instance_events"}, "model.aspects.fact_learner_course_grade": {"metadata": {"type": "table", "schema": "xapi", "name": "fact_learner_course_grade", "database": "", "comment": null, "owner": null}, "columns": {"org": {"type": "LowCardinality(String)", "index": 1, "name": "org", "comment": null}, "course_key": {"type": "LowCardinality(String)", "index": 2, "name": "course_key", "comment": null}, "actor_id": {"type": "String", "index": 3, "name": "actor_id", "comment": null}, "course_grade": {"type": "Float64", "index": 4, "name": "course_grade", "comment": null}, "emission_time": {"type": "DateTime", "index": 5, "name": "emission_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.aspects.fact_learner_course_grade"}, "model.aspects.fact_learner_course_status": {"metadata": {"type": "table", "schema": "xapi", "name": "fact_learner_course_status", "database": "", "comment": null, "owner": null}, "columns": {"org": {"type": "LowCardinality(String)", "index": 1, "name": "org", "comment": null}, "course_key": {"type": "LowCardinality(String)", "index": 2, "name": "course_key", "comment": null}, "actor_id": {"type": "String", "index": 3, "name": "actor_id", "comment": null}, "approving_state": {"type": "String", "index": 4, "name": "approving_state", "comment": null}, "emission_time": {"type": "DateTime", "index": 5, "name": "emission_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.aspects.fact_learner_course_status"}, "model.aspects.fact_learner_last_course_visit": {"metadata": {"type": "table", "schema": "xapi", "name": "fact_learner_last_course_visit", "database": "", "comment": null, "owner": null}, "columns": {"org": {"type": "LowCardinality(String)", "index": 1, "name": "org", "comment": null}, "course_key": {"type": "LowCardinality(String)", "index": 2, "name": "course_key", "comment": null}, "actor_id": {"type": "String", "index": 3, "name": "actor_id", "comment": null}, "emission_time": {"type": "DateTime", "index": 4, "name": "emission_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.aspects.fact_learner_last_course_visit"}, "model.aspects.fact_navigation": {"metadata": {"type": "view", "schema": "xapi", "name": "fact_navigation", "database": "", "comment": null, "owner": null}, "columns": {"emission_time": {"type": "DateTime", "index": 1, "name": "emission_time", "comment": null}, "org": {"type": "LowCardinality(String)", "index": 2, "name": "org", "comment": null}, "course_key": {"type": "LowCardinality(String)", "index": 3, "name": "course_key", "comment": null}, "course_name": {"type": "String", "index": 4, "name": "course_name", "comment": null}, "course_run": {"type": "String", "index": 5, "name": "course_run", "comment": null}, "actor_id": {"type": "String", "index": 6, "name": "actor_id", "comment": null}, "block_id": {"type": "String", "index": 7, "name": "block_id", "comment": null}, "block_name": {"type": "String", "index": 8, "name": "block_name", "comment": null}, "block_name_with_location": {"type": "String", "index": 9, "name": "block_name_with_location", "comment": null}, "course_order": {"type": "Int32", "index": 10, "name": "course_order", "comment": null}, "object_type": {"type": "String", "index": 11, "name": "object_type", "comment": null}, "starting_position": {"type": "Int64", "index": 12, "name": "starting_position", "comment": null}, "ending_point": {"type": "String", "index": 13, "name": "ending_point", "comment": null}, "username": {"type": "String", "index": 14, "name": "username", "comment": null}, "name": {"type": "String", "index": 15, "name": "name", "comment": null}, "email": {"type": "String", "index": 16, "name": "email", "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.aspects.fact_navigation"}, "model.aspects.fact_navigation_completion": {"metadata": {"type": "view", "schema": "xapi", "name": "fact_navigation_completion", "database": "", "comment": null, "owner": null}, "columns": {"visited_on": {"type": "Date", "index": 1, "name": "visited_on", "comment": null}, "org": {"type": "LowCardinality(String)", "index": 2, "name": "org", "comment": null}, "course_key": {"type": "LowCardinality(String)", "index": 3, "name": "course_key", "comment": null}, "course_name": {"type": "String", "index": 4, "name": "course_name", "comment": null}, "course_run": {"type": "String", "index": 5, "name": "course_run", "comment": null}, "section_with_name": {"type": "String", "index": 6, "name": "section_with_name", "comment": null}, "subsection_with_name": {"type": "String", "index": 7, "name": "subsection_with_name", "comment": null}, "course_order": {"type": "Int32", "index": 8, "name": "course_order", "comment": null}, "page_count": {"type": "UInt64", "index": 9, "name": "page_count", "comment": null}, "actor_id": {"type": "String", "index": 10, "name": "actor_id", "comment": null}, "block_id": {"type": "String", "index": 11, "name": "block_id", "comment": null}, "username": {"type": "String", "index": 12, "name": "username", "comment": null}, "name": {"type": "String", "index": 13, "name": "name", "comment": null}, "email": {"type": "String", "index": 14, "name": "email", "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.aspects.fact_navigation_completion"}, "model.aspects.fact_pageview_engagement": {"metadata": {"type": "view", "schema": "xapi", "name": "fact_pageview_engagement", "database": "", "comment": null, "owner": null}, "columns": {"org": {"type": "LowCardinality(String)", "index": 1, "name": "org", "comment": null}, "course_key": {"type": "LowCardinality(String)", "index": 2, "name": "course_key", "comment": null}, "course_run": {"type": "String", "index": 3, "name": "course_run", "comment": null}, "section_subsection_name": {"type": "String", "index": 4, "name": "section_subsection_name", "comment": null}, "content_level": {"type": "String", "index": 5, "name": "content_level", "comment": null}, "actor_id": {"type": "String", "index": 6, "name": "actor_id", "comment": null}, "section_subsection_page_engagement": {"type": "String", "index": 7, "name": "section_subsection_page_engagement", "comment": null}, "username": {"type": "String", "index": 8, "name": "username", "comment": null}, "name": {"type": "String", "index": 9, "name": "name", "comment": null}, "email": {"type": "String", "index": 10, "name": "email", "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.aspects.fact_pageview_engagement"}, "model.aspects.fact_problem_responses": {"metadata": {"type": "view", "schema": "xapi", "name": "fact_problem_responses", "database": "", "comment": null, "owner": null}, "columns": {"emission_time": {"type": "DateTime", "index": 1, "name": "emission_time", "comment": null}, "org": {"type": "LowCardinality(String)", "index": 2, "name": "org", "comment": null}, "course_key": {"type": "LowCardinality(String)", "index": 3, "name": "course_key", "comment": null}, "course_name": {"type": "String", "index": 4, "name": "course_name", "comment": null}, "course_run": {"type": "String", "index": 5, "name": "course_run", "comment": null}, "problem_id": {"type": "String", "index": 6, "name": "problem_id", "comment": null}, "problem_name": {"type": "String", "index": 7, "name": "problem_name", "comment": null}, "problem_name_with_location": {"type": "String", "index": 8, "name": "problem_name_with_location", "comment": null}, "problem_link": {"type": "String", "index": 9, "name": "problem_link", "comment": null}, "graded": {"type": "Bool", "index": 10, "name": "graded", "comment": null}, "course_order": {"type": "Int32", "index": 11, "name": "course_order", "comment": null}, "actor_id": {"type": "String", "index": 12, "name": "actor_id", "comment": null}, "responses": {"type": "String", "index": 13, "name": "responses", "comment": null}, "success": {"type": "Bool", "index": 14, "name": "success", "comment": null}, "attempts": {"type": "Int16", "index": 15, "name": "attempts", "comment": null}, "interaction_type": {"type": "LowCardinality(String)", "index": 16, "name": "interaction_type", "comment": null}, "username": {"type": "String", "index": 17, "name": "username", "comment": null}, "name": {"type": "String", "index": 18, "name": "name", "comment": null}, "email": {"type": "String", "index": 19, "name": "email", "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.aspects.fact_problem_responses"}, "model.aspects.fact_student_status": {"metadata": {"type": "view", "schema": "xapi", "name": "fact_student_status", "database": "", "comment": null, "owner": null}, "columns": {"org": {"type": "LowCardinality(String)", "index": 1, "name": "org", "comment": null}, "course_key": {"type": "LowCardinality(String)", "index": 2, "name": "course_key", "comment": null}, "actor_id": {"type": "String", "index": 3, "name": "actor_id", "comment": null}, "course_name": {"type": "String", "index": 4, "name": "course_name", "comment": null}, "course_run": {"type": "String", "index": 5, "name": "course_run", "comment": null}, "approving_state": {"type": "String", "index": 6, "name": "approving_state", "comment": null}, "enrollment_mode": {"type": "LowCardinality(String)", "index": 7, "name": "enrollment_mode", "comment": null}, "enrollment_status": {"type": "String", "index": 8, "name": "enrollment_status", "comment": null}, "course_grade": {"type": "Float64", "index": 9, "name": "course_grade", "comment": null}, "grade_bucket": {"type": "String", "index": 10, "name": "grade_bucket", "comment": null}, "username": {"type": "String", "index": 11, "name": "username", "comment": null}, "name": {"type": "String", "index": 12, "name": "name", "comment": null}, "email": {"type": "String", "index": 13, "name": "email", "comment": null}, "enrolled_at": {"type": "DateTime", "index": 14, "name": "enrolled_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.aspects.fact_student_status"}, "model.aspects.fact_video_engagement": {"metadata": {"type": "view", "schema": "xapi", "name": "fact_video_engagement", "database": "", "comment": null, "owner": null}, "columns": {"org": {"type": "LowCardinality(String)", "index": 1, "name": "org", "comment": null}, "course_key": {"type": "LowCardinality(String)", "index": 2, "name": "course_key", "comment": null}, "course_run": {"type": "String", "index": 3, "name": "course_run", "comment": null}, "section_subsection_name": {"type": "String", "index": 4, "name": "section_subsection_name", "comment": null}, "content_level": {"type": "String", "index": 5, "name": "content_level", "comment": null}, "actor_id": {"type": "String", "index": 6, "name": "actor_id", "comment": null}, "section_subsection_video_engagement": {"type": "String", "index": 7, "name": "section_subsection_video_engagement", "comment": null}, "username": {"type": "String", "index": 8, "name": "username", "comment": null}, "name": {"type": "String", "index": 9, "name": "name", "comment": null}, "email": {"type": "String", "index": 10, "name": "email", "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.aspects.fact_video_engagement"}, "model.aspects.fact_video_plays": {"metadata": {"type": "view", "schema": "xapi", "name": "fact_video_plays", "database": "", "comment": null, "owner": null}, "columns": {"emission_time": {"type": "DateTime", "index": 1, "name": "emission_time", "comment": null}, "org": {"type": "LowCardinality(String)", "index": 2, "name": "org", "comment": null}, "course_key": {"type": "LowCardinality(String)", "index": 3, "name": "course_key", "comment": null}, "course_name": {"type": "String", "index": 4, "name": "course_name", "comment": null}, "course_run": {"type": "String", "index": 5, "name": "course_run", "comment": null}, "video_id": {"type": "String", "index": 6, "name": "video_id", "comment": null}, "video_name": {"type": "String", "index": 7, "name": "video_name", "comment": null}, "video_name_with_location": {"type": "String", "index": 8, "name": "video_name_with_location", "comment": null}, "video_link": {"type": "String", "index": 9, "name": "video_link", "comment": null}, "graded": {"type": "Bool", "index": 10, "name": "graded", "comment": null}, "video_position": {"type": "Decimal(9, 2)", "index": 11, "name": "video_position", "comment": null}, "video_duration": {"type": "Int64", "index": 12, "name": "video_duration", "comment": null}, "visualization_bucket": {"type": "String", "index": 13, "name": "visualization_bucket", "comment": null}, "actor_id": {"type": "String", "index": 14, "name": "actor_id", "comment": null}, "username": {"type": "String", "index": 15, "name": "username", "comment": null}, "name": {"type": "String", "index": 16, "name": "name", "comment": null}, "email": {"type": "String", "index": 17, "name": "email", "comment": null}, "section_with_name": {"type": "String", "index": 18, "name": "section_with_name", "comment": null}, "subsection_with_name": {"type": "String", "index": 19, "name": "subsection_with_name", "comment": null}, "course_order": {"type": "Int32", "index": 20, "name": "course_order", "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.aspects.fact_video_plays"}, "model.aspects.grading_events": {"metadata": {"type": "table", "schema": "xapi", "name": "grading_events", "database": "", "comment": null, "owner": null}, "columns": {"event_id": {"type": "UUID", "index": 1, "name": "event_id", "comment": null}, "emission_time": {"type": "DateTime", "index": 2, "name": "emission_time", "comment": null}, "actor_id": {"type": "String", "index": 3, "name": "actor_id", "comment": null}, "object_id": {"type": "String", "index": 4, "name": "object_id", "comment": null}, "course_key": {"type": "LowCardinality(String)", "index": 5, "name": "course_key", "comment": null}, "org": {"type": "LowCardinality(String)", "index": 6, "name": "org", "comment": null}, "verb_id": {"type": "LowCardinality(String)", "index": 7, "name": "verb_id", "comment": null}, "scaled_score": {"type": "Float64", "index": 8, "name": "scaled_score", "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.aspects.grading_events"}, "model.aspects.int_pages_per_subsection": {"metadata": {"type": "view", "schema": "xapi", "name": "int_pages_per_subsection", "database": "", "comment": null, "owner": null}, "columns": {"org": {"type": "String", "index": 1, "name": "org", "comment": null}, "course_key": {"type": "String", "index": 2, "name": "course_key", "comment": null}, "section_number": {"type": "String", "index": 3, "name": "section_number", "comment": null}, "section_with_name": {"type": "String", "index": 4, "name": "section_with_name", "comment": null}, "subsection_number": {"type": "String", "index": 5, "name": "subsection_number", "comment": null}, "subsection_with_name": {"type": "String", "index": 6, "name": "subsection_with_name", "comment": null}, "course_order": {"type": "Int32", "index": 7, "name": "course_order", "comment": null}, "graded": {"type": "Bool", "index": 8, "name": "graded", "comment": null}, "item_count": {"type": "UInt64", "index": 9, "name": "item_count", "comment": null}, "subsection_block_id": {"type": "String", "index": 10, "name": "subsection_block_id", "comment": null}, "section_block_id": {"type": "String", "index": 11, "name": "section_block_id", "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.aspects.int_pages_per_subsection"}, "model.aspects.int_problem_hints": {"metadata": {"type": "view", "schema": "xapi", "name": "int_problem_hints", "database": "", "comment": null, "owner": null}, "columns": {"emission_time": {"type": "DateTime", "index": 1, "name": "emission_time", "comment": null}, "org": {"type": "LowCardinality(String)", "index": 2, "name": "org", "comment": null}, "course_key": {"type": "LowCardinality(String)", "index": 3, "name": "course_key", "comment": null}, "course_name": {"type": "String", "index": 4, "name": "course_name", "comment": null}, "course_run": {"type": "String", "index": 5, "name": "course_run", "comment": null}, "problem_id": {"type": "String", "index": 6, "name": "problem_id", "comment": null}, "problem_name": {"type": "String", "index": 7, "name": "problem_name", "comment": null}, "problem_name_with_location": {"type": "String", "index": 8, "name": "problem_name_with_location", "comment": null}, "course_order": {"type": "Int32", "index": 9, "name": "course_order", "comment": null}, "actor_id": {"type": "String", "index": 10, "name": "actor_id", "comment": null}, "help_type": {"type": "String", "index": 11, "name": "help_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.aspects.int_problem_hints"}, "model.aspects.int_problem_results": {"metadata": {"type": "view", "schema": "xapi", "name": "int_problem_results", "database": "", "comment": null, "owner": null}, "columns": {"emission_time": {"type": "DateTime", "index": 1, "name": "emission_time", "comment": null}, "org": {"type": "LowCardinality(String)", "index": 2, "name": "org", "comment": null}, "course_key": {"type": "LowCardinality(String)", "index": 3, "name": "course_key", "comment": null}, "course_name": {"type": "String", "index": 4, "name": "course_name", "comment": null}, "course_run": {"type": "String", "index": 5, "name": "course_run", "comment": null}, "problem_id": {"type": "String", "index": 6, "name": "problem_id", "comment": null}, "problem_name": {"type": "String", "index": 7, "name": "problem_name", "comment": null}, "problem_name_with_location": {"type": "String", "index": 8, "name": "problem_name_with_location", "comment": null}, "course_order": {"type": "Int32", "index": 9, "name": "course_order", "comment": null}, "problem_link": {"type": "String", "index": 10, "name": "problem_link", "comment": null}, "actor_id": {"type": "String", "index": 11, "name": "actor_id", "comment": null}, "responses": {"type": "String", "index": 12, "name": "responses", "comment": null}, "success": {"type": "Bool", "index": 13, "name": "success", "comment": null}, "attempts": {"type": "Int16", "index": 14, "name": "attempts", "comment": null}, "interaction_type": {"type": "LowCardinality(String)", "index": 15, "name": "interaction_type", "comment": null}, "graded": {"type": "Bool", "index": 16, "name": "graded", "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.aspects.int_problem_results"}, "model.aspects.int_problems_per_subsection": {"metadata": {"type": "view", "schema": "xapi", "name": "int_problems_per_subsection", "database": "", "comment": null, "owner": null}, "columns": {"org": {"type": "String", "index": 1, "name": "org", "comment": null}, "course_key": {"type": "String", "index": 2, "name": "course_key", "comment": null}, "section_number": {"type": "String", "index": 3, "name": "section_number", "comment": null}, "section_with_name": {"type": "String", "index": 4, "name": "section_with_name", "comment": null}, "subsection_number": {"type": "String", "index": 5, "name": "subsection_number", "comment": null}, "subsection_with_name": {"type": "String", "index": 6, "name": "subsection_with_name", "comment": null}, "course_order": {"type": "Int32", "index": 7, "name": "course_order", "comment": null}, "graded": {"type": "Bool", "index": 8, "name": "graded", "comment": null}, "item_count": {"type": "UInt64", "index": 9, "name": "item_count", "comment": null}, "subsection_block_id": {"type": "String", "index": 10, "name": "subsection_block_id", "comment": null}, "section_block_id": {"type": "String", "index": 11, "name": "section_block_id", "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.aspects.int_problems_per_subsection"}, "model.aspects.int_videos_per_subsection": {"metadata": {"type": "view", "schema": "xapi", "name": "int_videos_per_subsection", "database": "", "comment": null, "owner": null}, "columns": {"org": {"type": "String", "index": 1, "name": "org", "comment": null}, "course_key": {"type": "String", "index": 2, "name": "course_key", "comment": null}, "section_number": {"type": "String", "index": 3, "name": "section_number", "comment": null}, "section_with_name": {"type": "String", "index": 4, "name": "section_with_name", "comment": null}, "subsection_number": {"type": "String", "index": 5, "name": "subsection_number", "comment": null}, "subsection_with_name": {"type": "String", "index": 6, "name": "subsection_with_name", "comment": null}, "course_order": {"type": "Int32", "index": 7, "name": "course_order", "comment": null}, "graded": {"type": "Bool", "index": 8, "name": "graded", "comment": null}, "item_count": {"type": "UInt64", "index": 9, "name": "item_count", "comment": null}, "subsection_block_id": {"type": "String", "index": 10, "name": "subsection_block_id", "comment": null}, "section_block_id": {"type": "String", "index": 11, "name": "section_block_id", "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.aspects.int_videos_per_subsection"}, "model.aspects.most_recent_course_blocks": {"metadata": {"type": "table", "schema": "xapi", "name": "most_recent_course_blocks", "database": "", "comment": null, "owner": null}, "columns": {"location": {"type": "String", "index": 1, "name": "location", "comment": null}, "block_name": {"type": "String", "index": 2, "name": "block_name", "comment": null}, "display_name_with_location": {"type": "String", "index": 3, "name": "display_name_with_location", "comment": null}, "section": {"type": "Int64", "index": 4, "name": "section", "comment": null}, "subsection": {"type": "Int64", "index": 5, "name": "subsection", "comment": null}, "unit": {"type": "Int64", "index": 6, "name": "unit", "comment": null}, "graded": {"type": "UInt8", "index": 7, "name": "graded", "comment": null}, "course_order": {"type": "Int32", "index": 8, "name": "course_order", "comment": null}, "course_key": {"type": "String", "index": 9, "name": "course_key", "comment": null}, "dump_id": {"type": "UUID", "index": 10, "name": "dump_id", "comment": null}, "time_last_dumped": {"type": "String", "index": 11, "name": "time_last_dumped", "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.aspects.most_recent_course_blocks"}, "model.aspects.navigation_events": {"metadata": {"type": "table", "schema": "xapi", "name": "navigation_events", "database": "", "comment": null, "owner": null}, "columns": {"event_id": {"type": "UUID", "index": 1, "name": "event_id", "comment": null}, "emission_time": {"type": "DateTime", "index": 2, "name": "emission_time", "comment": null}, "actor_id": {"type": "String", "index": 3, "name": "actor_id", "comment": null}, "block_id": {"type": "String", "index": 4, "name": "block_id", "comment": null}, "course_key": {"type": "LowCardinality(String)", "index": 5, "name": "course_key", "comment": null}, "org": {"type": "LowCardinality(String)", "index": 6, "name": "org", "comment": null}, "verb_id": {"type": "LowCardinality(String)", "index": 7, "name": "verb_id", "comment": null}, "object_type": {"type": "String", "index": 8, "name": "object_type", "comment": null}, "starting_position": {"type": "Int64", "index": 9, "name": "starting_position", "comment": null}, "ending_point": {"type": "String", "index": 10, "name": "ending_point", "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.aspects.navigation_events"}, "model.aspects.problem_events": {"metadata": {"type": "table", "schema": "xapi", "name": "problem_events", "database": "", "comment": null, "owner": null}, "columns": {"event_id": {"type": "UUID", "index": 1, "name": "event_id", "comment": null}, "emission_time": {"type": "DateTime", "index": 2, "name": "emission_time", "comment": null}, "actor_id": {"type": "String", "index": 3, "name": "actor_id", "comment": null}, "object_id": {"type": "String", "index": 4, "name": "object_id", "comment": null}, "course_key": {"type": "LowCardinality(String)", "index": 5, "name": "course_key", "comment": null}, "org": {"type": "LowCardinality(String)", "index": 6, "name": "org", "comment": null}, "verb_id": {"type": "LowCardinality(String)", "index": 7, "name": "verb_id", "comment": null}, "responses": {"type": "String", "index": 8, "name": "responses", "comment": null}, "scaled_score": {"type": "String", "index": 9, "name": "scaled_score", "comment": null}, "success": {"type": "Bool", "index": 10, "name": "success", "comment": null}, "interaction_type": {"type": "LowCardinality(String)", "index": 11, "name": "interaction_type", "comment": null}, "attempts": {"type": "Int16", "index": 12, "name": "attempts", "comment": null}, "problem_id": {"type": "String", "index": 13, "name": "problem_id", "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.aspects.problem_events"}, "model.aspects.responses": {"metadata": {"type": "table", "schema": "xapi", "name": "responses", "database": "", "comment": null, "owner": null}, "columns": {"org": {"type": "LowCardinality(String)", "index": 1, "name": "org", "comment": null}, "course_key": {"type": "LowCardinality(String)", "index": 2, "name": "course_key", "comment": null}, "problem_id": {"type": "String", "index": 3, "name": "problem_id", "comment": null}, "actor_id": {"type": "String", "index": 4, "name": "actor_id", "comment": null}, "first_success_at": {"type": "Nullable(DateTime)", "index": 5, "name": "first_success_at", "comment": null}, "last_attempt_at": {"type": "DateTime", "index": 6, "name": "last_attempt_at", "comment": null}, "emission_time": {"type": "DateTime", "index": 7, "name": "emission_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.aspects.responses"}, "model.aspects.section_page_engagement": {"metadata": {"type": "table", "schema": "xapi", "name": "section_page_engagement", "database": "", "comment": null, "owner": null}, "columns": {"org": {"type": "LowCardinality(String)", "index": 1, "name": "org", "comment": null}, "course_key": {"type": "LowCardinality(String)", "index": 2, "name": "course_key", "comment": null}, "actor_id": {"type": "String", "index": 3, "name": "actor_id", "comment": null}, "section_block_id": {"type": "String", "index": 4, "name": "section_block_id", "comment": null}, "engagement_level": {"type": "String", "index": 5, "name": "engagement_level", "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.aspects.section_page_engagement"}, "model.aspects.section_problem_engagement": {"metadata": {"type": "table", "schema": "xapi", "name": "section_problem_engagement", "database": "", "comment": null, "owner": null}, "columns": {"org": {"type": "LowCardinality(String)", "index": 1, "name": "org", "comment": null}, "course_key": {"type": "LowCardinality(String)", "index": 2, "name": "course_key", "comment": null}, "actor_id": {"type": "String", "index": 3, "name": "actor_id", "comment": null}, "section_block_id": {"type": "String", "index": 4, "name": "section_block_id", "comment": null}, "engagement_level": {"type": "String", "index": 5, "name": "engagement_level", "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.aspects.section_problem_engagement"}, "model.aspects.section_video_engagement": {"metadata": {"type": "table", "schema": "xapi", "name": "section_video_engagement", "database": "", "comment": null, "owner": null}, "columns": {"org": {"type": "LowCardinality(String)", "index": 1, "name": "org", "comment": null}, "course_key": {"type": "LowCardinality(String)", "index": 2, "name": "course_key", "comment": null}, "actor_id": {"type": "String", "index": 3, "name": "actor_id", "comment": null}, "section_block_id": {"type": "String", "index": 4, "name": "section_block_id", "comment": null}, "engagement_level": {"type": "String", "index": 5, "name": "engagement_level", "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.aspects.section_video_engagement"}, "model.aspects.subsection_page_engagement": {"metadata": {"type": "table", "schema": "xapi", "name": "subsection_page_engagement", "database": "", "comment": null, "owner": null}, "columns": {"org": {"type": "LowCardinality(String)", "index": 1, "name": "org", "comment": null}, "course_key": {"type": "LowCardinality(String)", "index": 2, "name": "course_key", "comment": null}, "actor_id": {"type": "String", "index": 3, "name": "actor_id", "comment": null}, "subsection_block_id": {"type": "String", "index": 4, "name": "subsection_block_id", "comment": null}, "engagement_level": {"type": "String", "index": 5, "name": "engagement_level", "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.aspects.subsection_page_engagement"}, "model.aspects.subsection_problem_engagement": {"metadata": {"type": "table", "schema": "xapi", "name": "subsection_problem_engagement", "database": "", "comment": null, "owner": null}, "columns": {"org": {"type": "LowCardinality(String)", "index": 1, "name": "org", "comment": null}, "course_key": {"type": "LowCardinality(String)", "index": 2, "name": "course_key", "comment": null}, "actor_id": {"type": "String", "index": 3, "name": "actor_id", "comment": null}, "subsection_block_id": {"type": "String", "index": 4, "name": "subsection_block_id", "comment": null}, "engagement_level": {"type": "String", "index": 5, "name": "engagement_level", "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.aspects.subsection_problem_engagement"}, "model.aspects.subsection_video_engagement": {"metadata": {"type": "table", "schema": "xapi", "name": "subsection_video_engagement", "database": "", "comment": null, "owner": null}, "columns": {"org": {"type": "LowCardinality(String)", "index": 1, "name": "org", "comment": null}, "course_key": {"type": "LowCardinality(String)", "index": 2, "name": "course_key", "comment": null}, "actor_id": {"type": "String", "index": 3, "name": "actor_id", "comment": null}, "subsection_block_id": {"type": "String", "index": 4, "name": "subsection_block_id", "comment": null}, "engagement_level": {"type": "String", "index": 5, "name": "engagement_level", "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.aspects.subsection_video_engagement"}, "model.aspects.user_pii": {"metadata": {"type": "table", "schema": "xapi", "name": "user_pii", "database": "", "comment": null, "owner": null}, "columns": {"user_id": {"type": "Int32", "index": 1, "name": "user_id", "comment": null}, "external_user_id": {"type": "UUID", "index": 2, "name": "external_user_id", "comment": null}, "username": {"type": "String", "index": 3, "name": "username", "comment": null}, "name": {"type": "String", "index": 4, "name": "name", "comment": null}, "email": {"type": "String", "index": 5, "name": "email", "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.aspects.user_pii"}, "model.aspects.video_playback_events": {"metadata": {"type": "table", "schema": "xapi", "name": "video_playback_events", "database": "", "comment": null, "owner": null}, "columns": {"event_id": {"type": "UUID", "index": 1, "name": "event_id", "comment": null}, "emission_time": {"type": "DateTime", "index": 2, "name": "emission_time", "comment": null}, "actor_id": {"type": "String", "index": 3, "name": "actor_id", "comment": null}, "object_id": {"type": "String", "index": 4, "name": "object_id", "comment": null}, "course_key": {"type": "LowCardinality(String)", "index": 5, "name": "course_key", "comment": null}, "org": {"type": "LowCardinality(String)", "index": 6, "name": "org", "comment": null}, "verb_id": {"type": "LowCardinality(String)", "index": 7, "name": "verb_id", "comment": null}, "video_position": {"type": "Decimal(9, 2)", "index": 8, "name": "video_position", "comment": null}, "video_duration": {"type": "Int64", "index": 9, "name": "video_duration", "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.aspects.video_playback_events"}, "model.aspects.xapi_events_all_parsed": {"metadata": {"type": "table", "schema": "xapi", "name": "xapi_events_all_parsed", "database": "", "comment": null, "owner": null}, "columns": {"event_id": {"type": "UUID", "index": 1, "name": "event_id", "comment": null}, "verb_id": {"type": "LowCardinality(String)", "index": 2, "name": "verb_id", "comment": null}, "actor_id": {"type": "String", "index": 3, "name": "actor_id", "comment": null}, "object_id": {"type": "String", "index": 4, "name": "object_id", "comment": null}, "course_id": {"type": "LowCardinality(String)", "index": 5, "name": "course_id", "comment": null}, "course_key": {"type": "LowCardinality(String)", "index": 6, "name": "course_key", "comment": null}, "org": {"type": "LowCardinality(String)", "index": 7, "name": "org", "comment": null}, "emission_time": {"type": "DateTime64(6)", "index": 8, "name": "emission_time", "comment": null}, "event": {"type": "String", "index": 9, "name": "event", "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.aspects.xapi_events_all_parsed"}}, "sources": {}, "errors": null}
\ No newline at end of file
+{"metadata": {"dbt_schema_version": "https://schemas.getdbt.com/dbt/catalog/v1.json", "dbt_version": "1.8.5", "generated_at": "2024-08-15T21:11:17.978474Z", "invocation_id": "8b4070f2-5f6a-4318-8b6e-0095cfa33985", "env": {}}, "nodes": {"model.aspects.course_block_names": {"metadata": {"type": "table", "schema": "xapi", "name": "course_block_names", "database": "", "comment": null, "owner": null}, "columns": {"location": {"type": "String", "index": 1, "name": "location", "comment": null}, "block_name": {"type": "String", "index": 2, "name": "block_name", "comment": null}, "course_key": {"type": "String", "index": 3, "name": "course_key", "comment": null}, "graded": {"type": "Bool", "index": 4, "name": "graded", "comment": null}, "course_order": {"type": "Int32", "index": 5, "name": "course_order", "comment": null}, "display_name_with_location": {"type": "String", "index": 6, "name": "display_name_with_location", "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.aspects.course_block_names"}, "model.aspects.course_names": {"metadata": {"type": "table", "schema": "xapi", "name": "course_names", "database": "", "comment": null, "owner": null}, "columns": {"course_key": {"type": "String", "index": 1, "name": "course_key", "comment": null}, "course_name": {"type": "String", "index": 2, "name": "course_name", "comment": null}, "course_run": {"type": "String", "index": 3, "name": "course_run", "comment": null}, "org": {"type": "String", "index": 4, "name": "org", "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.aspects.course_names"}, "model.aspects.dim_course_blocks": {"metadata": {"type": "view", "schema": "xapi", "name": "dim_course_blocks", "database": "", "comment": null, "owner": null}, "columns": {"org": {"type": "String", "index": 1, "name": "org", "comment": null}, "course_key": {"type": "String", "index": 2, "name": "course_key", "comment": null}, "course_name": {"type": "String", "index": 3, "name": "course_name", "comment": null}, "course_run": {"type": "String", "index": 4, "name": "course_run", "comment": null}, "block_id": {"type": "String", "index": 5, "name": "block_id", "comment": null}, "block_name": {"type": "String", "index": 6, "name": "block_name", "comment": null}, "section_number": {"type": "String", "index": 7, "name": "section_number", "comment": null}, "subsection_number": {"type": "String", "index": 8, "name": "subsection_number", "comment": null}, "hierarchy_location": {"type": "String", "index": 9, "name": "hierarchy_location", "comment": null}, "display_name_with_location": {"type": "String", "index": 10, "name": "display_name_with_location", "comment": null}, "course_order": {"type": "Int32", "index": 11, "name": "course_order", "comment": null}, "graded": {"type": "Bool", "index": 12, "name": "graded", "comment": null}, "block_type": {"type": "String", "index": 13, "name": "block_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.aspects.dim_course_blocks"}, "model.aspects.dim_course_blocks_extended": {"metadata": {"type": "view", "schema": "xapi", "name": "dim_course_blocks_extended", "database": "", "comment": null, "owner": null}, "columns": {"org": {"type": "String", "index": 1, "name": "org", "comment": null}, "course_key": {"type": "String", "index": 2, "name": "course_key", "comment": null}, "course_name": {"type": "String", "index": 3, "name": "course_name", "comment": null}, "course_run": {"type": "String", "index": 4, "name": "course_run", "comment": null}, "block_id": {"type": "String", "index": 5, "name": "block_id", "comment": null}, "block_name": {"type": "String", "index": 6, "name": "block_name", "comment": null}, "section_number": {"type": "String", "index": 7, "name": "section_number", "comment": null}, "subsection_number": {"type": "String", "index": 8, "name": "subsection_number", "comment": null}, "hierarchy_location": {"type": "String", "index": 9, "name": "hierarchy_location", "comment": null}, "display_name_with_location": {"type": "String", "index": 10, "name": "display_name_with_location", "comment": null}, "graded": {"type": "Bool", "index": 11, "name": "graded", "comment": null}, "course_order": {"type": "Int32", "index": 12, "name": "course_order", "comment": null}, "block_type": {"type": "String", "index": 13, "name": "block_type", "comment": null}, "section_with_name": {"type": "String", "index": 14, "name": "section_with_name", "comment": null}, "subsection_with_name": {"type": "String", "index": 15, "name": "subsection_with_name", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.aspects.dim_course_blocks_extended"}, "model.aspects.dim_user_pii": {"metadata": {"type": "view", "schema": "xapi", "name": "dim_user_pii", "database": "", "comment": null, "owner": null}, "columns": {"external_user_id": {"type": "UUID", "index": 1, "name": "external_user_id", "comment": null}, "username": {"type": "String", "index": 2, "name": "username", "comment": null}, "name": {"type": "String", "index": 3, "name": "name", "comment": null}, "email": {"type": "String", "index": 4, "name": "email", "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.aspects.dim_user_pii"}, "model.aspects.enrollment_events": {"metadata": {"type": "table", "schema": "xapi", "name": "enrollment_events", "database": "", "comment": null, "owner": null}, "columns": {"event_id": {"type": "UUID", "index": 1, "name": "event_id", "comment": null}, "emission_time": {"type": "DateTime", "index": 2, "name": "emission_time", "comment": null}, "actor_id": {"type": "String", "index": 3, "name": "actor_id", "comment": null}, "object_id": {"type": "String", "index": 4, "name": "object_id", "comment": null}, "course_key": {"type": "LowCardinality(String)", "index": 5, "name": "course_key", "comment": null}, "org": {"type": "LowCardinality(String)", "index": 6, "name": "org", "comment": null}, "verb_id": {"type": "LowCardinality(String)", "index": 7, "name": "verb_id", "comment": null}, "enrollment_mode": {"type": "LowCardinality(String)", "index": 8, "name": "enrollment_mode", "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.aspects.enrollment_events"}, "model.aspects.fact_enrollment_status": {"metadata": {"type": "table", "schema": "xapi", "name": "fact_enrollment_status", "database": "", "comment": null, "owner": null}, "columns": {"org": {"type": "LowCardinality(String)", "index": 1, "name": "org", "comment": null}, "course_key": {"type": "LowCardinality(String)", "index": 2, "name": "course_key", "comment": null}, "actor_id": {"type": "String", "index": 3, "name": "actor_id", "comment": null}, "enrollment_status": {"type": "String", "index": 4, "name": "enrollment_status", "comment": null}, "enrollment_mode": {"type": "LowCardinality(String)", "index": 5, "name": "enrollment_mode", "comment": null}, "emission_time": {"type": "DateTime", "index": 6, "name": "emission_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.aspects.fact_enrollment_status"}, "model.aspects.fact_enrollments": {"metadata": {"type": "view", "schema": "xapi", "name": "fact_enrollments", "database": "", "comment": null, "owner": null}, "columns": {"emission_time": {"type": "DateTime", "index": 1, "name": "emission_time", "comment": null}, "org": {"type": "LowCardinality(String)", "index": 2, "name": "org", "comment": null}, "course_key": {"type": "LowCardinality(String)", "index": 3, "name": "course_key", "comment": null}, "course_name": {"type": "String", "index": 4, "name": "course_name", "comment": null}, "course_run": {"type": "String", "index": 5, "name": "course_run", "comment": null}, "actor_id": {"type": "String", "index": 6, "name": "actor_id", "comment": null}, "enrollment_mode": {"type": "LowCardinality(String)", "index": 7, "name": "enrollment_mode", "comment": null}, "enrollment_status": {"type": "String", "index": 8, "name": "enrollment_status", "comment": null}, "username": {"type": "String", "index": 9, "name": "username", "comment": null}, "name": {"type": "String", "index": 10, "name": "name", "comment": null}, "email": {"type": "String", "index": 11, "name": "email", "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.aspects.fact_enrollments"}, "model.aspects.fact_instance_actors": {"metadata": {"type": "table", "schema": "xapi", "name": "fact_instance_actors", "database": "", "comment": null, "owner": null}, "columns": {"emission_day": {"type": "DateTime", "index": 1, "name": "emission_day", "comment": null}, "actors_cnt": {"type": "AggregateFunction(uniqCombined, String)", "index": 2, "name": "actors_cnt", "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.aspects.fact_instance_actors"}, "model.aspects.fact_instance_courses": {"metadata": {"type": "table", "schema": "xapi", "name": "fact_instance_courses", "database": "", "comment": null, "owner": null}, "columns": {"emission_hour": {"type": "DateTime", "index": 1, "name": "emission_hour", "comment": null}, "courses_cnt": {"type": "AggregateFunction(uniqCombined, String)", "index": 2, "name": "courses_cnt", "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.aspects.fact_instance_courses"}, "model.aspects.fact_instance_enrollments": {"metadata": {"type": "table", "schema": "xapi", "name": "fact_instance_enrollments", "database": "", "comment": null, "owner": null}, "columns": {"emission_day": {"type": "DateTime", "index": 1, "name": "emission_day", "comment": null}, "course_key": {"type": "LowCardinality(String)", "index": 2, "name": "course_key", "comment": null}, "enrollment_mode": {"type": "LowCardinality(String)", "index": 3, "name": "enrollment_mode", "comment": null}, "enrollment_status": {"type": "String", "index": 4, "name": "enrollment_status", "comment": null}, "course_enrollment_mode_status_cnt": {"type": "UInt64", "index": 5, "name": "course_enrollment_mode_status_cnt", "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.aspects.fact_instance_enrollments"}, "model.aspects.fact_instance_events": {"metadata": {"type": "table", "schema": "xapi", "name": "fact_instance_events", "database": "", "comment": null, "owner": null}, "columns": {"emission_day": {"type": "DateTime", "index": 1, "name": "emission_day", "comment": null}, "events_cnt": {"type": "AggregateFunction(uniqCombined, UUID)", "index": 2, "name": "events_cnt", "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.aspects.fact_instance_events"}, "model.aspects.fact_learner_course_grade": {"metadata": {"type": "table", "schema": "xapi", "name": "fact_learner_course_grade", "database": "", "comment": null, "owner": null}, "columns": {"org": {"type": "LowCardinality(String)", "index": 1, "name": "org", "comment": null}, "course_key": {"type": "LowCardinality(String)", "index": 2, "name": "course_key", "comment": null}, "actor_id": {"type": "String", "index": 3, "name": "actor_id", "comment": null}, "course_grade": {"type": "Float64", "index": 4, "name": "course_grade", "comment": null}, "emission_time": {"type": "DateTime", "index": 5, "name": "emission_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.aspects.fact_learner_course_grade"}, "model.aspects.fact_learner_course_status": {"metadata": {"type": "table", "schema": "xapi", "name": "fact_learner_course_status", "database": "", "comment": null, "owner": null}, "columns": {"org": {"type": "LowCardinality(String)", "index": 1, "name": "org", "comment": null}, "course_key": {"type": "LowCardinality(String)", "index": 2, "name": "course_key", "comment": null}, "actor_id": {"type": "String", "index": 3, "name": "actor_id", "comment": null}, "approving_state": {"type": "String", "index": 4, "name": "approving_state", "comment": null}, "emission_time": {"type": "DateTime", "index": 5, "name": "emission_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.aspects.fact_learner_course_status"}, "model.aspects.fact_learner_last_course_visit": {"metadata": {"type": "table", "schema": "xapi", "name": "fact_learner_last_course_visit", "database": "", "comment": null, "owner": null}, "columns": {"org": {"type": "LowCardinality(String)", "index": 1, "name": "org", "comment": null}, "course_key": {"type": "LowCardinality(String)", "index": 2, "name": "course_key", "comment": null}, "actor_id": {"type": "String", "index": 3, "name": "actor_id", "comment": null}, "emission_time": {"type": "DateTime", "index": 4, "name": "emission_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.aspects.fact_learner_last_course_visit"}, "model.aspects.fact_navigation": {"metadata": {"type": "view", "schema": "xapi", "name": "fact_navigation", "database": "", "comment": null, "owner": null}, "columns": {"emission_time": {"type": "DateTime", "index": 1, "name": "emission_time", "comment": null}, "org": {"type": "LowCardinality(String)", "index": 2, "name": "org", "comment": null}, "course_key": {"type": "LowCardinality(String)", "index": 3, "name": "course_key", "comment": null}, "course_name": {"type": "String", "index": 4, "name": "course_name", "comment": null}, "course_run": {"type": "String", "index": 5, "name": "course_run", "comment": null}, "actor_id": {"type": "String", "index": 6, "name": "actor_id", "comment": null}, "block_id": {"type": "String", "index": 7, "name": "block_id", "comment": null}, "block_name": {"type": "String", "index": 8, "name": "block_name", "comment": null}, "block_name_with_location": {"type": "String", "index": 9, "name": "block_name_with_location", "comment": null}, "course_order": {"type": "Int32", "index": 10, "name": "course_order", "comment": null}, "object_type": {"type": "String", "index": 11, "name": "object_type", "comment": null}, "starting_position": {"type": "Int64", "index": 12, "name": "starting_position", "comment": null}, "ending_point": {"type": "String", "index": 13, "name": "ending_point", "comment": null}, "username": {"type": "String", "index": 14, "name": "username", "comment": null}, "name": {"type": "String", "index": 15, "name": "name", "comment": null}, "email": {"type": "String", "index": 16, "name": "email", "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.aspects.fact_navigation"}, "model.aspects.fact_navigation_completion": {"metadata": {"type": "view", "schema": "xapi", "name": "fact_navigation_completion", "database": "", "comment": null, "owner": null}, "columns": {"visited_on": {"type": "Date", "index": 1, "name": "visited_on", "comment": null}, "org": {"type": "LowCardinality(String)", "index": 2, "name": "org", "comment": null}, "course_key": {"type": "LowCardinality(String)", "index": 3, "name": "course_key", "comment": null}, "course_name": {"type": "String", "index": 4, "name": "course_name", "comment": null}, "course_run": {"type": "String", "index": 5, "name": "course_run", "comment": null}, "section_with_name": {"type": "String", "index": 6, "name": "section_with_name", "comment": null}, "subsection_with_name": {"type": "String", "index": 7, "name": "subsection_with_name", "comment": null}, "course_order": {"type": "Int32", "index": 8, "name": "course_order", "comment": null}, "page_count": {"type": "UInt64", "index": 9, "name": "page_count", "comment": null}, "actor_id": {"type": "String", "index": 10, "name": "actor_id", "comment": null}, "block_id": {"type": "String", "index": 11, "name": "block_id", "comment": null}, "username": {"type": "String", "index": 12, "name": "username", "comment": null}, "name": {"type": "String", "index": 13, "name": "name", "comment": null}, "email": {"type": "String", "index": 14, "name": "email", "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.aspects.fact_navigation_completion"}, "model.aspects.fact_pageview_engagement": {"metadata": {"type": "view", "schema": "xapi", "name": "fact_pageview_engagement", "database": "", "comment": null, "owner": null}, "columns": {"org": {"type": "LowCardinality(String)", "index": 1, "name": "org", "comment": null}, "course_key": {"type": "LowCardinality(String)", "index": 2, "name": "course_key", "comment": null}, "course_run": {"type": "String", "index": 3, "name": "course_run", "comment": null}, "section_subsection_name": {"type": "String", "index": 4, "name": "section_subsection_name", "comment": null}, "content_level": {"type": "String", "index": 5, "name": "content_level", "comment": null}, "actor_id": {"type": "String", "index": 6, "name": "actor_id", "comment": null}, "section_subsection_page_engagement": {"type": "String", "index": 7, "name": "section_subsection_page_engagement", "comment": null}, "username": {"type": "String", "index": 8, "name": "username", "comment": null}, "name": {"type": "String", "index": 9, "name": "name", "comment": null}, "email": {"type": "String", "index": 10, "name": "email", "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.aspects.fact_pageview_engagement"}, "model.aspects.fact_problem_responses": {"metadata": {"type": "view", "schema": "xapi", "name": "fact_problem_responses", "database": "", "comment": null, "owner": null}, "columns": {"emission_time": {"type": "DateTime", "index": 1, "name": "emission_time", "comment": null}, "org": {"type": "LowCardinality(String)", "index": 2, "name": "org", "comment": null}, "course_key": {"type": "LowCardinality(String)", "index": 3, "name": "course_key", "comment": null}, "course_name": {"type": "String", "index": 4, "name": "course_name", "comment": null}, "course_run": {"type": "String", "index": 5, "name": "course_run", "comment": null}, "problem_id": {"type": "String", "index": 6, "name": "problem_id", "comment": null}, "problem_name": {"type": "String", "index": 7, "name": "problem_name", "comment": null}, "problem_name_with_location": {"type": "String", "index": 8, "name": "problem_name_with_location", "comment": null}, "problem_link": {"type": "String", "index": 9, "name": "problem_link", "comment": null}, "graded": {"type": "Bool", "index": 10, "name": "graded", "comment": null}, "course_order": {"type": "Int32", "index": 11, "name": "course_order", "comment": null}, "actor_id": {"type": "String", "index": 12, "name": "actor_id", "comment": null}, "responses": {"type": "String", "index": 13, "name": "responses", "comment": null}, "success": {"type": "Bool", "index": 14, "name": "success", "comment": null}, "attempts": {"type": "Int16", "index": 15, "name": "attempts", "comment": null}, "interaction_type": {"type": "LowCardinality(String)", "index": 16, "name": "interaction_type", "comment": null}, "username": {"type": "String", "index": 17, "name": "username", "comment": null}, "name": {"type": "String", "index": 18, "name": "name", "comment": null}, "email": {"type": "String", "index": 19, "name": "email", "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.aspects.fact_problem_responses"}, "model.aspects.fact_student_status": {"metadata": {"type": "view", "schema": "xapi", "name": "fact_student_status", "database": "", "comment": null, "owner": null}, "columns": {"org": {"type": "LowCardinality(String)", "index": 1, "name": "org", "comment": null}, "course_key": {"type": "LowCardinality(String)", "index": 2, "name": "course_key", "comment": null}, "actor_id": {"type": "String", "index": 3, "name": "actor_id", "comment": null}, "course_name": {"type": "String", "index": 4, "name": "course_name", "comment": null}, "course_run": {"type": "String", "index": 5, "name": "course_run", "comment": null}, "approving_state": {"type": "String", "index": 6, "name": "approving_state", "comment": null}, "enrollment_mode": {"type": "LowCardinality(String)", "index": 7, "name": "enrollment_mode", "comment": null}, "enrollment_status": {"type": "String", "index": 8, "name": "enrollment_status", "comment": null}, "course_grade": {"type": "Float64", "index": 9, "name": "course_grade", "comment": null}, "grade_bucket": {"type": "String", "index": 10, "name": "grade_bucket", "comment": null}, "username": {"type": "String", "index": 11, "name": "username", "comment": null}, "name": {"type": "String", "index": 12, "name": "name", "comment": null}, "email": {"type": "String", "index": 13, "name": "email", "comment": null}, "enrolled_at": {"type": "DateTime", "index": 14, "name": "enrolled_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.aspects.fact_student_status"}, "model.aspects.fact_video_engagement": {"metadata": {"type": "view", "schema": "xapi", "name": "fact_video_engagement", "database": "", "comment": null, "owner": null}, "columns": {"org": {"type": "LowCardinality(String)", "index": 1, "name": "org", "comment": null}, "course_key": {"type": "LowCardinality(String)", "index": 2, "name": "course_key", "comment": null}, "course_run": {"type": "String", "index": 3, "name": "course_run", "comment": null}, "section_subsection_name": {"type": "String", "index": 4, "name": "section_subsection_name", "comment": null}, "content_level": {"type": "String", "index": 5, "name": "content_level", "comment": null}, "actor_id": {"type": "String", "index": 6, "name": "actor_id", "comment": null}, "section_subsection_video_engagement": {"type": "String", "index": 7, "name": "section_subsection_video_engagement", "comment": null}, "username": {"type": "String", "index": 8, "name": "username", "comment": null}, "name": {"type": "String", "index": 9, "name": "name", "comment": null}, "email": {"type": "String", "index": 10, "name": "email", "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.aspects.fact_video_engagement"}, "model.aspects.fact_video_plays": {"metadata": {"type": "view", "schema": "xapi", "name": "fact_video_plays", "database": "", "comment": null, "owner": null}, "columns": {"emission_time": {"type": "DateTime", "index": 1, "name": "emission_time", "comment": null}, "org": {"type": "LowCardinality(String)", "index": 2, "name": "org", "comment": null}, "course_key": {"type": "LowCardinality(String)", "index": 3, "name": "course_key", "comment": null}, "course_name": {"type": "String", "index": 4, "name": "course_name", "comment": null}, "course_run": {"type": "String", "index": 5, "name": "course_run", "comment": null}, "video_id": {"type": "String", "index": 6, "name": "video_id", "comment": null}, "video_name": {"type": "String", "index": 7, "name": "video_name", "comment": null}, "video_name_with_location": {"type": "String", "index": 8, "name": "video_name_with_location", "comment": null}, "video_link": {"type": "String", "index": 9, "name": "video_link", "comment": null}, "graded": {"type": "Bool", "index": 10, "name": "graded", "comment": null}, "video_position": {"type": "Decimal(9, 2)", "index": 11, "name": "video_position", "comment": null}, "video_duration": {"type": "Int64", "index": 12, "name": "video_duration", "comment": null}, "visualization_bucket": {"type": "String", "index": 13, "name": "visualization_bucket", "comment": null}, "actor_id": {"type": "String", "index": 14, "name": "actor_id", "comment": null}, "username": {"type": "String", "index": 15, "name": "username", "comment": null}, "name": {"type": "String", "index": 16, "name": "name", "comment": null}, "email": {"type": "String", "index": 17, "name": "email", "comment": null}, "section_with_name": {"type": "String", "index": 18, "name": "section_with_name", "comment": null}, "subsection_with_name": {"type": "String", "index": 19, "name": "subsection_with_name", "comment": null}, "course_order": {"type": "Int32", "index": 20, "name": "course_order", "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.aspects.fact_video_plays"}, "model.aspects.grading_events": {"metadata": {"type": "table", "schema": "xapi", "name": "grading_events", "database": "", "comment": null, "owner": null}, "columns": {"event_id": {"type": "UUID", "index": 1, "name": "event_id", "comment": null}, "emission_time": {"type": "DateTime", "index": 2, "name": "emission_time", "comment": null}, "actor_id": {"type": "String", "index": 3, "name": "actor_id", "comment": null}, "object_id": {"type": "String", "index": 4, "name": "object_id", "comment": null}, "course_key": {"type": "LowCardinality(String)", "index": 5, "name": "course_key", "comment": null}, "org": {"type": "LowCardinality(String)", "index": 6, "name": "org", "comment": null}, "verb_id": {"type": "LowCardinality(String)", "index": 7, "name": "verb_id", "comment": null}, "scaled_score": {"type": "Float64", "index": 8, "name": "scaled_score", "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.aspects.grading_events"}, "model.aspects.int_pages_per_subsection": {"metadata": {"type": "view", "schema": "xapi", "name": "int_pages_per_subsection", "database": "", "comment": null, "owner": null}, "columns": {"org": {"type": "String", "index": 1, "name": "org", "comment": null}, "course_key": {"type": "String", "index": 2, "name": "course_key", "comment": null}, "section_number": {"type": "String", "index": 3, "name": "section_number", "comment": null}, "section_with_name": {"type": "String", "index": 4, "name": "section_with_name", "comment": null}, "subsection_number": {"type": "String", "index": 5, "name": "subsection_number", "comment": null}, "subsection_with_name": {"type": "String", "index": 6, "name": "subsection_with_name", "comment": null}, "course_order": {"type": "Int32", "index": 7, "name": "course_order", "comment": null}, "graded": {"type": "Bool", "index": 8, "name": "graded", "comment": null}, "item_count": {"type": "UInt64", "index": 9, "name": "item_count", "comment": null}, "subsection_block_id": {"type": "String", "index": 10, "name": "subsection_block_id", "comment": null}, "section_block_id": {"type": "String", "index": 11, "name": "section_block_id", "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.aspects.int_pages_per_subsection"}, "model.aspects.int_problem_hints": {"metadata": {"type": "view", "schema": "xapi", "name": "int_problem_hints", "database": "", "comment": null, "owner": null}, "columns": {"emission_time": {"type": "DateTime", "index": 1, "name": "emission_time", "comment": null}, "org": {"type": "LowCardinality(String)", "index": 2, "name": "org", "comment": null}, "course_key": {"type": "LowCardinality(String)", "index": 3, "name": "course_key", "comment": null}, "course_name": {"type": "String", "index": 4, "name": "course_name", "comment": null}, "course_run": {"type": "String", "index": 5, "name": "course_run", "comment": null}, "problem_id": {"type": "String", "index": 6, "name": "problem_id", "comment": null}, "problem_name": {"type": "String", "index": 7, "name": "problem_name", "comment": null}, "problem_name_with_location": {"type": "String", "index": 8, "name": "problem_name_with_location", "comment": null}, "course_order": {"type": "Int32", "index": 9, "name": "course_order", "comment": null}, "actor_id": {"type": "String", "index": 10, "name": "actor_id", "comment": null}, "help_type": {"type": "String", "index": 11, "name": "help_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.aspects.int_problem_hints"}, "model.aspects.int_problem_results": {"metadata": {"type": "view", "schema": "xapi", "name": "int_problem_results", "database": "", "comment": null, "owner": null}, "columns": {"emission_time": {"type": "DateTime", "index": 1, "name": "emission_time", "comment": null}, "org": {"type": "LowCardinality(String)", "index": 2, "name": "org", "comment": null}, "course_key": {"type": "LowCardinality(String)", "index": 3, "name": "course_key", "comment": null}, "course_name": {"type": "String", "index": 4, "name": "course_name", "comment": null}, "course_run": {"type": "String", "index": 5, "name": "course_run", "comment": null}, "problem_id": {"type": "String", "index": 6, "name": "problem_id", "comment": null}, "problem_name": {"type": "String", "index": 7, "name": "problem_name", "comment": null}, "problem_name_with_location": {"type": "String", "index": 8, "name": "problem_name_with_location", "comment": null}, "course_order": {"type": "Int32", "index": 9, "name": "course_order", "comment": null}, "problem_link": {"type": "String", "index": 10, "name": "problem_link", "comment": null}, "actor_id": {"type": "String", "index": 11, "name": "actor_id", "comment": null}, "responses": {"type": "String", "index": 12, "name": "responses", "comment": null}, "success": {"type": "Bool", "index": 13, "name": "success", "comment": null}, "attempts": {"type": "Int16", "index": 14, "name": "attempts", "comment": null}, "interaction_type": {"type": "LowCardinality(String)", "index": 15, "name": "interaction_type", "comment": null}, "graded": {"type": "Bool", "index": 16, "name": "graded", "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.aspects.int_problem_results"}, "model.aspects.int_problems_per_subsection": {"metadata": {"type": "view", "schema": "xapi", "name": "int_problems_per_subsection", "database": "", "comment": null, "owner": null}, "columns": {"org": {"type": "String", "index": 1, "name": "org", "comment": null}, "course_key": {"type": "String", "index": 2, "name": "course_key", "comment": null}, "section_number": {"type": "String", "index": 3, "name": "section_number", "comment": null}, "section_with_name": {"type": "String", "index": 4, "name": "section_with_name", "comment": null}, "subsection_number": {"type": "String", "index": 5, "name": "subsection_number", "comment": null}, "subsection_with_name": {"type": "String", "index": 6, "name": "subsection_with_name", "comment": null}, "course_order": {"type": "Int32", "index": 7, "name": "course_order", "comment": null}, "graded": {"type": "Bool", "index": 8, "name": "graded", "comment": null}, "item_count": {"type": "UInt64", "index": 9, "name": "item_count", "comment": null}, "subsection_block_id": {"type": "String", "index": 10, "name": "subsection_block_id", "comment": null}, "section_block_id": {"type": "String", "index": 11, "name": "section_block_id", "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.aspects.int_problems_per_subsection"}, "model.aspects.int_videos_per_subsection": {"metadata": {"type": "view", "schema": "xapi", "name": "int_videos_per_subsection", "database": "", "comment": null, "owner": null}, "columns": {"org": {"type": "String", "index": 1, "name": "org", "comment": null}, "course_key": {"type": "String", "index": 2, "name": "course_key", "comment": null}, "section_number": {"type": "String", "index": 3, "name": "section_number", "comment": null}, "section_with_name": {"type": "String", "index": 4, "name": "section_with_name", "comment": null}, "subsection_number": {"type": "String", "index": 5, "name": "subsection_number", "comment": null}, "subsection_with_name": {"type": "String", "index": 6, "name": "subsection_with_name", "comment": null}, "course_order": {"type": "Int32", "index": 7, "name": "course_order", "comment": null}, "graded": {"type": "Bool", "index": 8, "name": "graded", "comment": null}, "item_count": {"type": "UInt64", "index": 9, "name": "item_count", "comment": null}, "subsection_block_id": {"type": "String", "index": 10, "name": "subsection_block_id", "comment": null}, "section_block_id": {"type": "String", "index": 11, "name": "section_block_id", "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.aspects.int_videos_per_subsection"}, "model.aspects.most_recent_course_blocks": {"metadata": {"type": "table", "schema": "xapi", "name": "most_recent_course_blocks", "database": "", "comment": null, "owner": null}, "columns": {"location": {"type": "String", "index": 1, "name": "location", "comment": null}, "block_name": {"type": "String", "index": 2, "name": "block_name", "comment": null}, "display_name_with_location": {"type": "String", "index": 3, "name": "display_name_with_location", "comment": null}, "section": {"type": "Int64", "index": 4, "name": "section", "comment": null}, "subsection": {"type": "Int64", "index": 5, "name": "subsection", "comment": null}, "unit": {"type": "Int64", "index": 6, "name": "unit", "comment": null}, "graded": {"type": "UInt8", "index": 7, "name": "graded", "comment": null}, "course_order": {"type": "Int32", "index": 8, "name": "course_order", "comment": null}, "course_key": {"type": "String", "index": 9, "name": "course_key", "comment": null}, "dump_id": {"type": "UUID", "index": 10, "name": "dump_id", "comment": null}, "time_last_dumped": {"type": "String", "index": 11, "name": "time_last_dumped", "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.aspects.most_recent_course_blocks"}, "model.aspects.navigation_events": {"metadata": {"type": "table", "schema": "xapi", "name": "navigation_events", "database": "", "comment": null, "owner": null}, "columns": {"event_id": {"type": "UUID", "index": 1, "name": "event_id", "comment": null}, "emission_time": {"type": "DateTime", "index": 2, "name": "emission_time", "comment": null}, "actor_id": {"type": "String", "index": 3, "name": "actor_id", "comment": null}, "block_id": {"type": "String", "index": 4, "name": "block_id", "comment": null}, "course_key": {"type": "LowCardinality(String)", "index": 5, "name": "course_key", "comment": null}, "org": {"type": "LowCardinality(String)", "index": 6, "name": "org", "comment": null}, "verb_id": {"type": "LowCardinality(String)", "index": 7, "name": "verb_id", "comment": null}, "object_type": {"type": "String", "index": 8, "name": "object_type", "comment": null}, "starting_position": {"type": "Int64", "index": 9, "name": "starting_position", "comment": null}, "ending_point": {"type": "String", "index": 10, "name": "ending_point", "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.aspects.navigation_events"}, "model.aspects.problem_events": {"metadata": {"type": "table", "schema": "xapi", "name": "problem_events", "database": "", "comment": null, "owner": null}, "columns": {"event_id": {"type": "UUID", "index": 1, "name": "event_id", "comment": null}, "emission_time": {"type": "DateTime", "index": 2, "name": "emission_time", "comment": null}, "actor_id": {"type": "String", "index": 3, "name": "actor_id", "comment": null}, "object_id": {"type": "String", "index": 4, "name": "object_id", "comment": null}, "course_key": {"type": "LowCardinality(String)", "index": 5, "name": "course_key", "comment": null}, "org": {"type": "LowCardinality(String)", "index": 6, "name": "org", "comment": null}, "verb_id": {"type": "LowCardinality(String)", "index": 7, "name": "verb_id", "comment": null}, "responses": {"type": "String", "index": 8, "name": "responses", "comment": null}, "scaled_score": {"type": "String", "index": 9, "name": "scaled_score", "comment": null}, "success": {"type": "Bool", "index": 10, "name": "success", "comment": null}, "interaction_type": {"type": "LowCardinality(String)", "index": 11, "name": "interaction_type", "comment": null}, "attempts": {"type": "Int16", "index": 12, "name": "attempts", "comment": null}, "problem_id": {"type": "String", "index": 13, "name": "problem_id", "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.aspects.problem_events"}, "model.aspects.responses": {"metadata": {"type": "table", "schema": "xapi", "name": "responses", "database": "", "comment": null, "owner": null}, "columns": {"org": {"type": "LowCardinality(String)", "index": 1, "name": "org", "comment": null}, "course_key": {"type": "LowCardinality(String)", "index": 2, "name": "course_key", "comment": null}, "problem_id": {"type": "String", "index": 3, "name": "problem_id", "comment": null}, "actor_id": {"type": "String", "index": 4, "name": "actor_id", "comment": null}, "first_success_at": {"type": "Nullable(DateTime)", "index": 5, "name": "first_success_at", "comment": null}, "last_attempt_at": {"type": "DateTime", "index": 6, "name": "last_attempt_at", "comment": null}, "emission_time": {"type": "DateTime", "index": 7, "name": "emission_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.aspects.responses"}, "model.aspects.section_page_engagement": {"metadata": {"type": "table", "schema": "xapi", "name": "section_page_engagement", "database": "", "comment": null, "owner": null}, "columns": {"org": {"type": "LowCardinality(String)", "index": 1, "name": "org", "comment": null}, "course_key": {"type": "LowCardinality(String)", "index": 2, "name": "course_key", "comment": null}, "actor_id": {"type": "String", "index": 3, "name": "actor_id", "comment": null}, "section_block_id": {"type": "String", "index": 4, "name": "section_block_id", "comment": null}, "engagement_level": {"type": "String", "index": 5, "name": "engagement_level", "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.aspects.section_page_engagement"}, "model.aspects.section_problem_engagement": {"metadata": {"type": "table", "schema": "xapi", "name": "section_problem_engagement", "database": "", "comment": null, "owner": null}, "columns": {"org": {"type": "LowCardinality(String)", "index": 1, "name": "org", "comment": null}, "course_key": {"type": "LowCardinality(String)", "index": 2, "name": "course_key", "comment": null}, "actor_id": {"type": "String", "index": 3, "name": "actor_id", "comment": null}, "section_block_id": {"type": "String", "index": 4, "name": "section_block_id", "comment": null}, "engagement_level": {"type": "String", "index": 5, "name": "engagement_level", "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.aspects.section_problem_engagement"}, "model.aspects.section_video_engagement": {"metadata": {"type": "table", "schema": "xapi", "name": "section_video_engagement", "database": "", "comment": null, "owner": null}, "columns": {"org": {"type": "LowCardinality(String)", "index": 1, "name": "org", "comment": null}, "course_key": {"type": "LowCardinality(String)", "index": 2, "name": "course_key", "comment": null}, "actor_id": {"type": "String", "index": 3, "name": "actor_id", "comment": null}, "section_block_id": {"type": "String", "index": 4, "name": "section_block_id", "comment": null}, "engagement_level": {"type": "String", "index": 5, "name": "engagement_level", "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.aspects.section_video_engagement"}, "model.aspects.subsection_page_engagement": {"metadata": {"type": "table", "schema": "xapi", "name": "subsection_page_engagement", "database": "", "comment": null, "owner": null}, "columns": {"org": {"type": "LowCardinality(String)", "index": 1, "name": "org", "comment": null}, "course_key": {"type": "LowCardinality(String)", "index": 2, "name": "course_key", "comment": null}, "actor_id": {"type": "String", "index": 3, "name": "actor_id", "comment": null}, "subsection_block_id": {"type": "String", "index": 4, "name": "subsection_block_id", "comment": null}, "engagement_level": {"type": "String", "index": 5, "name": "engagement_level", "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.aspects.subsection_page_engagement"}, "model.aspects.subsection_problem_engagement": {"metadata": {"type": "table", "schema": "xapi", "name": "subsection_problem_engagement", "database": "", "comment": null, "owner": null}, "columns": {"org": {"type": "LowCardinality(String)", "index": 1, "name": "org", "comment": null}, "course_key": {"type": "LowCardinality(String)", "index": 2, "name": "course_key", "comment": null}, "actor_id": {"type": "String", "index": 3, "name": "actor_id", "comment": null}, "subsection_block_id": {"type": "String", "index": 4, "name": "subsection_block_id", "comment": null}, "engagement_level": {"type": "String", "index": 5, "name": "engagement_level", "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.aspects.subsection_problem_engagement"}, "model.aspects.subsection_video_engagement": {"metadata": {"type": "table", "schema": "xapi", "name": "subsection_video_engagement", "database": "", "comment": null, "owner": null}, "columns": {"org": {"type": "LowCardinality(String)", "index": 1, "name": "org", "comment": null}, "course_key": {"type": "LowCardinality(String)", "index": 2, "name": "course_key", "comment": null}, "actor_id": {"type": "String", "index": 3, "name": "actor_id", "comment": null}, "subsection_block_id": {"type": "String", "index": 4, "name": "subsection_block_id", "comment": null}, "engagement_level": {"type": "String", "index": 5, "name": "engagement_level", "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.aspects.subsection_video_engagement"}, "model.aspects.user_pii": {"metadata": {"type": "table", "schema": "xapi", "name": "user_pii", "database": "", "comment": null, "owner": null}, "columns": {"user_id": {"type": "Int32", "index": 1, "name": "user_id", "comment": null}, "external_user_id": {"type": "UUID", "index": 2, "name": "external_user_id", "comment": null}, "username": {"type": "String", "index": 3, "name": "username", "comment": null}, "name": {"type": "String", "index": 4, "name": "name", "comment": null}, "email": {"type": "String", "index": 5, "name": "email", "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.aspects.user_pii"}, "model.aspects.video_playback_events": {"metadata": {"type": "table", "schema": "xapi", "name": "video_playback_events", "database": "", "comment": null, "owner": null}, "columns": {"event_id": {"type": "UUID", "index": 1, "name": "event_id", "comment": null}, "emission_time": {"type": "DateTime", "index": 2, "name": "emission_time", "comment": null}, "actor_id": {"type": "String", "index": 3, "name": "actor_id", "comment": null}, "object_id": {"type": "String", "index": 4, "name": "object_id", "comment": null}, "course_key": {"type": "LowCardinality(String)", "index": 5, "name": "course_key", "comment": null}, "org": {"type": "LowCardinality(String)", "index": 6, "name": "org", "comment": null}, "verb_id": {"type": "LowCardinality(String)", "index": 7, "name": "verb_id", "comment": null}, "video_position": {"type": "Decimal(9, 2)", "index": 8, "name": "video_position", "comment": null}, "video_duration": {"type": "Int64", "index": 9, "name": "video_duration", "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.aspects.video_playback_events"}, "model.aspects.xapi_events_all_parsed": {"metadata": {"type": "table", "schema": "xapi", "name": "xapi_events_all_parsed", "database": "", "comment": null, "owner": null}, "columns": {"event_id": {"type": "UUID", "index": 1, "name": "event_id", "comment": null}, "verb_id": {"type": "LowCardinality(String)", "index": 2, "name": "verb_id", "comment": null}, "actor_id": {"type": "String", "index": 3, "name": "actor_id", "comment": null}, "object_id": {"type": "String", "index": 4, "name": "object_id", "comment": null}, "course_id": {"type": "LowCardinality(String)", "index": 5, "name": "course_id", "comment": null}, "course_key": {"type": "LowCardinality(String)", "index": 6, "name": "course_key", "comment": null}, "org": {"type": "LowCardinality(String)", "index": 7, "name": "org", "comment": null}, "emission_time": {"type": "DateTime64(6)", "index": 8, "name": "emission_time", "comment": null}, "event": {"type": "String", "index": 9, "name": "event", "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.aspects.xapi_events_all_parsed"}}, "sources": {}, "errors": null}
\ No newline at end of file
diff --git a/compiled/aspects/models/video/subsection_video_engagement.sql b/compiled/aspects/models/video/subsection_video_engagement.sql
index 21448307..e88d00b8 100644
--- a/compiled/aspects/models/video/subsection_video_engagement.sql
+++ b/compiled/aspects/models/video/subsection_video_engagement.sql
@@ -77,5 +77,5 @@ with
item_count,
subsection_block_id
)
-select org, course_key, actor_id, subsection_block_id, engagement_level
+select distinct org, course_key, actor_id, subsection_block_id, engagement_level
from subsection_counts
\ No newline at end of file
diff --git a/compiled/aspects/tests/get_problem_id.sql b/compiled/aspects/tests/get_problem_id.sql
deleted file mode 100644
index 12a0c49a..00000000
--- a/compiled/aspects/tests/get_problem_id.sql
+++ /dev/null
@@ -1,11 +0,0 @@
-select
- 'http://local.edly.io:8000/xblock/block-v1:edunext+demo+demo+ccx+type@problem+block@3c1646f7133a4c5fb4557d649e22c251'
- as object_id
-from system.one
-where
-
- regexpExtract(
- object_id, 'xblock/([\w\d-\+:@]*@problem\+block@[\w\d][^_\/]*)(_\d_\d)?', 1
- )
-
- != 'block-v1:edunext+demo+demo+ccx+type@problem+block@3c1646f7133a4c5fb4557d649e22c251'
\ No newline at end of file
diff --git a/compiled/aspects/tests/a_tag.sql b/compiled/aspects/tests/macros/a_tag.sql
similarity index 100%
rename from compiled/aspects/tests/a_tag.sql
rename to compiled/aspects/tests/macros/a_tag.sql
diff --git a/compiled/aspects/tests/macros/get_bucket.sql b/compiled/aspects/tests/macros/get_bucket.sql
new file mode 100644
index 00000000..c1794974
--- /dev/null
+++ b/compiled/aspects/tests/macros/get_bucket.sql
@@ -0,0 +1,348 @@
+select 0.95 as field
+from system.one
+where
+ case
+ when field >= 0.9
+ then '90-100%'
+ when field >= 0.8 and field < 0.9
+ then '80-89%'
+ when field >= 0.7 and field < 0.8
+ then '70-79%'
+ when field >= 0.6 and field < 0.7
+ then '60-69%'
+ when field >= 0.5 and field < 0.6
+ then '50-59%'
+ when field >= 0.4 and field < 0.5
+ then '40-49%'
+ when field >= 0.3 and field < 0.4
+ then '30-39%'
+ when field >= 0.2 and field < 0.3
+ then '20-29%'
+ when field >= 0.1 and field < 0.2
+ then '10-19%'
+ else '0-9%'
+ end != '90-100%'
+
+union all
+
+select 0.8 as field
+from system.one
+where
+ case
+ when field >= 0.9
+ then '90-100%'
+ when field >= 0.8 and field < 0.9
+ then '80-89%'
+ when field >= 0.7 and field < 0.8
+ then '70-79%'
+ when field >= 0.6 and field < 0.7
+ then '60-69%'
+ when field >= 0.5 and field < 0.6
+ then '50-59%'
+ when field >= 0.4 and field < 0.5
+ then '40-49%'
+ when field >= 0.3 and field < 0.4
+ then '30-39%'
+ when field >= 0.2 and field < 0.3
+ then '20-29%'
+ when field >= 0.1 and field < 0.2
+ then '10-19%'
+ else '0-9%'
+ end != '80-89%'
+
+union all
+
+select 0.700009 as field
+from system.one
+where
+ case
+ when field >= 0.9
+ then '90-100%'
+ when field >= 0.8 and field < 0.9
+ then '80-89%'
+ when field >= 0.7 and field < 0.8
+ then '70-79%'
+ when field >= 0.6 and field < 0.7
+ then '60-69%'
+ when field >= 0.5 and field < 0.6
+ then '50-59%'
+ when field >= 0.4 and field < 0.5
+ then '40-49%'
+ when field >= 0.3 and field < 0.4
+ then '30-39%'
+ when field >= 0.2 and field < 0.3
+ then '20-29%'
+ when field >= 0.1 and field < 0.2
+ then '10-19%'
+ else '0-9%'
+ end != '70-79%'
+
+union all
+
+select 0.69999 as field
+from system.one
+where
+ case
+ when field >= 0.9
+ then '90-100%'
+ when field >= 0.8 and field < 0.9
+ then '80-89%'
+ when field >= 0.7 and field < 0.8
+ then '70-79%'
+ when field >= 0.6 and field < 0.7
+ then '60-69%'
+ when field >= 0.5 and field < 0.6
+ then '50-59%'
+ when field >= 0.4 and field < 0.5
+ then '40-49%'
+ when field >= 0.3 and field < 0.4
+ then '30-39%'
+ when field >= 0.2 and field < 0.3
+ then '20-29%'
+ when field >= 0.1 and field < 0.2
+ then '10-19%'
+ else '0-9%'
+ end != '60-69%'
+
+union all
+
+select 0.5 as field
+from system.one
+where
+ case
+ when field >= 0.9
+ then '90-100%'
+ when field >= 0.8 and field < 0.9
+ then '80-89%'
+ when field >= 0.7 and field < 0.8
+ then '70-79%'
+ when field >= 0.6 and field < 0.7
+ then '60-69%'
+ when field >= 0.5 and field < 0.6
+ then '50-59%'
+ when field >= 0.4 and field < 0.5
+ then '40-49%'
+ when field >= 0.3 and field < 0.4
+ then '30-39%'
+ when field >= 0.2 and field < 0.3
+ then '20-29%'
+ when field >= 0.1 and field < 0.2
+ then '10-19%'
+ else '0-9%'
+ end != '50-59%'
+
+union all
+
+select 0.4123 as field
+from system.one
+where
+ case
+ when field >= 0.9
+ then '90-100%'
+ when field >= 0.8 and field < 0.9
+ then '80-89%'
+ when field >= 0.7 and field < 0.8
+ then '70-79%'
+ when field >= 0.6 and field < 0.7
+ then '60-69%'
+ when field >= 0.5 and field < 0.6
+ then '50-59%'
+ when field >= 0.4 and field < 0.5
+ then '40-49%'
+ when field >= 0.3 and field < 0.4
+ then '30-39%'
+ when field >= 0.2 and field < 0.3
+ then '20-29%'
+ when field >= 0.1 and field < 0.2
+ then '10-19%'
+ else '0-9%'
+ end != '40-49%'
+
+union all
+
+select 0.3000000000 as field
+from system.one
+where
+ case
+ when field >= 0.9
+ then '90-100%'
+ when field >= 0.8 and field < 0.9
+ then '80-89%'
+ when field >= 0.7 and field < 0.8
+ then '70-79%'
+ when field >= 0.6 and field < 0.7
+ then '60-69%'
+ when field >= 0.5 and field < 0.6
+ then '50-59%'
+ when field >= 0.4 and field < 0.5
+ then '40-49%'
+ when field >= 0.3 and field < 0.4
+ then '30-39%'
+ when field >= 0.2 and field < 0.3
+ then '20-29%'
+ when field >= 0.1 and field < 0.2
+ then '10-19%'
+ else '0-9%'
+ end != '30-39%'
+
+union all
+
+select 0.276734 as field
+from system.one
+where
+ case
+ when field >= 0.9
+ then '90-100%'
+ when field >= 0.8 and field < 0.9
+ then '80-89%'
+ when field >= 0.7 and field < 0.8
+ then '70-79%'
+ when field >= 0.6 and field < 0.7
+ then '60-69%'
+ when field >= 0.5 and field < 0.6
+ then '50-59%'
+ when field >= 0.4 and field < 0.5
+ then '40-49%'
+ when field >= 0.3 and field < 0.4
+ then '30-39%'
+ when field >= 0.2 and field < 0.3
+ then '20-29%'
+ when field >= 0.1 and field < 0.2
+ then '10-19%'
+ else '0-9%'
+ end != '20-29%'
+
+union all
+
+select 0.11111 as field
+from system.one
+where
+ case
+ when field >= 0.9
+ then '90-100%'
+ when field >= 0.8 and field < 0.9
+ then '80-89%'
+ when field >= 0.7 and field < 0.8
+ then '70-79%'
+ when field >= 0.6 and field < 0.7
+ then '60-69%'
+ when field >= 0.5 and field < 0.6
+ then '50-59%'
+ when field >= 0.4 and field < 0.5
+ then '40-49%'
+ when field >= 0.3 and field < 0.4
+ then '30-39%'
+ when field >= 0.2 and field < 0.3
+ then '20-29%'
+ when field >= 0.1 and field < 0.2
+ then '10-19%'
+ else '0-9%'
+ end != '10-19%'
+
+union all
+
+select 0.0342 as field
+from system.one
+where
+ case
+ when field >= 0.9
+ then '90-100%'
+ when field >= 0.8 and field < 0.9
+ then '80-89%'
+ when field >= 0.7 and field < 0.8
+ then '70-79%'
+ when field >= 0.6 and field < 0.7
+ then '60-69%'
+ when field >= 0.5 and field < 0.6
+ then '50-59%'
+ when field >= 0.4 and field < 0.5
+ then '40-49%'
+ when field >= 0.3 and field < 0.4
+ then '30-39%'
+ when field >= 0.2 and field < 0.3
+ then '20-29%'
+ when field >= 0.1 and field < 0.2
+ then '10-19%'
+ else '0-9%'
+ end != '0-9%'
+
+union all
+
+select 0.00000005 as field
+from system.one
+where
+ case
+ when field >= 0.9
+ then '90-100%'
+ when field >= 0.8 and field < 0.9
+ then '80-89%'
+ when field >= 0.7 and field < 0.8
+ then '70-79%'
+ when field >= 0.6 and field < 0.7
+ then '60-69%'
+ when field >= 0.5 and field < 0.6
+ then '50-59%'
+ when field >= 0.4 and field < 0.5
+ then '40-49%'
+ when field >= 0.3 and field < 0.4
+ then '30-39%'
+ when field >= 0.2 and field < 0.3
+ then '20-29%'
+ when field >= 0.1 and field < 0.2
+ then '10-19%'
+ else '0-9%'
+ end != '0-9%'
+
+union all
+
+select -0.1 as field
+from system.one
+where
+ case
+ when field >= 0.9
+ then '90-100%'
+ when field >= 0.8 and field < 0.9
+ then '80-89%'
+ when field >= 0.7 and field < 0.8
+ then '70-79%'
+ when field >= 0.6 and field < 0.7
+ then '60-69%'
+ when field >= 0.5 and field < 0.6
+ then '50-59%'
+ when field >= 0.4 and field < 0.5
+ then '40-49%'
+ when field >= 0.3 and field < 0.4
+ then '30-39%'
+ when field >= 0.2 and field < 0.3
+ then '20-29%'
+ when field >= 0.1 and field < 0.2
+ then '10-19%'
+ else '0-9%'
+ end != '0-9%'
+
+union all
+
+select 123 as field
+from system.one
+where
+ case
+ when field >= 0.9
+ then '90-100%'
+ when field >= 0.8 and field < 0.9
+ then '80-89%'
+ when field >= 0.7 and field < 0.8
+ then '70-79%'
+ when field >= 0.6 and field < 0.7
+ then '60-69%'
+ when field >= 0.5 and field < 0.6
+ then '50-59%'
+ when field >= 0.4 and field < 0.5
+ then '40-49%'
+ when field >= 0.3 and field < 0.4
+ then '30-39%'
+ when field >= 0.2 and field < 0.3
+ then '20-29%'
+ when field >= 0.1 and field < 0.2
+ then '10-19%'
+ else '0-9%'
+ end != '90-100%'
\ No newline at end of file
diff --git a/compiled/aspects/tests/macros/get_problem_id.sql b/compiled/aspects/tests/macros/get_problem_id.sql
new file mode 100644
index 00000000..193e4dc2
--- /dev/null
+++ b/compiled/aspects/tests/macros/get_problem_id.sql
@@ -0,0 +1,81 @@
+select
+ 'http://local.edly.io:8000/xblock/block-v1:edunext+demo+demo+ccx+type@problem+block@3c1646f7133a4c5fb4557d649e22c251'
+ as object_id
+from system.one
+where
+
+ regexpExtract(
+ object_id, 'xblock/([\w\d-\+:@]*@problem\+block@[\w\d][^_\/]*)(_\d_\d)?', 1
+ )
+
+ != 'block-v1:edunext+demo+demo+ccx+type@problem+block@3c1646f7133a4c5fb4557d649e22c251'
+
+union all
+
+select
+ 'http://localhost:18000/course/course-v1:Org1+DemoX+1937e7'
+ as object_id
+from system.one
+where
+
+ regexpExtract(
+ object_id, 'xblock/([\w\d-\+:@]*@problem\+block@[\w\d][^_\/]*)(_\d_\d)?', 1
+ )
+
+ != ''
+
+union all
+
+select
+ 'http://localhost:18000/xblock/block-v1:course-v1:Org0+DemoX+2bc51b+type@problem+block@09b07a8d'
+ as object_id
+from system.one
+where
+
+ regexpExtract(
+ object_id, 'xblock/([\w\d-\+:@]*@problem\+block@[\w\d][^_\/]*)(_\d_\d)?', 1
+ )
+
+ != 'block-v1:course-v1:Org0+DemoX+2bc51b+type@problem+block@09b07a8d'
+
+union all
+
+select
+ 'http://localhost:18000/xblock/block-v1:course-v1:Org0+DemoX+2bc51b+type@problem+block@09b07a8d/answer'
+ as object_id
+from system.one
+where
+
+ regexpExtract(
+ object_id, 'xblock/([\w\d-\+:@]*@problem\+block@[\w\d][^_\/]*)(_\d_\d)?', 1
+ )
+
+ != 'block-v1:course-v1:Org0+DemoX+2bc51b+type@problem+block@09b07a8d'
+
+union all
+
+select
+ 'http://localhost:18000/xblock/block-v1:course-v1:Org0+DemoX+81bba1+type@problem+block@20d3f709/hint/1'
+ as object_id
+from system.one
+where
+
+ regexpExtract(
+ object_id, 'xblock/([\w\d-\+:@]*@problem\+block@[\w\d][^_\/]*)(_\d_\d)?', 1
+ )
+
+ != 'block-v1:course-v1:Org0+DemoX+81bba1+type@problem+block@20d3f709'
+
+union all
+
+select
+ 'http://localhost:18000/xblock/block-v1:course-v1:Org0+DemoX+81bba1+type@problem+block@20d3f709/hint/1'
+ as object_id
+from system.one
+where
+
+ regexpExtract(
+ object_id, 'xblock/([\w\d-\+:@]*@problem\+block@[\w\d][^_\/]*)(_\d_\d)?', 1
+ )
+
+ != 'block-v1:course-v1:Org0+DemoX+81bba1+type@problem+block@20d3f709'
\ No newline at end of file
diff --git a/compiled/aspects/tests/get_problem_id_with_ccx.sql b/compiled/aspects/tests/macros/get_problem_id_with_ccx.sql
similarity index 100%
rename from compiled/aspects/tests/get_problem_id_with_ccx.sql
rename to compiled/aspects/tests/macros/get_problem_id_with_ccx.sql
diff --git a/compiled/aspects/tests/macros/section_from_display.sql b/compiled/aspects/tests/macros/section_from_display.sql
new file mode 100644
index 00000000..90256aef
--- /dev/null
+++ b/compiled/aspects/tests/macros/section_from_display.sql
@@ -0,0 +1,61 @@
+select
+ '1:2:3 - Course 1a2b3c' as display_name_with_location
+from system.one
+where
+
+ concat(
+ splitByString(
+ ':', splitByString(' - ', display_name_with_location)[1], 1
+ )[1],
+ ':0:0'
+ )
+
+ != '1:0:0'
+
+union all
+
+select
+ '1:2:33 - Video 12' as display_name_with_location
+from system.one
+where
+
+ concat(
+ splitByString(
+ ':', splitByString(' - ', display_name_with_location)[1], 1
+ )[1],
+ ':0:0'
+ )
+
+ != '1:0:0'
+
+union all
+
+select
+ '1:22:3 - Vertical 345' as display_name_with_location
+from system.one
+where
+
+ concat(
+ splitByString(
+ ':', splitByString(' - ', display_name_with_location)[1], 1
+ )[1],
+ ':0:0'
+ )
+
+ != '1:0:0'
+
+union all
+
+select
+ '11:2:3 - Sequential 678' as display_name_with_location
+from system.one
+where
+
+ concat(
+ splitByString(
+ ':', splitByString(' - ', display_name_with_location)[1], 1
+ )[1],
+ ':0:0'
+ )
+
+ != '11:0:0'
\ No newline at end of file
diff --git a/compiled/aspects/tests/macros/subsection_from_display.sql b/compiled/aspects/tests/macros/subsection_from_display.sql
new file mode 100644
index 00000000..69c90fd9
--- /dev/null
+++ b/compiled/aspects/tests/macros/subsection_from_display.sql
@@ -0,0 +1,73 @@
+select
+ '1:2:3 - Chapter 123' as display_name_with_location
+from system.one
+where
+
+ concat(
+ arrayStringConcat(
+ splitByString(
+ ':', splitByString(' - ', display_name_with_location)[1], 2
+ ),
+ ':'
+ ),
+ ':0'
+ )
+
+ != '1:2:0'
+
+union all
+
+select
+ '1:2:33 - Problem 456' as display_name_with_location
+from system.one
+where
+
+ concat(
+ arrayStringConcat(
+ splitByString(
+ ':', splitByString(' - ', display_name_with_location)[1], 2
+ ),
+ ':'
+ ),
+ ':0'
+ )
+
+ != '1:2:0'
+
+union all
+
+select
+ '1:22:3 - Sequential 789' as display_name_with_location
+from system.one
+where
+
+ concat(
+ arrayStringConcat(
+ splitByString(
+ ':', splitByString(' - ', display_name_with_location)[1], 2
+ ),
+ ':'
+ ),
+ ':0'
+ )
+
+ != '1:22:0'
+
+union all
+
+select
+ '11:2:3 - Vertical 123' as display_name_with_location
+from system.one
+where
+
+ concat(
+ arrayStringConcat(
+ splitByString(
+ ':', splitByString(' - ', display_name_with_location)[1], 2
+ ),
+ ':'
+ ),
+ ':0'
+ )
+
+ != '11:2:0'
\ No newline at end of file
diff --git a/graph.gpickle b/graph.gpickle
index aaed449a..9fb0c6bb 100644
Binary files a/graph.gpickle and b/graph.gpickle differ
diff --git a/graph_summary.json b/graph_summary.json
index e613cc0c..9236bedc 100644
--- a/graph_summary.json
+++ b/graph_summary.json
@@ -1 +1 @@
-{"_invocation_id": "7a90ab1d-4858-4113-a565-f6d0e653511e", "linked": {"0": {"name": "source.aspects.event_sink.user_profile", "type": "source", "succ": [6]}, "1": {"name": "source.aspects.event_sink.external_id", "type": "source", "succ": [6]}, "2": {"name": "source.aspects.xapi.xapi_events_all", "type": "source", "succ": [11]}, "3": {"name": "source.aspects.event_sink.course_blocks", "type": "source", "succ": [37]}, "4": {"name": "source.aspects.event_sink.course_overviews", "type": "source", "succ": [9]}, "5": {"name": "model.aspects.dim_user_pii", "type": "model", "succ": [7, 19, 20, 33, 35, 40, 42]}, "6": {"name": "model.aspects.user_pii", "type": "model", "succ": [5, 63]}, "7": {"name": "model.aspects.fact_enrollments", "type": "model", "succ": [49, 64]}, "8": {"name": "model.aspects.enrollment_events", "type": "model", "succ": [7, 10, 12, 65]}, "9": {"name": "model.aspects.course_names", "type": "model", "succ": [7, 19, 22, 87]}, "10": {"name": "model.aspects.fact_enrollment_status", "type": "model", "succ": [19, 50, 66]}, "11": {"name": "model.aspects.xapi_events_all_parsed", "type": "model", "succ": [8, 13, 14, 15, 17, 21, 31, 41, 78]}, "12": {"name": "model.aspects.fact_instance_enrollments", "type": "model", "succ": [51, 67]}, "13": {"name": "model.aspects.fact_instance_actors", "type": "model"}, "14": {"name": "model.aspects.fact_instance_courses", "type": "model"}, "15": {"name": "model.aspects.fact_instance_events", "type": "model"}, "16": {"name": "model.aspects.fact_learner_course_grade", "type": "model", "succ": [19, 69]}, "17": {"name": "model.aspects.grading_events", "type": "model", "succ": [16, 18, 68]}, "18": {"name": "model.aspects.fact_learner_course_status", "type": "model", "succ": [19, 52, 70]}, "19": {"name": "model.aspects.fact_student_status", "type": "model", "succ": [53, 71]}, "20": {"name": "model.aspects.fact_problem_responses", "type": "model", "succ": [73]}, "21": {"name": "model.aspects.problem_events", "type": "model", "succ": [20, 24, 25, 26, 27, 28, 72]}, "22": {"name": "model.aspects.dim_course_blocks", "type": "model", "succ": [20, 23, 24, 25, 26, 28, 29, 32, 33, 35, 34, 39, 42, 45, 88]}, "23": {"name": "model.aspects.int_problems_per_subsection", "type": "model", "succ": [25, 26]}, "24": {"name": "model.aspects.int_problem_hints", "type": "model", "succ": [74]}, "25": {"name": "model.aspects.subsection_problem_engagement", "type": "model", "succ": [55, 77]}, "26": {"name": "model.aspects.section_problem_engagement", "type": "model", "succ": [54]}, "27": {"name": "model.aspects.responses", "type": "model", "succ": [28, 75]}, "28": {"name": "model.aspects.int_problem_results", "type": "model", "succ": [76]}, "29": {"name": "model.aspects.int_pages_per_subsection", "type": "model", "succ": [32, 36, 34, 85]}, "30": {"name": "model.aspects.fact_learner_last_course_visit", "type": "model"}, "31": {"name": "model.aspects.navigation_events", "type": "model", "succ": [30, 32, 35, 34, 79]}, "32": {"name": "model.aspects.subsection_page_engagement", "type": "model", "succ": [33, 58, 83]}, "33": {"name": "model.aspects.fact_pageview_engagement", "type": "model", "succ": [56, 84]}, "34": {"name": "model.aspects.section_page_engagement", "type": "model", "succ": [33, 57, 82]}, "35": {"name": "model.aspects.fact_navigation", "type": "model", "succ": [36, 80]}, "36": {"name": "model.aspects.fact_navigation_completion", "type": "model", "succ": [81]}, "37": {"name": "model.aspects.most_recent_course_blocks", "type": "model", "succ": [38, 86]}, "38": {"name": "model.aspects.course_block_names", "type": "model", "succ": [22]}, "39": {"name": "model.aspects.dim_course_blocks_extended", "type": "model", "succ": [40, 89]}, "40": {"name": "model.aspects.fact_video_plays", "type": "model", "succ": [44, 43, 91]}, "41": {"name": "model.aspects.video_playback_events", "type": "model", "succ": [40, 90]}, "42": {"name": "model.aspects.fact_video_engagement", "type": "model", "succ": [59, 60, 93]}, "43": {"name": "model.aspects.subsection_video_engagement", "type": "model", "succ": [42, 62]}, "44": {"name": "model.aspects.section_video_engagement", "type": "model", "succ": [42, 61, 92]}, "45": {"name": "model.aspects.int_videos_per_subsection", "type": "model", "succ": [44, 43]}, "46": {"name": "test.aspects.get_problem_id_with_ccx", "type": "test"}, "47": {"name": "test.aspects.get_problem_id", "type": "test"}, "48": {"name": "test.aspects.a_tag", "type": "test"}, "49": {"name": "test.aspects.accepted_values_fact_enrollments_enrollment_status__registered__unregistered.f8d10203f4", "type": "test"}, "50": {"name": "test.aspects.accepted_values_fact_enrollment_status_enrollment_status__registered__unregistered.893527c11f", "type": "test"}, "51": {"name": "test.aspects.accepted_values_xapi_fact_instance_enrollments_enrollment_status__xapi_fact_instance_enrollments__registered__unregistered.744ab867be", "type": "test"}, "52": {"name": "test.aspects.accepted_values_fact_learner_course_status_approving_state__passed__failed.f9c0c1b85f", "type": "test"}, "53": {"name": "test.aspects.accepted_values_fact_student_status_enrollment_status__registered__unregistered.53cae8a0f3", "type": "test"}, "54": {"name": "test.aspects.accepted_values_xapi_section_problem_engagement_engagement_level__xapi_section_problem_engagement__No_problems_attempted_yet__All_problems_attempted__At_least_one_problem_attempted.48ca5955e3", "type": "test"}, "55": {"name": "test.aspects.accepted_values_xapi_subsection_problem_engagement_engagement_level__xapi_subsection_problem_engagement__No_problems_attempted_yet__All_problems_attempted__At_least_one_problem_attempted.51aa37af55", "type": "test"}, "56": {"name": "test.aspects.accepted_values_fact_pageview_engagement_content_level__section__subsection.dd9e9af3ed", "type": "test"}, "57": {"name": "test.aspects.accepted_values_xapi_section_page_engagement_engagement_level__xapi_section_page_engagement__No_pages_viewed_yet__All_pages_viewed__At_least_one_page_viewed.f10135df89", "type": "test"}, "58": {"name": "test.aspects.accepted_values_xapi_subsection_page_engagement_engagement_level__xapi_subsection_page_engagement__No_pages_viewed_yet__All_pages_viewed__At_least_one_page_viewed.bcd23fe35f", "type": "test"}, "59": {"name": "test.aspects.accepted_values_fact_video_engagement_content_level__section__subsection.636c5e7005", "type": "test"}, "60": {"name": "test.aspects.accepted_values_fact_video_engagement_section_subsection_video_engagement__No_videos_viewed_yet__At_least_one_video_viewed__All_videos_viewed.91f6ccbf80", "type": "test"}, "61": {"name": "test.aspects.accepted_values_xapi_section_video_engagement_engagement_level__xapi_section_video_engagement__No_videos_viewed_yet__All_videos_viewed__At_least_one_video_viewed.597c4fb289", "type": "test"}, "62": {"name": "test.aspects.accepted_values_xapi_subsection_video_engagement_engagement_level__xapi_subsection_video_engagement__No_videos_viewed_yet__All_videos_viewed__At_least_one_video_viewed.c9b49600d3", "type": "test"}, "63": {"name": "unit_test.aspects.user_pii.test_user_pii", "type": "unit_test"}, "64": {"name": "unit_test.aspects.fact_enrollments.test_fact_enrollments", "type": "unit_test"}, "65": {"name": "unit_test.aspects.enrollment_events.test_enrollment_events", "type": "unit_test"}, "66": {"name": "unit_test.aspects.fact_enrollment_status.test_fact_enrollment_status", "type": "unit_test"}, "67": {"name": "unit_test.aspects.fact_instance_enrollments.test_fact_instance_enrollments", "type": "unit_test"}, "68": {"name": "unit_test.aspects.grading_events.test_grading_events", "type": "unit_test"}, "69": {"name": "unit_test.aspects.fact_learner_course_grade.test_fact_learner_course_grade", "type": "unit_test"}, "70": {"name": "unit_test.aspects.fact_learner_course_status.test_fact_learner_course_status", "type": "unit_test"}, "71": {"name": "unit_test.aspects.fact_student_status.test_fact_student_status", "type": "unit_test"}, "72": {"name": "unit_test.aspects.problem_events.test_problem_events", "type": "unit_test"}, "73": {"name": "unit_test.aspects.fact_problem_responses.test_fact_problem_responses", "type": "unit_test"}, "74": {"name": "unit_test.aspects.int_problem_hints.test_int_problem_hints", "type": "unit_test"}, "75": {"name": "unit_test.aspects.responses.test_responses", "type": "unit_test"}, "76": {"name": "unit_test.aspects.int_problem_results.test_int_problem_results", "type": "unit_test"}, "77": {"name": "unit_test.aspects.subsection_problem_engagement.test_subsection_problem_engagement", "type": "unit_test"}, "78": {"name": "unit_test.aspects.xapi_events_all_parsed.test_xapi_events_all_parsed", "type": "unit_test"}, "79": {"name": "unit_test.aspects.navigation_events.test_navigation_events", "type": "unit_test"}, "80": {"name": "unit_test.aspects.fact_navigation.test_fact_navigation", "type": "unit_test"}, "81": {"name": "unit_test.aspects.fact_navigation_completion.test_fact_navigation_completion", "type": "unit_test"}, "82": {"name": "unit_test.aspects.section_page_engagement.test_section_page_engagement", "type": "unit_test"}, "83": {"name": "unit_test.aspects.subsection_page_engagement.test_subsection_page_engagement", "type": "unit_test"}, "84": {"name": "unit_test.aspects.fact_pageview_engagement.test_fact_pageview_engagement", "type": "unit_test"}, "85": {"name": "unit_test.aspects.int_pages_per_subsection.test_macro_items_per_subsection", "type": "unit_test"}, "86": {"name": "unit_test.aspects.most_recent_course_blocks.test_most_recent_course_blocks", "type": "unit_test"}, "87": {"name": "unit_test.aspects.course_names.test_course_names", "type": "unit_test"}, "88": {"name": "unit_test.aspects.dim_course_blocks.test_dim_course_blocks", "type": "unit_test"}, "89": {"name": "unit_test.aspects.dim_course_blocks_extended.test_dim_course_blocks_extended", "type": "unit_test"}, "90": {"name": "unit_test.aspects.video_playback_events.test_video_playback_events", "type": "unit_test"}, "91": {"name": "unit_test.aspects.fact_video_plays.test_fact_video_plays", "type": "unit_test"}, "92": {"name": "unit_test.aspects.section_video_engagement.test_section_video_engagement", "type": "unit_test"}, "93": {"name": "unit_test.aspects.fact_video_engagement.test_fact_video_engagement", "type": "unit_test"}}}
\ No newline at end of file
+{"_invocation_id": "8b4070f2-5f6a-4318-8b6e-0095cfa33985", "linked": {"0": {"name": "source.aspects.event_sink.user_profile", "type": "source", "succ": [6]}, "1": {"name": "source.aspects.event_sink.external_id", "type": "source", "succ": [6]}, "2": {"name": "source.aspects.xapi.xapi_events_all", "type": "source", "succ": [11]}, "3": {"name": "source.aspects.event_sink.course_blocks", "type": "source", "succ": [37]}, "4": {"name": "source.aspects.event_sink.course_overviews", "type": "source", "succ": [9]}, "5": {"name": "model.aspects.dim_user_pii", "type": "model", "succ": [7, 19, 20, 33, 35, 40, 42]}, "6": {"name": "model.aspects.user_pii", "type": "model", "succ": [5, 66]}, "7": {"name": "model.aspects.fact_enrollments", "type": "model", "succ": [52, 67]}, "8": {"name": "model.aspects.enrollment_events", "type": "model", "succ": [7, 10, 12, 68]}, "9": {"name": "model.aspects.course_names", "type": "model", "succ": [7, 19, 22, 90]}, "10": {"name": "model.aspects.fact_enrollment_status", "type": "model", "succ": [19, 53, 69]}, "11": {"name": "model.aspects.xapi_events_all_parsed", "type": "model", "succ": [8, 13, 14, 15, 17, 21, 31, 41, 81]}, "12": {"name": "model.aspects.fact_instance_enrollments", "type": "model", "succ": [54, 70]}, "13": {"name": "model.aspects.fact_instance_actors", "type": "model"}, "14": {"name": "model.aspects.fact_instance_courses", "type": "model"}, "15": {"name": "model.aspects.fact_instance_events", "type": "model"}, "16": {"name": "model.aspects.fact_learner_course_grade", "type": "model", "succ": [19, 72]}, "17": {"name": "model.aspects.grading_events", "type": "model", "succ": [16, 18, 71]}, "18": {"name": "model.aspects.fact_learner_course_status", "type": "model", "succ": [19, 55, 73]}, "19": {"name": "model.aspects.fact_student_status", "type": "model", "succ": [56, 74]}, "20": {"name": "model.aspects.fact_problem_responses", "type": "model", "succ": [76]}, "21": {"name": "model.aspects.problem_events", "type": "model", "succ": [20, 24, 25, 26, 27, 28, 75]}, "22": {"name": "model.aspects.dim_course_blocks", "type": "model", "succ": [20, 23, 24, 25, 26, 28, 29, 32, 33, 35, 34, 39, 42, 45, 91]}, "23": {"name": "model.aspects.int_problems_per_subsection", "type": "model", "succ": [25, 26]}, "24": {"name": "model.aspects.int_problem_hints", "type": "model", "succ": [77]}, "25": {"name": "model.aspects.subsection_problem_engagement", "type": "model", "succ": [58, 80]}, "26": {"name": "model.aspects.section_problem_engagement", "type": "model", "succ": [57]}, "27": {"name": "model.aspects.responses", "type": "model", "succ": [28, 78]}, "28": {"name": "model.aspects.int_problem_results", "type": "model", "succ": [79]}, "29": {"name": "model.aspects.int_pages_per_subsection", "type": "model", "succ": [32, 36, 34, 88]}, "30": {"name": "model.aspects.fact_learner_last_course_visit", "type": "model"}, "31": {"name": "model.aspects.navigation_events", "type": "model", "succ": [30, 32, 35, 34, 82]}, "32": {"name": "model.aspects.subsection_page_engagement", "type": "model", "succ": [33, 61, 86]}, "33": {"name": "model.aspects.fact_pageview_engagement", "type": "model", "succ": [59, 87]}, "34": {"name": "model.aspects.section_page_engagement", "type": "model", "succ": [33, 60, 85]}, "35": {"name": "model.aspects.fact_navigation", "type": "model", "succ": [36, 83]}, "36": {"name": "model.aspects.fact_navigation_completion", "type": "model", "succ": [84]}, "37": {"name": "model.aspects.most_recent_course_blocks", "type": "model", "succ": [38, 89]}, "38": {"name": "model.aspects.course_block_names", "type": "model", "succ": [22]}, "39": {"name": "model.aspects.dim_course_blocks_extended", "type": "model", "succ": [40, 92]}, "40": {"name": "model.aspects.fact_video_plays", "type": "model", "succ": [44, 43, 94]}, "41": {"name": "model.aspects.video_playback_events", "type": "model", "succ": [40, 93]}, "42": {"name": "model.aspects.fact_video_engagement", "type": "model", "succ": [62, 63, 97]}, "43": {"name": "model.aspects.subsection_video_engagement", "type": "model", "succ": [42, 65, 96]}, "44": {"name": "model.aspects.section_video_engagement", "type": "model", "succ": [42, 64, 95]}, "45": {"name": "model.aspects.int_videos_per_subsection", "type": "model", "succ": [44, 43]}, "46": {"name": "test.aspects.get_problem_id_with_ccx", "type": "test"}, "47": {"name": "test.aspects.get_bucket", "type": "test"}, "48": {"name": "test.aspects.section_from_display", "type": "test"}, "49": {"name": "test.aspects.subsection_from_display", "type": "test"}, "50": {"name": "test.aspects.get_problem_id", "type": "test"}, "51": {"name": "test.aspects.a_tag", "type": "test"}, "52": {"name": "test.aspects.accepted_values_fact_enrollments_enrollment_status__registered__unregistered.f8d10203f4", "type": "test"}, "53": {"name": "test.aspects.accepted_values_fact_enrollment_status_enrollment_status__registered__unregistered.893527c11f", "type": "test"}, "54": {"name": "test.aspects.accepted_values_xapi_fact_instance_enrollments_enrollment_status__xapi_fact_instance_enrollments__registered__unregistered.744ab867be", "type": "test"}, "55": {"name": "test.aspects.accepted_values_fact_learner_course_status_approving_state__passed__failed.f9c0c1b85f", "type": "test"}, "56": {"name": "test.aspects.accepted_values_fact_student_status_enrollment_status__registered__unregistered.53cae8a0f3", "type": "test"}, "57": {"name": "test.aspects.accepted_values_xapi_section_problem_engagement_engagement_level__xapi_section_problem_engagement__No_problems_attempted_yet__All_problems_attempted__At_least_one_problem_attempted.48ca5955e3", "type": "test"}, "58": {"name": "test.aspects.accepted_values_xapi_subsection_problem_engagement_engagement_level__xapi_subsection_problem_engagement__No_problems_attempted_yet__All_problems_attempted__At_least_one_problem_attempted.51aa37af55", "type": "test"}, "59": {"name": "test.aspects.accepted_values_fact_pageview_engagement_content_level__section__subsection.dd9e9af3ed", "type": "test"}, "60": {"name": "test.aspects.accepted_values_xapi_section_page_engagement_engagement_level__xapi_section_page_engagement__No_pages_viewed_yet__All_pages_viewed__At_least_one_page_viewed.f10135df89", "type": "test"}, "61": {"name": "test.aspects.accepted_values_xapi_subsection_page_engagement_engagement_level__xapi_subsection_page_engagement__No_pages_viewed_yet__All_pages_viewed__At_least_one_page_viewed.bcd23fe35f", "type": "test"}, "62": {"name": "test.aspects.accepted_values_fact_video_engagement_content_level__section__subsection.636c5e7005", "type": "test"}, "63": {"name": "test.aspects.accepted_values_fact_video_engagement_section_subsection_video_engagement__No_videos_viewed_yet__At_least_one_video_viewed__All_videos_viewed.91f6ccbf80", "type": "test"}, "64": {"name": "test.aspects.accepted_values_xapi_section_video_engagement_engagement_level__xapi_section_video_engagement__No_videos_viewed_yet__All_videos_viewed__At_least_one_video_viewed.597c4fb289", "type": "test"}, "65": {"name": "test.aspects.accepted_values_xapi_subsection_video_engagement_engagement_level__xapi_subsection_video_engagement__No_videos_viewed_yet__All_videos_viewed__At_least_one_video_viewed.c9b49600d3", "type": "test"}, "66": {"name": "unit_test.aspects.user_pii.test_user_pii", "type": "unit_test"}, "67": {"name": "unit_test.aspects.fact_enrollments.test_fact_enrollments", "type": "unit_test"}, "68": {"name": "unit_test.aspects.enrollment_events.test_enrollment_events", "type": "unit_test"}, "69": {"name": "unit_test.aspects.fact_enrollment_status.test_fact_enrollment_status", "type": "unit_test"}, "70": {"name": "unit_test.aspects.fact_instance_enrollments.test_fact_instance_enrollments", "type": "unit_test"}, "71": {"name": "unit_test.aspects.grading_events.test_grading_events", "type": "unit_test"}, "72": {"name": "unit_test.aspects.fact_learner_course_grade.test_fact_learner_course_grade", "type": "unit_test"}, "73": {"name": "unit_test.aspects.fact_learner_course_status.test_fact_learner_course_status", "type": "unit_test"}, "74": {"name": "unit_test.aspects.fact_student_status.test_fact_student_status", "type": "unit_test"}, "75": {"name": "unit_test.aspects.problem_events.test_problem_events", "type": "unit_test"}, "76": {"name": "unit_test.aspects.fact_problem_responses.test_fact_problem_responses", "type": "unit_test"}, "77": {"name": "unit_test.aspects.int_problem_hints.test_int_problem_hints", "type": "unit_test"}, "78": {"name": "unit_test.aspects.responses.test_responses", "type": "unit_test"}, "79": {"name": "unit_test.aspects.int_problem_results.test_int_problem_results", "type": "unit_test"}, "80": {"name": "unit_test.aspects.subsection_problem_engagement.test_subsection_problem_engagement", "type": "unit_test"}, "81": {"name": "unit_test.aspects.xapi_events_all_parsed.test_xapi_events_all_parsed", "type": "unit_test"}, "82": {"name": "unit_test.aspects.navigation_events.test_navigation_events", "type": "unit_test"}, "83": {"name": "unit_test.aspects.fact_navigation.test_fact_navigation", "type": "unit_test"}, "84": {"name": "unit_test.aspects.fact_navigation_completion.test_fact_navigation_completion", "type": "unit_test"}, "85": {"name": "unit_test.aspects.section_page_engagement.test_section_page_engagement", "type": "unit_test"}, "86": {"name": "unit_test.aspects.subsection_page_engagement.test_subsection_page_engagement", "type": "unit_test"}, "87": {"name": "unit_test.aspects.fact_pageview_engagement.test_fact_pageview_engagement", "type": "unit_test"}, "88": {"name": "unit_test.aspects.int_pages_per_subsection.test_macro_items_per_subsection", "type": "unit_test"}, "89": {"name": "unit_test.aspects.most_recent_course_blocks.test_most_recent_course_blocks", "type": "unit_test"}, "90": {"name": "unit_test.aspects.course_names.test_course_names", "type": "unit_test"}, "91": {"name": "unit_test.aspects.dim_course_blocks.test_dim_course_blocks", "type": "unit_test"}, "92": {"name": "unit_test.aspects.dim_course_blocks_extended.test_dim_course_blocks_extended", "type": "unit_test"}, "93": {"name": "unit_test.aspects.video_playback_events.test_video_playback_events", "type": "unit_test"}, "94": {"name": "unit_test.aspects.fact_video_plays.test_fact_video_plays", "type": "unit_test"}, "95": {"name": "unit_test.aspects.section_video_engagement.test_section_video_engagement", "type": "unit_test"}, "96": {"name": "unit_test.aspects.subsection_video_engagement.test_subsection_video_engagement", "type": "unit_test"}, "97": {"name": "unit_test.aspects.fact_video_engagement.test_fact_video_engagement", "type": "unit_test"}}}
\ No newline at end of file
diff --git a/manifest.json b/manifest.json
index 914dfc06..759241a5 100644
--- a/manifest.json
+++ b/manifest.json
@@ -1 +1 @@
-{"metadata": {"dbt_schema_version": "https://schemas.getdbt.com/dbt/manifest/v12.json", "dbt_version": "1.8.5", "generated_at": "2024-08-09T18:45:49.772578Z", "invocation_id": "7a90ab1d-4858-4113-a565-f6d0e653511e", "env": {}, "project_name": "aspects", "project_id": "9074d4992d118978696669561f06dfcc", "user_id": "b03ae01c-9b63-4121-bed1-1c6b53eb9701", "send_anonymous_usage_stats": true, "adapter_type": "clickhouse"}, "nodes": {"model.aspects.dim_user_pii": {"database": "", "schema": "xapi", "name": "dim_user_pii", "resource_type": "model", "package_name": "aspects", "path": "users/dim_user_pii.sql", "original_file_path": "models/users/dim_user_pii.sql", "unique_id": "model.aspects.dim_user_pii", "fqn": ["aspects", "users", "dim_user_pii"], "alias": "dim_user_pii", "checksum": {"name": "sha256", "checksum": "ff3243c8cf092b7ca0122d07ef2ef5cf937b44af60f7980ce0a29ab2c9e1d224"}, "config": {"enabled": true, "alias": null, "schema": null, "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": "A denormalized table of user PII information", "columns": {"external_user_id": {"name": "external_user_id", "description": "The external user id", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "username": {"name": "username", "description": "The username", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "name": {"name": "name", "description": "The name of the user", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "email": {"name": "email", "description": "The email of the user", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "aspects://models/users/schema.yml", "build_path": null, "unrendered_config": {}, "created_at": 1723229144.869714, "relation_name": "`xapi`.`dim_user_pii`", "raw_code": "select external_user_id, username, name, email from {{ ref(\"user_pii\") }} user_pii", "language": "sql", "refs": [{"name": "user_pii", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.aspects.user_pii"]}, "compiled_path": "target/compiled/aspects/models/users/dim_user_pii.sql", "compiled": true, "compiled_code": "select external_user_id, username, name, email from `xapi`.`user_pii` user_pii", "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.aspects.user_pii": {"database": "", "schema": "xapi", "name": "user_pii", "resource_type": "model", "package_name": "aspects", "path": "users/user_pii.sql", "original_file_path": "models/users/user_pii.sql", "unique_id": "model.aspects.user_pii", "fqn": ["aspects", "users", "user_pii"], "alias": "user_pii", "checksum": {"name": "sha256", "checksum": "a2f8fb4eafd60aba015b18f1842c4ea28409c8a5103b947fedf791e6f5a1d9e8"}, "config": {"enabled": true, "alias": null, "schema": "event_sink", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "dictionary", "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", "fields": [["user_id", "Int32"], ["external_user_id", "UUID"], ["username", "String"], ["name", "String"], ["email", "String"]], "primary_key": "(user_id, external_user_id)", "layout": "COMPLEX_KEY_SPARSE_HASHED()", "lifetime": "120", "source_type": "clickhouse", "connection_overrides": {"host": "localhost"}}, "tags": [], "description": "The user PII table for reports.", "columns": {"user_id": {"name": "user_id", "description": "The user id", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "external_user_id": {"name": "external_user_id", "description": "The external user id", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "username": {"name": "username", "description": "The username of the user", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "name": {"name": "name", "description": "The name of the user", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "email": {"name": "email", "description": "The email of the user", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "aspects://models/users/schema.yml", "build_path": null, "unrendered_config": {"materialized": "dictionary", "schema": "event_sink", "fields": [["user_id", "Int32"], ["external_user_id", "UUID"], ["username", "String"], ["name", "String"], ["email", "String"]], "primary_key": "(user_id, external_user_id)", "layout": "COMPLEX_KEY_SPARSE_HASHED()", "lifetime": "120", "source_type": "clickhouse", "connection_overrides": {"host": "localhost"}}, "created_at": 1723229144.868791, "relation_name": "`xapi`.`user_pii`", "raw_code": "{{\n config(\n materialized=\"dictionary\",\n schema=env_var(\"ASPECTS_EVENT_SINK_DATABASE\", \"event_sink\"),\n fields=[\n (\"user_id\", \"Int32\"),\n (\"external_user_id\", \"UUID\"),\n (\"username\", \"String\"),\n (\"name\", \"String\"),\n (\"email\", \"String\"),\n ],\n primary_key=\"(user_id, external_user_id)\",\n layout=\"COMPLEX_KEY_SPARSE_HASHED()\",\n lifetime=env_var(\"ASPECTS_PII_CACHE_LIFETIME\", \"120\"),\n source_type=\"clickhouse\",\n connection_overrides={\n \"host\": \"localhost\",\n },\n )\n}}\n\nwith\n most_recent_user_profile as (\n select user_id, max(time_last_dumped) as time_last_dumped\n from {{ source(\"event_sink\", \"user_profile\") }}\n group by user_id\n )\nselect ex.user_id as user_id, ex.external_user_id, ex.username, up.name, up.email\nfrom {{ source(\"event_sink\", \"external_id\") }} ex\nleft outer join most_recent_user_profile mrup on mrup.user_id = ex.user_id\nleft outer join\n {{ source(\"event_sink\", \"user_profile\") }} up\n on up.user_id = mrup.user_id\n and up.time_last_dumped = mrup.time_last_dumped", "language": "sql", "refs": [], "sources": [["event_sink", "user_profile"], ["event_sink", "external_id"], ["event_sink", "user_profile"]], "metrics": [], "depends_on": {"macros": [], "nodes": ["source.aspects.event_sink.user_profile", "source.aspects.event_sink.external_id"]}, "compiled_path": "target/compiled/aspects/models/users/user_pii.sql", "compiled": true, "compiled_code": "\n\nwith\n most_recent_user_profile as (\n select user_id, max(time_last_dumped) as time_last_dumped\n from `event_sink`.`user_profile`\n group by user_id\n )\nselect ex.user_id as user_id, ex.external_user_id, ex.username, up.name, up.email\nfrom `event_sink`.`external_id` ex\nleft outer join most_recent_user_profile mrup on mrup.user_id = ex.user_id\nleft outer join\n `event_sink`.`user_profile` up\n on up.user_id = mrup.user_id\n and up.time_last_dumped = mrup.time_last_dumped", "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.aspects.fact_enrollments": {"database": "", "schema": "xapi", "name": "fact_enrollments", "resource_type": "model", "package_name": "aspects", "path": "enrollment/fact_enrollments.sql", "original_file_path": "models/enrollment/fact_enrollments.sql", "unique_id": "model.aspects.fact_enrollments", "fqn": ["aspects", "enrollment", "fact_enrollments"], "alias": "fact_enrollments", "checksum": {"name": "sha256", "checksum": "9cf04dc27c049a785918a39f058a51bf2607b1134a7c8416a77309ac50b5db30"}, "config": {"enabled": true, "alias": null, "schema": null, "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": "A record for each enrollment event", "columns": {"emission_time": {"name": "emission_time", "description": "Timestamp, to the second, of when this event was emitted", "meta": {}, "data_type": "DateTime", "constraints": [], "quote": null, "tags": []}, "org": {"name": "org", "description": "The organization that the course belongs to", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_key": {"name": "course_key", "description": "The course key for the course", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_name": {"name": "course_name", "description": "The name of the course", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_run": {"name": "course_run", "description": "The course run for the course", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "actor_id": {"name": "actor_id", "description": "The xAPI actor identifier", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "enrollment_mode": {"name": "enrollment_mode", "description": "The mode of enrollment", "meta": {}, "data_type": "LowCardinality(String)", "constraints": [], "quote": null, "tags": []}, "enrollment_status": {"name": "enrollment_status", "description": "Whether a learner is actively enrolled in a course", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "username": {"name": "username", "description": "The username of the learner", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "name": {"name": "name", "description": "The full name of the learner", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "email": {"name": "email", "description": "The email address of the learner", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "aspects://models/enrollment/schema.yml", "build_path": null, "unrendered_config": {"materialized": "view"}, "created_at": 1723229144.8739614, "relation_name": "`xapi`.`fact_enrollments`", "raw_code": "with\n enrollments as (\n select\n emission_time,\n org,\n course_key,\n actor_id,\n enrollment_mode,\n splitByString('/', verb_id)[-1] as enrollment_status\n from {{ ref(\"enrollment_events\") }}\n )\n\nselect\n enrollments.emission_time as emission_time,\n enrollments.org as org,\n enrollments.course_key as course_key,\n courses.course_name as course_name,\n courses.course_run as course_run,\n enrollments.actor_id as actor_id,\n enrollments.enrollment_mode as enrollment_mode,\n enrollments.enrollment_status as enrollment_status,\n users.username as username,\n users.name as name,\n users.email as email\nfrom enrollments\njoin {{ ref(\"course_names\") }} courses on enrollments.course_key = courses.course_key\nleft outer join\n {{ ref(\"dim_user_pii\") }} users on toUUID(actor_id) = users.external_user_id", "language": "sql", "refs": [{"name": "enrollment_events", "package": null, "version": null}, {"name": "course_names", "package": null, "version": null}, {"name": "dim_user_pii", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.aspects.enrollment_events", "model.aspects.course_names", "model.aspects.dim_user_pii"]}, "compiled_path": "target/compiled/aspects/models/enrollment/fact_enrollments.sql", "compiled": true, "compiled_code": "with\n enrollments as (\n select\n emission_time,\n org,\n course_key,\n actor_id,\n enrollment_mode,\n splitByString('/', verb_id)[-1] as enrollment_status\n from `xapi`.`enrollment_events`\n )\n\nselect\n enrollments.emission_time as emission_time,\n enrollments.org as org,\n enrollments.course_key as course_key,\n courses.course_name as course_name,\n courses.course_run as course_run,\n enrollments.actor_id as actor_id,\n enrollments.enrollment_mode as enrollment_mode,\n enrollments.enrollment_status as enrollment_status,\n users.username as username,\n users.name as name,\n users.email as email\nfrom enrollments\njoin `xapi`.`course_names` courses on enrollments.course_key = courses.course_key\nleft outer join\n `xapi`.`dim_user_pii` users on toUUID(actor_id) = users.external_user_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.aspects.fact_enrollment_status": {"database": "", "schema": "xapi", "name": "fact_enrollment_status", "resource_type": "model", "package_name": "aspects", "path": "enrollment/fact_enrollment_status.sql", "original_file_path": "models/enrollment/fact_enrollment_status.sql", "unique_id": "model.aspects.fact_enrollment_status", "fqn": ["aspects", "enrollment", "fact_enrollment_status"], "alias": "fact_enrollment_status", "checksum": {"name": "sha256", "checksum": "e77614db9ce84f1d643ada3263c531c8c3764d0808d7bc4633bd40fffac4d6b2"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": [], "meta": {}, "group": null, "materialized": "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", "engine": "\n ReplacingMergeTree()", "order_by": "(org, course_key, actor_id)", "primary_key": "(org, course_key, actor_id)"}, "tags": [], "description": "One record per learner per course for the most recent enrollment status", "columns": {"org": {"name": "org", "description": "The organization that the course belongs to", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_key": {"name": "course_key", "description": "The course key for the course", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "actor_id": {"name": "actor_id", "description": "The xAPI actor identifier", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "enrollment_status": {"name": "enrollment_status", "description": "Whether a learner is actively enrolled in a course", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "enrollment_mode": {"name": "enrollment_mode", "description": "The mode of enrollment", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "emission_time": {"name": "emission_time", "description": "The time the enrollment status was emitted", "meta": {}, "data_type": "DateTime", "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "aspects://models/enrollment/schema.yml", "build_path": null, "unrendered_config": {"materialized": "materialized_view", "engine": "\n ReplacingMergeTree()", "primary_key": "(org, course_key, actor_id)", "order_by": "(org, course_key, actor_id)"}, "created_at": 1723229144.876555, "relation_name": "`xapi`.`fact_enrollment_status`", "raw_code": "{{\n config(\n materialized=\"materialized_view\",\n engine=get_engine(\"ReplacingMergeTree()\"),\n primary_key=\"(org, course_key, actor_id)\",\n order_by=\"(org, course_key, actor_id)\",\n )\n}}\n\nwith\n ranked_enrollments as (\n select\n emission_time,\n org,\n course_key,\n actor_id,\n enrollment_mode,\n splitByString('/', verb_id)[-1] as enrollment_status,\n row_number() over (\n partition by org, course_key, actor_id order by emission_time desc\n ) as rn\n from {{ ref(\"enrollment_events\") }}\n )\n\nselect org, course_key, actor_id, enrollment_status, enrollment_mode, emission_time\nfrom ranked_enrollments\nwhere rn = 1", "language": "sql", "refs": [{"name": "enrollment_events", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.aspects.get_engine"], "nodes": ["model.aspects.enrollment_events"]}, "compiled_path": "target/compiled/aspects/models/enrollment/fact_enrollment_status.sql", "compiled": true, "compiled_code": "\n\nwith\n ranked_enrollments as (\n select\n emission_time,\n org,\n course_key,\n actor_id,\n enrollment_mode,\n splitByString('/', verb_id)[-1] as enrollment_status,\n row_number() over (\n partition by org, course_key, actor_id order by emission_time desc\n ) as rn\n from `xapi`.`enrollment_events`\n )\n\nselect org, course_key, actor_id, enrollment_status, enrollment_mode, emission_time\nfrom ranked_enrollments\nwhere rn = 1", "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.aspects.enrollment_events": {"database": "", "schema": "xapi", "name": "enrollment_events", "resource_type": "model", "package_name": "aspects", "path": "enrollment/enrollment_events.sql", "original_file_path": "models/enrollment/enrollment_events.sql", "unique_id": "model.aspects.enrollment_events", "fqn": ["aspects", "enrollment", "enrollment_events"], "alias": "enrollment_events", "checksum": {"name": "sha256", "checksum": "f5465a9f486856ae14336c1bedc0f57886bd8a558f684ecb235302f377ef4ff8"}, "config": {"enabled": true, "alias": null, "schema": "xapi", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "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", "engine": "\n ReplacingMergeTree()", "order_by": "(org, course_key, emission_time, actor_id, enrollment_mode, event_id)", "partition_by": "(toYYYYMM(emission_time))", "ttl": "", "primary_key": "(org, course_key)"}, "tags": [], "description": "A materialized view for xAPI events related to course enrollment", "columns": {"event_id": {"name": "event_id", "description": "The unique identifier for the event", "meta": {}, "data_type": "UUID", "constraints": [], "quote": null, "tags": []}, "emission_time": {"name": "emission_time", "description": "The time the event was emitted", "meta": {}, "data_type": "DateTime", "constraints": [], "quote": null, "tags": []}, "actor_id": {"name": "actor_id", "description": "The xAPI actor identifier", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "object_id": {"name": "object_id", "description": "The xAPI object identifier", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_key": {"name": "course_key", "description": "The course identifier", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "org": {"name": "org", "description": "The organization that the course belongs to", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "verb_id": {"name": "verb_id", "description": "The xAPI verb identifier", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "enrollment_mode": {"name": "enrollment_mode", "description": "The mode of enrollment", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "aspects://models/enrollment/schema.yml", "build_path": null, "unrendered_config": {"materialized": "materialized_view", "schema": "xapi", "engine": "\n ReplacingMergeTree()", "primary_key": "(org, course_key)", "order_by": "(org, course_key, emission_time, actor_id, enrollment_mode, event_id)", "partition_by": "(toYYYYMM(emission_time))", "ttl": ""}, "created_at": 1723229144.8757868, "relation_name": "`xapi`.`enrollment_events`", "raw_code": "{{\n config(\n materialized=\"materialized_view\",\n schema=env_var(\"ASPECTS_XAPI_DATABASE\", \"xapi\"),\n engine=get_engine(\"ReplacingMergeTree()\"),\n primary_key=\"(org, course_key)\",\n order_by=\"(org, course_key, emission_time, actor_id, enrollment_mode, event_id)\",\n partition_by=\"(toYYYYMM(emission_time))\",\n ttl=env_var(\"ASPECTS_DATA_TTL_EXPRESSION\", \"\"),\n )\n}}\n\nselect\n event_id,\n cast(emission_time as DateTime) as emission_time,\n actor_id,\n object_id,\n course_key,\n org,\n verb_id,\n toLowCardinality(\n JSON_VALUE(\n event,\n '$.object.definition.extensions.\"https://w3id.org/xapi/acrossx/extensions/type\"'\n )\n ) as enrollment_mode\nfrom {{ ref(\"xapi_events_all_parsed\") }}\nwhere\n verb_id in (\n 'http://adlnet.gov/expapi/verbs/registered',\n 'http://id.tincanapi.com/verb/unregistered'\n )", "language": "sql", "refs": [{"name": "xapi_events_all_parsed", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.aspects.get_engine"], "nodes": ["model.aspects.xapi_events_all_parsed"]}, "compiled_path": "target/compiled/aspects/models/enrollment/enrollment_events.sql", "compiled": true, "compiled_code": "\n\nselect\n event_id,\n cast(emission_time as DateTime) as emission_time,\n actor_id,\n object_id,\n course_key,\n org,\n verb_id,\n toLowCardinality(\n JSON_VALUE(\n event,\n '$.object.definition.extensions.\"https://w3id.org/xapi/acrossx/extensions/type\"'\n )\n ) as enrollment_mode\nfrom `xapi`.`xapi_events_all_parsed`\nwhere\n verb_id in (\n 'http://adlnet.gov/expapi/verbs/registered',\n 'http://id.tincanapi.com/verb/unregistered'\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.aspects.fact_instance_enrollments": {"database": "", "schema": "xapi", "name": "fact_instance_enrollments", "resource_type": "model", "package_name": "aspects", "path": "instance/fact_instance_enrollments.sql", "original_file_path": "models/instance/fact_instance_enrollments.sql", "unique_id": "model.aspects.fact_instance_enrollments", "fqn": ["aspects", "instance", "fact_instance_enrollments"], "alias": "fact_instance_enrollments", "checksum": {"name": "sha256", "checksum": "c305918eced6c4301f6d32582f622e3b9ba4a08bc20798cd7e981fc79304ebb3"}, "config": {"enabled": true, "alias": null, "schema": "xapi", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "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", "engine": "\n SummingMergeTree()", "order_by": "(emission_day, course_key, enrollment_mode, enrollment_status)", "partition_by": "(toYYYYMM(emission_day))"}, "tags": [], "description": "A materialized view for summarizing site-wide enrollment activity", "columns": {"emission_day": {"name": "emission_day", "description": "Time of summary, truncated to the day", "meta": {}, "data_type": "DateTime", "constraints": [], "quote": null, "tags": []}, "course_name": {"name": "course_name", "description": "The name of the course", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_key": {"name": "course_key", "description": "The course key for the course", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "enrollment_mode": {"name": "enrollment_mode", "description": "The name of the enrollment mode (ex: audit, honor)", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "enrollment_status": {"name": "enrollment_status", "description": "The type of enrollment event (ex: registered, unregistered)", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_enrollment_mode_status_cnt": {"name": "course_enrollment_mode_status_cnt", "description": "The number of enrollment events for this mode that occurred in the given hour", "meta": {}, "data_type": "Int", "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "aspects://models/instance/schema.yml", "build_path": null, "unrendered_config": {"materialized": "materialized_view", "schema": "xapi", "engine": "\n SummingMergeTree()", "order_by": "(emission_day, course_key, enrollment_mode, enrollment_status)", "partition_by": "(toYYYYMM(emission_day))"}, "created_at": 1723229144.973803, "relation_name": "`xapi`.`fact_instance_enrollments`", "raw_code": "{{\n config(\n materialized=\"materialized_view\",\n schema=env_var(\"ASPECTS_XAPI_DATABASE\", \"xapi\"),\n engine=get_engine(\"SummingMergeTree()\"),\n order_by=\"(emission_day, course_key, enrollment_mode, enrollment_status)\",\n partition_by=\"(toYYYYMM(emission_day))\",\n )\n}}\n\nwith\n enrollments as (\n select\n emission_time,\n course_key,\n enrollment_mode,\n splitByString('/', verb_id)[-1] as enrollment_status\n from {{ ref(\"enrollment_events\") }}\n )\n\nselect\n date_trunc('day', emission_time) as emission_day,\n enrollments.course_key,\n enrollments.enrollment_mode as enrollment_mode,\n enrollments.enrollment_status as enrollment_status,\n count() as course_enrollment_mode_status_cnt\nfrom enrollments\ngroup by emission_day, course_key, enrollment_mode, enrollment_status", "language": "sql", "refs": [{"name": "enrollment_events", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.aspects.get_engine"], "nodes": ["model.aspects.enrollment_events"]}, "compiled_path": "target/compiled/aspects/models/instance/fact_instance_enrollments.sql", "compiled": true, "compiled_code": "\n\nwith\n enrollments as (\n select\n emission_time,\n course_key,\n enrollment_mode,\n splitByString('/', verb_id)[-1] as enrollment_status\n from `xapi`.`enrollment_events`\n )\n\nselect\n date_trunc('day', emission_time) as emission_day,\n enrollments.course_key,\n enrollments.enrollment_mode as enrollment_mode,\n enrollments.enrollment_status as enrollment_status,\n count() as course_enrollment_mode_status_cnt\nfrom enrollments\ngroup by emission_day, course_key, enrollment_mode, enrollment_status", "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.aspects.fact_instance_actors": {"database": "", "schema": "xapi", "name": "fact_instance_actors", "resource_type": "model", "package_name": "aspects", "path": "instance/fact_instance_actors.sql", "original_file_path": "models/instance/fact_instance_actors.sql", "unique_id": "model.aspects.fact_instance_actors", "fqn": ["aspects", "instance", "fact_instance_actors"], "alias": "fact_instance_actors", "checksum": {"name": "sha256", "checksum": "3dc087e4035b4b76542573dfb033742cd6e08ecd38c51c644a35f2127bd97f5f"}, "config": {"enabled": true, "alias": null, "schema": "xapi", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "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", "engine": "\n AggregatingMergeTree()", "order_by": "(emission_day)", "partition_by": "(toYYYYMM(emission_day))"}, "tags": [], "description": "A materialized view summarizing site-wide user activity", "columns": {"emission_day": {"name": "emission_day", "description": "Time of summary, truncated to the day", "meta": {}, "data_type": "DateTime", "constraints": [], "quote": null, "tags": []}, "actors_cnt": {"name": "actors_cnt", "description": "The number of xAPI actors active in the given hour", "meta": {}, "data_type": "Int", "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "aspects://models/instance/schema.yml", "build_path": null, "unrendered_config": {"materialized": "materialized_view", "schema": "xapi", "engine": "\n AggregatingMergeTree()", "order_by": "(emission_day)", "partition_by": "(toYYYYMM(emission_day))"}, "created_at": 1723229144.9726677, "relation_name": "`xapi`.`fact_instance_actors`", "raw_code": "{{\n config(\n materialized=\"materialized_view\",\n schema=env_var(\"ASPECTS_XAPI_DATABASE\", \"xapi\"),\n engine=get_engine(\"AggregatingMergeTree()\"),\n order_by=\"(emission_day)\",\n partition_by=\"(toYYYYMM(emission_day))\",\n )\n}}\n\nselect\n date_trunc('day', emission_time) as emission_day,\n uniqCombinedState(actor_id) as actors_cnt\nfrom {{ ref(\"xapi_events_all_parsed\") }}\ngroup by emission_day", "language": "sql", "refs": [{"name": "xapi_events_all_parsed", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.aspects.get_engine"], "nodes": ["model.aspects.xapi_events_all_parsed"]}, "compiled_path": "target/compiled/aspects/models/instance/fact_instance_actors.sql", "compiled": true, "compiled_code": "\n\nselect\n date_trunc('day', emission_time) as emission_day,\n uniqCombinedState(actor_id) as actors_cnt\nfrom `xapi`.`xapi_events_all_parsed`\ngroup by emission_day", "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.aspects.fact_instance_courses": {"database": "", "schema": "xapi", "name": "fact_instance_courses", "resource_type": "model", "package_name": "aspects", "path": "instance/fact_instance_courses.sql", "original_file_path": "models/instance/fact_instance_courses.sql", "unique_id": "model.aspects.fact_instance_courses", "fqn": ["aspects", "instance", "fact_instance_courses"], "alias": "fact_instance_courses", "checksum": {"name": "sha256", "checksum": "f4ad165686c10a3ff85f8cdd6e6a32e970e1d1503612995e1f4fadb7a87b5a4f"}, "config": {"enabled": true, "alias": null, "schema": "xapi", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "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", "engine": "\n AggregatingMergeTree()", "order_by": "(emission_hour)", "partition_by": "(toYYYYMM(emission_hour))"}, "tags": [], "description": "A materialized view summarizing site-wide course activity", "columns": {"emission_hour": {"name": "emission_hour", "description": "Time of summary, rounded to the nearest hour", "meta": {}, "data_type": "DateTime(64)", "constraints": [], "quote": null, "tags": []}, "courses_cnt": {"name": "courses_cnt", "description": "The number of xAPI courses active in the given hour", "meta": {}, "data_type": "Int", "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "aspects://models/instance/schema.yml", "build_path": null, "unrendered_config": {"materialized": "materialized_view", "schema": "xapi", "engine": "\n AggregatingMergeTree()", "order_by": "(emission_hour)", "partition_by": "(toYYYYMM(emission_hour))"}, "created_at": 1723229144.9691503, "relation_name": "`xapi`.`fact_instance_courses`", "raw_code": "{{\n config(\n materialized=\"materialized_view\",\n schema=env_var(\"ASPECTS_XAPI_DATABASE\", \"xapi\"),\n engine=get_engine(\"AggregatingMergeTree()\"),\n order_by=\"(emission_hour)\",\n partition_by=\"(toYYYYMM(emission_hour))\",\n )\n}}\n\nselect\n date_trunc('hour', emission_time) as emission_hour,\n uniqCombinedState(course_id) as courses_cnt\nfrom {{ ref(\"xapi_events_all_parsed\") }}\ngroup by emission_hour", "language": "sql", "refs": [{"name": "xapi_events_all_parsed", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.aspects.get_engine"], "nodes": ["model.aspects.xapi_events_all_parsed"]}, "compiled_path": "target/compiled/aspects/models/instance/fact_instance_courses.sql", "compiled": true, "compiled_code": "\n\nselect\n date_trunc('hour', emission_time) as emission_hour,\n uniqCombinedState(course_id) as courses_cnt\nfrom `xapi`.`xapi_events_all_parsed`\ngroup by emission_hour", "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.aspects.fact_instance_events": {"database": "", "schema": "xapi", "name": "fact_instance_events", "resource_type": "model", "package_name": "aspects", "path": "instance/fact_instance_events.sql", "original_file_path": "models/instance/fact_instance_events.sql", "unique_id": "model.aspects.fact_instance_events", "fqn": ["aspects", "instance", "fact_instance_events"], "alias": "fact_instance_events", "checksum": {"name": "sha256", "checksum": "4769f8d269c17cc93946adbc44d2209af542698ae0c5ca17025b6bacdccf6669"}, "config": {"enabled": true, "alias": null, "schema": "xapi", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "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", "engine": "\n AggregatingMergeTree()", "order_by": "(emission_day)", "partition_by": "(toYYYYMM(emission_day))"}, "tags": [], "description": "A materialized view summarizing site-wide xAPI event activity", "columns": {"emission_day": {"name": "emission_day", "description": "Time of summary, truncated to the day", "meta": {}, "data_type": "DateTime", "constraints": [], "quote": null, "tags": []}, "events_cnt": {"name": "events_cnt", "description": "The number of xAPI events that occurred in the given hour", "meta": {}, "data_type": "Int", "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "aspects://models/instance/schema.yml", "build_path": null, "unrendered_config": {"materialized": "materialized_view", "schema": "xapi", "engine": "\n AggregatingMergeTree()", "order_by": "(emission_day)", "partition_by": "(toYYYYMM(emission_day))"}, "created_at": 1723229144.9717672, "relation_name": "`xapi`.`fact_instance_events`", "raw_code": "{{\n config(\n materialized=\"materialized_view\",\n schema=env_var(\"ASPECTS_XAPI_DATABASE\", \"xapi\"),\n engine=get_engine(\"AggregatingMergeTree()\"),\n order_by=\"(emission_day)\",\n partition_by=\"(toYYYYMM(emission_day))\",\n )\n}}\n\nselect\n date_trunc('day', emission_time) as emission_day,\n uniqCombinedState(event_id) as events_cnt\nfrom {{ ref(\"xapi_events_all_parsed\") }}\ngroup by emission_day", "language": "sql", "refs": [{"name": "xapi_events_all_parsed", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.aspects.get_engine"], "nodes": ["model.aspects.xapi_events_all_parsed"]}, "compiled_path": "target/compiled/aspects/models/instance/fact_instance_events.sql", "compiled": true, "compiled_code": "\n\nselect\n date_trunc('day', emission_time) as emission_day,\n uniqCombinedState(event_id) as events_cnt\nfrom `xapi`.`xapi_events_all_parsed`\ngroup by emission_day", "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.aspects.fact_learner_course_grade": {"database": "", "schema": "xapi", "name": "fact_learner_course_grade", "resource_type": "model", "package_name": "aspects", "path": "grading/fact_learner_course_grade.sql", "original_file_path": "models/grading/fact_learner_course_grade.sql", "unique_id": "model.aspects.fact_learner_course_grade", "fqn": ["aspects", "grading", "fact_learner_course_grade"], "alias": "fact_learner_course_grade", "checksum": {"name": "sha256", "checksum": "65bd38f1afb16919483eff0217b13bc2f58d64041c1a5034457d45e461de4340"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": [], "meta": {}, "group": null, "materialized": "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", "engine": "\n ReplacingMergeTree()", "order_by": "(org, course_key, actor_id)", "primary_key": "(org, course_key, actor_id)"}, "tags": [], "description": "One record per learner per course for the most recent grade", "columns": {"org": {"name": "org", "description": "The organization that the course belongs to", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_key": {"name": "course_key", "description": "The course key for the course", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "actor_id": {"name": "actor_id", "description": "The xAPI actor identifier", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_grade": {"name": "course_grade", "description": "The most recent grade for the learner", "meta": {}, "data_type": "float64", "constraints": [], "quote": null, "tags": []}, "emission_time": {"name": "emission_time", "description": "The time the event was emitted", "meta": {}, "data_type": "DateTime", "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "aspects://models/grading/schema.yml", "build_path": null, "unrendered_config": {"materialized": "materialized_view", "engine": "\n ReplacingMergeTree()", "primary_key": "(org, course_key, actor_id)", "order_by": "(org, course_key, actor_id)"}, "created_at": 1723229144.9808722, "relation_name": "`xapi`.`fact_learner_course_grade`", "raw_code": "{{\n config(\n materialized=\"materialized_view\",\n engine=get_engine(\"ReplacingMergeTree()\"),\n primary_key=\"(org, course_key, actor_id)\",\n order_by=\"(org, course_key, actor_id)\",\n )\n}}\n\nwith\n ranked_grades as (\n select\n emission_time,\n org,\n course_key,\n actor_id,\n scaled_score as course_grade,\n row_number() over (\n partition by org, course_key, actor_id order by emission_time desc\n ) as rn\n from {{ ref(\"grading_events\") }}\n where object_id like '%/course/%'\n )\n\nselect org, course_key, actor_id, course_grade, emission_time\nfrom ranked_grades\nwhere rn = 1", "language": "sql", "refs": [{"name": "grading_events", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.aspects.get_engine"], "nodes": ["model.aspects.grading_events"]}, "compiled_path": "target/compiled/aspects/models/grading/fact_learner_course_grade.sql", "compiled": true, "compiled_code": "\n\nwith\n ranked_grades as (\n select\n emission_time,\n org,\n course_key,\n actor_id,\n scaled_score as course_grade,\n row_number() over (\n partition by org, course_key, actor_id order by emission_time desc\n ) as rn\n from `xapi`.`grading_events`\n where object_id like '%/course/%'\n )\n\nselect org, course_key, actor_id, course_grade, emission_time\nfrom ranked_grades\nwhere rn = 1", "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.aspects.grading_events": {"database": "", "schema": "xapi", "name": "grading_events", "resource_type": "model", "package_name": "aspects", "path": "grading/grading_events.sql", "original_file_path": "models/grading/grading_events.sql", "unique_id": "model.aspects.grading_events", "fqn": ["aspects", "grading", "grading_events"], "alias": "grading_events", "checksum": {"name": "sha256", "checksum": "560e180b3c8684ea507910a88f1a2e616db7cf1fb751ea6b93b0475d519fd7ac"}, "config": {"enabled": true, "alias": null, "schema": "xapi", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "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", "engine": "\n ReplacingMergeTree()", "order_by": "(org, course_key, verb_id, emission_time, actor_id, object_id, scaled_score, event_id)", "partition_by": "(toYYYYMM(emission_time))", "ttl": "", "primary_key": "(org, course_key, verb_id)"}, "tags": [], "description": "Events related to grading", "columns": {"event_id": {"name": "event_id", "description": "The unique identifier for the event", "meta": {}, "data_type": "UUID", "constraints": [], "quote": null, "tags": []}, "emission_time": {"name": "emission_time", "description": "The time the event was emitted", "meta": {}, "data_type": "DateTime", "constraints": [], "quote": null, "tags": []}, "actor_id": {"name": "actor_id", "description": "The xAPI actor identifier", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "object_id": {"name": "object_id", "description": "The xAPI object identifier", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_key": {"name": "course_key", "description": "The course identifier", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "org": {"name": "org", "description": "The organization that the course belongs to", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "verb_id": {"name": "verb_id", "description": "The xAPI verb identifier", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "scaled_score": {"name": "scaled_score", "description": "A ratio between 0 and 1, inclusive, of the learner's grade", "meta": {}, "data_type": "float64", "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "aspects://models/grading/schema.yml", "build_path": null, "unrendered_config": {"materialized": "materialized_view", "schema": "xapi", "engine": "\n ReplacingMergeTree()", "primary_key": "(org, course_key, verb_id)", "order_by": "(org, course_key, verb_id, emission_time, actor_id, object_id, scaled_score, event_id)", "partition_by": "(toYYYYMM(emission_time))", "ttl": ""}, "created_at": 1723229144.9829972, "relation_name": "`xapi`.`grading_events`", "raw_code": "{{\n config(\n materialized=\"materialized_view\",\n schema=env_var(\"ASPECTS_XAPI_DATABASE\", \"xapi\"),\n engine=get_engine(\"ReplacingMergeTree()\"),\n primary_key=\"(org, course_key, verb_id)\",\n order_by=\"(org, course_key, verb_id, emission_time, actor_id, object_id, scaled_score, event_id)\",\n partition_by=\"(toYYYYMM(emission_time))\",\n ttl=env_var(\"ASPECTS_DATA_TTL_EXPRESSION\", \"\"),\n )\n}}\n\n\nselect\n event_id,\n CAST(emission_time, 'DateTime') as emission_time,\n actor_id,\n object_id,\n course_key,\n org,\n verb_id,\n JSONExtractFloat(event, 'result', 'score', 'scaled') as scaled_score\nfrom {{ ref(\"xapi_events_all_parsed\") }}\nwhere\n verb_id in (\n 'http://id.tincanapi.com/verb/earned',\n 'https://w3id.org/xapi/acrossx/verbs/evaluated'\n )\n or (\n verb_id in (\n 'http://adlnet.gov/expapi/verbs/passed',\n 'http://adlnet.gov/expapi/verbs/failed'\n )\n and JSON_VALUE(event::String, '$.object.definition.type')\n = 'http://adlnet.gov/expapi/activities/course'\n )", "language": "sql", "refs": [{"name": "xapi_events_all_parsed", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.aspects.get_engine"], "nodes": ["model.aspects.xapi_events_all_parsed"]}, "compiled_path": "target/compiled/aspects/models/grading/grading_events.sql", "compiled": true, "compiled_code": "\n\n\nselect\n event_id,\n CAST(emission_time, 'DateTime') as emission_time,\n actor_id,\n object_id,\n course_key,\n org,\n verb_id,\n JSONExtractFloat(event, 'result', 'score', 'scaled') as scaled_score\nfrom `xapi`.`xapi_events_all_parsed`\nwhere\n verb_id in (\n 'http://id.tincanapi.com/verb/earned',\n 'https://w3id.org/xapi/acrossx/verbs/evaluated'\n )\n or (\n verb_id in (\n 'http://adlnet.gov/expapi/verbs/passed',\n 'http://adlnet.gov/expapi/verbs/failed'\n )\n and JSON_VALUE(event::String, '$.object.definition.type')\n = 'http://adlnet.gov/expapi/activities/course'\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.aspects.fact_learner_course_status": {"database": "", "schema": "xapi", "name": "fact_learner_course_status", "resource_type": "model", "package_name": "aspects", "path": "grading/fact_learner_course_status.sql", "original_file_path": "models/grading/fact_learner_course_status.sql", "unique_id": "model.aspects.fact_learner_course_status", "fqn": ["aspects", "grading", "fact_learner_course_status"], "alias": "fact_learner_course_status", "checksum": {"name": "sha256", "checksum": "b222a83595d291ea6410e32e2c9c55afff79efe3c0268c415edf3154f4b60ee4"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": [], "meta": {}, "group": null, "materialized": "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", "engine": "\n ReplacingMergeTree()", "order_by": "(org, course_key, actor_id)", "primary_key": "(org, course_key, actor_id)"}, "tags": [], "description": "One record per learner per course for the most recent approving status", "columns": {"org": {"name": "org", "description": "The organization that the course belongs to", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_key": {"name": "course_key", "description": "The course key for the course", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "actor_id": {"name": "actor_id", "description": "The xAPI actor identifier", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "emission_time": {"name": "emission_time", "description": "The time the event was emitted", "meta": {}, "data_type": "DateTime", "constraints": [], "quote": null, "tags": []}, "approving_state": {"name": "approving_state", "description": "The most recent approving_state of the learner's grade", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "aspects://models/grading/schema.yml", "build_path": null, "unrendered_config": {"materialized": "materialized_view", "engine": "\n ReplacingMergeTree()", "primary_key": "(org, course_key, actor_id)", "order_by": "(org, course_key, actor_id)"}, "created_at": 1723229144.9818764, "relation_name": "`xapi`.`fact_learner_course_status`", "raw_code": "{{\n config(\n materialized=\"materialized_view\",\n engine=get_engine(\"ReplacingMergeTree()\"),\n primary_key=\"(org, course_key, actor_id)\",\n order_by=\"(org, course_key, actor_id)\",\n )\n}}\n\nwith\n ranked_status as (\n select\n org,\n course_key,\n actor_id,\n splitByString('/', verb_id)[-1] as approving_state,\n emission_time,\n row_number() over (\n partition by org, course_key, actor_id order by emission_time desc\n ) as rn\n from {{ ref(\"grading_events\") }}\n where\n verb_id in (\n 'http://adlnet.gov/expapi/verbs/passed',\n 'http://adlnet.gov/expapi/verbs/failed'\n )\n )\n\nselect org, course_key, actor_id, approving_state, emission_time\nfrom ranked_status\nwhere rn = 1", "language": "sql", "refs": [{"name": "grading_events", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.aspects.get_engine"], "nodes": ["model.aspects.grading_events"]}, "compiled_path": "target/compiled/aspects/models/grading/fact_learner_course_status.sql", "compiled": true, "compiled_code": "\n\nwith\n ranked_status as (\n select\n org,\n course_key,\n actor_id,\n splitByString('/', verb_id)[-1] as approving_state,\n emission_time,\n row_number() over (\n partition by org, course_key, actor_id order by emission_time desc\n ) as rn\n from `xapi`.`grading_events`\n where\n verb_id in (\n 'http://adlnet.gov/expapi/verbs/passed',\n 'http://adlnet.gov/expapi/verbs/failed'\n )\n )\n\nselect org, course_key, actor_id, approving_state, emission_time\nfrom ranked_status\nwhere rn = 1", "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.aspects.fact_student_status": {"database": "", "schema": "xapi", "name": "fact_student_status", "resource_type": "model", "package_name": "aspects", "path": "grading/fact_student_status.sql", "original_file_path": "models/grading/fact_student_status.sql", "unique_id": "model.aspects.fact_student_status", "fqn": ["aspects", "grading", "fact_student_status"], "alias": "fact_student_status", "checksum": {"name": "sha256", "checksum": "6a873b9bd0a579367e3e9ccd2e5a9b2ef96ce0c44ea12eced299a7a96b56535e"}, "config": {"enabled": true, "alias": null, "schema": null, "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": "One record per learner per course for the most recent grade and enrollment status", "columns": {"org": {"name": "org", "description": "The organization that the course belongs to", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_key": {"name": "course_key", "description": "The course key for the course", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "actor_id": {"name": "actor_id", "description": "The xAPI actor identifier", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_name": {"name": "course_name", "description": "The name of the course", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_run": {"name": "course_run", "description": "The course run for the course", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "approving_state": {"name": "approving_state", "description": "The most recent approving state for the learner", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "enrollment_mode": {"name": "enrollment_mode", "description": "The mode of enrollment", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "enrollment_status": {"name": "enrollment_status", "description": "Whether a learner is actively enrolled in a course", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "course_grade": {"name": "course_grade", "description": "The most recent grade for the learner", "meta": {}, "data_type": "float64", "constraints": [], "quote": null, "tags": []}, "grade_bucket": {"name": "grade_bucket", "description": "A displayable value of grades sorted into 10% buckets. Useful for grouping grades together to show high-level learner performance", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "username": {"name": "username", "description": "The username of the learner", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "name": {"name": "name", "description": "The full name of the learner", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "email": {"name": "email", "description": "The email address of the learner", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "enrolled_at": {"name": "enrolled_at", "description": "The timestamp, to the second, of the most recent enrollment action for this learner and course.", "meta": {}, "data_type": "DateTime", "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "aspects://models/grading/schema.yml", "build_path": null, "unrendered_config": {}, "created_at": 1723229144.9847083, "relation_name": "`xapi`.`fact_student_status`", "raw_code": "select\n fes.org as org,\n fes.course_key as course_key,\n fes.actor_id as actor_id,\n courses.course_name as course_name,\n courses.course_run as course_run,\n if(empty(approving_state), 'failed', approving_state) as approving_state,\n enrollment_mode,\n enrollment_status,\n course_grade,\n {{ get_bucket(\"course_grade\") }} as grade_bucket,\n users.username as username,\n users.name as name,\n users.email as email,\n fes.emission_time as enrolled_at\nfrom {{ ref(\"fact_enrollment_status\") }} fes\nleft join\n {{ ref(\"fact_learner_course_status\") }} lg\n on fes.org = lg.org\n and fes.course_key = lg.course_key\n and fes.actor_id = lg.actor_id\nleft join\n {{ ref(\"fact_learner_course_grade\") }} ls\n on fes.org = ls.org\n and fes.course_key = ls.course_key\n and fes.actor_id = ls.actor_id\njoin\n {{ ref(\"course_names\") }} courses\n on fes.org = courses.org\n and fes.course_key = courses.course_key\nleft outer join\n {{ ref(\"dim_user_pii\") }} users on toUUID(actor_id) = users.external_user_id", "language": "sql", "refs": [{"name": "fact_enrollment_status", "package": null, "version": null}, {"name": "fact_learner_course_status", "package": null, "version": null}, {"name": "fact_learner_course_grade", "package": null, "version": null}, {"name": "course_names", "package": null, "version": null}, {"name": "dim_user_pii", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.aspects.get_bucket"], "nodes": ["model.aspects.fact_enrollment_status", "model.aspects.fact_learner_course_status", "model.aspects.fact_learner_course_grade", "model.aspects.course_names", "model.aspects.dim_user_pii"]}, "compiled_path": "target/compiled/aspects/models/grading/fact_student_status.sql", "compiled": true, "compiled_code": "select\n fes.org as org,\n fes.course_key as course_key,\n fes.actor_id as actor_id,\n courses.course_name as course_name,\n courses.course_run as course_run,\n if(empty(approving_state), 'failed', approving_state) as approving_state,\n enrollment_mode,\n enrollment_status,\n course_grade,\n case\n when course_grade >= 0.9\n then '90-100%'\n when course_grade >= 0.8 and course_grade < 0.9\n then '80-89%'\n when course_grade >= 0.7 and course_grade < 0.8\n then '70-79%'\n when course_grade >= 0.6 and course_grade < 0.7\n then '60-69%'\n when course_grade >= 0.5 and course_grade < 0.6\n then '50-59%'\n when course_grade >= 0.4 and course_grade < 0.5\n then '40-49%'\n when course_grade >= 0.3 and course_grade < 0.4\n then '30-39%'\n when course_grade >= 0.2 and course_grade < 0.3\n then '20-29%'\n when course_grade >= 0.1 and course_grade < 0.2\n then '10-19%'\n else '0-9%'\n end as grade_bucket,\n users.username as username,\n users.name as name,\n users.email as email,\n fes.emission_time as enrolled_at\nfrom `xapi`.`fact_enrollment_status` fes\nleft join\n `xapi`.`fact_learner_course_status` lg\n on fes.org = lg.org\n and fes.course_key = lg.course_key\n and fes.actor_id = lg.actor_id\nleft join\n `xapi`.`fact_learner_course_grade` ls\n on fes.org = ls.org\n and fes.course_key = ls.course_key\n and fes.actor_id = ls.actor_id\njoin\n `xapi`.`course_names` courses\n on fes.org = courses.org\n and fes.course_key = courses.course_key\nleft outer join\n `xapi`.`dim_user_pii` users on toUUID(actor_id) = users.external_user_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.aspects.fact_problem_responses": {"database": "", "schema": "xapi", "name": "fact_problem_responses", "resource_type": "model", "package_name": "aspects", "path": "problems/fact_problem_responses.sql", "original_file_path": "models/problems/fact_problem_responses.sql", "unique_id": "model.aspects.fact_problem_responses", "fqn": ["aspects", "problems", "fact_problem_responses"], "alias": "fact_problem_responses", "checksum": {"name": "sha256", "checksum": "eb6b76a7274cba5c47c75273374aa21e690b6c6f9ca335dd3db360c827f18b2a"}, "config": {"enabled": true, "alias": null, "schema": null, "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": "One record for each submitted response to a problem", "columns": {"emission_time": {"name": "emission_time", "description": "Timestamp, to the second, of when this event was emitted", "meta": {}, "data_type": "DateTime", "constraints": [], "quote": null, "tags": []}, "org": {"name": "org", "description": "The organization that the course belongs to", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_key": {"name": "course_key", "description": "The course key for the course", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_name": {"name": "course_name", "description": "The name of the course", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_run": {"name": "course_run", "description": "The course run for the course", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "problem_id": {"name": "problem_id", "description": "The problem's unique identifier", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "problem_name": {"name": "problem_name", "description": "The problem's name", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "problem_name_with_location": {"name": "problem_name_with_location", "description": "The problem's display name with section, subsection, and unit prepended to the name. This provides additional context when looking at problem names and can help data consumers understand which problem they are analyzing", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "problem_link": {"name": "problem_link", "description": "An anchor tag with a link to the problem", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "graded": {"name": "graded", "description": "Boolean indicating this block is graded", "meta": {}, "data_type": "bool", "constraints": [], "quote": null, "tags": []}, "actor_id": {"name": "actor_id", "description": "The xAPI actor identifier", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "responses": {"name": "responses", "description": "The responses for this submission. If a problem has multiple parts, values for all parts will be in this field", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "success": {"name": "success", "description": "Boolean indicating whether the responses were correct", "meta": {}, "data_type": "Bool", "constraints": [], "quote": null, "tags": []}, "attempts": {"name": "attempts", "description": "Number indicating which attempt this was", "meta": {}, "data_type": "Int16", "constraints": [], "quote": null, "tags": []}, "interaction_type": {"name": "interaction_type", "description": "The type of interaction - e.g. multiple choice", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "username": {"name": "username", "description": "The username of the learner", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "name": {"name": "name", "description": "The full name of the learner", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "email": {"name": "email", "description": "The email address of the learner", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_order": {"name": "course_order", "description": "The sort order of this block in the course across all course blocks", "meta": {}, "data_type": "Int32", "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "aspects://models/problems/schema.yml", "build_path": null, "unrendered_config": {}, "created_at": 1723229144.9979386, "relation_name": "`xapi`.`fact_problem_responses`", "raw_code": "with\n responses as (\n select\n emission_time,\n org,\n course_key,\n object_id,\n problem_id,\n actor_id,\n responses,\n success,\n attempts,\n interaction_type\n from {{ ref(\"problem_events\") }}\n where verb_id = 'https://w3id.org/xapi/acrossx/verbs/evaluated'\n )\n\nselect\n responses.emission_time as emission_time,\n responses.org as org,\n responses.course_key as course_key,\n blocks.course_name as course_name,\n blocks.course_run as course_run,\n responses.problem_id as problem_id,\n blocks.block_name as problem_name,\n blocks.display_name_with_location as problem_name_with_location,\n {{ a_tag(\"responses.object_id\", \"blocks.block_name\") }} as problem_link,\n blocks.graded as graded,\n course_order as course_order,\n responses.actor_id as actor_id,\n responses.responses as responses,\n responses.success as success,\n responses.attempts as attempts,\n responses.interaction_type as interaction_type,\n users.username as username,\n users.name as name,\n users.email as email\nfrom responses\njoin\n {{ ref(\"dim_course_blocks\") }} blocks\n on (\n responses.course_key = blocks.course_key\n and responses.problem_id = blocks.block_id\n )\nleft outer join\n {{ ref(\"dim_user_pii\") }} users on toUUID(actor_id) = users.external_user_id\ngroup by\n -- multi-part questions include an extra record for the response to the first\n -- part of the question. this group by clause eliminates the duplicate record\n emission_time,\n org,\n course_key,\n course_name,\n course_run,\n problem_id,\n problem_name,\n problem_name_with_location,\n problem_link,\n actor_id,\n responses,\n success,\n attempts,\n course_order,\n graded,\n interaction_type,\n username,\n name,\n email", "language": "sql", "refs": [{"name": "problem_events", "package": null, "version": null}, {"name": "dim_course_blocks", "package": null, "version": null}, {"name": "dim_user_pii", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.aspects.a_tag"], "nodes": ["model.aspects.problem_events", "model.aspects.dim_course_blocks", "model.aspects.dim_user_pii"]}, "compiled_path": "target/compiled/aspects/models/problems/fact_problem_responses.sql", "compiled": true, "compiled_code": "with\n responses as (\n select\n emission_time,\n org,\n course_key,\n object_id,\n problem_id,\n actor_id,\n responses,\n success,\n attempts,\n interaction_type\n from `xapi`.`problem_events`\n where verb_id = 'https://w3id.org/xapi/acrossx/verbs/evaluated'\n )\n\nselect\n responses.emission_time as emission_time,\n responses.org as org,\n responses.course_key as course_key,\n blocks.course_name as course_name,\n blocks.course_run as course_run,\n responses.problem_id as problem_id,\n blocks.block_name as problem_name,\n blocks.display_name_with_location as problem_name_with_location,\n \n concat(\n '', blocks.block_name, ''\n )\n as problem_link,\n blocks.graded as graded,\n course_order as course_order,\n responses.actor_id as actor_id,\n responses.responses as responses,\n responses.success as success,\n responses.attempts as attempts,\n responses.interaction_type as interaction_type,\n users.username as username,\n users.name as name,\n users.email as email\nfrom responses\njoin\n `xapi`.`dim_course_blocks` blocks\n on (\n responses.course_key = blocks.course_key\n and responses.problem_id = blocks.block_id\n )\nleft outer join\n `xapi`.`dim_user_pii` users on toUUID(actor_id) = users.external_user_id\ngroup by\n -- multi-part questions include an extra record for the response to the first\n -- part of the question. this group by clause eliminates the duplicate record\n emission_time,\n org,\n course_key,\n course_name,\n course_run,\n problem_id,\n problem_name,\n problem_name_with_location,\n problem_link,\n actor_id,\n responses,\n success,\n attempts,\n course_order,\n graded,\n interaction_type,\n username,\n name,\n email", "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.aspects.int_problems_per_subsection": {"database": "", "schema": "xapi", "name": "int_problems_per_subsection", "resource_type": "model", "package_name": "aspects", "path": "problems/int_problems_per_subsection.sql", "original_file_path": "models/problems/int_problems_per_subsection.sql", "unique_id": "model.aspects.int_problems_per_subsection", "fqn": ["aspects", "problems", "int_problems_per_subsection"], "alias": "int_problems_per_subsection", "checksum": {"name": "sha256", "checksum": "8ef5aa318ccd2200d1cc3ecd3332004099cdb2050f6d8ff83e98124fdab1ee31"}, "config": {"enabled": true, "alias": null, "schema": null, "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": "A dimension table with the number of problems per subsection", "columns": {"org": {"name": "org", "description": "The organization that the course belongs to", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_key": {"name": "course_key", "description": "The course key for the course", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "section_number": {"name": "section_number", "description": "The location of this section in the course, represented as section:0:0", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "section_with_name": {"name": "section_with_name", "description": "The name of the section this subsection belongs to, with section_number prepended", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "subsection_number": {"name": "subsection_number", "description": "The location of this subsection in the course, represented as section:subsection:0", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "subsection_with_name": {"name": "subsection_with_name", "description": "The name of the subsection, with section_number prepended", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "graded": {"name": "graded", "description": "Whether this subsection block is graded", "meta": {}, "data_type": "bool", "constraints": [], "quote": null, "tags": []}, "item_count": {"name": "item_count", "description": "The number of problems in this subsection", "meta": {}, "data_type": "UInt64", "constraints": [], "quote": null, "tags": []}, "course_order": {"name": "course_order", "description": "The sort order of this block in the course across all course blocks", "meta": {}, "data_type": "Int32", "constraints": [], "quote": null, "tags": []}, "subsection_block_id": {"name": "subsection_block_id", "description": "The unique identifier for the subsection block", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "section_block_id": {"name": "section_block_id", "description": "The unique identifier for the section block", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "aspects://models/problems/schema.yml", "build_path": null, "unrendered_config": {}, "created_at": 1723229145.0063028, "relation_name": "`xapi`.`int_problems_per_subsection`", "raw_code": "select * from ({{ items_per_subsection(\"%@problem+block@%\") }})", "language": "sql", "refs": [{"name": "dim_course_blocks", "package": null, "version": null}, {"name": "dim_course_blocks", "package": null, "version": null}, {"name": "dim_course_blocks", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.aspects.items_per_subsection"], "nodes": ["model.aspects.dim_course_blocks"]}, "compiled_path": "target/compiled/aspects/models/problems/int_problems_per_subsection.sql", "compiled": true, "compiled_code": "select * from (\n with\n items_per_subsection as (\n select\n org,\n course_key,\n section_number,\n subsection_number,\n course_order,\n graded,\n count(*) as item_count\n from `xapi`.`dim_course_blocks`\n where block_id like '%@problem+block@%'\n group by\n org, course_key, section_number, subsection_number, course_order, graded\n )\n\n select\n ips.org as org,\n ips.course_key as course_key,\n ips.section_number as section_number,\n section_blocks.display_name_with_location as section_with_name,\n ips.subsection_number as subsection_number,\n subsection_blocks.display_name_with_location as subsection_with_name,\n ips.course_order as course_order,\n ips.graded as graded,\n ips.item_count as item_count,\n subsection_blocks.block_id as subsection_block_id,\n section_blocks.block_id as section_block_id\n from items_per_subsection ips\n left join\n `xapi`.`dim_course_blocks` section_blocks\n on (\n ips.section_number = section_blocks.hierarchy_location\n and ips.org = section_blocks.org\n and ips.course_key = section_blocks.course_key\n and section_blocks.block_id like '%@chapter+block@%'\n )\n left join\n `xapi`.`dim_course_blocks` subsection_blocks\n on (\n ips.subsection_number = subsection_blocks.hierarchy_location\n and ips.org = subsection_blocks.org\n and ips.course_key = subsection_blocks.course_key\n and subsection_blocks.block_id like '%@sequential+block@%'\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.aspects.int_problem_hints": {"database": "", "schema": "xapi", "name": "int_problem_hints", "resource_type": "model", "package_name": "aspects", "path": "problems/int_problem_hints.sql", "original_file_path": "models/problems/int_problem_hints.sql", "unique_id": "model.aspects.int_problem_hints", "fqn": ["aspects", "problems", "int_problem_hints"], "alias": "int_problem_hints", "checksum": {"name": "sha256", "checksum": "4c77d1d17128bfe3f033aedd32977c54f03fb141af58589715fd1efb1b7dec25"}, "config": {"enabled": true, "alias": null, "schema": null, "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": "Internal table for problem hints", "columns": {"emission_time": {"name": "emission_time", "description": "Timestamp, to the second, of when this event was emitted", "meta": {}, "data_type": "DateTime", "constraints": [], "quote": null, "tags": []}, "org": {"name": "org", "description": "The organization that the course belongs to", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_key": {"name": "course_key", "description": "The course key for the course", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_name": {"name": "course_name", "description": "The name of the course", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_run": {"name": "course_run", "description": "The course run for the course", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "problem_id": {"name": "problem_id", "description": "The problem's unique identifier", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "problem_name": {"name": "problem_name", "description": "The problem's name", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "problem_name_with_location": {"name": "problem_name_with_location", "description": "The problem's display name with section, subsection, and unit prepended to the name. This provides additional context when looking at problem names and can help data consumers understand which problem they are analyzing", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "actor_id": {"name": "actor_id", "description": "The xAPI actor identifier", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "help_type": {"name": "help_type", "description": "The type of help requested", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_order": {"name": "course_order", "description": "The sort order of this block in the course across all course blocks", "meta": {}, "data_type": "Int32", "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "aspects://models/problems/schema.yml", "build_path": null, "unrendered_config": {}, "created_at": 1723229144.9993067, "relation_name": "`xapi`.`int_problem_hints`", "raw_code": "with\n hints as (\n select\n emission_time,\n org,\n course_key,\n problem_id,\n actor_id,\n case\n when object_id like '%/hint%'\n then 'hint'\n when object_id like '%/answer%'\n then 'answer'\n else 'N/A'\n end as help_type\n from {{ ref(\"problem_events\") }}\n where verb_id = 'http://adlnet.gov/expapi/verbs/asked'\n )\n\nselect\n hints.emission_time as emission_time,\n hints.org as org,\n hints.course_key as course_key,\n blocks.course_name as course_name,\n blocks.course_run as course_run,\n hints.problem_id as problem_id,\n blocks.block_name as problem_name,\n blocks.display_name_with_location as problem_name_with_location,\n blocks.course_order as course_order,\n hints.actor_id as actor_id,\n hints.help_type as help_type\nfrom hints\njoin\n {{ ref(\"dim_course_blocks\") }} blocks\n on (hints.course_key = blocks.course_key and hints.problem_id = blocks.block_id)", "language": "sql", "refs": [{"name": "problem_events", "package": null, "version": null}, {"name": "dim_course_blocks", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.aspects.problem_events", "model.aspects.dim_course_blocks"]}, "compiled_path": "target/compiled/aspects/models/problems/int_problem_hints.sql", "compiled": true, "compiled_code": "with\n hints as (\n select\n emission_time,\n org,\n course_key,\n problem_id,\n actor_id,\n case\n when object_id like '%/hint%'\n then 'hint'\n when object_id like '%/answer%'\n then 'answer'\n else 'N/A'\n end as help_type\n from `xapi`.`problem_events`\n where verb_id = 'http://adlnet.gov/expapi/verbs/asked'\n )\n\nselect\n hints.emission_time as emission_time,\n hints.org as org,\n hints.course_key as course_key,\n blocks.course_name as course_name,\n blocks.course_run as course_run,\n hints.problem_id as problem_id,\n blocks.block_name as problem_name,\n blocks.display_name_with_location as problem_name_with_location,\n blocks.course_order as course_order,\n hints.actor_id as actor_id,\n hints.help_type as help_type\nfrom hints\njoin\n `xapi`.`dim_course_blocks` blocks\n on (hints.course_key = blocks.course_key and hints.problem_id = blocks.block_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.aspects.subsection_problem_engagement": {"database": "", "schema": "xapi", "name": "subsection_problem_engagement", "resource_type": "model", "package_name": "aspects", "path": "problems/subsection_problem_engagement.sql", "original_file_path": "models/problems/subsection_problem_engagement.sql", "unique_id": "model.aspects.subsection_problem_engagement", "fqn": ["aspects", "problems", "subsection_problem_engagement"], "alias": "subsection_problem_engagement", "checksum": {"name": "sha256", "checksum": "e2921cd8b8b5150a9a22e1bedba8c9a0f3682449e1f39a07d5248ba61e16c322"}, "config": {"enabled": true, "alias": null, "schema": "xapi", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "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", "engine": "\n ReplacingMergeTree()", "order_by": "(org, course_key, subsection_block_id, actor_id)", "primary_key": "(org, course_key)"}, "tags": [], "description": "A record per course per subsection per learner with their engagement level", "columns": {"org": {"name": "org", "description": "The organization that the course belongs to", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_key": {"name": "course_key", "description": "The course key for the course", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "actor_id": {"name": "actor_id", "description": "The xAPI actor identifier", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "subsection_block_id": {"name": "subsection_block_id", "description": "The unique identifier for the subsection block", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "engagement_level": {"name": "engagement_level", "description": "The engagement level of the learner with the subsection", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "aspects://models/problems/schema.yml", "build_path": null, "unrendered_config": {"materialized": "materialized_view", "schema": "xapi", "engine": "\n ReplacingMergeTree()", "primary_key": "(org, course_key)", "order_by": "(org, course_key, subsection_block_id, actor_id)"}, "created_at": 1723229145.009245, "relation_name": "`xapi`.`subsection_problem_engagement`", "raw_code": "{{\n config(\n materialized=\"materialized_view\",\n schema=env_var(\"ASPECTS_XAPI_DATABASE\", \"xapi\"),\n engine=get_engine(\"ReplacingMergeTree()\"),\n primary_key=\"(org, course_key)\",\n order_by=\"(org, course_key, subsection_block_id, actor_id)\",\n )\n}}\n\nwith\n responses as (\n select\n emission_time,\n org,\n course_key,\n object_id,\n problem_id,\n actor_id,\n responses,\n success,\n attempts,\n interaction_type\n from {{ ref(\"problem_events\") }}\n where verb_id = 'https://w3id.org/xapi/acrossx/verbs/evaluated'\n ),\n fact_problem_responses as (\n select\n responses.emission_time as emission_time,\n responses.org as org,\n responses.course_key as course_key,\n blocks.course_name as course_name,\n responses.problem_id as problem_id,\n blocks.block_name as problem_name,\n blocks.display_name_with_location as problem_name_with_location,\n {{ a_tag(\"responses.object_id\", \"blocks.block_name\") }} as problem_link,\n blocks.graded as graded,\n course_order as course_order,\n responses.actor_id as actor_id,\n responses.responses as responses,\n responses.success as success,\n responses.attempts as attempts,\n responses.interaction_type as interaction_type\n from responses\n join\n {{ ref(\"dim_course_blocks\") }} blocks\n on (\n responses.course_key = blocks.course_key\n and responses.problem_id = blocks.block_id\n )\n group by\n -- multi-part questions include an extra record for the response to the\n -- first\n -- part of the question. this group by clause eliminates the duplicate\n -- record\n emission_time,\n org,\n course_key,\n course_name,\n problem_id,\n problem_name,\n problem_name_with_location,\n problem_link,\n actor_id,\n responses,\n success,\n attempts,\n course_order,\n graded,\n interaction_type\n ),\n attempted_subsection_problems as (\n select distinct\n date(emission_time) as attempted_on,\n org,\n course_key,\n {{ section_from_display(\"problem_name_with_location\") }} as section_number,\n {{ subsection_from_display(\"problem_name_with_location\") }}\n as subsection_number,\n course_order as course_order,\n graded,\n actor_id,\n problem_id\n from fact_problem_responses\n ),\n fact_problem_engagement_per_subsection as (\n select\n attempts.org as org,\n attempts.course_key as course_key,\n problems.section_with_name as section_with_name,\n problems.subsection_with_name as subsection_with_name,\n problems.item_count as item_count,\n attempts.actor_id as actor_id,\n attempts.problem_id as problem_id,\n problems.subsection_block_id as subsection_block_id\n from attempted_subsection_problems attempts\n join\n {{ ref(\"int_problems_per_subsection\") }} problems\n on (\n attempts.org = problems.org\n and attempts.course_key = problems.course_key\n and attempts.section_number = problems.section_number\n and attempts.subsection_number = problems.subsection_number\n )\n ),\n subsection_counts as (\n select\n org,\n course_key,\n section_with_name,\n subsection_with_name,\n actor_id,\n item_count,\n count(distinct problem_id) as problems_attempted,\n case\n when problems_attempted = 0\n then 'No problems attempted yet'\n when problems_attempted = item_count\n then 'All problems attempted'\n else 'At least one problem attempted'\n end as engagement_level,\n subsection_block_id\n from fact_problem_engagement_per_subsection\n group by\n org,\n course_key,\n section_with_name,\n subsection_with_name,\n actor_id,\n item_count,\n subsection_block_id\n )\n\nselect org, course_key, actor_id, subsection_block_id, engagement_level\nfrom subsection_counts", "language": "sql", "refs": [{"name": "problem_events", "package": null, "version": null}, {"name": "dim_course_blocks", "package": null, "version": null}, {"name": "int_problems_per_subsection", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.aspects.get_engine", "macro.aspects.a_tag", "macro.aspects.section_from_display", "macro.aspects.subsection_from_display"], "nodes": ["model.aspects.problem_events", "model.aspects.dim_course_blocks", "model.aspects.int_problems_per_subsection"]}, "compiled_path": "target/compiled/aspects/models/problems/subsection_problem_engagement.sql", "compiled": true, "compiled_code": "\n\nwith\n responses as (\n select\n emission_time,\n org,\n course_key,\n object_id,\n problem_id,\n actor_id,\n responses,\n success,\n attempts,\n interaction_type\n from `xapi`.`problem_events`\n where verb_id = 'https://w3id.org/xapi/acrossx/verbs/evaluated'\n ),\n fact_problem_responses as (\n select\n responses.emission_time as emission_time,\n responses.org as org,\n responses.course_key as course_key,\n blocks.course_name as course_name,\n responses.problem_id as problem_id,\n blocks.block_name as problem_name,\n blocks.display_name_with_location as problem_name_with_location,\n \n concat(\n '', blocks.block_name, ''\n )\n as problem_link,\n blocks.graded as graded,\n course_order as course_order,\n responses.actor_id as actor_id,\n responses.responses as responses,\n responses.success as success,\n responses.attempts as attempts,\n responses.interaction_type as interaction_type\n from responses\n join\n `xapi`.`dim_course_blocks` blocks\n on (\n responses.course_key = blocks.course_key\n and responses.problem_id = blocks.block_id\n )\n group by\n -- multi-part questions include an extra record for the response to the\n -- first\n -- part of the question. this group by clause eliminates the duplicate\n -- record\n emission_time,\n org,\n course_key,\n course_name,\n problem_id,\n problem_name,\n problem_name_with_location,\n problem_link,\n actor_id,\n responses,\n success,\n attempts,\n course_order,\n graded,\n interaction_type\n ),\n attempted_subsection_problems as (\n select distinct\n date(emission_time) as attempted_on,\n org,\n course_key,\n \n concat(\n splitByString(\n ':', splitByString(' - ', problem_name_with_location)[1], 1\n )[1],\n ':0:0'\n )\n as section_number,\n \n concat(\n arrayStringConcat(\n splitByString(\n ':', splitByString(' - ', problem_name_with_location)[1], 2\n ),\n ':'\n ),\n ':0'\n )\n\n as subsection_number,\n course_order as course_order,\n graded,\n actor_id,\n problem_id\n from fact_problem_responses\n ),\n fact_problem_engagement_per_subsection as (\n select\n attempts.org as org,\n attempts.course_key as course_key,\n problems.section_with_name as section_with_name,\n problems.subsection_with_name as subsection_with_name,\n problems.item_count as item_count,\n attempts.actor_id as actor_id,\n attempts.problem_id as problem_id,\n problems.subsection_block_id as subsection_block_id\n from attempted_subsection_problems attempts\n join\n `xapi`.`int_problems_per_subsection` problems\n on (\n attempts.org = problems.org\n and attempts.course_key = problems.course_key\n and attempts.section_number = problems.section_number\n and attempts.subsection_number = problems.subsection_number\n )\n ),\n subsection_counts as (\n select\n org,\n course_key,\n section_with_name,\n subsection_with_name,\n actor_id,\n item_count,\n count(distinct problem_id) as problems_attempted,\n case\n when problems_attempted = 0\n then 'No problems attempted yet'\n when problems_attempted = item_count\n then 'All problems attempted'\n else 'At least one problem attempted'\n end as engagement_level,\n subsection_block_id\n from fact_problem_engagement_per_subsection\n group by\n org,\n course_key,\n section_with_name,\n subsection_with_name,\n actor_id,\n item_count,\n subsection_block_id\n )\n\nselect org, course_key, actor_id, subsection_block_id, engagement_level\nfrom subsection_counts", "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.aspects.section_problem_engagement": {"database": "", "schema": "xapi", "name": "section_problem_engagement", "resource_type": "model", "package_name": "aspects", "path": "problems/section_problem_engagement.sql", "original_file_path": "models/problems/section_problem_engagement.sql", "unique_id": "model.aspects.section_problem_engagement", "fqn": ["aspects", "problems", "section_problem_engagement"], "alias": "section_problem_engagement", "checksum": {"name": "sha256", "checksum": "524c2a33f7ce8786133b9cb05fe6ac139625a4acf4efe26a0173d4217096e0b8"}, "config": {"enabled": true, "alias": null, "schema": "xapi", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "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", "engine": "\n ReplacingMergeTree()", "order_by": "(org, course_key, section_block_id, actor_id)", "primary_key": "(org, course_key)"}, "tags": [], "description": "A record per course per section per learner with their engagement level", "columns": {"org": {"name": "org", "description": "The organization that the course belongs to", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_key": {"name": "course_key", "description": "The course key for the course", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "actor_id": {"name": "actor_id", "description": "The xAPI actor identifier", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "section_block_id": {"name": "section_block_id", "description": "The unique identifier for the section block", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "engagement_level": {"name": "engagement_level", "description": "The engagement level of the learner with the section", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "aspects://models/problems/schema.yml", "build_path": null, "unrendered_config": {"materialized": "materialized_view", "schema": "xapi", "engine": "\n ReplacingMergeTree()", "primary_key": "(org, course_key)", "order_by": "(org, course_key, section_block_id, actor_id)"}, "created_at": 1723229145.0085664, "relation_name": "`xapi`.`section_problem_engagement`", "raw_code": "{{\n config(\n materialized=\"materialized_view\",\n schema=env_var(\"ASPECTS_XAPI_DATABASE\", \"xapi\"),\n engine=get_engine(\"ReplacingMergeTree()\"),\n primary_key=\"(org, course_key)\",\n order_by=\"(org, course_key, section_block_id, actor_id)\",\n )\n}}\n\nwith\n responses as (\n select\n emission_time,\n org,\n course_key,\n object_id,\n problem_id,\n actor_id,\n responses,\n success,\n attempts,\n interaction_type\n from {{ ref(\"problem_events\") }}\n where verb_id = 'https://w3id.org/xapi/acrossx/verbs/evaluated'\n ),\n fact_problem_responses as (\n select\n responses.emission_time as emission_time,\n responses.org as org,\n responses.course_key as course_key,\n blocks.course_name as course_name,\n responses.problem_id as problem_id,\n blocks.block_name as problem_name,\n blocks.display_name_with_location as problem_name_with_location,\n {{ a_tag(\"responses.object_id\", \"blocks.block_name\") }} as problem_link,\n blocks.graded as graded,\n course_order as course_order,\n responses.actor_id as actor_id,\n responses.responses as responses,\n responses.success as success,\n responses.attempts as attempts,\n responses.interaction_type as interaction_type\n from responses\n join\n {{ ref(\"dim_course_blocks\") }} blocks\n on (\n responses.course_key = blocks.course_key\n and responses.problem_id = blocks.block_id\n )\n group by\n -- multi-part questions include an extra record for the response to the\n -- first\n -- part of the question. this group by clause eliminates the duplicate\n -- record\n emission_time,\n org,\n course_key,\n course_name,\n problem_id,\n problem_name,\n problem_name_with_location,\n problem_link,\n actor_id,\n responses,\n success,\n attempts,\n course_order,\n graded,\n interaction_type\n ),\n attempted_subsection_problems as (\n select distinct\n date(emission_time) as attempted_on,\n org,\n course_key,\n {{ section_from_display(\"problem_name_with_location\") }} as section_number,\n {{ subsection_from_display(\"problem_name_with_location\") }}\n as subsection_number,\n course_order as course_order,\n graded,\n actor_id,\n problem_id\n from fact_problem_responses\n ),\n fact_problem_engagement_per_subsection as (\n select\n attempts.org as org,\n attempts.course_key as course_key,\n problems.section_with_name as section_with_name,\n problems.subsection_with_name as subsection_with_name,\n problems.item_count as item_count,\n attempts.actor_id as actor_id,\n attempts.problem_id as problem_id,\n problems.section_block_id as section_block_id\n from attempted_subsection_problems attempts\n join\n {{ ref(\"int_problems_per_subsection\") }} problems\n on (\n attempts.org = problems.org\n and attempts.course_key = problems.course_key\n and attempts.section_number = problems.section_number\n and attempts.subsection_number = problems.subsection_number\n )\n ),\n subsection_counts as (\n select\n org,\n course_key,\n section_with_name,\n subsection_with_name,\n actor_id,\n item_count,\n count(distinct problem_id) as problems_attempted,\n case\n when problems_attempted = 0\n then 'No problems attempted yet'\n when problems_attempted = item_count\n then 'All problems attempted'\n else 'At least one problem attempted'\n end as engagement_level,\n section_block_id\n from fact_problem_engagement_per_subsection\n group by\n org,\n course_key,\n section_with_name,\n subsection_with_name,\n actor_id,\n item_count,\n section_block_id\n ),\n section_counts as (\n select\n org,\n course_key,\n actor_id,\n sum(item_count) as item_count,\n sum(problems_attempted) as problems_attempted,\n case\n when problems_attempted = 0\n then 'No problems attempted yet'\n when problems_attempted = item_count\n then 'All problems attempted'\n else 'At least one problem attempted'\n end as engagement_level,\n section_block_id\n from subsection_counts\n group by org, course_key, section_block_id, actor_id\n )\n\nselect org, course_key, actor_id, section_block_id, engagement_level\nfrom section_counts", "language": "sql", "refs": [{"name": "problem_events", "package": null, "version": null}, {"name": "dim_course_blocks", "package": null, "version": null}, {"name": "int_problems_per_subsection", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.aspects.get_engine", "macro.aspects.a_tag", "macro.aspects.section_from_display", "macro.aspects.subsection_from_display"], "nodes": ["model.aspects.problem_events", "model.aspects.dim_course_blocks", "model.aspects.int_problems_per_subsection"]}, "compiled_path": "target/compiled/aspects/models/problems/section_problem_engagement.sql", "compiled": true, "compiled_code": "\n\nwith\n responses as (\n select\n emission_time,\n org,\n course_key,\n object_id,\n problem_id,\n actor_id,\n responses,\n success,\n attempts,\n interaction_type\n from `xapi`.`problem_events`\n where verb_id = 'https://w3id.org/xapi/acrossx/verbs/evaluated'\n ),\n fact_problem_responses as (\n select\n responses.emission_time as emission_time,\n responses.org as org,\n responses.course_key as course_key,\n blocks.course_name as course_name,\n responses.problem_id as problem_id,\n blocks.block_name as problem_name,\n blocks.display_name_with_location as problem_name_with_location,\n \n concat(\n '', blocks.block_name, ''\n )\n as problem_link,\n blocks.graded as graded,\n course_order as course_order,\n responses.actor_id as actor_id,\n responses.responses as responses,\n responses.success as success,\n responses.attempts as attempts,\n responses.interaction_type as interaction_type\n from responses\n join\n `xapi`.`dim_course_blocks` blocks\n on (\n responses.course_key = blocks.course_key\n and responses.problem_id = blocks.block_id\n )\n group by\n -- multi-part questions include an extra record for the response to the\n -- first\n -- part of the question. this group by clause eliminates the duplicate\n -- record\n emission_time,\n org,\n course_key,\n course_name,\n problem_id,\n problem_name,\n problem_name_with_location,\n problem_link,\n actor_id,\n responses,\n success,\n attempts,\n course_order,\n graded,\n interaction_type\n ),\n attempted_subsection_problems as (\n select distinct\n date(emission_time) as attempted_on,\n org,\n course_key,\n \n concat(\n splitByString(\n ':', splitByString(' - ', problem_name_with_location)[1], 1\n )[1],\n ':0:0'\n )\n as section_number,\n \n concat(\n arrayStringConcat(\n splitByString(\n ':', splitByString(' - ', problem_name_with_location)[1], 2\n ),\n ':'\n ),\n ':0'\n )\n\n as subsection_number,\n course_order as course_order,\n graded,\n actor_id,\n problem_id\n from fact_problem_responses\n ),\n fact_problem_engagement_per_subsection as (\n select\n attempts.org as org,\n attempts.course_key as course_key,\n problems.section_with_name as section_with_name,\n problems.subsection_with_name as subsection_with_name,\n problems.item_count as item_count,\n attempts.actor_id as actor_id,\n attempts.problem_id as problem_id,\n problems.section_block_id as section_block_id\n from attempted_subsection_problems attempts\n join\n `xapi`.`int_problems_per_subsection` problems\n on (\n attempts.org = problems.org\n and attempts.course_key = problems.course_key\n and attempts.section_number = problems.section_number\n and attempts.subsection_number = problems.subsection_number\n )\n ),\n subsection_counts as (\n select\n org,\n course_key,\n section_with_name,\n subsection_with_name,\n actor_id,\n item_count,\n count(distinct problem_id) as problems_attempted,\n case\n when problems_attempted = 0\n then 'No problems attempted yet'\n when problems_attempted = item_count\n then 'All problems attempted'\n else 'At least one problem attempted'\n end as engagement_level,\n section_block_id\n from fact_problem_engagement_per_subsection\n group by\n org,\n course_key,\n section_with_name,\n subsection_with_name,\n actor_id,\n item_count,\n section_block_id\n ),\n section_counts as (\n select\n org,\n course_key,\n actor_id,\n sum(item_count) as item_count,\n sum(problems_attempted) as problems_attempted,\n case\n when problems_attempted = 0\n then 'No problems attempted yet'\n when problems_attempted = item_count\n then 'All problems attempted'\n else 'At least one problem attempted'\n end as engagement_level,\n section_block_id\n from subsection_counts\n group by org, course_key, section_block_id, actor_id\n )\n\nselect org, course_key, actor_id, section_block_id, engagement_level\nfrom section_counts", "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.aspects.responses": {"database": "", "schema": "xapi", "name": "responses", "resource_type": "model", "package_name": "aspects", "path": "problems/responses.sql", "original_file_path": "models/problems/responses.sql", "unique_id": "model.aspects.responses", "fqn": ["aspects", "problems", "responses"], "alias": "responses", "checksum": {"name": "sha256", "checksum": "740ef52e23ba2baf158991a2637f2f6636cc82690de11ed734f8cbd536a411f3"}, "config": {"enabled": true, "alias": null, "schema": "xapi", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "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", "engine": "\n ReplacingMergeTree()", "order_by": "(org, course_key, problem_id, actor_id)", "partition_by": "toYYYYMM(emission_time)", "ttl": "", "primary_key": "(org, course_key, problem_id)"}, "tags": [], "description": "A record per course per problem per learner with their last attempt and first success", "columns": {"org": {"name": "org", "description": "The organization that the course belongs to", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_key": {"name": "course_key", "description": "The course key for the course", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "problem_id": {"name": "problem_id", "description": "The problem's unique identifier", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "actor_id": {"name": "actor_id", "description": "The xAPI actor identifier", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "first_success_at": {"name": "first_success_at", "description": "The timestamp of the first successful attempt", "meta": {}, "data_type": "Nullable(DateTime)", "constraints": [], "quote": null, "tags": []}, "last_attempt_at": {"name": "last_attempt_at", "description": "The timestamp of the last attempt", "meta": {}, "data_type": "DateTime", "constraints": [], "quote": null, "tags": []}, "emission_time": {"name": "emission_time", "description": "The timestamp of the last attempt or the first successful attempt", "meta": {}, "data_type": "DateTime", "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "aspects://models/problems/schema.yml", "build_path": null, "unrendered_config": {"materialized": "materialized_view", "schema": "xapi", "engine": "\n ReplacingMergeTree()", "primary_key": "(org, course_key, problem_id)", "order_by": "(org, course_key, problem_id, actor_id)", "partition_by": "toYYYYMM(emission_time)", "ttl": ""}, "created_at": 1723229145.0076077, "relation_name": "`xapi`.`responses`", "raw_code": "-- select one record per (learner, problem, course, org) tuple\n-- contains either the first successful attempt\n-- or the most recent unsuccessful attempt\n-- find the timestamp of the earliest successful response\n-- this will be used to pick the xAPI event corresponding to that submission\n{{\n config(\n materialized=\"materialized_view\",\n schema=env_var(\"ASPECTS_XAPI_DATABASE\", \"xapi\"),\n engine=get_engine(\"ReplacingMergeTree()\"),\n primary_key=\"(org, course_key, problem_id)\",\n order_by=\"(org, course_key, problem_id, actor_id)\",\n partition_by=\"toYYYYMM(emission_time)\",\n ttl=env_var(\"ASPECTS_DATA_TTL_EXPRESSION\", \"\"),\n )\n}}\n\nwith\n responses as (\n select emission_time, org, course_key, object_id, problem_id, actor_id, success\n from {{ ref(\"problem_events\") }}\n where verb_id = 'https://w3id.org/xapi/acrossx/verbs/evaluated'\n ),\n response_status as (\n select\n org,\n course_key,\n problem_id,\n actor_id,\n MIN(case when success then emission_time else NULL end) as first_success_at,\n MAX(emission_time) as last_attempt_at\n from responses\n group by org, course_key, problem_id, actor_id\n )\nselect\n org,\n course_key,\n problem_id,\n actor_id,\n first_success_at,\n last_attempt_at,\n coalesce(first_success_at, last_attempt_at) as emission_time\nfrom response_status", "language": "sql", "refs": [{"name": "problem_events", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.aspects.get_engine"], "nodes": ["model.aspects.problem_events"]}, "compiled_path": "target/compiled/aspects/models/problems/responses.sql", "compiled": true, "compiled_code": "-- select one record per (learner, problem, course, org) tuple\n-- contains either the first successful attempt\n-- or the most recent unsuccessful attempt\n-- find the timestamp of the earliest successful response\n-- this will be used to pick the xAPI event corresponding to that submission\n\n\nwith\n responses as (\n select emission_time, org, course_key, object_id, problem_id, actor_id, success\n from `xapi`.`problem_events`\n where verb_id = 'https://w3id.org/xapi/acrossx/verbs/evaluated'\n ),\n response_status as (\n select\n org,\n course_key,\n problem_id,\n actor_id,\n MIN(case when success then emission_time else NULL end) as first_success_at,\n MAX(emission_time) as last_attempt_at\n from responses\n group by org, course_key, problem_id, actor_id\n )\nselect\n org,\n course_key,\n problem_id,\n actor_id,\n first_success_at,\n last_attempt_at,\n coalesce(first_success_at, last_attempt_at) as emission_time\nfrom response_status", "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.aspects.problem_events": {"database": "", "schema": "xapi", "name": "problem_events", "resource_type": "model", "package_name": "aspects", "path": "problems/problem_events.sql", "original_file_path": "models/problems/problem_events.sql", "unique_id": "model.aspects.problem_events", "fqn": ["aspects", "problems", "problem_events"], "alias": "problem_events", "checksum": {"name": "sha256", "checksum": "8ae3c62c7630e40ba807a70bfcea0d1a95a14cd83d1add4e2603ac7bffb805e9"}, "config": {"enabled": true, "alias": null, "schema": "xapi", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "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", "engine": "\n ReplacingMergeTree()", "order_by": "(org, course_key, verb_id, emission_time, actor_id, object_id, responses, success, event_id)", "partition_by": "(toYYYYMM(emission_time))", "ttl": "", "primary_key": "(org, course_key, verb_id)"}, "tags": [], "description": "Problem events", "columns": {"event_id": {"name": "event_id", "description": "The unique identifier for the event", "meta": {}, "data_type": "UUID", "constraints": [], "quote": null, "tags": []}, "emission_time": {"name": "emission_time", "description": "The time the event was emitted", "meta": {}, "data_type": "DateTime", "constraints": [], "quote": null, "tags": []}, "actor_id": {"name": "actor_id", "description": "The xAPI actor identifier", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "object_id": {"name": "object_id", "description": "The xAPI object identifier", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_key": {"name": "course_key", "description": "The course identifier", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "org": {"name": "org", "description": "The organization that the course belongs to", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "verb_id": {"name": "verb_id", "description": "The xAPI verb identifier", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "responses": {"name": "responses", "description": "The responses for this submission. If a problem has multiple parts, values for all parts will be in this field", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "scaled_score": {"name": "scaled_score", "description": "A ratio between 0 and 1, inclusive, of the learner's grade", "meta": {}, "data_type": "Float32", "constraints": [], "quote": null, "tags": []}, "success": {"name": "success", "description": "Boolean indicating whether the responses were correct", "meta": {}, "data_type": "Boolean", "constraints": [], "quote": null, "tags": []}, "interaction_type": {"name": "interaction_type", "description": "The type of interaction", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "attempts": {"name": "attempts", "description": "Number indicating which attempt this was", "meta": {}, "data_type": "Int16", "constraints": [], "quote": null, "tags": []}, "problem_id": {"name": "problem_id", "description": "The problem's unique identifier", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "aspects://models/problems/schema.yml", "build_path": null, "unrendered_config": {"materialized": "materialized_view", "schema": "xapi", "engine": "\n ReplacingMergeTree()", "primary_key": "(org, course_key, verb_id)", "order_by": "(org, course_key, verb_id, emission_time, actor_id, object_id, responses, success, event_id)", "partition_by": "(toYYYYMM(emission_time))", "ttl": ""}, "created_at": 1723229145.00295, "relation_name": "`xapi`.`problem_events`", "raw_code": "{{\n config(\n materialized=\"materialized_view\",\n schema=env_var(\"ASPECTS_XAPI_DATABASE\", \"xapi\"),\n engine=get_engine(\"ReplacingMergeTree()\"),\n primary_key=\"(org, course_key, verb_id)\",\n order_by=\"(org, course_key, verb_id, emission_time, actor_id, object_id, responses, success, event_id)\",\n partition_by=\"(toYYYYMM(emission_time))\",\n ttl=env_var(\"ASPECTS_DATA_TTL_EXPRESSION\", \"\"),\n )\n}}\n\nselect\n event_id,\n cast(emission_time as DateTime) as emission_time,\n actor_id,\n object_id,\n course_key,\n org,\n verb_id,\n JSON_VALUE(event, '$.result.response') as responses,\n JSONExtractFloat(event, 'result', 'score', 'scaled') as scaled_score,\n if(\n verb_id = 'https://w3id.org/xapi/acrossx/verbs/evaluated',\n cast(JSON_VALUE(event, '$.result.success') as Bool),\n false\n ) as success,\n toLowCardinality(\n JSON_VALUE(event, '$.object.definition.interactionType')\n ) as interaction_type,\n if(\n verb_id = 'https://w3id.org/xapi/acrossx/verbs/evaluated',\n cast(\n JSON_VALUE(\n event,\n '$.object.definition.extensions.\"http://id.tincanapi.com/extension/attempt-id\"'\n ) as Int16\n ),\n 0\n ) as attempts,\n {{ get_problem_id(\"object_id\") }} as problem_id\nfrom {{ ref(\"xapi_events_all_parsed\") }}\nwhere\n verb_id in (\n 'https://w3id.org/xapi/acrossx/verbs/evaluated',\n 'http://adlnet.gov/expapi/verbs/passed',\n 'http://adlnet.gov/expapi/verbs/asked'\n )", "language": "sql", "refs": [{"name": "xapi_events_all_parsed", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.aspects.get_engine", "macro.aspects.get_problem_id"], "nodes": ["model.aspects.xapi_events_all_parsed"]}, "compiled_path": "target/compiled/aspects/models/problems/problem_events.sql", "compiled": true, "compiled_code": "\n\nselect\n event_id,\n cast(emission_time as DateTime) as emission_time,\n actor_id,\n object_id,\n course_key,\n org,\n verb_id,\n JSON_VALUE(event, '$.result.response') as responses,\n JSONExtractFloat(event, 'result', 'score', 'scaled') as scaled_score,\n if(\n verb_id = 'https://w3id.org/xapi/acrossx/verbs/evaluated',\n cast(JSON_VALUE(event, '$.result.success') as Bool),\n false\n ) as success,\n toLowCardinality(\n JSON_VALUE(event, '$.object.definition.interactionType')\n ) as interaction_type,\n if(\n verb_id = 'https://w3id.org/xapi/acrossx/verbs/evaluated',\n cast(\n JSON_VALUE(\n event,\n '$.object.definition.extensions.\"http://id.tincanapi.com/extension/attempt-id\"'\n ) as Int16\n ),\n 0\n ) as attempts,\n \n regexpExtract(\n object_id, 'xblock/([\\w\\d-\\+:@]*@problem\\+block@[\\w\\d][^_\\/]*)(_\\d_\\d)?', 1\n )\n as problem_id\nfrom `xapi`.`xapi_events_all_parsed`\nwhere\n verb_id in (\n 'https://w3id.org/xapi/acrossx/verbs/evaluated',\n 'http://adlnet.gov/expapi/verbs/passed',\n 'http://adlnet.gov/expapi/verbs/asked'\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.aspects.int_problem_results": {"database": "", "schema": "xapi", "name": "int_problem_results", "resource_type": "model", "package_name": "aspects", "path": "problems/int_problem_results.sql", "original_file_path": "models/problems/int_problem_results.sql", "unique_id": "model.aspects.int_problem_results", "fqn": ["aspects", "problems", "int_problem_results"], "alias": "int_problem_results", "checksum": {"name": "sha256", "checksum": "77b3a3ce55db9521350c6f946389c62076d558b6dfbc55a05dcc398067391772"}, "config": {"enabled": true, "alias": null, "schema": null, "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": "Internal table for problem results", "columns": {"emission_time": {"name": "emission_time", "description": "Timestamp, to the second, of when this event was emitted", "meta": {}, "data_type": "DateTime", "constraints": [], "quote": null, "tags": []}, "org": {"name": "org", "description": "The organization that the course belongs to", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_key": {"name": "course_key", "description": "The course key for the course", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_name": {"name": "course_name", "description": "The name of the course", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_run": {"name": "course_run", "description": "The course run for the course", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "problem_id": {"name": "problem_id", "description": "The problem's unique identifier", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "problem_name": {"name": "problem_name", "description": "The problem's name", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "problem_name_with_location": {"name": "problem_name_with_location", "description": "The problem's display name with section, subsection, and unit prepended to the name. This provides additional context when looking at problem names and can help data consumers understand which problem they are analyzing", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "problem_link": {"name": "problem_link", "description": "An anchor tag with a link to the problem", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "actor_id": {"name": "actor_id", "description": "The xAPI actor identifier", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "responses": {"name": "responses", "description": "The responses for this submission. If a problem has multiple parts, values for all parts will be in this field", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "success": {"name": "success", "description": "Boolean indicating whether the responses were correct", "meta": {}, "data_type": "bool", "constraints": [], "quote": null, "tags": []}, "attempts": {"name": "attempts", "description": "Number indicating which attempt this was", "meta": {}, "data_type": "Int16", "constraints": [], "quote": null, "tags": []}, "graded": {"name": "graded", "description": "Boolean indicating this block is graded", "meta": {}, "data_type": "bool", "constraints": [], "quote": null, "tags": []}, "interaction_type": {"name": "interaction_type", "description": "The type of interaction - e.g. multiple choice", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_order": {"name": "course_order", "description": "The sort order of this block in the course across all course blocks", "meta": {}, "data_type": "Int32", "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "aspects://models/problems/schema.yml", "build_path": null, "unrendered_config": {}, "created_at": 1723229145.0007, "relation_name": "`xapi`.`int_problem_results`", "raw_code": "-- select one record per (learner, problem, course, org) tuple\n-- contains either the first successful attempt\n-- or the most recent unsuccessful attempt\n-- find the timestamp of the earliest successful response\n-- this will be used to pick the xAPI event corresponding to that submission\nwith\n full_responses as (\n select\n events.emission_time as emission_time,\n events.org as org,\n events.course_key as course_key,\n events.problem_id as problem_id,\n events.object_id as object_id,\n events.actor_id as actor_id,\n events.responses as responses,\n events.success as success,\n events.attempts as attempts,\n events.interaction_type as interaction_type\n from {{ ref(\"problem_events\") }} events\n join\n {{ ref(\"responses\") }} using (\n org, course_key, problem_id, actor_id, emission_time\n )\n )\n\nselect\n full_responses.emission_time as emission_time,\n full_responses.org as org,\n full_responses.course_key as course_key,\n blocks.course_name as course_name,\n blocks.course_run as course_run,\n full_responses.problem_id as problem_id,\n blocks.block_name as problem_name,\n blocks.display_name_with_location as problem_name_with_location,\n blocks.course_order as course_order,\n {{ a_tag(\"full_responses.object_id\", \"blocks.block_name\") }} as problem_link,\n full_responses.actor_id as actor_id,\n full_responses.responses as responses,\n full_responses.success as success,\n full_responses.attempts as attempts,\n full_responses.interaction_type as interaction_type,\n blocks.graded\nfrom full_responses\njoin\n {{ ref(\"dim_course_blocks\") }} blocks\n on (\n full_responses.course_key = blocks.course_key\n and full_responses.problem_id = blocks.block_id\n )", "language": "sql", "refs": [{"name": "problem_events", "package": null, "version": null}, {"name": "responses", "package": null, "version": null}, {"name": "dim_course_blocks", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.aspects.a_tag"], "nodes": ["model.aspects.problem_events", "model.aspects.responses", "model.aspects.dim_course_blocks"]}, "compiled_path": "target/compiled/aspects/models/problems/int_problem_results.sql", "compiled": true, "compiled_code": "-- select one record per (learner, problem, course, org) tuple\n-- contains either the first successful attempt\n-- or the most recent unsuccessful attempt\n-- find the timestamp of the earliest successful response\n-- this will be used to pick the xAPI event corresponding to that submission\nwith\n full_responses as (\n select\n events.emission_time as emission_time,\n events.org as org,\n events.course_key as course_key,\n events.problem_id as problem_id,\n events.object_id as object_id,\n events.actor_id as actor_id,\n events.responses as responses,\n events.success as success,\n events.attempts as attempts,\n events.interaction_type as interaction_type\n from `xapi`.`problem_events` events\n join\n `xapi`.`responses` using (\n org, course_key, problem_id, actor_id, emission_time\n )\n )\n\nselect\n full_responses.emission_time as emission_time,\n full_responses.org as org,\n full_responses.course_key as course_key,\n blocks.course_name as course_name,\n blocks.course_run as course_run,\n full_responses.problem_id as problem_id,\n blocks.block_name as problem_name,\n blocks.display_name_with_location as problem_name_with_location,\n blocks.course_order as course_order,\n \n concat(\n '', blocks.block_name, ''\n )\n as problem_link,\n full_responses.actor_id as actor_id,\n full_responses.responses as responses,\n full_responses.success as success,\n full_responses.attempts as attempts,\n full_responses.interaction_type as interaction_type,\n blocks.graded\nfrom full_responses\njoin\n `xapi`.`dim_course_blocks` blocks\n on (\n full_responses.course_key = blocks.course_key\n and full_responses.problem_id = blocks.block_id\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.aspects.xapi_events_all_parsed": {"database": "", "schema": "xapi", "name": "xapi_events_all_parsed", "resource_type": "model", "package_name": "aspects", "path": "base/xapi_events_all_parsed.sql", "original_file_path": "models/base/xapi_events_all_parsed.sql", "unique_id": "model.aspects.xapi_events_all_parsed", "fqn": ["aspects", "base", "xapi_events_all_parsed"], "alias": "xapi_events_all_parsed", "checksum": {"name": "sha256", "checksum": "424b48a5e299cf1bc431b66c79dfcec02800dea174a774717b5ad5782a91216a"}, "config": {"enabled": true, "alias": null, "schema": "xapi", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "materialized_view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "OPTIMIZE TABLE {{ this }} {{ on_cluster() }} FINAL", "transaction": true, "index": null}], "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", "engine": "\n ReplacingMergeTree()", "order_by": "(org, course_id, verb_id, actor_id, emission_time, event_id)", "partition_by": "(toYYYYMM(emission_time))", "ttl": "", "primary_key": "(org, course_id, verb_id, actor_id, emission_time, event_id)"}, "tags": [], "description": "A materialized view for xAPI events", "columns": {"event_id": {"name": "event_id", "description": "The unique identifier for the event", "meta": {}, "data_type": "UUID", "constraints": [], "quote": null, "tags": []}, "verb_id": {"name": "verb_id", "description": "The xAPI verb identifier", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "actor_id": {"name": "actor_id", "description": "The xAPI actor identifier", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "object_id": {"name": "object_id", "description": "The xAPI object identifier", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_id": {"name": "course_id", "description": "The fully-qualified course identifier URL", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_key": {"name": "course_key", "description": "The course key for the course", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "org": {"name": "org", "description": "The organization that the course belongs to", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "emission_time": {"name": "emission_time", "description": "The time the event was emitted", "meta": {}, "data_type": "DateTime64(6)", "constraints": [], "quote": null, "tags": []}, "event": {"name": "event", "description": "The xAPI event as a String", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "aspects://models/base/schema.yml", "build_path": null, "unrendered_config": {"materialized": "materialized_view", "schema": "xapi", "engine": "\n ReplacingMergeTree()", "primary_key": "(org, course_id, verb_id, actor_id, emission_time, event_id)", "order_by": "(org, course_id, verb_id, actor_id, emission_time, event_id)", "partition_by": "(toYYYYMM(emission_time))", "ttl": "", "post-hook": ["OPTIMIZE TABLE {{ this }} {{ on_cluster() }} FINAL"]}, "created_at": 1723229145.021542, "relation_name": "`xapi`.`xapi_events_all_parsed`", "raw_code": "{{\n config(\n materialized=\"materialized_view\",\n schema=env_var(\"ASPECTS_XAPI_DATABASE\", \"xapi\"),\n engine=get_engine(\"ReplacingMergeTree()\"),\n primary_key=\"(org, course_id, verb_id, actor_id, emission_time, event_id)\",\n order_by=\"(org, course_id, verb_id, actor_id, emission_time, event_id)\",\n partition_by=\"(toYYYYMM(emission_time))\",\n ttl=env_var(\"ASPECTS_DATA_TTL_EXPRESSION\", \"\"),\n post_hook=\"OPTIMIZE TABLE {{ this }} {{ on_cluster() }} FINAL\",\n )\n}}\n\nselect\n event_id as event_id,\n toLowCardinality(JSON_VALUE(event::String, '$.verb.id')) as verb_id,\n COALESCE(\n NULLIF(JSON_VALUE(event::String, '$.actor.account.name'), ''),\n NULLIF(JSON_VALUE(event::String, '$.actor.mbox'), ''),\n JSON_VALUE(event::String, '$.actor.mbox_sha1sum')\n ) as actor_id,\n JSON_VALUE(event::String, '$.object.id') as object_id,\n -- If the contextActivities parent is a course, use that. It can be a \"course\"\n -- type, or a \"cmi.interaction\" type for multiple question problem submissions.\n -- Otherwise use the object id for the course id.\n toLowCardinality(\n multiIf(\n -- If the contextActivities parent is a course, use that\n JSON_VALUE(\n event::String, '$.context.contextActivities.parent[0].definition.type'\n )\n = 'http://adlnet.gov/expapi/activities/course',\n JSON_VALUE(event::String, '$.context.contextActivities.parent[0].id'),\n -- Else if the contextActivities parent is a GroupActivity, it's a multi\n -- question problem and we use the grouping id\n JSON_VALUE(\n event::String, '$.context.contextActivities.parent[0].objectType'\n )\n in ('Activity', 'GroupActivity'),\n JSON_VALUE(event::String, '$.context.contextActivities.grouping[0].id'),\n -- Otherwise use the object id\n JSON_VALUE(event::String, '$.object.id')\n )\n ) as course_id,\n toLowCardinality(splitByString('/', course_id)[-1]) as course_key,\n toLowCardinality(\n coalesce(\n get_org_from_course_url(course_id),\n get_org_from_ccx_course_url(course_id),\n ''\n )\n ) as org,\n emission_time as emission_time,\n event::String as event\nfrom {{ source(\"xapi\", \"xapi_events_all\") }}", "language": "sql", "refs": [], "sources": [["xapi", "xapi_events_all"]], "metrics": [], "depends_on": {"macros": ["macro.aspects.get_engine", "macro.aspects.on_cluster"], "nodes": ["source.aspects.xapi.xapi_events_all"]}, "compiled_path": "target/compiled/aspects/models/base/xapi_events_all_parsed.sql", "compiled": true, "compiled_code": "\n\nselect\n event_id as event_id,\n toLowCardinality(JSON_VALUE(event::String, '$.verb.id')) as verb_id,\n COALESCE(\n NULLIF(JSON_VALUE(event::String, '$.actor.account.name'), ''),\n NULLIF(JSON_VALUE(event::String, '$.actor.mbox'), ''),\n JSON_VALUE(event::String, '$.actor.mbox_sha1sum')\n ) as actor_id,\n JSON_VALUE(event::String, '$.object.id') as object_id,\n -- If the contextActivities parent is a course, use that. It can be a \"course\"\n -- type, or a \"cmi.interaction\" type for multiple question problem submissions.\n -- Otherwise use the object id for the course id.\n toLowCardinality(\n multiIf(\n -- If the contextActivities parent is a course, use that\n JSON_VALUE(\n event::String, '$.context.contextActivities.parent[0].definition.type'\n )\n = 'http://adlnet.gov/expapi/activities/course',\n JSON_VALUE(event::String, '$.context.contextActivities.parent[0].id'),\n -- Else if the contextActivities parent is a GroupActivity, it's a multi\n -- question problem and we use the grouping id\n JSON_VALUE(\n event::String, '$.context.contextActivities.parent[0].objectType'\n )\n in ('Activity', 'GroupActivity'),\n JSON_VALUE(event::String, '$.context.contextActivities.grouping[0].id'),\n -- Otherwise use the object id\n JSON_VALUE(event::String, '$.object.id')\n )\n ) as course_id,\n toLowCardinality(splitByString('/', course_id)[-1]) as course_key,\n toLowCardinality(\n coalesce(\n get_org_from_course_url(course_id),\n get_org_from_ccx_course_url(course_id),\n ''\n )\n ) as org,\n emission_time as emission_time,\n event::String as event\nfrom `xapi`.`xapi_events_all`", "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.aspects.int_pages_per_subsection": {"database": "", "schema": "xapi", "name": "int_pages_per_subsection", "resource_type": "model", "package_name": "aspects", "path": "navigation/int_pages_per_subsection.sql", "original_file_path": "models/navigation/int_pages_per_subsection.sql", "unique_id": "model.aspects.int_pages_per_subsection", "fqn": ["aspects", "navigation", "int_pages_per_subsection"], "alias": "int_pages_per_subsection", "checksum": {"name": "sha256", "checksum": "157337fb72683a82aa1c9dc95d1885038ba643c3bc17224fed8736f1d7044bc3"}, "config": {"enabled": true, "alias": null, "schema": null, "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": "A view for analyzing the number of pages in each subsection", "columns": {"org": {"name": "org", "description": "The organization that the course belongs to", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_key": {"name": "course_key", "description": "The course identifier", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "section_number": {"name": "section_number", "description": "The section number", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "section_with_name": {"name": "section_with_name", "description": "The section number and name", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "subsection_number": {"name": "subsection_number", "description": "The subsection number", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "subsection_with_name": {"name": "subsection_with_name", "description": "The subsection number and name", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_order": {"name": "course_order", "description": "The sort order of this block in the course across all course blocks", "meta": {}, "data_type": "Int32", "constraints": [], "quote": null, "tags": []}, "graded": {"name": "graded", "description": "Whether the unit is graded", "meta": {}, "data_type": "Boolean", "constraints": [], "quote": null, "tags": []}, "item_count": {"name": "item_count", "description": "The number of pages in the associated subsection", "meta": {}, "data_type": "UInt64", "constraints": [], "quote": null, "tags": []}, "subsection_block_id": {"name": "subsection_block_id", "description": "The unique identifier for the subsection block", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "section_block_id": {"name": "section_block_id", "description": "The unique identifier for the section block", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "aspects://models/navigation/schema.yml", "build_path": null, "unrendered_config": {}, "created_at": 1723229145.028501, "relation_name": "`xapi`.`int_pages_per_subsection`", "raw_code": "select * from ({{ items_per_subsection(\"%@vertical+block@%\") }})", "language": "sql", "refs": [{"name": "dim_course_blocks", "package": null, "version": null}, {"name": "dim_course_blocks", "package": null, "version": null}, {"name": "dim_course_blocks", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.aspects.items_per_subsection"], "nodes": ["model.aspects.dim_course_blocks"]}, "compiled_path": "target/compiled/aspects/models/navigation/int_pages_per_subsection.sql", "compiled": true, "compiled_code": "select * from (\n with\n items_per_subsection as (\n select\n org,\n course_key,\n section_number,\n subsection_number,\n course_order,\n graded,\n count(*) as item_count\n from `xapi`.`dim_course_blocks`\n where block_id like '%@vertical+block@%'\n group by\n org, course_key, section_number, subsection_number, course_order, graded\n )\n\n select\n ips.org as org,\n ips.course_key as course_key,\n ips.section_number as section_number,\n section_blocks.display_name_with_location as section_with_name,\n ips.subsection_number as subsection_number,\n subsection_blocks.display_name_with_location as subsection_with_name,\n ips.course_order as course_order,\n ips.graded as graded,\n ips.item_count as item_count,\n subsection_blocks.block_id as subsection_block_id,\n section_blocks.block_id as section_block_id\n from items_per_subsection ips\n left join\n `xapi`.`dim_course_blocks` section_blocks\n on (\n ips.section_number = section_blocks.hierarchy_location\n and ips.org = section_blocks.org\n and ips.course_key = section_blocks.course_key\n and section_blocks.block_id like '%@chapter+block@%'\n )\n left join\n `xapi`.`dim_course_blocks` subsection_blocks\n on (\n ips.subsection_number = subsection_blocks.hierarchy_location\n and ips.org = subsection_blocks.org\n and ips.course_key = subsection_blocks.course_key\n and subsection_blocks.block_id like '%@sequential+block@%'\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.aspects.fact_learner_last_course_visit": {"database": "", "schema": "xapi", "name": "fact_learner_last_course_visit", "resource_type": "model", "package_name": "aspects", "path": "navigation/fact_learner_last_course_visit.sql", "original_file_path": "models/navigation/fact_learner_last_course_visit.sql", "unique_id": "model.aspects.fact_learner_last_course_visit", "fqn": ["aspects", "navigation", "fact_learner_last_course_visit"], "alias": "fact_learner_last_course_visit", "checksum": {"name": "sha256", "checksum": "1742158805f568d348f81e63dc240faa230563f6da0943f11a22d5113c64f20b"}, "config": {"enabled": true, "alias": null, "schema": "xapi", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "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", "engine": "\n ReplacingMergeTree()", "order_by": "(org, course_key, actor_id)", "partition_by": "(toYYYYMM(emission_time))", "ttl": "", "primary_key": "(org, course_key, actor_id)"}, "tags": [], "description": "A materialized view that stores a learners last navigation event timestamp for a course", "columns": {"org": {"name": "org", "description": "The organization that the course belongs to", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_key": {"name": "course_key", "description": "The course identifier", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "actor_id": {"name": "actor_id", "description": "The xAPI actor identifier", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "emission_time": {"name": "emission_time", "description": "Timestamp, to the second, of when this event was emitted", "meta": {}, "data_type": "DateTime", "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "aspects://models/navigation/schema.yml", "build_path": null, "unrendered_config": {"materialized": "materialized_view", "schema": "xapi", "engine": "\n ReplacingMergeTree()", "primary_key": "(org, course_key, actor_id)", "order_by": "(org, course_key, actor_id)", "partition_by": "(toYYYYMM(emission_time))", "ttl": ""}, "created_at": 1723229145.0311422, "relation_name": "`xapi`.`fact_learner_last_course_visit`", "raw_code": "{{\n config(\n materialized=\"materialized_view\",\n schema=env_var(\"ASPECTS_XAPI_DATABASE\", \"xapi\"),\n engine=get_engine(\"ReplacingMergeTree()\"),\n primary_key=\"(org, course_key, actor_id)\",\n order_by=\"(org, course_key, actor_id)\",\n partition_by=\"(toYYYYMM(emission_time))\",\n ttl=env_var(\"ASPECTS_DATA_TTL_EXPRESSION\", \"\"),\n )\n}}\n\nselect org, course_key, actor_id, max(emission_time) as emission_time\nfrom {{ ref(\"navigation_events\") }}\ngroup by org, course_key, actor_id", "language": "sql", "refs": [{"name": "navigation_events", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.aspects.get_engine"], "nodes": ["model.aspects.navigation_events"]}, "compiled_path": "target/compiled/aspects/models/navigation/fact_learner_last_course_visit.sql", "compiled": true, "compiled_code": "\n\nselect org, course_key, actor_id, max(emission_time) as emission_time\nfrom `xapi`.`navigation_events`\ngroup by org, course_key, actor_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.aspects.subsection_page_engagement": {"database": "", "schema": "xapi", "name": "subsection_page_engagement", "resource_type": "model", "package_name": "aspects", "path": "navigation/subsection_page_engagement.sql", "original_file_path": "models/navigation/subsection_page_engagement.sql", "unique_id": "model.aspects.subsection_page_engagement", "fqn": ["aspects", "navigation", "subsection_page_engagement"], "alias": "subsection_page_engagement", "checksum": {"name": "sha256", "checksum": "7c18a0d825e3f7fd80735a3e57f2cb636faf829f8b2a93f299c57f59f01b03ca"}, "config": {"enabled": true, "alias": null, "schema": "xapi", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "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", "engine": "\n ReplacingMergeTree()", "order_by": "(org, course_key, subsection_block_id, actor_id)", "primary_key": "(org, course_key)"}, "tags": [], "description": "A record per course per subsection per learner with their engagement level", "columns": {"org": {"name": "org", "description": "The organization that the course belongs to", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_key": {"name": "course_key", "description": "The course key for the course", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "actor_id": {"name": "actor_id", "description": "The xAPI actor identifier", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "subsection_block_id": {"name": "subsection_block_id", "description": "The unique identifier for the subsection block", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "engagement_level": {"name": "engagement_level", "description": "The engagement level of the learner with the subsection", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "aspects://models/navigation/schema.yml", "build_path": null, "unrendered_config": {"materialized": "materialized_view", "schema": "xapi", "engine": "\n ReplacingMergeTree()", "primary_key": "(org, course_key)", "order_by": "(org, course_key, subsection_block_id, actor_id)"}, "created_at": 1723229145.0325322, "relation_name": "`xapi`.`subsection_page_engagement`", "raw_code": "{{\n config(\n materialized=\"materialized_view\",\n schema=env_var(\"ASPECTS_XAPI_DATABASE\", \"xapi\"),\n engine=get_engine(\"ReplacingMergeTree()\"),\n primary_key=\"(org, course_key)\",\n order_by=\"(org, course_key, subsection_block_id, actor_id)\",\n )\n}}\n\nwith\n fact_navigation as (\n select\n navigation.emission_time as emission_time,\n navigation.org as org,\n navigation.course_key as course_key,\n navigation.actor_id as actor_id,\n navigation.block_id as block_id,\n blocks.display_name_with_location as block_name_with_location\n from {{ ref(\"navigation_events\") }} navigation\n join\n {{ ref(\"dim_course_blocks\") }} blocks\n on (\n navigation.course_key = blocks.course_key\n and navigation.block_id = blocks.block_id\n )\n ),\n visited_subsection_pages as (\n select distinct\n date(emission_time) as visited_on,\n org,\n course_key,\n {{ section_from_display(\"block_name_with_location\") }} as section_number,\n {{ subsection_from_display(\"block_name_with_location\") }}\n as subsection_number,\n actor_id,\n block_id\n from fact_navigation\n ),\n fact_navigation_completion as (\n select\n visits.visited_on as visited_on,\n visits.org as org,\n visits.course_key as course_key,\n pages.section_with_name as section_with_name,\n pages.subsection_with_name as subsection_with_name,\n pages.item_count as item_count,\n visits.actor_id as actor_id,\n visits.block_id as block_id,\n pages.subsection_block_id as subsection_block_id\n from visited_subsection_pages visits\n join\n {{ ref(\"int_pages_per_subsection\") }} pages\n on (\n visits.org = pages.org\n and visits.course_key = pages.course_key\n and visits.section_number = pages.section_number\n and visits.subsection_number = pages.subsection_number\n )\n ),\n subsection_counts as (\n select\n org,\n course_key,\n section_with_name,\n subsection_with_name,\n actor_id,\n item_count,\n count(distinct block_id) as pages_visited,\n case\n when pages_visited = 0\n then 'No pages viewed yet'\n when pages_visited = item_count\n then 'All pages viewed'\n else 'At least one page viewed'\n end as engagement_level,\n subsection_block_id\n from fact_navigation_completion\n group by\n org,\n course_key,\n section_with_name,\n subsection_with_name,\n actor_id,\n item_count,\n subsection_block_id\n )\n\nselect org, course_key, actor_id, subsection_block_id, engagement_level\nfrom subsection_counts", "language": "sql", "refs": [{"name": "navigation_events", "package": null, "version": null}, {"name": "dim_course_blocks", "package": null, "version": null}, {"name": "int_pages_per_subsection", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.aspects.get_engine", "macro.aspects.section_from_display", "macro.aspects.subsection_from_display"], "nodes": ["model.aspects.navigation_events", "model.aspects.dim_course_blocks", "model.aspects.int_pages_per_subsection"]}, "compiled_path": "target/compiled/aspects/models/navigation/subsection_page_engagement.sql", "compiled": true, "compiled_code": "\n\nwith\n fact_navigation as (\n select\n navigation.emission_time as emission_time,\n navigation.org as org,\n navigation.course_key as course_key,\n navigation.actor_id as actor_id,\n navigation.block_id as block_id,\n blocks.display_name_with_location as block_name_with_location\n from `xapi`.`navigation_events` navigation\n join\n `xapi`.`dim_course_blocks` blocks\n on (\n navigation.course_key = blocks.course_key\n and navigation.block_id = blocks.block_id\n )\n ),\n visited_subsection_pages as (\n select distinct\n date(emission_time) as visited_on,\n org,\n course_key,\n \n concat(\n splitByString(\n ':', splitByString(' - ', block_name_with_location)[1], 1\n )[1],\n ':0:0'\n )\n as section_number,\n \n concat(\n arrayStringConcat(\n splitByString(\n ':', splitByString(' - ', block_name_with_location)[1], 2\n ),\n ':'\n ),\n ':0'\n )\n\n as subsection_number,\n actor_id,\n block_id\n from fact_navigation\n ),\n fact_navigation_completion as (\n select\n visits.visited_on as visited_on,\n visits.org as org,\n visits.course_key as course_key,\n pages.section_with_name as section_with_name,\n pages.subsection_with_name as subsection_with_name,\n pages.item_count as item_count,\n visits.actor_id as actor_id,\n visits.block_id as block_id,\n pages.subsection_block_id as subsection_block_id\n from visited_subsection_pages visits\n join\n `xapi`.`int_pages_per_subsection` pages\n on (\n visits.org = pages.org\n and visits.course_key = pages.course_key\n and visits.section_number = pages.section_number\n and visits.subsection_number = pages.subsection_number\n )\n ),\n subsection_counts as (\n select\n org,\n course_key,\n section_with_name,\n subsection_with_name,\n actor_id,\n item_count,\n count(distinct block_id) as pages_visited,\n case\n when pages_visited = 0\n then 'No pages viewed yet'\n when pages_visited = item_count\n then 'All pages viewed'\n else 'At least one page viewed'\n end as engagement_level,\n subsection_block_id\n from fact_navigation_completion\n group by\n org,\n course_key,\n section_with_name,\n subsection_with_name,\n actor_id,\n item_count,\n subsection_block_id\n )\n\nselect org, course_key, actor_id, subsection_block_id, engagement_level\nfrom subsection_counts", "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.aspects.fact_pageview_engagement": {"database": "", "schema": "xapi", "name": "fact_pageview_engagement", "resource_type": "model", "package_name": "aspects", "path": "navigation/fact_pageview_engagement.sql", "original_file_path": "models/navigation/fact_pageview_engagement.sql", "unique_id": "model.aspects.fact_pageview_engagement", "fqn": ["aspects", "navigation", "fact_pageview_engagement"], "alias": "fact_pageview_engagement", "checksum": {"name": "sha256", "checksum": "af19d40d074e7f785aab0477ac6293a637601d043a48c4fef983b13f0aeacf26"}, "config": {"enabled": true, "alias": null, "schema": null, "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": "A view for analyzing the number of page views per learner per section and subsection", "columns": {"org": {"name": "org", "description": "The organization that the course belongs to", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_key": {"name": "course_key", "description": "The course identifier", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_run": {"name": "course_run", "description": "The course run for the course", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "section_with_name": {"name": "section_with_name", "description": "The name of the section", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "subsection_with_name": {"name": "subsection_with_name", "description": "The name of the subsection", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "section_subsection_name": {"name": "section_subsection_name", "description": "The name of the section or subsection", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "content_level": {"name": "content_level", "description": "The level at which page views are counted", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "actor_id": {"name": "actor_id", "description": "The xAPI actor identifier", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "section_subsection_page_engagement": {"name": "section_subsection_page_engagement", "description": "The total number of times a learner viewed pages in this section or subsection", "meta": {}, "data_type": "UInt64", "constraints": [], "quote": null, "tags": []}, "username": {"name": "username", "description": "The username of the learner", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "name": {"name": "name", "description": "The full name of the learner", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "email": {"name": "email", "description": "The email address of the learner", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "aspects://models/navigation/schema.yml", "build_path": null, "unrendered_config": {}, "created_at": 1723229145.0305245, "relation_name": "`xapi`.`fact_pageview_engagement`", "raw_code": "with\n subsection_engagement as (\n select\n org,\n course_key,\n 'subsection' as content_level,\n actor_id,\n subsection_block_id as block_id,\n engagement_level as section_subsection_page_engagement\n from {{ ref(\"subsection_page_engagement\") }}\n ),\n section_engagement as (\n select\n org,\n course_key,\n 'section' as content_level,\n actor_id,\n section_block_id as block_id,\n engagement_level as section_subsection_page_engagement\n from {{ ref(\"section_page_engagement\") }}\n ),\n page_engagement as (\n select *\n from subsection_engagement\n union all\n select *\n from section_engagement\n )\n\nselect\n pv.org as org,\n pv.course_key as course_key,\n course_blocks.course_run as course_run,\n course_blocks.display_name_with_location as section_subsection_name,\n pv.content_level as content_level,\n pv.actor_id as actor_id,\n pv.section_subsection_page_engagement as section_subsection_page_engagement,\n users.username as username,\n users.name as name,\n users.email as email\nfrom page_engagement pv\njoin\n {{ ref(\"dim_course_blocks\") }} course_blocks\n on (\n pv.org = course_blocks.org\n and pv.course_key = course_blocks.course_key\n and pv.block_id = course_blocks.block_id\n )\nleft outer join\n {{ ref(\"dim_user_pii\") }} users on toUUID(pv.actor_id) = users.external_user_id", "language": "sql", "refs": [{"name": "subsection_page_engagement", "package": null, "version": null}, {"name": "section_page_engagement", "package": null, "version": null}, {"name": "dim_course_blocks", "package": null, "version": null}, {"name": "dim_user_pii", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.aspects.subsection_page_engagement", "model.aspects.section_page_engagement", "model.aspects.dim_course_blocks", "model.aspects.dim_user_pii"]}, "compiled_path": "target/compiled/aspects/models/navigation/fact_pageview_engagement.sql", "compiled": true, "compiled_code": "with\n subsection_engagement as (\n select\n org,\n course_key,\n 'subsection' as content_level,\n actor_id,\n subsection_block_id as block_id,\n engagement_level as section_subsection_page_engagement\n from `xapi`.`subsection_page_engagement`\n ),\n section_engagement as (\n select\n org,\n course_key,\n 'section' as content_level,\n actor_id,\n section_block_id as block_id,\n engagement_level as section_subsection_page_engagement\n from `xapi`.`section_page_engagement`\n ),\n page_engagement as (\n select *\n from subsection_engagement\n union all\n select *\n from section_engagement\n )\n\nselect\n pv.org as org,\n pv.course_key as course_key,\n course_blocks.course_run as course_run,\n course_blocks.display_name_with_location as section_subsection_name,\n pv.content_level as content_level,\n pv.actor_id as actor_id,\n pv.section_subsection_page_engagement as section_subsection_page_engagement,\n users.username as username,\n users.name as name,\n users.email as email\nfrom page_engagement pv\njoin\n `xapi`.`dim_course_blocks` course_blocks\n on (\n pv.org = course_blocks.org\n and pv.course_key = course_blocks.course_key\n and pv.block_id = course_blocks.block_id\n )\nleft outer join\n `xapi`.`dim_user_pii` users on toUUID(pv.actor_id) = users.external_user_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.aspects.fact_navigation": {"database": "", "schema": "xapi", "name": "fact_navigation", "resource_type": "model", "package_name": "aspects", "path": "navigation/fact_navigation.sql", "original_file_path": "models/navigation/fact_navigation.sql", "unique_id": "model.aspects.fact_navigation", "fqn": ["aspects", "navigation", "fact_navigation"], "alias": "fact_navigation", "checksum": {"name": "sha256", "checksum": "fedcdf93920cee5d71d2a1d279ba3a6df2d2ffbdeab7d91e09bd165dc3921abe"}, "config": {"enabled": true, "alias": null, "schema": null, "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": "A view of navigation_events enriched with course and block metadata", "columns": {"emission_time": {"name": "emission_time", "description": "Timestamp, to the second, of when this event was emitted", "meta": {}, "data_type": "DateTime", "constraints": [], "quote": null, "tags": []}, "org": {"name": "org", "description": "The organization that the course belongs to", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_key": {"name": "course_key", "description": "The course identifier", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_name": {"name": "course_name", "description": "The name of the course", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_run": {"name": "course_run", "description": "The course run for the course", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "actor_id": {"name": "actor_id", "description": "The xAPI actor identifier", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "block_id": {"name": "block_id", "description": "The LMS object identifier", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "block_name": {"name": "block_name", "description": "The block's name", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "block_name_with_location": {"name": "block_name_with_location", "description": "The block's display name with section, subsection, and unit prepended to the name. This provides additional context when looking at block names and can help data consumers understand which block they are analyzing", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "object_type": {"name": "object_type", "description": "The type of object that the learner interacted with", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "starting_position": {"name": "starting_position", "description": "The tab in the unit navigation bar that the learner was viewing before clicking a link", "meta": {}, "data_type": "Int64", "constraints": [], "quote": null, "tags": []}, "ending_point": {"name": "ending_point", "description": "The tab in the unit navigation bar that the learner selected to navigate to", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "username": {"name": "username", "description": "The username of the learner", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "name": {"name": "name", "description": "The full name of the learner", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "email": {"name": "email", "description": "The email address of the learner", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_order": {"name": "course_order", "description": "The sort order of this block in the course across all course blocks", "meta": {}, "data_type": "Int32", "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "aspects://models/navigation/schema.yml", "build_path": null, "unrendered_config": {}, "created_at": 1723229145.0257757, "relation_name": "`xapi`.`fact_navigation`", "raw_code": "select\n navigation.emission_time as emission_time,\n navigation.org as org,\n navigation.course_key as course_key,\n blocks.course_name as course_name,\n blocks.course_run as course_run,\n navigation.actor_id as actor_id,\n navigation.block_id as block_id,\n blocks.block_name as block_name,\n blocks.display_name_with_location as block_name_with_location,\n blocks.course_order as course_order,\n navigation.object_type as object_type,\n navigation.starting_position as starting_position,\n navigation.ending_point as ending_point,\n users.username as username,\n users.name as name,\n users.email as email\nfrom {{ ref(\"navigation_events\") }} navigation\njoin\n {{ ref(\"dim_course_blocks\") }} blocks\n on (\n navigation.course_key = blocks.course_key\n and navigation.block_id = blocks.block_id\n )\nleft outer join\n {{ ref(\"dim_user_pii\") }} users on toUUID(actor_id) = users.external_user_id", "language": "sql", "refs": [{"name": "navigation_events", "package": null, "version": null}, {"name": "dim_course_blocks", "package": null, "version": null}, {"name": "dim_user_pii", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.aspects.navigation_events", "model.aspects.dim_course_blocks", "model.aspects.dim_user_pii"]}, "compiled_path": "target/compiled/aspects/models/navigation/fact_navigation.sql", "compiled": true, "compiled_code": "select\n navigation.emission_time as emission_time,\n navigation.org as org,\n navigation.course_key as course_key,\n blocks.course_name as course_name,\n blocks.course_run as course_run,\n navigation.actor_id as actor_id,\n navigation.block_id as block_id,\n blocks.block_name as block_name,\n blocks.display_name_with_location as block_name_with_location,\n blocks.course_order as course_order,\n navigation.object_type as object_type,\n navigation.starting_position as starting_position,\n navigation.ending_point as ending_point,\n users.username as username,\n users.name as name,\n users.email as email\nfrom `xapi`.`navigation_events` navigation\njoin\n `xapi`.`dim_course_blocks` blocks\n on (\n navigation.course_key = blocks.course_key\n and navigation.block_id = blocks.block_id\n )\nleft outer join\n `xapi`.`dim_user_pii` users on toUUID(actor_id) = users.external_user_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.aspects.fact_navigation_completion": {"database": "", "schema": "xapi", "name": "fact_navigation_completion", "resource_type": "model", "package_name": "aspects", "path": "navigation/fact_navigation_completion.sql", "original_file_path": "models/navigation/fact_navigation_completion.sql", "unique_id": "model.aspects.fact_navigation_completion", "fqn": ["aspects", "navigation", "fact_navigation_completion"], "alias": "fact_navigation_completion", "checksum": {"name": "sha256", "checksum": "0306927e93c1f866131888d6bd818aa473682c3bc72256e38a658c266fef6c96"}, "config": {"enabled": true, "alias": null, "schema": null, "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": "A view for analyzing how many pages a learner has visited in a section or subsection", "columns": {"visited_on": {"name": "visited_on", "description": "The Date the page was visited", "meta": {}, "data_type": "Date", "constraints": [], "quote": null, "tags": []}, "org": {"name": "org", "description": "The organization that the course belongs to", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_key": {"name": "course_key", "description": "The course identifier", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_name": {"name": "course_name", "description": "The course name", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_run": {"name": "course_run", "description": "The course run for the course", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "section_with_name": {"name": "section_with_name", "description": "The name of the section", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "subsection_with_name": {"name": "subsection_with_name", "description": "The name of the subsection", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "page_count": {"name": "page_count", "description": "The number of pages in the associated subsection", "meta": {}, "data_type": "UInt64", "constraints": [], "quote": null, "tags": []}, "actor_id": {"name": "actor_id", "description": "The xAPI actor identifier", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "block_id": {"name": "block_id", "description": "The ID of the specific page visited", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "username": {"name": "username", "description": "The username of the learner", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "name": {"name": "name", "description": "The full name of the learner", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "email": {"name": "email", "description": "The email address of the learner", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_order": {"name": "course_order", "description": "The sort order of this block in the course across all course blocks", "meta": {}, "data_type": "Int32", "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "aspects://models/navigation/schema.yml", "build_path": null, "unrendered_config": {}, "created_at": 1723229145.0276082, "relation_name": "`xapi`.`fact_navigation_completion`", "raw_code": "-- number of learners who've viewed all pages in a section/subsection\nwith\n visited_subsection_pages as (\n select distinct\n date(emission_time) as visited_on,\n org,\n course_key,\n course_name,\n course_run,\n {{ section_from_display(\"block_name_with_location\") }} as section_number,\n {{ subsection_from_display(\"block_name_with_location\") }}\n as subsection_number,\n actor_id,\n block_id,\n username,\n name,\n email\n from {{ ref(\"fact_navigation\") }}\n )\n\nselect\n visits.visited_on as visited_on,\n visits.org as org,\n visits.course_key as course_key,\n visits.course_name as course_name,\n visits.course_run as course_run,\n pages.section_with_name as section_with_name,\n pages.subsection_with_name as subsection_with_name,\n pages.course_order as course_order,\n pages.item_count as page_count,\n visits.actor_id as actor_id,\n visits.block_id as block_id,\n visits.username as username,\n visits.name as name,\n visits.email as email\nfrom visited_subsection_pages visits\njoin\n {{ ref(\"int_pages_per_subsection\") }} pages\n on (\n visits.org = pages.org\n and visits.course_key = pages.course_key\n and visits.section_number = pages.section_number\n and visits.subsection_number = pages.subsection_number\n )", "language": "sql", "refs": [{"name": "fact_navigation", "package": null, "version": null}, {"name": "int_pages_per_subsection", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.aspects.section_from_display", "macro.aspects.subsection_from_display"], "nodes": ["model.aspects.fact_navigation", "model.aspects.int_pages_per_subsection"]}, "compiled_path": "target/compiled/aspects/models/navigation/fact_navigation_completion.sql", "compiled": true, "compiled_code": "-- number of learners who've viewed all pages in a section/subsection\nwith\n visited_subsection_pages as (\n select distinct\n date(emission_time) as visited_on,\n org,\n course_key,\n course_name,\n course_run,\n \n concat(\n splitByString(\n ':', splitByString(' - ', block_name_with_location)[1], 1\n )[1],\n ':0:0'\n )\n as section_number,\n \n concat(\n arrayStringConcat(\n splitByString(\n ':', splitByString(' - ', block_name_with_location)[1], 2\n ),\n ':'\n ),\n ':0'\n )\n\n as subsection_number,\n actor_id,\n block_id,\n username,\n name,\n email\n from `xapi`.`fact_navigation`\n )\n\nselect\n visits.visited_on as visited_on,\n visits.org as org,\n visits.course_key as course_key,\n visits.course_name as course_name,\n visits.course_run as course_run,\n pages.section_with_name as section_with_name,\n pages.subsection_with_name as subsection_with_name,\n pages.course_order as course_order,\n pages.item_count as page_count,\n visits.actor_id as actor_id,\n visits.block_id as block_id,\n visits.username as username,\n visits.name as name,\n visits.email as email\nfrom visited_subsection_pages visits\njoin\n `xapi`.`int_pages_per_subsection` pages\n on (\n visits.org = pages.org\n and visits.course_key = pages.course_key\n and visits.section_number = pages.section_number\n and visits.subsection_number = pages.subsection_number\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.aspects.navigation_events": {"database": "", "schema": "xapi", "name": "navigation_events", "resource_type": "model", "package_name": "aspects", "path": "navigation/navigation_events.sql", "original_file_path": "models/navigation/navigation_events.sql", "unique_id": "model.aspects.navigation_events", "fqn": ["aspects", "navigation", "navigation_events"], "alias": "navigation_events", "checksum": {"name": "sha256", "checksum": "62c4af9d418c53e355ab215c806528e3171c33d28a71cddcc2cfc88f7899ebd6"}, "config": {"enabled": true, "alias": null, "schema": "xapi", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "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", "engine": "\n ReplacingMergeTree()", "order_by": "(org, course_key, object_type, emission_time, actor_id, starting_position, event_id)", "partition_by": "(toYYYYMM(emission_time))", "ttl": "", "primary_key": "(org, course_key, object_type)"}, "tags": [], "description": "A materialized view for xAPI events related to course navigation", "columns": {"event_id": {"name": "event_id", "description": "The unique identifier for the event", "meta": {}, "data_type": "UUID", "constraints": [], "quote": null, "tags": []}, "emission_time": {"name": "emission_time", "description": "Timestamp, to the second, of when this event was emitted", "meta": {}, "data_type": "DateTime", "constraints": [], "quote": null, "tags": []}, "actor_id": {"name": "actor_id", "description": "The xAPI actor identifier", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "block_id": {"name": "block_id", "description": "The LMS object identifier", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_key": {"name": "course_key", "description": "The course identifier", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "org": {"name": "org", "description": "The organization that the course belongs to", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "verb_id": {"name": "verb_id", "description": "The xAPI verb identifier", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "object_type": {"name": "object_type", "description": "The type of object that the learner interacted with", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "starting_position": {"name": "starting_position", "description": "The tab in the unit navigation bar that the learner was viewing before clicking a link", "meta": {}, "data_type": "Int64", "constraints": [], "quote": null, "tags": []}, "ending_point": {"name": "ending_point", "description": "The tab in the unit navigation bar that the learner selected to navigate to", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "aspects://models/navigation/schema.yml", "build_path": null, "unrendered_config": {"materialized": "materialized_view", "schema": "xapi", "engine": "\n ReplacingMergeTree()", "primary_key": "(org, course_key, object_type)", "order_by": "(org, course_key, object_type, emission_time, actor_id, starting_position, event_id)", "partition_by": "(toYYYYMM(emission_time))", "ttl": ""}, "created_at": 1723229145.0238755, "relation_name": "`xapi`.`navigation_events`", "raw_code": "{{\n config(\n materialized=\"materialized_view\",\n schema=env_var(\"ASPECTS_XAPI_DATABASE\", \"xapi\"),\n engine=get_engine(\"ReplacingMergeTree()\"),\n primary_key=\"(org, course_key, object_type)\",\n order_by=\"(org, course_key, object_type, emission_time, actor_id, starting_position, event_id)\",\n partition_by=\"(toYYYYMM(emission_time))\",\n ttl=env_var(\"ASPECTS_DATA_TTL_EXPRESSION\", \"\"),\n )\n}}\n\nselect\n event_id,\n cast(emission_time as DateTime) as emission_time,\n actor_id,\n splitByString('/xblock/', object_id)[-1] as block_id,\n course_key,\n org,\n verb_id,\n JSONExtractString(event, 'object', 'definition', 'type') as object_type,\n -- clicking a link and selecting a module outline have no starting-position field\n if(\n object_type in (\n 'http://adlnet.gov/expapi/activities/link',\n 'http://adlnet.gov/expapi/activities/module'\n ),\n 0,\n JSONExtractInt(\n event,\n 'context',\n 'extensions',\n 'http://id.tincanapi.com/extension/starting-position'\n )\n ) as starting_position,\n JSONExtractString(\n event, 'context', 'extensions', 'http://id.tincanapi.com/extension/ending-point'\n ) as ending_point\nfrom {{ ref(\"xapi_events_all_parsed\") }}\nwhere verb_id in ('https://w3id.org/xapi/dod-isd/verbs/navigated')", "language": "sql", "refs": [{"name": "xapi_events_all_parsed", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.aspects.get_engine"], "nodes": ["model.aspects.xapi_events_all_parsed"]}, "compiled_path": "target/compiled/aspects/models/navigation/navigation_events.sql", "compiled": true, "compiled_code": "\n\nselect\n event_id,\n cast(emission_time as DateTime) as emission_time,\n actor_id,\n splitByString('/xblock/', object_id)[-1] as block_id,\n course_key,\n org,\n verb_id,\n JSONExtractString(event, 'object', 'definition', 'type') as object_type,\n -- clicking a link and selecting a module outline have no starting-position field\n if(\n object_type in (\n 'http://adlnet.gov/expapi/activities/link',\n 'http://adlnet.gov/expapi/activities/module'\n ),\n 0,\n JSONExtractInt(\n event,\n 'context',\n 'extensions',\n 'http://id.tincanapi.com/extension/starting-position'\n )\n ) as starting_position,\n JSONExtractString(\n event, 'context', 'extensions', 'http://id.tincanapi.com/extension/ending-point'\n ) as ending_point\nfrom `xapi`.`xapi_events_all_parsed`\nwhere verb_id in ('https://w3id.org/xapi/dod-isd/verbs/navigated')", "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.aspects.section_page_engagement": {"database": "", "schema": "xapi", "name": "section_page_engagement", "resource_type": "model", "package_name": "aspects", "path": "navigation/section_page_engagement.sql", "original_file_path": "models/navigation/section_page_engagement.sql", "unique_id": "model.aspects.section_page_engagement", "fqn": ["aspects", "navigation", "section_page_engagement"], "alias": "section_page_engagement", "checksum": {"name": "sha256", "checksum": "801300c920e1857ff7a0c48b7a58b45073b5380238faf615b574b649322313af"}, "config": {"enabled": true, "alias": null, "schema": "xapi", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "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", "engine": "\n ReplacingMergeTree()", "order_by": "(org, course_key, section_block_id, actor_id)", "primary_key": "(org, course_key)"}, "tags": [], "description": "A record per course per section per learner with their engagement level", "columns": {"org": {"name": "org", "description": "The organization that the course belongs to", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_key": {"name": "course_key", "description": "The course key for the course", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "actor_id": {"name": "actor_id", "description": "The xAPI actor identifier", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "section_block_id": {"name": "section_block_id", "description": "The unique identifier for the section block", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "engagement_level": {"name": "engagement_level", "description": "The engagement level of the learner with the section", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "aspects://models/navigation/schema.yml", "build_path": null, "unrendered_config": {"materialized": "materialized_view", "schema": "xapi", "engine": "\n ReplacingMergeTree()", "primary_key": "(org, course_key)", "order_by": "(org, course_key, section_block_id, actor_id)"}, "created_at": 1723229145.0318365, "relation_name": "`xapi`.`section_page_engagement`", "raw_code": "{{\n config(\n materialized=\"materialized_view\",\n schema=env_var(\"ASPECTS_XAPI_DATABASE\", \"xapi\"),\n engine=get_engine(\"ReplacingMergeTree()\"),\n primary_key=\"(org, course_key)\",\n order_by=\"(org, course_key, section_block_id, actor_id)\",\n )\n}}\n\nwith\n fact_navigation as (\n select\n navigation.emission_time as emission_time,\n navigation.org as org,\n navigation.course_key as course_key,\n navigation.actor_id as actor_id,\n navigation.block_id as block_id,\n blocks.display_name_with_location as block_name_with_location\n from {{ ref(\"navigation_events\") }} navigation\n join\n {{ ref(\"dim_course_blocks\") }} blocks\n on (\n navigation.course_key = blocks.course_key\n and navigation.block_id = blocks.block_id\n )\n ),\n visited_subsection_pages as (\n select distinct\n date(emission_time) as visited_on,\n org,\n course_key,\n {{ section_from_display(\"block_name_with_location\") }} as section_number,\n {{ subsection_from_display(\"block_name_with_location\") }}\n as subsection_number,\n actor_id,\n block_id\n from fact_navigation\n ),\n fact_navigation_completion as (\n select\n visits.visited_on as visited_on,\n visits.org as org,\n visits.course_key as course_key,\n pages.section_with_name as section_with_name,\n pages.subsection_with_name as subsection_with_name,\n pages.item_count as item_count,\n visits.actor_id as actor_id,\n visits.block_id as block_id,\n pages.section_block_id as section_block_id\n from visited_subsection_pages visits\n join\n {{ ref(\"int_pages_per_subsection\") }} pages\n on (\n visits.org = pages.org\n and visits.course_key = pages.course_key\n and visits.section_number = pages.section_number\n and visits.subsection_number = pages.subsection_number\n )\n ),\n subsection_counts as (\n select\n org,\n course_key,\n section_with_name,\n subsection_with_name,\n actor_id,\n item_count,\n count(distinct block_id) as pages_visited,\n case\n when pages_visited = 0\n then 'No pages viewed yet'\n when pages_visited = item_count\n then 'All pages viewed'\n else 'At least one page viewed'\n end as engagement_level,\n section_block_id\n from fact_navigation_completion\n group by\n org,\n course_key,\n section_with_name,\n subsection_with_name,\n actor_id,\n item_count,\n section_block_id\n ),\n section_counts as (\n select\n org,\n course_key,\n actor_id,\n sum(item_count) as item_count,\n sum(pages_visited) as pages_visited,\n case\n when pages_visited = 0\n then 'No pages viewed yet'\n when pages_visited = item_count\n then 'All pages viewed'\n else 'At least one page viewed'\n end as engagement_level,\n section_block_id\n from subsection_counts\n group by org, course_key, section_block_id, actor_id\n )\n\nselect org, course_key, actor_id, section_block_id, engagement_level\nfrom section_counts", "language": "sql", "refs": [{"name": "navigation_events", "package": null, "version": null}, {"name": "dim_course_blocks", "package": null, "version": null}, {"name": "int_pages_per_subsection", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.aspects.get_engine", "macro.aspects.section_from_display", "macro.aspects.subsection_from_display"], "nodes": ["model.aspects.navigation_events", "model.aspects.dim_course_blocks", "model.aspects.int_pages_per_subsection"]}, "compiled_path": "target/compiled/aspects/models/navigation/section_page_engagement.sql", "compiled": true, "compiled_code": "\n\nwith\n fact_navigation as (\n select\n navigation.emission_time as emission_time,\n navigation.org as org,\n navigation.course_key as course_key,\n navigation.actor_id as actor_id,\n navigation.block_id as block_id,\n blocks.display_name_with_location as block_name_with_location\n from `xapi`.`navigation_events` navigation\n join\n `xapi`.`dim_course_blocks` blocks\n on (\n navigation.course_key = blocks.course_key\n and navigation.block_id = blocks.block_id\n )\n ),\n visited_subsection_pages as (\n select distinct\n date(emission_time) as visited_on,\n org,\n course_key,\n \n concat(\n splitByString(\n ':', splitByString(' - ', block_name_with_location)[1], 1\n )[1],\n ':0:0'\n )\n as section_number,\n \n concat(\n arrayStringConcat(\n splitByString(\n ':', splitByString(' - ', block_name_with_location)[1], 2\n ),\n ':'\n ),\n ':0'\n )\n\n as subsection_number,\n actor_id,\n block_id\n from fact_navigation\n ),\n fact_navigation_completion as (\n select\n visits.visited_on as visited_on,\n visits.org as org,\n visits.course_key as course_key,\n pages.section_with_name as section_with_name,\n pages.subsection_with_name as subsection_with_name,\n pages.item_count as item_count,\n visits.actor_id as actor_id,\n visits.block_id as block_id,\n pages.section_block_id as section_block_id\n from visited_subsection_pages visits\n join\n `xapi`.`int_pages_per_subsection` pages\n on (\n visits.org = pages.org\n and visits.course_key = pages.course_key\n and visits.section_number = pages.section_number\n and visits.subsection_number = pages.subsection_number\n )\n ),\n subsection_counts as (\n select\n org,\n course_key,\n section_with_name,\n subsection_with_name,\n actor_id,\n item_count,\n count(distinct block_id) as pages_visited,\n case\n when pages_visited = 0\n then 'No pages viewed yet'\n when pages_visited = item_count\n then 'All pages viewed'\n else 'At least one page viewed'\n end as engagement_level,\n section_block_id\n from fact_navigation_completion\n group by\n org,\n course_key,\n section_with_name,\n subsection_with_name,\n actor_id,\n item_count,\n section_block_id\n ),\n section_counts as (\n select\n org,\n course_key,\n actor_id,\n sum(item_count) as item_count,\n sum(pages_visited) as pages_visited,\n case\n when pages_visited = 0\n then 'No pages viewed yet'\n when pages_visited = item_count\n then 'All pages viewed'\n else 'At least one page viewed'\n end as engagement_level,\n section_block_id\n from subsection_counts\n group by org, course_key, section_block_id, actor_id\n )\n\nselect org, course_key, actor_id, section_block_id, engagement_level\nfrom section_counts", "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.aspects.most_recent_course_blocks": {"database": "", "schema": "xapi", "name": "most_recent_course_blocks", "resource_type": "model", "package_name": "aspects", "path": "courses/most_recent_course_blocks.sql", "original_file_path": "models/courses/most_recent_course_blocks.sql", "unique_id": "model.aspects.most_recent_course_blocks", "fqn": ["aspects", "courses", "most_recent_course_blocks"], "alias": "most_recent_course_blocks", "checksum": {"name": "sha256", "checksum": "0f8320ce8fbe084846c2d4cf90c5632ed5ab812cc738cf1191734572b8861cdf"}, "config": {"enabled": true, "alias": null, "schema": "event_sink", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "materialized_view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "OPTIMIZE TABLE {{ this }} {{ on_cluster() }} FINAL", "transaction": true, "index": null}], "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", "engine": "\n ReplacingMergeTree()", "order_by": "(location)"}, "tags": [], "description": "A materialized view of course blocks with their display names and additional metadata. Only stores the most recent row per block location.", "columns": {"location": {"name": "location", "description": "The location of the block", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "block_name": {"name": "block_name", "description": "The name of the block", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_key": {"name": "course_key", "description": "The course which the block belongs to", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "graded": {"name": "graded", "description": "Whether the block is graded", "meta": {}, "data_type": "Boolean", "constraints": [], "quote": null, "tags": []}, "display_name_with_location": {"name": "display_name_with_location", "description": "The block's display name with section, subsection, and unit prepended to the name. This provides additional context when looking at block names and can help data consumers understand which block they are analyzing", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_order": {"name": "course_order", "description": "The sort order of this block in the course across all course blocks", "meta": {}, "data_type": "Int32", "constraints": [], "quote": null, "tags": []}, "section": {"name": "section", "description": "The section number that this block falls under in the course. Starts at 1.", "meta": {}, "data_type": "Int32", "constraints": [], "quote": null, "tags": []}, "subsection": {"name": "subsection", "description": "The subsection number that this block falls under in the section. Starts at 1.", "meta": {}, "data_type": "Int32", "constraints": [], "quote": null, "tags": []}, "unit": {"name": "unit", "description": "The unit number that this block falls under in the subsection. Starts at 1.", "meta": {}, "data_type": "Int32", "constraints": [], "quote": null, "tags": []}, "dump_id": {"name": "dump_id", "description": "The UUID of the event sink run that published this block to ClickHouse. When a course is published all blocks inside it are sent with the same dump_id.", "meta": {}, "data_type": "UUID", "constraints": [], "quote": null, "tags": []}, "time_last_dumped": {"name": "time_last_dumped", "description": "The datetime of the event sink run that published this block to ClickHouse. When a course is published all blocks inside it are sent with the same time_last_dumped.", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "aspects://models/courses/schema.yml", "build_path": null, "unrendered_config": {"materialized": "materialized_view", "schema": "event_sink", "engine": "\n ReplacingMergeTree()", "order_by": "(location)", "post-hook": ["OPTIMIZE TABLE {{ this }} {{ on_cluster() }} FINAL"]}, "created_at": 1723229145.0551176, "relation_name": "`xapi`.`most_recent_course_blocks`", "raw_code": "{{\n config(\n materialized=\"materialized_view\",\n schema=env_var(\"ASPECTS_EVENT_SINK_DATABASE\", \"event_sink\"),\n engine=get_engine(\"ReplacingMergeTree()\"),\n order_by=\"(location)\",\n post_hook=\"OPTIMIZE TABLE {{ this }} {{ on_cluster() }} FINAL\",\n )\n}}\n\nselect\n location,\n display_name as block_name,\n toString(section)\n || ':'\n || toString(subsection)\n || ':'\n || toString(unit)\n || ' - '\n || display_name as display_name_with_location,\n JSONExtractInt(xblock_data_json, 'section') as section,\n JSONExtractInt(xblock_data_json, 'subsection') as subsection,\n JSONExtractInt(xblock_data_json, 'unit') as unit,\n JSONExtractBool(xblock_data_json, 'graded') as graded,\n order as course_order,\n course_key,\n dump_id,\n time_last_dumped\nfrom {{ source(\"event_sink\", \"course_blocks\") }} course_blocks\njoin\n (\n select location, max(time_last_dumped) as max_time_last_dumped\n from {{ source(\"event_sink\", \"course_blocks\") }}\n group by location\n ) latest_course_blocks\n on course_blocks.location = latest_course_blocks.location\n and course_blocks.time_last_dumped = latest_course_blocks.max_time_last_dumped", "language": "sql", "refs": [], "sources": [["event_sink", "course_blocks"], ["event_sink", "course_blocks"]], "metrics": [], "depends_on": {"macros": ["macro.aspects.get_engine", "macro.aspects.on_cluster"], "nodes": ["source.aspects.event_sink.course_blocks"]}, "compiled_path": "target/compiled/aspects/models/courses/most_recent_course_blocks.sql", "compiled": true, "compiled_code": "\n\nselect\n location,\n display_name as block_name,\n toString(section)\n || ':'\n || toString(subsection)\n || ':'\n || toString(unit)\n || ' - '\n || display_name as display_name_with_location,\n JSONExtractInt(xblock_data_json, 'section') as section,\n JSONExtractInt(xblock_data_json, 'subsection') as subsection,\n JSONExtractInt(xblock_data_json, 'unit') as unit,\n JSONExtractBool(xblock_data_json, 'graded') as graded,\n order as course_order,\n course_key,\n dump_id,\n time_last_dumped\nfrom `event_sink`.`course_blocks` course_blocks\njoin\n (\n select location, max(time_last_dumped) as max_time_last_dumped\n from `event_sink`.`course_blocks`\n group by location\n ) latest_course_blocks\n on course_blocks.location = latest_course_blocks.location\n and course_blocks.time_last_dumped = latest_course_blocks.max_time_last_dumped", "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.aspects.course_block_names": {"database": "", "schema": "xapi", "name": "course_block_names", "resource_type": "model", "package_name": "aspects", "path": "courses/course_block_names.sql", "original_file_path": "models/courses/course_block_names.sql", "unique_id": "model.aspects.course_block_names", "fqn": ["aspects", "courses", "course_block_names"], "alias": "course_block_names", "checksum": {"name": "sha256", "checksum": "6933b776c5701841fe7562c97c03f8ba7bf23757546de725573de7fd414800f0"}, "config": {"enabled": true, "alias": null, "schema": "event_sink", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "dictionary", "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", "fields": [["location", "String"], ["block_name", "String"], ["course_key", "String"], ["graded", "Bool"], ["course_order", "Int32"], ["display_name_with_location", "String"]], "primary_key": "location", "layout": "COMPLEX_KEY_SPARSE_HASHED()", "lifetime": "120", "source_type": "clickhouse", "connection_overrides": {"host": "localhost"}}, "tags": [], "description": "An in-memory dictionary of course blocks with their display names and additional metadata. Only stores the most recent row per block location.", "columns": {"location": {"name": "location", "description": "The location of the block", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "block_name": {"name": "block_name", "description": "The name of the block", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_key": {"name": "course_key", "description": "The course which the block belongs to", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "graded": {"name": "graded", "description": "Whether the block is graded", "meta": {}, "data_type": "Boolean", "constraints": [], "quote": null, "tags": []}, "display_name_with_location": {"name": "display_name_with_location", "description": "The block's display name with section, subsection, and unit prepended to the name. This provides additional context when looking at block names and can help data consumers understand which block they are analyzing", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_order": {"name": "course_order", "description": "The sort order of this block in the course across all course blocks", "meta": {}, "data_type": "Int32", "constraints": [], "quote": null, "tags": []}, "section": {"name": "section", "description": "The section number that this block falls under in the course. Starts at 1.", "meta": {}, "data_type": "Int32", "constraints": [], "quote": null, "tags": []}, "subsection": {"name": "subsection", "description": "The subsection number that this block falls under in the section. Starts at 1.", "meta": {}, "data_type": "Int32", "constraints": [], "quote": null, "tags": []}, "unit": {"name": "unit", "description": "The unit number that this block falls under in the subsection. Starts at 1.", "meta": {}, "data_type": "Int32", "constraints": [], "quote": null, "tags": []}, "dump_id": {"name": "dump_id", "description": "The UUID of the event sink run that published this block to ClickHouse. When a course is published all blocks inside it are sent with the same dump_id.", "meta": {}, "data_type": "UUID", "constraints": [], "quote": null, "tags": []}, "time_last_dumped": {"name": "time_last_dumped", "description": "The Datetime of the event sink run that published this block to ClickHouse. When a course is published all blocks inside it are sent with the same time_last_dumped.", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "aspects://models/courses/schema.yml", "build_path": null, "unrendered_config": {"materialized": "dictionary", "schema": "event_sink", "fields": [["location", "String"], ["block_name", "String"], ["course_key", "String"], ["graded", "Bool"], ["course_order", "Int32"], ["display_name_with_location", "String"]], "primary_key": "location", "layout": "COMPLEX_KEY_SPARSE_HASHED()", "lifetime": "120", "source_type": "clickhouse", "connection_overrides": {"host": "localhost"}}, "created_at": 1723229145.05419, "relation_name": "`xapi`.`course_block_names`", "raw_code": "{{\n config(\n materialized=\"dictionary\",\n schema=env_var(\"ASPECTS_EVENT_SINK_DATABASE\", \"event_sink\"),\n fields=[\n (\"location\", \"String\"),\n (\"block_name\", \"String\"),\n (\"course_key\", \"String\"),\n (\"graded\", \"Bool\"),\n (\"course_order\", \"Int32\"),\n (\"display_name_with_location\", \"String\"),\n ],\n primary_key=\"location\",\n layout=\"COMPLEX_KEY_SPARSE_HASHED()\",\n lifetime=env_var(\"ASPECTS_BLOCK_NAME_CACHE_LIFETIME\", \"120\"),\n source_type=\"clickhouse\",\n connection_overrides={\n \"host\": \"localhost\",\n },\n )\n}}\nselect\n location, block_name, course_key, graded, course_order, display_name_with_location\nfrom {{ ref(\"most_recent_course_blocks\") }}", "language": "sql", "refs": [{"name": "most_recent_course_blocks", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.aspects.most_recent_course_blocks"]}, "compiled_path": "target/compiled/aspects/models/courses/course_block_names.sql", "compiled": true, "compiled_code": "\nselect\n location, block_name, course_key, graded, course_order, display_name_with_location\nfrom `xapi`.`most_recent_course_blocks`", "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.aspects.dim_course_blocks": {"database": "", "schema": "xapi", "name": "dim_course_blocks", "resource_type": "model", "package_name": "aspects", "path": "courses/dim_course_blocks.sql", "original_file_path": "models/courses/dim_course_blocks.sql", "unique_id": "model.aspects.dim_course_blocks", "fqn": ["aspects", "courses", "dim_course_blocks"], "alias": "dim_course_blocks", "checksum": {"name": "sha256", "checksum": "89cb965d3c845f1bd52e529617f3cdb65527ab39200559b2ea529dac72fbde00"}, "config": {"enabled": true, "alias": null, "schema": null, "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": "A denormalized table of course block information. This should be preferred over dim_course_blocks_extended when section and subsection names are not necessary to include in a model", "columns": {"org": {"name": "org", "description": "The organization that the course belongs to", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_key": {"name": "course_key", "description": "The course key for the course", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_name": {"name": "course_name", "description": "The name of the course", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_run": {"name": "course_run", "description": "The course run for the course", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "block_id": {"name": "block_id", "description": "The block's unique identifier", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "block_name": {"name": "block_name", "description": "The block's name", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "section_number": {"name": "section_number", "description": "The section this block belongs to, formatted as :0:0", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "subsection_number": {"name": "subsection_number", "description": "The subsection this block belongs to, formatted as ::0", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "hierarchy_location": {"name": "hierarchy_location", "description": "The full section:subsection:unit hierarchy in which this block belongs", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "display_name_with_location": {"name": "display_name_with_location", "description": "The block's display name with section, subsection, and unit prepended to the name. This provides additional context when looking at block names and can help data consumers understand which block they are analyzing", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_order": {"name": "course_order", "description": "The sort order of this block in the course across all course blocks", "meta": {}, "data_type": "Int32", "constraints": [], "quote": null, "tags": []}, "graded": {"name": "graded", "description": "Whether the block is graded", "meta": {}, "data_type": "Boolean", "constraints": [], "quote": null, "tags": []}, "block_type": {"name": "block_type", "description": "The type of block. This can be a section, subsection, unit, or the block type", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "aspects://models/courses/schema.yml", "build_path": null, "unrendered_config": {}, "created_at": 1723229145.053257, "relation_name": "`xapi`.`dim_course_blocks`", "raw_code": "select\n courses.org as org,\n courses.course_key as course_key,\n courses.course_name as course_name,\n courses.course_run as course_run,\n blocks.location as block_id,\n blocks.block_name as block_name,\n {{ section_from_display(\"blocks.display_name_with_location\") }} as section_number,\n {{ subsection_from_display(\"blocks.display_name_with_location\") }}\n as subsection_number,\n splitByString(' - ', blocks.display_name_with_location)[1] as hierarchy_location,\n blocks.display_name_with_location as display_name_with_location,\n course_order,\n graded,\n case\n when block_id like '%@chapter+block@%'\n then 'section'\n when block_id like '%@sequential+block@%'\n then 'subsection'\n when block_id like '%@vertical+block@%'\n then 'unit'\n else regexpExtract(block_id, '@([^+]+)\\+block@', 1)\n end as block_type\nfrom {{ ref(\"course_block_names\") }} blocks\njoin {{ ref(\"course_names\") }} courses on blocks.course_key = courses.course_key", "language": "sql", "refs": [{"name": "course_block_names", "package": null, "version": null}, {"name": "course_names", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.aspects.section_from_display", "macro.aspects.subsection_from_display"], "nodes": ["model.aspects.course_block_names", "model.aspects.course_names"]}, "compiled_path": "target/compiled/aspects/models/courses/dim_course_blocks.sql", "compiled": true, "compiled_code": "select\n courses.org as org,\n courses.course_key as course_key,\n courses.course_name as course_name,\n courses.course_run as course_run,\n blocks.location as block_id,\n blocks.block_name as block_name,\n \n concat(\n splitByString(\n ':', splitByString(' - ', blocks.display_name_with_location)[1], 1\n )[1],\n ':0:0'\n )\n as section_number,\n \n concat(\n arrayStringConcat(\n splitByString(\n ':', splitByString(' - ', blocks.display_name_with_location)[1], 2\n ),\n ':'\n ),\n ':0'\n )\n\n as subsection_number,\n splitByString(' - ', blocks.display_name_with_location)[1] as hierarchy_location,\n blocks.display_name_with_location as display_name_with_location,\n course_order,\n graded,\n case\n when block_id like '%@chapter+block@%'\n then 'section'\n when block_id like '%@sequential+block@%'\n then 'subsection'\n when block_id like '%@vertical+block@%'\n then 'unit'\n else regexpExtract(block_id, '@([^+]+)\\+block@', 1)\n end as block_type\nfrom `xapi`.`course_block_names` blocks\njoin `xapi`.`course_names` courses on blocks.course_key = courses.course_key", "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.aspects.course_names": {"database": "", "schema": "xapi", "name": "course_names", "resource_type": "model", "package_name": "aspects", "path": "courses/course_names.sql", "original_file_path": "models/courses/course_names.sql", "unique_id": "model.aspects.course_names", "fqn": ["aspects", "courses", "course_names"], "alias": "course_names", "checksum": {"name": "sha256", "checksum": "e5d77448bfdc32f7d60d5ab96e1ecc596f16e006119432684c5725007292e205"}, "config": {"enabled": true, "alias": null, "schema": "event_sink", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "dictionary", "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", "fields": [["course_key", "String"], ["course_name", "String"], ["course_run", "String"], ["org", "String"]], "primary_key": "course_key", "layout": "COMPLEX_KEY_HASHED()", "lifetime": "120", "source_type": "clickhouse", "connection_overrides": {"host": "localhost"}}, "tags": [], "description": "A table of courses with their names", "columns": {"course_key": {"name": "course_key", "description": "The course key for the course", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_name": {"name": "course_name", "description": "The name of the course", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_run": {"name": "course_run", "description": "The course run for the course", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "org": {"name": "org", "description": "The organization that the course belongs to", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "aspects://models/courses/schema.yml", "build_path": null, "unrendered_config": {"materialized": "dictionary", "schema": "event_sink", "fields": [["course_key", "String"], ["course_name", "String"], ["course_run", "String"], ["org", "String"]], "primary_key": "course_key", "layout": "COMPLEX_KEY_HASHED()", "lifetime": "120", "source_type": "clickhouse", "connection_overrides": {"host": "localhost"}}, "created_at": 1723229145.0557058, "relation_name": "`xapi`.`course_names`", "raw_code": "{{\n config(\n materialized=\"dictionary\",\n schema=env_var(\"ASPECTS_EVENT_SINK_DATABASE\", \"event_sink\"),\n fields=[\n (\"course_key\", \"String\"),\n (\"course_name\", \"String\"),\n (\"course_run\", \"String\"),\n (\"org\", \"String\"),\n ],\n primary_key=\"course_key\",\n layout=\"COMPLEX_KEY_HASHED()\",\n lifetime=env_var(\"ASPECTS_COURSE_NAME_CACHE_LIFETIME\", \"120\"),\n source_type=\"clickhouse\",\n connection_overrides={\n \"host\": \"localhost\",\n },\n )\n}}\n\nwith\n most_recent_overviews as (\n select org, course_key, max(modified) as last_modified\n from {{ source(\"event_sink\", \"course_overviews\") }}\n group by org, course_key\n )\nselect\n course_key,\n display_name as course_name,\n splitByString('+', course_key)[-1] as course_run,\n org\nfrom {{ source(\"event_sink\", \"course_overviews\") }} co\ninner join\n most_recent_overviews mro\n on co.org = mro.org\n and co.course_key = mro.course_key\n and co.modified = mro.last_modified", "language": "sql", "refs": [], "sources": [["event_sink", "course_overviews"], ["event_sink", "course_overviews"]], "metrics": [], "depends_on": {"macros": [], "nodes": ["source.aspects.event_sink.course_overviews"]}, "compiled_path": "target/compiled/aspects/models/courses/course_names.sql", "compiled": true, "compiled_code": "\n\nwith\n most_recent_overviews as (\n select org, course_key, max(modified) as last_modified\n from `event_sink`.`course_overviews`\n group by org, course_key\n )\nselect\n course_key,\n display_name as course_name,\n splitByString('+', course_key)[-1] as course_run,\n org\nfrom `event_sink`.`course_overviews` co\ninner join\n most_recent_overviews mro\n on co.org = mro.org\n and co.course_key = mro.course_key\n and co.modified = mro.last_modified", "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.aspects.dim_course_blocks_extended": {"database": "", "schema": "xapi", "name": "dim_course_blocks_extended", "resource_type": "model", "package_name": "aspects", "path": "courses/dim_course_blocks_extended.sql", "original_file_path": "models/courses/dim_course_blocks_extended.sql", "unique_id": "model.aspects.dim_course_blocks_extended", "fqn": ["aspects", "courses", "dim_course_blocks_extended"], "alias": "dim_course_blocks_extended", "checksum": {"name": "sha256", "checksum": "40e5bf47d8b788c9ddcddcb67b793fa839c4e217a9b39b7c70a9e902a2928485"}, "config": {"enabled": true, "alias": null, "schema": null, "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": "dim_course_blocks with section and subsection names joined into the data.", "columns": {"org": {"name": "org", "description": "The organization that the course belongs to", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_key": {"name": "course_key", "description": "The course key for the course", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_name": {"name": "course_name", "description": "The name of the course", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_run": {"name": "course_run", "description": "The course run for the course", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "block_id": {"name": "block_id", "description": "The block's unique identifier", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "block_name": {"name": "block_name", "description": "The block's name", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "section_number": {"name": "section_number", "description": "The section this block belongs to, formatted as :0:0", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "subsection_number": {"name": "subsection_number", "description": "The subsection this block belongs to, formatted as ::0", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "hierarchy_location": {"name": "hierarchy_location", "description": "The full section:subsection:unit hierarchy in which this block belongs", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "display_name_with_location": {"name": "display_name_with_location", "description": "The block's display name with section, subsection, and unit prepended to the name. This provides additional context when looking at block names and can help data consumers understand which block they are analyzing", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "graded": {"name": "graded", "description": "Whether the block is graded", "meta": {}, "data_type": "Boolean", "constraints": [], "quote": null, "tags": []}, "block_type": {"name": "block_type", "description": "The type of block. This can be a section, subsection, unit, or the block type", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "section_with_name": {"name": "section_with_name", "description": "The name of the section this block belongs to, with section_number prepended", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "subsection_with_name": {"name": "subsection_with_name", "description": "The name of the section this subsection belongs to, with subsection_number prepended", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_order": {"name": "course_order", "description": "The sort order of this block in the course across all course blocks", "meta": {}, "data_type": "Int32", "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "aspects://models/courses/schema.yml", "build_path": null, "unrendered_config": {}, "created_at": 1723229145.0568297, "relation_name": "`xapi`.`dim_course_blocks_extended`", "raw_code": "select\n blocks.org as org,\n blocks.course_key as course_key,\n blocks.course_name as course_name,\n blocks.course_run as course_run,\n blocks.block_id as block_id,\n blocks.block_name as block_name,\n blocks.section_number as section_number,\n blocks.subsection_number as subsection_number,\n blocks.hierarchy_location as hierarchy_location,\n blocks.display_name_with_location as display_name_with_location,\n blocks.graded as graded,\n blocks.course_order as course_order,\n blocks.block_type as block_type,\n section_blocks.display_name_with_location as section_with_name,\n subsection_blocks.display_name_with_location as subsection_with_name\nfrom {{ ref(\"dim_course_blocks\") }} blocks\nleft join\n {{ ref(\"dim_course_blocks\") }} section_blocks\n on (\n blocks.section_number = section_blocks.hierarchy_location\n and blocks.org = section_blocks.org\n and blocks.course_key = section_blocks.course_key\n and section_blocks.block_id like '%@chapter+block@%'\n )\nleft join\n {{ ref(\"dim_course_blocks\") }} subsection_blocks\n on (\n blocks.subsection_number = subsection_blocks.hierarchy_location\n and blocks.org = subsection_blocks.org\n and blocks.course_key = subsection_blocks.course_key\n and subsection_blocks.block_id like '%@sequential+block@%'\n )", "language": "sql", "refs": [{"name": "dim_course_blocks", "package": null, "version": null}, {"name": "dim_course_blocks", "package": null, "version": null}, {"name": "dim_course_blocks", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.aspects.dim_course_blocks"]}, "compiled_path": "target/compiled/aspects/models/courses/dim_course_blocks_extended.sql", "compiled": true, "compiled_code": "select\n blocks.org as org,\n blocks.course_key as course_key,\n blocks.course_name as course_name,\n blocks.course_run as course_run,\n blocks.block_id as block_id,\n blocks.block_name as block_name,\n blocks.section_number as section_number,\n blocks.subsection_number as subsection_number,\n blocks.hierarchy_location as hierarchy_location,\n blocks.display_name_with_location as display_name_with_location,\n blocks.graded as graded,\n blocks.course_order as course_order,\n blocks.block_type as block_type,\n section_blocks.display_name_with_location as section_with_name,\n subsection_blocks.display_name_with_location as subsection_with_name\nfrom `xapi`.`dim_course_blocks` blocks\nleft join\n `xapi`.`dim_course_blocks` section_blocks\n on (\n blocks.section_number = section_blocks.hierarchy_location\n and blocks.org = section_blocks.org\n and blocks.course_key = section_blocks.course_key\n and section_blocks.block_id like '%@chapter+block@%'\n )\nleft join\n `xapi`.`dim_course_blocks` subsection_blocks\n on (\n blocks.subsection_number = subsection_blocks.hierarchy_location\n and blocks.org = subsection_blocks.org\n and blocks.course_key = subsection_blocks.course_key\n and subsection_blocks.block_id like '%@sequential+block@%'\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.aspects.fact_video_plays": {"database": "", "schema": "xapi", "name": "fact_video_plays", "resource_type": "model", "package_name": "aspects", "path": "video/fact_video_plays.sql", "original_file_path": "models/video/fact_video_plays.sql", "unique_id": "model.aspects.fact_video_plays", "fqn": ["aspects", "video", "fact_video_plays"], "alias": "fact_video_plays", "checksum": {"name": "sha256", "checksum": "318b681ff711047f401c5cef658d3782a098b690c0e36314dcd40c0f4450e197"}, "config": {"enabled": true, "alias": null, "schema": null, "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": "One record for each time a learner played a video", "columns": {"emission_time": {"name": "emission_time", "description": "Timestamp, to the second, of when this event was emitted", "meta": {}, "data_type": "DateTime", "constraints": [], "quote": null, "tags": []}, "org": {"name": "org", "description": "The organization that the course belongs to", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_key": {"name": "course_key", "description": "The course key for the course", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_name": {"name": "course_name", "description": "The name of the course", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_run": {"name": "course_run", "description": "The course run for the course", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "video_id": {"name": "video_id", "description": "The xAPI object identifier", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "video_name": {"name": "video_name", "description": "The name of the video", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "video_name_with_location": {"name": "video_name_with_location", "description": "The name of the video with the section and subsection", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "video_link": {"name": "video_link", "description": "An anchor tag with a link to the video", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "graded": {"name": "graded", "description": "Whether the block is graded", "meta": {}, "data_type": "Boolean", "constraints": [], "quote": null, "tags": []}, "actor_id": {"name": "actor_id", "description": "The xAPI actor identifier", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "video_duration": {"name": "video_duration", "description": "The duration of the video in seconds", "meta": {}, "data_type": "Int64", "constraints": [], "quote": null, "tags": []}, "video_position": {"name": "video_position", "description": "The seconds into the video where the play event occurred", "meta": {}, "data_type": "Int64", "constraints": [], "quote": null, "tags": []}, "visualization_bucket": {"name": "visualization_bucket", "description": "The percentile bucket for the video play event", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "username": {"name": "username", "description": "The username of the learner", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "name": {"name": "name", "description": "The full name of the learner", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "email": {"name": "email", "description": "The email address of the learner", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "section_with_name": {"name": "section_with_name", "description": "The name of the section this video belongs to, with section_number prepended", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "subsection_with_name": {"name": "subsection_with_name", "description": "The name of the subsection this video belongs to, with subsection_number prepended", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "course_order": {"name": "course_order", "description": "The sort order of this block in the course across all course blocks", "meta": {}, "data_type": "Int32", "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "aspects://models/video/schema.yml", "build_path": null, "unrendered_config": {}, "created_at": 1723229145.0603814, "relation_name": "`xapi`.`fact_video_plays`", "raw_code": "-- model to support number of watches per video\n-- ref:\n-- https://edx.readthedocs.io/projects/edx-insights/en/latest/Reference.html#engagement-computations\nwith\n plays as (\n select\n emission_time,\n org,\n course_key,\n object_id,\n video_duration,\n video_position,\n splitByString('/xblock/', object_id)[-1] as video_id,\n actor_id\n from {{ ref(\"video_playback_events\") }}\n where verb_id = 'https://w3id.org/xapi/video/verbs/played'\n )\n\nselect\n plays.emission_time as emission_time,\n plays.org as org,\n plays.course_key as course_key,\n blocks.course_name as course_name,\n blocks.course_run as course_run,\n plays.video_id as video_id,\n blocks.block_name as video_name,\n blocks.display_name_with_location as video_name_with_location,\n {{ a_tag(\"plays.object_id\", \"blocks.block_name\") }} as video_link,\n blocks.graded as graded,\n plays.video_position as video_position,\n plays.video_duration as video_duration,\n {{ get_bucket(\"video_position/video_duration\") }} as visualization_bucket,\n plays.actor_id as actor_id,\n users.username as username,\n users.name as name,\n users.email as email,\n blocks.section_with_name as section_with_name,\n blocks.subsection_with_name as subsection_with_name,\n blocks.course_order as course_order\nfrom plays\njoin\n {{ ref(\"dim_course_blocks_extended\") }} blocks\n on (plays.course_key = blocks.course_key and plays.video_id = blocks.block_id)\nleft outer join\n {{ ref(\"dim_user_pii\") }} users on toUUID(actor_id) = users.external_user_id", "language": "sql", "refs": [{"name": "video_playback_events", "package": null, "version": null}, {"name": "dim_course_blocks_extended", "package": null, "version": null}, {"name": "dim_user_pii", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.aspects.a_tag", "macro.aspects.get_bucket"], "nodes": ["model.aspects.video_playback_events", "model.aspects.dim_course_blocks_extended", "model.aspects.dim_user_pii"]}, "compiled_path": "target/compiled/aspects/models/video/fact_video_plays.sql", "compiled": true, "compiled_code": "-- model to support number of watches per video\n-- ref:\n-- https://edx.readthedocs.io/projects/edx-insights/en/latest/Reference.html#engagement-computations\nwith\n plays as (\n select\n emission_time,\n org,\n course_key,\n object_id,\n video_duration,\n video_position,\n splitByString('/xblock/', object_id)[-1] as video_id,\n actor_id\n from `xapi`.`video_playback_events`\n where verb_id = 'https://w3id.org/xapi/video/verbs/played'\n )\n\nselect\n plays.emission_time as emission_time,\n plays.org as org,\n plays.course_key as course_key,\n blocks.course_name as course_name,\n blocks.course_run as course_run,\n plays.video_id as video_id,\n blocks.block_name as video_name,\n blocks.display_name_with_location as video_name_with_location,\n \n concat(\n '', blocks.block_name, ''\n )\n as video_link,\n blocks.graded as graded,\n plays.video_position as video_position,\n plays.video_duration as video_duration,\n case\n when video_position/video_duration >= 0.9\n then '90-100%'\n when video_position/video_duration >= 0.8 and video_position/video_duration < 0.9\n then '80-89%'\n when video_position/video_duration >= 0.7 and video_position/video_duration < 0.8\n then '70-79%'\n when video_position/video_duration >= 0.6 and video_position/video_duration < 0.7\n then '60-69%'\n when video_position/video_duration >= 0.5 and video_position/video_duration < 0.6\n then '50-59%'\n when video_position/video_duration >= 0.4 and video_position/video_duration < 0.5\n then '40-49%'\n when video_position/video_duration >= 0.3 and video_position/video_duration < 0.4\n then '30-39%'\n when video_position/video_duration >= 0.2 and video_position/video_duration < 0.3\n then '20-29%'\n when video_position/video_duration >= 0.1 and video_position/video_duration < 0.2\n then '10-19%'\n else '0-9%'\n end as visualization_bucket,\n plays.actor_id as actor_id,\n users.username as username,\n users.name as name,\n users.email as email,\n blocks.section_with_name as section_with_name,\n blocks.subsection_with_name as subsection_with_name,\n blocks.course_order as course_order\nfrom plays\njoin\n `xapi`.`dim_course_blocks_extended` blocks\n on (plays.course_key = blocks.course_key and plays.video_id = blocks.block_id)\nleft outer join\n `xapi`.`dim_user_pii` users on toUUID(actor_id) = users.external_user_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.aspects.fact_video_engagement": {"database": "", "schema": "xapi", "name": "fact_video_engagement", "resource_type": "model", "package_name": "aspects", "path": "video/fact_video_engagement.sql", "original_file_path": "models/video/fact_video_engagement.sql", "unique_id": "model.aspects.fact_video_engagement", "fqn": ["aspects", "video", "fact_video_engagement"], "alias": "fact_video_engagement", "checksum": {"name": "sha256", "checksum": "8e4f4f8c49b7970ae89b05b8dfccf909507c9c93ced2c4e10a4683f7e54257d0"}, "config": {"enabled": true, "alias": null, "schema": null, "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": "A dataset with one record representing the engagement of a learner with a video", "columns": {"org": {"name": "org", "description": "The organization that the video belongs to", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "course_key": {"name": "course_key", "description": "The course key for the course", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "course_run": {"name": "course_run", "description": "The course run for the course", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "section_with_name": {"name": "section_with_name", "description": "The name of the section this subsection belongs to, with section_number prepended", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "subsection_with_name": {"name": "subsection_with_name", "description": "The name of the subsection, with section_number prepended", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "section_subsection_name": {"name": "section_subsection_name", "description": "The name of the section or the subsection", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "content_level": {"name": "content_level", "description": "The content level of the video", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "actor_id": {"name": "actor_id", "description": "The xAPI actor identifier", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "section_subsection_video_engagement": {"name": "section_subsection_video_engagement", "description": "The engagement level of the learner with the video", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "username": {"name": "username", "description": "The username of the learner", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "name": {"name": "name", "description": "The full name of the learner", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "email": {"name": "email", "description": "The email address of the learner", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "aspects://models/video/schema.yml", "build_path": null, "unrendered_config": {}, "created_at": 1723229145.0650246, "relation_name": "`xapi`.`fact_video_engagement`", "raw_code": "with\n subsection_engagement as (\n select\n org,\n course_key,\n 'subsection' as content_level,\n actor_id,\n subsection_block_id as block_id,\n engagement_level as section_subsection_video_engagement\n from {{ ref(\"subsection_video_engagement\") }}\n ),\n section_engagement as (\n select\n org,\n course_key,\n 'section' as content_level,\n actor_id,\n section_block_id as block_id,\n engagement_level as section_subsection_video_engagement\n from {{ ref(\"section_video_engagement\") }}\n ),\n video_engagement as (\n select *\n from subsection_engagement\n union all\n select *\n from section_engagement\n )\nselect\n ve.org as org,\n ve.course_key as course_key,\n course_blocks.course_run as course_run,\n course_blocks.display_name_with_location as section_subsection_name,\n ve.content_level as content_level,\n ve.actor_id as actor_id,\n ve.section_subsection_video_engagement as section_subsection_video_engagement,\n users.username as username,\n users.name as name,\n users.email as email\nfrom video_engagement ve\njoin\n {{ ref(\"dim_course_blocks\") }} course_blocks\n on (\n ve.org = course_blocks.org\n and ve.course_key = course_blocks.course_key\n and ve.block_id = course_blocks.block_id\n )\nleft outer join\n {{ ref(\"dim_user_pii\") }} users on toUUID(ve.actor_id) = users.external_user_id", "language": "sql", "refs": [{"name": "subsection_video_engagement", "package": null, "version": null}, {"name": "section_video_engagement", "package": null, "version": null}, {"name": "dim_course_blocks", "package": null, "version": null}, {"name": "dim_user_pii", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.aspects.subsection_video_engagement", "model.aspects.section_video_engagement", "model.aspects.dim_course_blocks", "model.aspects.dim_user_pii"]}, "compiled_path": "target/compiled/aspects/models/video/fact_video_engagement.sql", "compiled": true, "compiled_code": "with\n subsection_engagement as (\n select\n org,\n course_key,\n 'subsection' as content_level,\n actor_id,\n subsection_block_id as block_id,\n engagement_level as section_subsection_video_engagement\n from `xapi`.`subsection_video_engagement`\n ),\n section_engagement as (\n select\n org,\n course_key,\n 'section' as content_level,\n actor_id,\n section_block_id as block_id,\n engagement_level as section_subsection_video_engagement\n from `xapi`.`section_video_engagement`\n ),\n video_engagement as (\n select *\n from subsection_engagement\n union all\n select *\n from section_engagement\n )\nselect\n ve.org as org,\n ve.course_key as course_key,\n course_blocks.course_run as course_run,\n course_blocks.display_name_with_location as section_subsection_name,\n ve.content_level as content_level,\n ve.actor_id as actor_id,\n ve.section_subsection_video_engagement as section_subsection_video_engagement,\n users.username as username,\n users.name as name,\n users.email as email\nfrom video_engagement ve\njoin\n `xapi`.`dim_course_blocks` course_blocks\n on (\n ve.org = course_blocks.org\n and ve.course_key = course_blocks.course_key\n and ve.block_id = course_blocks.block_id\n )\nleft outer join\n `xapi`.`dim_user_pii` users on toUUID(ve.actor_id) = users.external_user_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.aspects.section_video_engagement": {"database": "", "schema": "xapi", "name": "section_video_engagement", "resource_type": "model", "package_name": "aspects", "path": "video/section_video_engagement.sql", "original_file_path": "models/video/section_video_engagement.sql", "unique_id": "model.aspects.section_video_engagement", "fqn": ["aspects", "video", "section_video_engagement"], "alias": "section_video_engagement", "checksum": {"name": "sha256", "checksum": "e1faecd8052346a0a55780f549f68d57b386ebdb31c0bcb9a9b98083a3466560"}, "config": {"enabled": true, "alias": null, "schema": "xapi", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "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", "engine": "\n ReplacingMergeTree()", "order_by": "(org, course_key, section_block_id, actor_id)", "primary_key": "(org, course_key)"}, "tags": [], "description": "A record per course per section per learner with their engagement level", "columns": {"org": {"name": "org", "description": "The organization that the course belongs to", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "course_key": {"name": "course_key", "description": "The course key for the course", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "actor_id": {"name": "actor_id", "description": "The xAPI actor identifier", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "section_block_id": {"name": "section_block_id", "description": "The unique identifier for the section block", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "engagement_level": {"name": "engagement_level", "description": "The engagement level of the learner with the section", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "aspects://models/video/schema.yml", "build_path": null, "unrendered_config": {"materialized": "materialized_view", "schema": "xapi", "engine": "\n ReplacingMergeTree()", "primary_key": "(org, course_key)", "order_by": "(org, course_key, section_block_id, actor_id)"}, "created_at": 1723229145.0657487, "relation_name": "`xapi`.`section_video_engagement`", "raw_code": "{{\n config(\n materialized=\"materialized_view\",\n schema=env_var(\"ASPECTS_XAPI_DATABASE\", \"xapi\"),\n engine=get_engine(\"ReplacingMergeTree()\"),\n primary_key=\"(org, course_key)\",\n order_by=\"(org, course_key, section_block_id, actor_id)\",\n )\n}}\n\nwith\n viewed_subsection_videos as (\n select distinct\n date(emission_time) as viewed_on,\n org,\n course_key,\n {{ section_from_display(\"video_name_with_location\") }} as section_number,\n {{ subsection_from_display(\"video_name_with_location\") }}\n as subsection_number,\n actor_id,\n video_id\n from {{ ref(\"fact_video_plays\") }}\n ),\n fact_video_engagement_per_subsection as (\n select\n views.org as org,\n views.course_key as course_key,\n videos.section_with_name as section_with_name,\n videos.subsection_with_name as subsection_with_name,\n videos.item_count as item_count,\n views.actor_id as actor_id,\n views.video_id as video_id,\n videos.section_block_id as section_block_id\n from viewed_subsection_videos views\n join\n {{ ref(\"int_videos_per_subsection\") }} videos\n on (\n views.org = videos.org\n and views.course_key = videos.course_key\n and views.section_number = videos.section_number\n and views.subsection_number = videos.subsection_number\n )\n ),\n subsection_counts as (\n select\n org,\n course_key,\n section_with_name,\n subsection_with_name,\n actor_id,\n item_count,\n count(distinct video_id) as videos_viewed,\n case\n when videos_viewed = 0\n then 'No videos viewed yet'\n when videos_viewed = item_count\n then 'All videos viewed'\n else 'At least one video viewed'\n end as engagement_level,\n section_block_id\n from fact_video_engagement_per_subsection\n group by\n org,\n course_key,\n section_with_name,\n subsection_with_name,\n actor_id,\n item_count,\n section_block_id\n ),\n section_counts as (\n select\n org,\n course_key,\n actor_id,\n sum(item_count) as item_count,\n sum(videos_viewed) as videos_viewed,\n case\n when videos_viewed = 0\n then 'No videos viewed yet'\n when videos_viewed = item_count\n then 'All videos viewed'\n else 'At least one video viewed'\n end as engagement_level,\n section_block_id\n from subsection_counts\n group by org, course_key, section_block_id, actor_id\n )\nselect org, course_key, actor_id, section_block_id, engagement_level\nfrom section_counts", "language": "sql", "refs": [{"name": "fact_video_plays", "package": null, "version": null}, {"name": "int_videos_per_subsection", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.aspects.get_engine", "macro.aspects.section_from_display", "macro.aspects.subsection_from_display"], "nodes": ["model.aspects.fact_video_plays", "model.aspects.int_videos_per_subsection"]}, "compiled_path": "target/compiled/aspects/models/video/section_video_engagement.sql", "compiled": true, "compiled_code": "\n\nwith\n viewed_subsection_videos as (\n select distinct\n date(emission_time) as viewed_on,\n org,\n course_key,\n \n concat(\n splitByString(\n ':', splitByString(' - ', video_name_with_location)[1], 1\n )[1],\n ':0:0'\n )\n as section_number,\n \n concat(\n arrayStringConcat(\n splitByString(\n ':', splitByString(' - ', video_name_with_location)[1], 2\n ),\n ':'\n ),\n ':0'\n )\n\n as subsection_number,\n actor_id,\n video_id\n from `xapi`.`fact_video_plays`\n ),\n fact_video_engagement_per_subsection as (\n select\n views.org as org,\n views.course_key as course_key,\n videos.section_with_name as section_with_name,\n videos.subsection_with_name as subsection_with_name,\n videos.item_count as item_count,\n views.actor_id as actor_id,\n views.video_id as video_id,\n videos.section_block_id as section_block_id\n from viewed_subsection_videos views\n join\n `xapi`.`int_videos_per_subsection` videos\n on (\n views.org = videos.org\n and views.course_key = videos.course_key\n and views.section_number = videos.section_number\n and views.subsection_number = videos.subsection_number\n )\n ),\n subsection_counts as (\n select\n org,\n course_key,\n section_with_name,\n subsection_with_name,\n actor_id,\n item_count,\n count(distinct video_id) as videos_viewed,\n case\n when videos_viewed = 0\n then 'No videos viewed yet'\n when videos_viewed = item_count\n then 'All videos viewed'\n else 'At least one video viewed'\n end as engagement_level,\n section_block_id\n from fact_video_engagement_per_subsection\n group by\n org,\n course_key,\n section_with_name,\n subsection_with_name,\n actor_id,\n item_count,\n section_block_id\n ),\n section_counts as (\n select\n org,\n course_key,\n actor_id,\n sum(item_count) as item_count,\n sum(videos_viewed) as videos_viewed,\n case\n when videos_viewed = 0\n then 'No videos viewed yet'\n when videos_viewed = item_count\n then 'All videos viewed'\n else 'At least one video viewed'\n end as engagement_level,\n section_block_id\n from subsection_counts\n group by org, course_key, section_block_id, actor_id\n )\nselect org, course_key, actor_id, section_block_id, engagement_level\nfrom section_counts", "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.aspects.video_playback_events": {"database": "", "schema": "xapi", "name": "video_playback_events", "resource_type": "model", "package_name": "aspects", "path": "video/video_playback_events.sql", "original_file_path": "models/video/video_playback_events.sql", "unique_id": "model.aspects.video_playback_events", "fqn": ["aspects", "video", "video_playback_events"], "alias": "video_playback_events", "checksum": {"name": "sha256", "checksum": "30efe06d3eb1c3e5d9469c92a3ee4d767b726cff8a8aafc8e129d1cfea410c30"}, "config": {"enabled": true, "alias": null, "schema": "xapi", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "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", "engine": "\n ReplacingMergeTree()", "order_by": "(org, course_key, verb_id, emission_time, actor_id, video_position, event_id)", "partition_by": "(toYYYYMM(emission_time))", "ttl": "", "primary_key": "(org, course_key, verb_id)"}, "tags": [], "description": "Events related to video playback", "columns": {"event_id": {"name": "event_id", "description": "The unique identifier for the event", "meta": {}, "data_type": "uuid", "constraints": [], "quote": null, "tags": []}, "emission_time": {"name": "emission_time", "description": "The time the event was emitted", "meta": {}, "data_type": "datetime", "constraints": [], "quote": null, "tags": []}, "actor_id": {"name": "actor_id", "description": "The xAPI actor identifier", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "object_id": {"name": "object_id", "description": "The xAPI object identifier", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "course_key": {"name": "course_key", "description": "The course identifier", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "org": {"name": "org", "description": "The organization that the course belongs to", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "verb_id": {"name": "verb_id", "description": "The xAPI verb identifier", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "video_position": {"name": "video_position", "description": "The position in the video where the event occurred", "meta": {}, "data_type": "decimal(9, 2)", "constraints": [], "quote": null, "tags": []}, "video_duration": {"name": "video_duration", "description": "The duration of the video in seconds", "meta": {}, "data_type": "int64", "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "aspects://models/video/schema.yml", "build_path": null, "unrendered_config": {"materialized": "materialized_view", "schema": "xapi", "engine": "\n ReplacingMergeTree()", "primary_key": "(org, course_key, verb_id)", "order_by": "(org, course_key, verb_id, emission_time, actor_id, video_position, event_id)", "partition_by": "(toYYYYMM(emission_time))", "ttl": ""}, "created_at": 1723229145.0624382, "relation_name": "`xapi`.`video_playback_events`", "raw_code": "{{\n config(\n materialized=\"materialized_view\",\n schema=env_var(\"ASPECTS_XAPI_DATABASE\", \"xapi\"),\n engine=get_engine(\"ReplacingMergeTree()\"),\n primary_key=\"(org, course_key, verb_id)\",\n order_by=\"(org, course_key, verb_id, emission_time, actor_id, video_position, event_id)\",\n partition_by=\"(toYYYYMM(emission_time))\",\n ttl=env_var(\"ASPECTS_DATA_TTL_EXPRESSION\", \"\"),\n )\n}}\n\nselect\n event_id,\n CAST(emission_time, 'DateTime') as emission_time,\n actor_id,\n object_id,\n course_key,\n org,\n verb_id,\n ceil(\n CAST(\n coalesce(\n nullIf(\n JSON_VALUE(\n event,\n '$.result.extensions.\"https://w3id.org/xapi/video/extensions/time\"'\n ),\n ''\n ),\n nullIf(\n JSON_VALUE(\n event,\n '$.result.extensions.\"https://w3id.org/xapi/video/extensions/time-from\"'\n ),\n ''\n ),\n '0.0'\n ),\n 'Decimal32(2)'\n )\n ) as video_position,\n JSONExtractInt(\n event, 'context', 'extensions', 'https://w3id.org/xapi/video/extensions/length'\n ) as video_duration\nfrom {{ ref(\"xapi_events_all_parsed\") }}\nwhere\n (\n verb_id in (\n 'http://adlnet.gov/expapi/verbs/completed',\n 'http://adlnet.gov/expapi/verbs/initialized',\n 'http://adlnet.gov/expapi/verbs/terminated',\n 'https://w3id.org/xapi/video/verbs/paused',\n 'https://w3id.org/xapi/video/verbs/played',\n 'https://w3id.org/xapi/video/verbs/seeked'\n )\n )\n and (object_id like '%video+block%')", "language": "sql", "refs": [{"name": "xapi_events_all_parsed", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.aspects.get_engine"], "nodes": ["model.aspects.xapi_events_all_parsed"]}, "compiled_path": "target/compiled/aspects/models/video/video_playback_events.sql", "compiled": true, "compiled_code": "\n\nselect\n event_id,\n CAST(emission_time, 'DateTime') as emission_time,\n actor_id,\n object_id,\n course_key,\n org,\n verb_id,\n ceil(\n CAST(\n coalesce(\n nullIf(\n JSON_VALUE(\n event,\n '$.result.extensions.\"https://w3id.org/xapi/video/extensions/time\"'\n ),\n ''\n ),\n nullIf(\n JSON_VALUE(\n event,\n '$.result.extensions.\"https://w3id.org/xapi/video/extensions/time-from\"'\n ),\n ''\n ),\n '0.0'\n ),\n 'Decimal32(2)'\n )\n ) as video_position,\n JSONExtractInt(\n event, 'context', 'extensions', 'https://w3id.org/xapi/video/extensions/length'\n ) as video_duration\nfrom `xapi`.`xapi_events_all_parsed`\nwhere\n (\n verb_id in (\n 'http://adlnet.gov/expapi/verbs/completed',\n 'http://adlnet.gov/expapi/verbs/initialized',\n 'http://adlnet.gov/expapi/verbs/terminated',\n 'https://w3id.org/xapi/video/verbs/paused',\n 'https://w3id.org/xapi/video/verbs/played',\n 'https://w3id.org/xapi/video/verbs/seeked'\n )\n )\n and (object_id like '%video+block%')", "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.aspects.subsection_video_engagement": {"database": "", "schema": "xapi", "name": "subsection_video_engagement", "resource_type": "model", "package_name": "aspects", "path": "video/subsection_video_engagement.sql", "original_file_path": "models/video/subsection_video_engagement.sql", "unique_id": "model.aspects.subsection_video_engagement", "fqn": ["aspects", "video", "subsection_video_engagement"], "alias": "subsection_video_engagement", "checksum": {"name": "sha256", "checksum": "b1852a5536b3b6570a1f67f70630dc2fbc9577ce1936d2fb7e11bb64308c03e9"}, "config": {"enabled": true, "alias": null, "schema": "xapi", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "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", "engine": "\n ReplacingMergeTree()", "order_by": "(org, course_key, subsection_block_id, actor_id)", "primary_key": "(org, course_key)"}, "tags": [], "description": "A record per course per subsection per learner with their engagement level", "columns": {"org": {"name": "org", "description": "The organization that the course belongs to", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "course_key": {"name": "course_key", "description": "The course key for the course", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "actor_id": {"name": "actor_id", "description": "The xAPI actor identifier", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "subsection_block_id": {"name": "subsection_block_id", "description": "The unique identifier for the subsection block", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "engagement_level": {"name": "engagement_level", "description": "The engagement level of the learner with the subsection", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "aspects://models/video/schema.yml", "build_path": null, "unrendered_config": {"materialized": "materialized_view", "schema": "xapi", "engine": "\n ReplacingMergeTree()", "primary_key": "(org, course_key)", "order_by": "(org, course_key, subsection_block_id, actor_id)"}, "created_at": 1723229145.0664327, "relation_name": "`xapi`.`subsection_video_engagement`", "raw_code": "{{\n config(\n materialized=\"materialized_view\",\n schema=env_var(\"ASPECTS_XAPI_DATABASE\", \"xapi\"),\n engine=get_engine(\"ReplacingMergeTree()\"),\n primary_key=\"(org, course_key)\",\n order_by=\"(org, course_key, subsection_block_id, actor_id)\",\n )\n}}\n\nwith\n viewed_subsection_videos as (\n select distinct\n date(emission_time) as viewed_on,\n org,\n course_key,\n {{ section_from_display(\"video_name_with_location\") }} as section_number,\n {{ subsection_from_display(\"video_name_with_location\") }}\n as subsection_number,\n actor_id,\n video_id\n from {{ ref(\"fact_video_plays\") }}\n ),\n fact_video_engagement_per_subsection as (\n select\n views.org as org,\n views.course_key as course_key,\n videos.section_with_name as section_with_name,\n videos.subsection_with_name as subsection_with_name,\n videos.item_count as item_count,\n views.actor_id as actor_id,\n views.video_id as video_id,\n videos.subsection_block_id as subsection_block_id\n from viewed_subsection_videos views\n join\n {{ ref(\"int_videos_per_subsection\") }} videos\n on (\n views.org = videos.org\n and views.course_key = videos.course_key\n and views.section_number = videos.section_number\n and views.subsection_number = videos.subsection_number\n )\n ),\n subsection_counts as (\n select\n org,\n course_key,\n section_with_name,\n subsection_with_name,\n actor_id,\n item_count,\n count(distinct video_id) as videos_viewed,\n case\n when videos_viewed = 0\n then 'No videos viewed yet'\n when videos_viewed = item_count\n then 'All videos viewed'\n else 'At least one video viewed'\n end as engagement_level,\n subsection_block_id\n from fact_video_engagement_per_subsection\n group by\n org,\n course_key,\n section_with_name,\n subsection_with_name,\n actor_id,\n item_count,\n subsection_block_id\n )\nselect org, course_key, actor_id, subsection_block_id, engagement_level\nfrom subsection_counts", "language": "sql", "refs": [{"name": "fact_video_plays", "package": null, "version": null}, {"name": "int_videos_per_subsection", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.aspects.get_engine", "macro.aspects.section_from_display", "macro.aspects.subsection_from_display"], "nodes": ["model.aspects.fact_video_plays", "model.aspects.int_videos_per_subsection"]}, "compiled_path": "target/compiled/aspects/models/video/subsection_video_engagement.sql", "compiled": true, "compiled_code": "\n\nwith\n viewed_subsection_videos as (\n select distinct\n date(emission_time) as viewed_on,\n org,\n course_key,\n \n concat(\n splitByString(\n ':', splitByString(' - ', video_name_with_location)[1], 1\n )[1],\n ':0:0'\n )\n as section_number,\n \n concat(\n arrayStringConcat(\n splitByString(\n ':', splitByString(' - ', video_name_with_location)[1], 2\n ),\n ':'\n ),\n ':0'\n )\n\n as subsection_number,\n actor_id,\n video_id\n from `xapi`.`fact_video_plays`\n ),\n fact_video_engagement_per_subsection as (\n select\n views.org as org,\n views.course_key as course_key,\n videos.section_with_name as section_with_name,\n videos.subsection_with_name as subsection_with_name,\n videos.item_count as item_count,\n views.actor_id as actor_id,\n views.video_id as video_id,\n videos.subsection_block_id as subsection_block_id\n from viewed_subsection_videos views\n join\n `xapi`.`int_videos_per_subsection` videos\n on (\n views.org = videos.org\n and views.course_key = videos.course_key\n and views.section_number = videos.section_number\n and views.subsection_number = videos.subsection_number\n )\n ),\n subsection_counts as (\n select\n org,\n course_key,\n section_with_name,\n subsection_with_name,\n actor_id,\n item_count,\n count(distinct video_id) as videos_viewed,\n case\n when videos_viewed = 0\n then 'No videos viewed yet'\n when videos_viewed = item_count\n then 'All videos viewed'\n else 'At least one video viewed'\n end as engagement_level,\n subsection_block_id\n from fact_video_engagement_per_subsection\n group by\n org,\n course_key,\n section_with_name,\n subsection_with_name,\n actor_id,\n item_count,\n subsection_block_id\n )\nselect org, course_key, actor_id, subsection_block_id, engagement_level\nfrom subsection_counts", "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.aspects.int_videos_per_subsection": {"database": "", "schema": "xapi", "name": "int_videos_per_subsection", "resource_type": "model", "package_name": "aspects", "path": "video/int_videos_per_subsection.sql", "original_file_path": "models/video/int_videos_per_subsection.sql", "unique_id": "model.aspects.int_videos_per_subsection", "fqn": ["aspects", "video", "int_videos_per_subsection"], "alias": "int_videos_per_subsection", "checksum": {"name": "sha256", "checksum": "b95fb8fbe257ae83e6a3dd859730de95ede0685e04ff98bd10c94eba8134807e"}, "config": {"enabled": true, "alias": null, "schema": null, "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": "A dimension table with the number of videos per subsection", "columns": {"org": {"name": "org", "description": "The organization that the course belongs to", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "course_key": {"name": "course_key", "description": "The course key for the course", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "section_number": {"name": "section_number", "description": "The location of this section in the course, represented as section:0:0", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "section_with_name": {"name": "section_with_name", "description": "The name of the section this subsection belongs to, with section_number prepended", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "subsection_number": {"name": "subsection_number", "description": "The location of this subsection in the course, represented as section:subsection:0", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "subsection_with_name": {"name": "subsection_with_name", "description": "The name of the subsection, with section_number prepended", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "graded": {"name": "graded", "description": "Whether the block is graded", "meta": {}, "data_type": "Boolean", "constraints": [], "quote": null, "tags": []}, "item_count": {"name": "item_count", "description": "The number of videos in this subsection", "meta": {}, "data_type": "uint64", "constraints": [], "quote": null, "tags": []}, "course_order": {"name": "course_order", "description": "The sort order of this block in the course across all course blocks", "meta": {}, "data_type": "Int32", "constraints": [], "quote": null, "tags": []}, "subsection_block_id": {"name": "subsection_block_id", "description": "The unique identifier for the subsection block", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "section_block_id": {"name": "section_block_id", "description": "The unique identifier for the section block", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "aspects://models/video/schema.yml", "build_path": null, "unrendered_config": {}, "created_at": 1723229145.0637057, "relation_name": "`xapi`.`int_videos_per_subsection`", "raw_code": "select * from ({{ items_per_subsection(\"%@video+block@%\") }})", "language": "sql", "refs": [{"name": "dim_course_blocks", "package": null, "version": null}, {"name": "dim_course_blocks", "package": null, "version": null}, {"name": "dim_course_blocks", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.aspects.items_per_subsection"], "nodes": ["model.aspects.dim_course_blocks"]}, "compiled_path": "target/compiled/aspects/models/video/int_videos_per_subsection.sql", "compiled": true, "compiled_code": "select * from (\n with\n items_per_subsection as (\n select\n org,\n course_key,\n section_number,\n subsection_number,\n course_order,\n graded,\n count(*) as item_count\n from `xapi`.`dim_course_blocks`\n where block_id like '%@video+block@%'\n group by\n org, course_key, section_number, subsection_number, course_order, graded\n )\n\n select\n ips.org as org,\n ips.course_key as course_key,\n ips.section_number as section_number,\n section_blocks.display_name_with_location as section_with_name,\n ips.subsection_number as subsection_number,\n subsection_blocks.display_name_with_location as subsection_with_name,\n ips.course_order as course_order,\n ips.graded as graded,\n ips.item_count as item_count,\n subsection_blocks.block_id as subsection_block_id,\n section_blocks.block_id as section_block_id\n from items_per_subsection ips\n left join\n `xapi`.`dim_course_blocks` section_blocks\n on (\n ips.section_number = section_blocks.hierarchy_location\n and ips.org = section_blocks.org\n and ips.course_key = section_blocks.course_key\n and section_blocks.block_id like '%@chapter+block@%'\n )\n left join\n `xapi`.`dim_course_blocks` subsection_blocks\n on (\n ips.subsection_number = subsection_blocks.hierarchy_location\n and ips.org = subsection_blocks.org\n and ips.course_key = subsection_blocks.course_key\n and subsection_blocks.block_id like '%@sequential+block@%'\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}, "test.aspects.get_problem_id_with_ccx": {"database": "", "schema": "xapi", "name": "get_problem_id_with_ccx", "resource_type": "test", "package_name": "aspects", "path": "get_problem_id_with_ccx.sql", "original_file_path": "tests/get_problem_id_with_ccx.sql", "unique_id": "test.aspects.get_problem_id_with_ccx", "fqn": ["aspects", "get_problem_id_with_ccx"], "alias": "get_problem_id_with_ccx", "checksum": {"name": "sha256", "checksum": "6a34adbf88e71976a4ec23527f8c9d805cacb1da2927f68eb1325bd694703b07"}, "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": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "unrendered_config": {}, "created_at": 1723229144.683171, "relation_name": null, "raw_code": "select\n 'http://local.edly.io:8000/xblock/ccx-block-v1:edunext+demo+demo+ccx@1+type@problem+block@3c1646f7133a4c5fb4557d649e22c251'\n as object_id\nfrom system.one\nwhere\n {{ get_problem_id(\"object_id\") }}\n != 'ccx-block-v1:edunext+demo+demo+ccx@1+type@problem+block@3c1646f7133a4c5fb4557d649e22c251'", "language": "sql", "refs": [], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.aspects.get_problem_id"], "nodes": []}, "compiled_path": "target/compiled/aspects/tests/get_problem_id_with_ccx.sql", "compiled": true, "compiled_code": "select\n 'http://local.edly.io:8000/xblock/ccx-block-v1:edunext+demo+demo+ccx@1+type@problem+block@3c1646f7133a4c5fb4557d649e22c251'\n as object_id\nfrom system.one\nwhere\n \n regexpExtract(\n object_id, 'xblock/([\\w\\d-\\+:@]*@problem\\+block@[\\w\\d][^_\\/]*)(_\\d_\\d)?', 1\n )\n\n != 'ccx-block-v1:edunext+demo+demo+ccx@1+type@problem+block@3c1646f7133a4c5fb4557d649e22c251'", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}}, "test.aspects.get_problem_id": {"database": "", "schema": "xapi", "name": "get_problem_id", "resource_type": "test", "package_name": "aspects", "path": "get_problem_id.sql", "original_file_path": "tests/get_problem_id.sql", "unique_id": "test.aspects.get_problem_id", "fqn": ["aspects", "get_problem_id"], "alias": "get_problem_id", "checksum": {"name": "sha256", "checksum": "d56f4561a030c08b2d11b6c35fe8c647ca8c4f3143016ae6eada086ae3a06c49"}, "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": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "unrendered_config": {}, "created_at": 1723229144.6922483, "relation_name": null, "raw_code": "select\n 'http://local.edly.io:8000/xblock/block-v1:edunext+demo+demo+ccx+type@problem+block@3c1646f7133a4c5fb4557d649e22c251'\n as object_id\nfrom system.one\nwhere\n {{ get_problem_id(\"object_id\") }}\n != 'block-v1:edunext+demo+demo+ccx+type@problem+block@3c1646f7133a4c5fb4557d649e22c251'", "language": "sql", "refs": [], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.aspects.get_problem_id"], "nodes": []}, "compiled_path": "target/compiled/aspects/tests/get_problem_id.sql", "compiled": true, "compiled_code": "select\n 'http://local.edly.io:8000/xblock/block-v1:edunext+demo+demo+ccx+type@problem+block@3c1646f7133a4c5fb4557d649e22c251'\n as object_id\nfrom system.one\nwhere\n \n regexpExtract(\n object_id, 'xblock/([\\w\\d-\\+:@]*@problem\\+block@[\\w\\d][^_\\/]*)(_\\d_\\d)?', 1\n )\n\n != 'block-v1:edunext+demo+demo+ccx+type@problem+block@3c1646f7133a4c5fb4557d649e22c251'", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}}, "test.aspects.a_tag": {"database": "", "schema": "xapi", "name": "a_tag", "resource_type": "test", "package_name": "aspects", "path": "a_tag.sql", "original_file_path": "tests/a_tag.sql", "unique_id": "test.aspects.a_tag", "fqn": ["aspects", "a_tag"], "alias": "a_tag", "checksum": {"name": "sha256", "checksum": "0189e37c42a186a7c6b57b43ce3cade68fe400b57580a137c3ce8f927bda1048"}, "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": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "unrendered_config": {}, "created_at": 1723229144.6955717, "relation_name": null, "raw_code": "select\n 'http://local.edly.io/xblock/block-v1:OpenedX+DemoX+DemoCourse+type@video+block@d5a54ce52f464acfa7a83ae155712cc3' as object_id,\n 'The Purpose, Power and Reach of the Open edX\u00ae Platform' as video_name,\n {{ a_tag('object_id', 'video_name') }} as object_a_tag\nfrom\n system.numbers\nwhere object_a_tag != 'The Purpose, Power and Reach of the Open edX\u00ae Platform'", "language": "sql", "refs": [], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.aspects.a_tag"], "nodes": []}, "compiled_path": "target/compiled/aspects/tests/a_tag.sql", "compiled": true, "compiled_code": "select\n 'http://local.edly.io/xblock/block-v1:OpenedX+DemoX+DemoCourse+type@video+block@d5a54ce52f464acfa7a83ae155712cc3' as object_id,\n 'The Purpose, Power and Reach of the Open edX\u00ae Platform' as video_name,\n \n concat(\n '', video_name, ''\n )\n as object_a_tag\nfrom\n system.numbers\nwhere object_a_tag != 'The Purpose, Power and Reach of the Open edX\u00ae Platform'", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}}, "test.aspects.accepted_values_fact_enrollments_enrollment_status__registered__unregistered.f8d10203f4": {"database": "", "schema": "xapi", "name": "accepted_values_fact_enrollments_enrollment_status__registered__unregistered", "resource_type": "test", "package_name": "aspects", "path": "accepted_values_fact_enrollmen_1086f4b5aaa1831a14dfbb256e3845c9.sql", "original_file_path": "models/enrollment/schema.yml", "unique_id": "test.aspects.accepted_values_fact_enrollments_enrollment_status__registered__unregistered.f8d10203f4", "fqn": ["aspects", "enrollment", "accepted_values_fact_enrollments_enrollment_status__registered__unregistered"], "alias": "accepted_values_fact_enrollmen_1086f4b5aaa1831a14dfbb256e3845c9", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "accepted_values_fact_enrollmen_1086f4b5aaa1831a14dfbb256e3845c9", "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": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "unrendered_config": {"alias": "accepted_values_fact_enrollmen_1086f4b5aaa1831a14dfbb256e3845c9"}, "created_at": 1723229144.9467237, "relation_name": null, "raw_code": "{{ test_accepted_values(**_dbt_generic_test_kwargs) }}{{ config(alias=\"accepted_values_fact_enrollmen_1086f4b5aaa1831a14dfbb256e3845c9\") }}", "language": "sql", "refs": [{"name": "fact_enrollments", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_accepted_values", "macro.dbt.get_where_subquery"], "nodes": ["model.aspects.fact_enrollments"]}, "compiled_path": "target/compiled/aspects/models/enrollment/schema.yml/accepted_values_fact_enrollmen_1086f4b5aaa1831a14dfbb256e3845c9.sql", "compiled": true, "compiled_code": "\n \n \n\nwith all_values as (\n\n select\n enrollment_status as value_field,\n count(*) as n_records\n\n from `xapi`.`fact_enrollments`\n group by enrollment_status\n\n)\n\nselect *\nfrom all_values\nwhere value_field not in (\n 'registered','unregistered'\n)\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "enrollment_status", "file_key_name": "models.fact_enrollments", "attached_node": "model.aspects.fact_enrollments", "test_metadata": {"name": "accepted_values", "kwargs": {"values": ["registered", "unregistered"], "column_name": "enrollment_status", "model": "{{ get_where_subquery(ref('fact_enrollments')) }}"}, "namespace": null}}, "test.aspects.accepted_values_fact_enrollment_status_enrollment_status__registered__unregistered.893527c11f": {"database": "", "schema": "xapi", "name": "accepted_values_fact_enrollment_status_enrollment_status__registered__unregistered", "resource_type": "test", "package_name": "aspects", "path": "accepted_values_fact_enrollmen_19e28d0c914e4e943cd678ae73f6a8ec.sql", "original_file_path": "models/enrollment/schema.yml", "unique_id": "test.aspects.accepted_values_fact_enrollment_status_enrollment_status__registered__unregistered.893527c11f", "fqn": ["aspects", "enrollment", "accepted_values_fact_enrollment_status_enrollment_status__registered__unregistered"], "alias": "accepted_values_fact_enrollmen_19e28d0c914e4e943cd678ae73f6a8ec", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "accepted_values_fact_enrollmen_19e28d0c914e4e943cd678ae73f6a8ec", "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": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "unrendered_config": {"alias": "accepted_values_fact_enrollmen_19e28d0c914e4e943cd678ae73f6a8ec"}, "created_at": 1723229144.9646082, "relation_name": null, "raw_code": "{{ test_accepted_values(**_dbt_generic_test_kwargs) }}{{ config(alias=\"accepted_values_fact_enrollmen_19e28d0c914e4e943cd678ae73f6a8ec\") }}", "language": "sql", "refs": [{"name": "fact_enrollment_status", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_accepted_values", "macro.dbt.get_where_subquery"], "nodes": ["model.aspects.fact_enrollment_status"]}, "compiled_path": "target/compiled/aspects/models/enrollment/schema.yml/accepted_values_fact_enrollmen_19e28d0c914e4e943cd678ae73f6a8ec.sql", "compiled": true, "compiled_code": "\n \n \n\nwith all_values as (\n\n select\n enrollment_status as value_field,\n count(*) as n_records\n\n from `xapi`.`fact_enrollment_status`\n group by enrollment_status\n\n)\n\nselect *\nfrom all_values\nwhere value_field not in (\n 'registered','unregistered'\n)\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "enrollment_status", "file_key_name": "models.fact_enrollment_status", "attached_node": "model.aspects.fact_enrollment_status", "test_metadata": {"name": "accepted_values", "kwargs": {"values": ["registered", "unregistered"], "column_name": "enrollment_status", "model": "{{ get_where_subquery(ref('fact_enrollment_status')) }}"}, "namespace": null}}, "test.aspects.accepted_values_xapi_fact_instance_enrollments_enrollment_status__xapi_fact_instance_enrollments__registered__unregistered.744ab867be": {"database": "", "schema": "xapi", "name": "accepted_values_xapi_fact_instance_enrollments_enrollment_status__xapi_fact_instance_enrollments__registered__unregistered", "resource_type": "test", "package_name": "aspects", "path": "accepted_values_xapi_fact_inst_919ea2b7d3586eb457e7b98e6f268476.sql", "original_file_path": "models/instance/schema.yml", "unique_id": "test.aspects.accepted_values_xapi_fact_instance_enrollments_enrollment_status__xapi_fact_instance_enrollments__registered__unregistered.744ab867be", "fqn": ["aspects", "instance", "accepted_values_xapi_fact_instance_enrollments_enrollment_status__xapi_fact_instance_enrollments__registered__unregistered"], "alias": "accepted_values_xapi_fact_inst_919ea2b7d3586eb457e7b98e6f268476", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "accepted_values_xapi_fact_inst_919ea2b7d3586eb457e7b98e6f268476", "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": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "unrendered_config": {"alias": "accepted_values_xapi_fact_inst_919ea2b7d3586eb457e7b98e6f268476"}, "created_at": 1723229144.9746542, "relation_name": null, "raw_code": "{{ test_accepted_values_xapi(**_dbt_generic_test_kwargs) }}{{ config(alias=\"accepted_values_xapi_fact_inst_919ea2b7d3586eb457e7b98e6f268476\") }}", "language": "sql", "refs": [{"name": "fact_instance_enrollments", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.aspects.test_accepted_values_xapi", "macro.dbt.get_where_subquery"], "nodes": ["model.aspects.fact_instance_enrollments"]}, "compiled_path": "target/compiled/aspects/models/instance/schema.yml/accepted_values_xapi_fact_inst_919ea2b7d3586eb457e7b98e6f268476.sql", "compiled": true, "compiled_code": "\n\nwith all_values as (\n\n select distinct\n enrollment_status as value_field\n\n from xapi.fact_instance_enrollments\n\n),\n\nvalidation_errors as (\n\n select\n value_field\n\n from all_values\n where value_field not in (\n 'registered','unregistered'\n )\n\n)\n\nselect *\nfrom validation_errors\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "enrollment_status", "file_key_name": "models.fact_instance_enrollments", "attached_node": "model.aspects.fact_instance_enrollments", "test_metadata": {"name": "accepted_values_xapi", "kwargs": {"values": ["registered", "unregistered"], "table": "xapi.fact_instance_enrollments", "column_name": "enrollment_status", "model": "{{ get_where_subquery(ref('fact_instance_enrollments')) }}"}, "namespace": null}}, "test.aspects.accepted_values_fact_learner_course_status_approving_state__passed__failed.f9c0c1b85f": {"database": "", "schema": "xapi", "name": "accepted_values_fact_learner_course_status_approving_state__passed__failed", "resource_type": "test", "package_name": "aspects", "path": "accepted_values_fact_learner_c_559ec0ad399aaf9694346b1d7ddfb5aa.sql", "original_file_path": "models/grading/schema.yml", "unique_id": "test.aspects.accepted_values_fact_learner_course_status_approving_state__passed__failed.f9c0c1b85f", "fqn": ["aspects", "grading", "accepted_values_fact_learner_course_status_approving_state__passed__failed"], "alias": "accepted_values_fact_learner_c_559ec0ad399aaf9694346b1d7ddfb5aa", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "accepted_values_fact_learner_c_559ec0ad399aaf9694346b1d7ddfb5aa", "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": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "unrendered_config": {"alias": "accepted_values_fact_learner_c_559ec0ad399aaf9694346b1d7ddfb5aa"}, "created_at": 1723229144.9857254, "relation_name": null, "raw_code": "{{ test_accepted_values(**_dbt_generic_test_kwargs) }}{{ config(alias=\"accepted_values_fact_learner_c_559ec0ad399aaf9694346b1d7ddfb5aa\") }}", "language": "sql", "refs": [{"name": "fact_learner_course_status", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_accepted_values", "macro.dbt.get_where_subquery"], "nodes": ["model.aspects.fact_learner_course_status"]}, "compiled_path": "target/compiled/aspects/models/grading/schema.yml/accepted_values_fact_learner_c_559ec0ad399aaf9694346b1d7ddfb5aa.sql", "compiled": true, "compiled_code": "\n \n \n\nwith all_values as (\n\n select\n approving_state as value_field,\n count(*) as n_records\n\n from `xapi`.`fact_learner_course_status`\n group by approving_state\n\n)\n\nselect *\nfrom all_values\nwhere value_field not in (\n 'passed','failed'\n)\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "approving_state", "file_key_name": "models.fact_learner_course_status", "attached_node": "model.aspects.fact_learner_course_status", "test_metadata": {"name": "accepted_values", "kwargs": {"values": ["passed", "failed"], "column_name": "approving_state", "model": "{{ get_where_subquery(ref('fact_learner_course_status')) }}"}, "namespace": null}}, "test.aspects.accepted_values_fact_student_status_enrollment_status__registered__unregistered.53cae8a0f3": {"database": "", "schema": "xapi", "name": "accepted_values_fact_student_status_enrollment_status__registered__unregistered", "resource_type": "test", "package_name": "aspects", "path": "accepted_values_fact_student_s_8a61d4434c0b8a7d4988caa6759e7181.sql", "original_file_path": "models/grading/schema.yml", "unique_id": "test.aspects.accepted_values_fact_student_status_enrollment_status__registered__unregistered.53cae8a0f3", "fqn": ["aspects", "grading", "accepted_values_fact_student_status_enrollment_status__registered__unregistered"], "alias": "accepted_values_fact_student_s_8a61d4434c0b8a7d4988caa6759e7181", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "accepted_values_fact_student_s_8a61d4434c0b8a7d4988caa6759e7181", "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": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "unrendered_config": {"alias": "accepted_values_fact_student_s_8a61d4434c0b8a7d4988caa6759e7181"}, "created_at": 1723229144.989936, "relation_name": null, "raw_code": "{{ test_accepted_values(**_dbt_generic_test_kwargs) }}{{ config(alias=\"accepted_values_fact_student_s_8a61d4434c0b8a7d4988caa6759e7181\") }}", "language": "sql", "refs": [{"name": "fact_student_status", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_accepted_values", "macro.dbt.get_where_subquery"], "nodes": ["model.aspects.fact_student_status"]}, "compiled_path": "target/compiled/aspects/models/grading/schema.yml/accepted_values_fact_student_s_8a61d4434c0b8a7d4988caa6759e7181.sql", "compiled": true, "compiled_code": "\n \n \n\nwith all_values as (\n\n select\n enrollment_status as value_field,\n count(*) as n_records\n\n from `xapi`.`fact_student_status`\n group by enrollment_status\n\n)\n\nselect *\nfrom all_values\nwhere value_field not in (\n 'registered','unregistered'\n)\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "enrollment_status", "file_key_name": "models.fact_student_status", "attached_node": "model.aspects.fact_student_status", "test_metadata": {"name": "accepted_values", "kwargs": {"values": ["registered", "unregistered"], "column_name": "enrollment_status", "model": "{{ get_where_subquery(ref('fact_student_status')) }}"}, "namespace": null}}, "test.aspects.accepted_values_xapi_section_problem_engagement_engagement_level__xapi_section_problem_engagement__No_problems_attempted_yet__All_problems_attempted__At_least_one_problem_attempted.48ca5955e3": {"database": "", "schema": "xapi", "name": "accepted_values_xapi_section_problem_engagement_engagement_level__xapi_section_problem_engagement__No_problems_attempted_yet__All_problems_attempted__At_least_one_problem_attempted", "resource_type": "test", "package_name": "aspects", "path": "accepted_values_xapi_section_p_b967763ff505769e8077838e07629ef4.sql", "original_file_path": "models/problems/schema.yml", "unique_id": "test.aspects.accepted_values_xapi_section_problem_engagement_engagement_level__xapi_section_problem_engagement__No_problems_attempted_yet__All_problems_attempted__At_least_one_problem_attempted.48ca5955e3", "fqn": ["aspects", "problems", "accepted_values_xapi_section_problem_engagement_engagement_level__xapi_section_problem_engagement__No_problems_attempted_yet__All_problems_attempted__At_least_one_problem_attempted"], "alias": "accepted_values_xapi_section_p_b967763ff505769e8077838e07629ef4", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "accepted_values_xapi_section_p_b967763ff505769e8077838e07629ef4", "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": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "unrendered_config": {"alias": "accepted_values_xapi_section_p_b967763ff505769e8077838e07629ef4"}, "created_at": 1723229145.01015, "relation_name": null, "raw_code": "{{ test_accepted_values_xapi(**_dbt_generic_test_kwargs) }}{{ config(alias=\"accepted_values_xapi_section_p_b967763ff505769e8077838e07629ef4\") }}", "language": "sql", "refs": [{"name": "section_problem_engagement", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.aspects.test_accepted_values_xapi", "macro.dbt.get_where_subquery"], "nodes": ["model.aspects.section_problem_engagement"]}, "compiled_path": "target/compiled/aspects/models/problems/schema.yml/accepted_values_xapi_section_p_b967763ff505769e8077838e07629ef4.sql", "compiled": true, "compiled_code": "\n\nwith all_values as (\n\n select distinct\n engagement_level as value_field\n\n from xapi.section_problem_engagement\n\n),\n\nvalidation_errors as (\n\n select\n value_field\n\n from all_values\n where value_field not in (\n 'No problems attempted yet','All problems attempted','At least one problem attempted'\n )\n\n)\n\nselect *\nfrom validation_errors\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "engagement_level", "file_key_name": "models.section_problem_engagement", "attached_node": "model.aspects.section_problem_engagement", "test_metadata": {"name": "accepted_values_xapi", "kwargs": {"values": ["No problems attempted yet", "All problems attempted", "At least one problem attempted"], "table": "xapi.section_problem_engagement", "column_name": "engagement_level", "model": "{{ get_where_subquery(ref('section_problem_engagement')) }}"}, "namespace": null}}, "test.aspects.accepted_values_xapi_subsection_problem_engagement_engagement_level__xapi_subsection_problem_engagement__No_problems_attempted_yet__All_problems_attempted__At_least_one_problem_attempted.51aa37af55": {"database": "", "schema": "xapi", "name": "accepted_values_xapi_subsection_problem_engagement_engagement_level__xapi_subsection_problem_engagement__No_problems_attempted_yet__All_problems_attempted__At_least_one_problem_attempted", "resource_type": "test", "package_name": "aspects", "path": "accepted_values_xapi_subsectio_4ae05d21f0929163fa94f554b6c70554.sql", "original_file_path": "models/problems/schema.yml", "unique_id": "test.aspects.accepted_values_xapi_subsection_problem_engagement_engagement_level__xapi_subsection_problem_engagement__No_problems_attempted_yet__All_problems_attempted__At_least_one_problem_attempted.51aa37af55", "fqn": ["aspects", "problems", "accepted_values_xapi_subsection_problem_engagement_engagement_level__xapi_subsection_problem_engagement__No_problems_attempted_yet__All_problems_attempted__At_least_one_problem_attempted"], "alias": "accepted_values_xapi_subsectio_4ae05d21f0929163fa94f554b6c70554", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "accepted_values_xapi_subsectio_4ae05d21f0929163fa94f554b6c70554", "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": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "unrendered_config": {"alias": "accepted_values_xapi_subsectio_4ae05d21f0929163fa94f554b6c70554"}, "created_at": 1723229145.014859, "relation_name": null, "raw_code": "{{ test_accepted_values_xapi(**_dbt_generic_test_kwargs) }}{{ config(alias=\"accepted_values_xapi_subsectio_4ae05d21f0929163fa94f554b6c70554\") }}", "language": "sql", "refs": [{"name": "subsection_problem_engagement", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.aspects.test_accepted_values_xapi", "macro.dbt.get_where_subquery"], "nodes": ["model.aspects.subsection_problem_engagement"]}, "compiled_path": "target/compiled/aspects/models/problems/schema.yml/accepted_values_xapi_subsectio_4ae05d21f0929163fa94f554b6c70554.sql", "compiled": true, "compiled_code": "\n\nwith all_values as (\n\n select distinct\n engagement_level as value_field\n\n from xapi.subsection_problem_engagement\n\n),\n\nvalidation_errors as (\n\n select\n value_field\n\n from all_values\n where value_field not in (\n 'No problems attempted yet','All problems attempted','At least one problem attempted'\n )\n\n)\n\nselect *\nfrom validation_errors\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "engagement_level", "file_key_name": "models.subsection_problem_engagement", "attached_node": "model.aspects.subsection_problem_engagement", "test_metadata": {"name": "accepted_values_xapi", "kwargs": {"values": ["No problems attempted yet", "All problems attempted", "At least one problem attempted"], "table": "xapi.subsection_problem_engagement", "column_name": "engagement_level", "model": "{{ get_where_subquery(ref('subsection_problem_engagement')) }}"}, "namespace": null}}, "test.aspects.accepted_values_fact_pageview_engagement_content_level__section__subsection.dd9e9af3ed": {"database": "", "schema": "xapi", "name": "accepted_values_fact_pageview_engagement_content_level__section__subsection", "resource_type": "test", "package_name": "aspects", "path": "accepted_values_fact_pageview__b1bf1051fb872a03819d7debc3e80b8b.sql", "original_file_path": "models/navigation/schema.yml", "unique_id": "test.aspects.accepted_values_fact_pageview_engagement_content_level__section__subsection.dd9e9af3ed", "fqn": ["aspects", "navigation", "accepted_values_fact_pageview_engagement_content_level__section__subsection"], "alias": "accepted_values_fact_pageview__b1bf1051fb872a03819d7debc3e80b8b", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "accepted_values_fact_pageview__b1bf1051fb872a03819d7debc3e80b8b", "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": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "unrendered_config": {"alias": "accepted_values_fact_pageview__b1bf1051fb872a03819d7debc3e80b8b"}, "created_at": 1723229145.033445, "relation_name": null, "raw_code": "{{ test_accepted_values(**_dbt_generic_test_kwargs) }}{{ config(alias=\"accepted_values_fact_pageview__b1bf1051fb872a03819d7debc3e80b8b\") }}", "language": "sql", "refs": [{"name": "fact_pageview_engagement", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_accepted_values", "macro.dbt.get_where_subquery"], "nodes": ["model.aspects.fact_pageview_engagement"]}, "compiled_path": "target/compiled/aspects/models/navigation/schema.yml/accepted_values_fact_pageview__b1bf1051fb872a03819d7debc3e80b8b.sql", "compiled": true, "compiled_code": "\n \n \n\nwith all_values as (\n\n select\n content_level as value_field,\n count(*) as n_records\n\n from `xapi`.`fact_pageview_engagement`\n group by content_level\n\n)\n\nselect *\nfrom all_values\nwhere value_field not in (\n 'section','subsection'\n)\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "content_level", "file_key_name": "models.fact_pageview_engagement", "attached_node": "model.aspects.fact_pageview_engagement", "test_metadata": {"name": "accepted_values", "kwargs": {"values": ["section", "subsection"], "column_name": "content_level", "model": "{{ get_where_subquery(ref('fact_pageview_engagement')) }}"}, "namespace": null}}, "test.aspects.accepted_values_xapi_section_page_engagement_engagement_level__xapi_section_page_engagement__No_pages_viewed_yet__All_pages_viewed__At_least_one_page_viewed.f10135df89": {"database": "", "schema": "xapi", "name": "accepted_values_xapi_section_page_engagement_engagement_level__xapi_section_page_engagement__No_pages_viewed_yet__All_pages_viewed__At_least_one_page_viewed", "resource_type": "test", "package_name": "aspects", "path": "accepted_values_xapi_section_p_b5c1b2417b819abf84119480ff120fda.sql", "original_file_path": "models/navigation/schema.yml", "unique_id": "test.aspects.accepted_values_xapi_section_page_engagement_engagement_level__xapi_section_page_engagement__No_pages_viewed_yet__All_pages_viewed__At_least_one_page_viewed.f10135df89", "fqn": ["aspects", "navigation", "accepted_values_xapi_section_page_engagement_engagement_level__xapi_section_page_engagement__No_pages_viewed_yet__All_pages_viewed__At_least_one_page_viewed"], "alias": "accepted_values_xapi_section_p_b5c1b2417b819abf84119480ff120fda", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "accepted_values_xapi_section_p_b5c1b2417b819abf84119480ff120fda", "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": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "unrendered_config": {"alias": "accepted_values_xapi_section_p_b5c1b2417b819abf84119480ff120fda"}, "created_at": 1723229145.0376403, "relation_name": null, "raw_code": "{{ test_accepted_values_xapi(**_dbt_generic_test_kwargs) }}{{ config(alias=\"accepted_values_xapi_section_p_b5c1b2417b819abf84119480ff120fda\") }}", "language": "sql", "refs": [{"name": "section_page_engagement", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.aspects.test_accepted_values_xapi", "macro.dbt.get_where_subquery"], "nodes": ["model.aspects.section_page_engagement"]}, "compiled_path": "target/compiled/aspects/models/navigation/schema.yml/accepted_values_xapi_section_p_b5c1b2417b819abf84119480ff120fda.sql", "compiled": true, "compiled_code": "\n\nwith all_values as (\n\n select distinct\n engagement_level as value_field\n\n from xapi.section_page_engagement\n\n),\n\nvalidation_errors as (\n\n select\n value_field\n\n from all_values\n where value_field not in (\n 'No pages viewed yet','All pages viewed','At least one page viewed'\n )\n\n)\n\nselect *\nfrom validation_errors\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "engagement_level", "file_key_name": "models.section_page_engagement", "attached_node": "model.aspects.section_page_engagement", "test_metadata": {"name": "accepted_values_xapi", "kwargs": {"values": ["No pages viewed yet", "All pages viewed", "At least one page viewed"], "table": "xapi.section_page_engagement", "column_name": "engagement_level", "model": "{{ get_where_subquery(ref('section_page_engagement')) }}"}, "namespace": null}}, "test.aspects.accepted_values_xapi_subsection_page_engagement_engagement_level__xapi_subsection_page_engagement__No_pages_viewed_yet__All_pages_viewed__At_least_one_page_viewed.bcd23fe35f": {"database": "", "schema": "xapi", "name": "accepted_values_xapi_subsection_page_engagement_engagement_level__xapi_subsection_page_engagement__No_pages_viewed_yet__All_pages_viewed__At_least_one_page_viewed", "resource_type": "test", "package_name": "aspects", "path": "accepted_values_xapi_subsectio_6fa349f10ec258c2fc19269de9d5561b.sql", "original_file_path": "models/navigation/schema.yml", "unique_id": "test.aspects.accepted_values_xapi_subsection_page_engagement_engagement_level__xapi_subsection_page_engagement__No_pages_viewed_yet__All_pages_viewed__At_least_one_page_viewed.bcd23fe35f", "fqn": ["aspects", "navigation", "accepted_values_xapi_subsection_page_engagement_engagement_level__xapi_subsection_page_engagement__No_pages_viewed_yet__All_pages_viewed__At_least_one_page_viewed"], "alias": "accepted_values_xapi_subsectio_6fa349f10ec258c2fc19269de9d5561b", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "accepted_values_xapi_subsectio_6fa349f10ec258c2fc19269de9d5561b", "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": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "unrendered_config": {"alias": "accepted_values_xapi_subsectio_6fa349f10ec258c2fc19269de9d5561b"}, "created_at": 1723229145.0423465, "relation_name": null, "raw_code": "{{ test_accepted_values_xapi(**_dbt_generic_test_kwargs) }}{{ config(alias=\"accepted_values_xapi_subsectio_6fa349f10ec258c2fc19269de9d5561b\") }}", "language": "sql", "refs": [{"name": "subsection_page_engagement", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.aspects.test_accepted_values_xapi", "macro.dbt.get_where_subquery"], "nodes": ["model.aspects.subsection_page_engagement"]}, "compiled_path": "target/compiled/aspects/models/navigation/schema.yml/accepted_values_xapi_subsectio_6fa349f10ec258c2fc19269de9d5561b.sql", "compiled": true, "compiled_code": "\n\nwith all_values as (\n\n select distinct\n engagement_level as value_field\n\n from xapi.subsection_page_engagement\n\n),\n\nvalidation_errors as (\n\n select\n value_field\n\n from all_values\n where value_field not in (\n 'No pages viewed yet','All pages viewed','At least one page viewed'\n )\n\n)\n\nselect *\nfrom validation_errors\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "engagement_level", "file_key_name": "models.subsection_page_engagement", "attached_node": "model.aspects.subsection_page_engagement", "test_metadata": {"name": "accepted_values_xapi", "kwargs": {"values": ["No pages viewed yet", "All pages viewed", "At least one page viewed"], "table": "xapi.subsection_page_engagement", "column_name": "engagement_level", "model": "{{ get_where_subquery(ref('subsection_page_engagement')) }}"}, "namespace": null}}, "test.aspects.accepted_values_fact_video_engagement_content_level__section__subsection.636c5e7005": {"database": "", "schema": "xapi", "name": "accepted_values_fact_video_engagement_content_level__section__subsection", "resource_type": "test", "package_name": "aspects", "path": "accepted_values_fact_video_eng_1114368cd7e3e54d8e33e4933a5078fe.sql", "original_file_path": "models/video/schema.yml", "unique_id": "test.aspects.accepted_values_fact_video_engagement_content_level__section__subsection.636c5e7005", "fqn": ["aspects", "video", "accepted_values_fact_video_engagement_content_level__section__subsection"], "alias": "accepted_values_fact_video_eng_1114368cd7e3e54d8e33e4933a5078fe", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "accepted_values_fact_video_eng_1114368cd7e3e54d8e33e4933a5078fe", "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": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "unrendered_config": {"alias": "accepted_values_fact_video_eng_1114368cd7e3e54d8e33e4933a5078fe"}, "created_at": 1723229145.0672743, "relation_name": null, "raw_code": "{{ test_accepted_values(**_dbt_generic_test_kwargs) }}{{ config(alias=\"accepted_values_fact_video_eng_1114368cd7e3e54d8e33e4933a5078fe\") }}", "language": "sql", "refs": [{"name": "fact_video_engagement", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_accepted_values", "macro.dbt.get_where_subquery"], "nodes": ["model.aspects.fact_video_engagement"]}, "compiled_path": "target/compiled/aspects/models/video/schema.yml/accepted_values_fact_video_eng_1114368cd7e3e54d8e33e4933a5078fe.sql", "compiled": true, "compiled_code": "\n \n \n\nwith all_values as (\n\n select\n content_level as value_field,\n count(*) as n_records\n\n from `xapi`.`fact_video_engagement`\n group by content_level\n\n)\n\nselect *\nfrom all_values\nwhere value_field not in (\n 'section','subsection'\n)\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "content_level", "file_key_name": "models.fact_video_engagement", "attached_node": "model.aspects.fact_video_engagement", "test_metadata": {"name": "accepted_values", "kwargs": {"values": ["section", "subsection"], "column_name": "content_level", "model": "{{ get_where_subquery(ref('fact_video_engagement')) }}"}, "namespace": null}}, "test.aspects.accepted_values_fact_video_engagement_section_subsection_video_engagement__No_videos_viewed_yet__At_least_one_video_viewed__All_videos_viewed.91f6ccbf80": {"database": "", "schema": "xapi", "name": "accepted_values_fact_video_engagement_section_subsection_video_engagement__No_videos_viewed_yet__At_least_one_video_viewed__All_videos_viewed", "resource_type": "test", "package_name": "aspects", "path": "accepted_values_fact_video_eng_b5eba4b87ba3d5dc281e045ba5fb35bc.sql", "original_file_path": "models/video/schema.yml", "unique_id": "test.aspects.accepted_values_fact_video_engagement_section_subsection_video_engagement__No_videos_viewed_yet__At_least_one_video_viewed__All_videos_viewed.91f6ccbf80", "fqn": ["aspects", "video", "accepted_values_fact_video_engagement_section_subsection_video_engagement__No_videos_viewed_yet__At_least_one_video_viewed__All_videos_viewed"], "alias": "accepted_values_fact_video_eng_b5eba4b87ba3d5dc281e045ba5fb35bc", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "accepted_values_fact_video_eng_b5eba4b87ba3d5dc281e045ba5fb35bc", "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": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "unrendered_config": {"alias": "accepted_values_fact_video_eng_b5eba4b87ba3d5dc281e045ba5fb35bc"}, "created_at": 1723229145.0710063, "relation_name": null, "raw_code": "{{ test_accepted_values(**_dbt_generic_test_kwargs) }}{{ config(alias=\"accepted_values_fact_video_eng_b5eba4b87ba3d5dc281e045ba5fb35bc\") }}", "language": "sql", "refs": [{"name": "fact_video_engagement", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_accepted_values", "macro.dbt.get_where_subquery"], "nodes": ["model.aspects.fact_video_engagement"]}, "compiled_path": "target/compiled/aspects/models/video/schema.yml/accepted_values_fact_video_eng_b5eba4b87ba3d5dc281e045ba5fb35bc.sql", "compiled": true, "compiled_code": "\n \n \n\nwith all_values as (\n\n select\n section_subsection_video_engagement as value_field,\n count(*) as n_records\n\n from `xapi`.`fact_video_engagement`\n group by section_subsection_video_engagement\n\n)\n\nselect *\nfrom all_values\nwhere value_field not in (\n 'No videos viewed yet','At least one video viewed','All videos viewed'\n)\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "section_subsection_video_engagement", "file_key_name": "models.fact_video_engagement", "attached_node": "model.aspects.fact_video_engagement", "test_metadata": {"name": "accepted_values", "kwargs": {"values": ["No videos viewed yet", "At least one video viewed", "All videos viewed"], "column_name": "section_subsection_video_engagement", "model": "{{ get_where_subquery(ref('fact_video_engagement')) }}"}, "namespace": null}}, "test.aspects.accepted_values_xapi_section_video_engagement_engagement_level__xapi_section_video_engagement__No_videos_viewed_yet__All_videos_viewed__At_least_one_video_viewed.597c4fb289": {"database": "", "schema": "xapi", "name": "accepted_values_xapi_section_video_engagement_engagement_level__xapi_section_video_engagement__No_videos_viewed_yet__All_videos_viewed__At_least_one_video_viewed", "resource_type": "test", "package_name": "aspects", "path": "accepted_values_xapi_section_v_b5f2914f10014237c993abbc74075a03.sql", "original_file_path": "models/video/schema.yml", "unique_id": "test.aspects.accepted_values_xapi_section_video_engagement_engagement_level__xapi_section_video_engagement__No_videos_viewed_yet__All_videos_viewed__At_least_one_video_viewed.597c4fb289", "fqn": ["aspects", "video", "accepted_values_xapi_section_video_engagement_engagement_level__xapi_section_video_engagement__No_videos_viewed_yet__All_videos_viewed__At_least_one_video_viewed"], "alias": "accepted_values_xapi_section_v_b5f2914f10014237c993abbc74075a03", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "accepted_values_xapi_section_v_b5f2914f10014237c993abbc74075a03", "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": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "unrendered_config": {"alias": "accepted_values_xapi_section_v_b5f2914f10014237c993abbc74075a03"}, "created_at": 1723229145.0755174, "relation_name": null, "raw_code": "{{ test_accepted_values_xapi(**_dbt_generic_test_kwargs) }}{{ config(alias=\"accepted_values_xapi_section_v_b5f2914f10014237c993abbc74075a03\") }}", "language": "sql", "refs": [{"name": "section_video_engagement", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.aspects.test_accepted_values_xapi", "macro.dbt.get_where_subquery"], "nodes": ["model.aspects.section_video_engagement"]}, "compiled_path": "target/compiled/aspects/models/video/schema.yml/accepted_values_xapi_section_v_b5f2914f10014237c993abbc74075a03.sql", "compiled": true, "compiled_code": "\n\nwith all_values as (\n\n select distinct\n engagement_level as value_field\n\n from xapi.section_video_engagement\n\n),\n\nvalidation_errors as (\n\n select\n value_field\n\n from all_values\n where value_field not in (\n 'No videos viewed yet','All videos viewed','At least one video viewed'\n )\n\n)\n\nselect *\nfrom validation_errors\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "engagement_level", "file_key_name": "models.section_video_engagement", "attached_node": "model.aspects.section_video_engagement", "test_metadata": {"name": "accepted_values_xapi", "kwargs": {"values": ["No videos viewed yet", "All videos viewed", "At least one video viewed"], "table": "xapi.section_video_engagement", "column_name": "engagement_level", "model": "{{ get_where_subquery(ref('section_video_engagement')) }}"}, "namespace": null}}, "test.aspects.accepted_values_xapi_subsection_video_engagement_engagement_level__xapi_subsection_video_engagement__No_videos_viewed_yet__All_videos_viewed__At_least_one_video_viewed.c9b49600d3": {"database": "", "schema": "xapi", "name": "accepted_values_xapi_subsection_video_engagement_engagement_level__xapi_subsection_video_engagement__No_videos_viewed_yet__All_videos_viewed__At_least_one_video_viewed", "resource_type": "test", "package_name": "aspects", "path": "accepted_values_xapi_subsectio_02ffe7720b136f9bdf72d6b72e181c99.sql", "original_file_path": "models/video/schema.yml", "unique_id": "test.aspects.accepted_values_xapi_subsection_video_engagement_engagement_level__xapi_subsection_video_engagement__No_videos_viewed_yet__All_videos_viewed__At_least_one_video_viewed.c9b49600d3", "fqn": ["aspects", "video", "accepted_values_xapi_subsection_video_engagement_engagement_level__xapi_subsection_video_engagement__No_videos_viewed_yet__All_videos_viewed__At_least_one_video_viewed"], "alias": "accepted_values_xapi_subsectio_02ffe7720b136f9bdf72d6b72e181c99", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "accepted_values_xapi_subsectio_02ffe7720b136f9bdf72d6b72e181c99", "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": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "unrendered_config": {"alias": "accepted_values_xapi_subsectio_02ffe7720b136f9bdf72d6b72e181c99"}, "created_at": 1723229145.07921, "relation_name": null, "raw_code": "{{ test_accepted_values_xapi(**_dbt_generic_test_kwargs) }}{{ config(alias=\"accepted_values_xapi_subsectio_02ffe7720b136f9bdf72d6b72e181c99\") }}", "language": "sql", "refs": [{"name": "subsection_video_engagement", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.aspects.test_accepted_values_xapi", "macro.dbt.get_where_subquery"], "nodes": ["model.aspects.subsection_video_engagement"]}, "compiled_path": "target/compiled/aspects/models/video/schema.yml/accepted_values_xapi_subsectio_02ffe7720b136f9bdf72d6b72e181c99.sql", "compiled": true, "compiled_code": "\n\nwith all_values as (\n\n select distinct\n engagement_level as value_field\n\n from xapi.subsection_video_engagement\n\n),\n\nvalidation_errors as (\n\n select\n value_field\n\n from all_values\n where value_field not in (\n 'No videos viewed yet','All videos viewed','At least one video viewed'\n )\n\n)\n\nselect *\nfrom validation_errors\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "engagement_level", "file_key_name": "models.subsection_video_engagement", "attached_node": "model.aspects.subsection_video_engagement", "test_metadata": {"name": "accepted_values_xapi", "kwargs": {"values": ["No videos viewed yet", "All videos viewed", "At least one video viewed"], "table": "xapi.subsection_video_engagement", "column_name": "engagement_level", "model": "{{ get_where_subquery(ref('subsection_video_engagement')) }}"}, "namespace": null}}}, "sources": {"source.aspects.event_sink.user_profile": {"database": "event_sink", "schema": "event_sink", "name": "user_profile", "resource_type": "source", "package_name": "aspects", "path": "models/users/sources.yml", "original_file_path": "models/users/sources.yml", "unique_id": "source.aspects.event_sink.user_profile", "fqn": ["aspects", "users", "event_sink", "user_profile"], "source_name": "event_sink", "source_description": "", "loader": "", "identifier": "user_profile", "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": {"id": {"name": "id", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "user_id": {"name": "user_id", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "name": {"name": "name", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "email": {"name": "email", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "meta": {"name": "meta", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "courseware": {"name": "courseware", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "language": {"name": "language", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "location": {"name": "location", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "year_of_birth": {"name": "year_of_birth", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "gender": {"name": "gender", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "level_of_education": {"name": "level_of_education", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "mailing_address": {"name": "mailing_address", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "city": {"name": "city", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "country": {"name": "country", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "state": {"name": "state", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "goals": {"name": "goals", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "bio": {"name": "bio", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "profile_image_uploaded_at": {"name": "profile_image_uploaded_at", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "phone_number": {"name": "phone_number", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dump_id": {"name": "dump_id", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "time_last_dumped": {"name": "time_last_dumped", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "`event_sink`.`user_profile`", "created_at": 1723229145.1654356}, "source.aspects.event_sink.external_id": {"database": "event_sink", "schema": "event_sink", "name": "external_id", "resource_type": "source", "package_name": "aspects", "path": "models/users/sources.yml", "original_file_path": "models/users/sources.yml", "unique_id": "source.aspects.event_sink.external_id", "fqn": ["aspects", "users", "event_sink", "external_id"], "source_name": "event_sink", "source_description": "", "loader": "", "identifier": "external_id", "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": {"external_user_id": {"name": "external_user_id", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "external_id_type": {"name": "external_id_type", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "username": {"name": "username", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "user_id": {"name": "user_id", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dump_id": {"name": "dump_id", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "time_last_dumped": {"name": "time_last_dumped", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "`event_sink`.`external_id`", "created_at": 1723229145.166594}, "source.aspects.xapi.xapi_events_all": {"database": "xapi", "schema": "xapi", "name": "xapi_events_all", "resource_type": "source", "package_name": "aspects", "path": "models/base/sources.yml", "original_file_path": "models/base/sources.yml", "unique_id": "source.aspects.xapi.xapi_events_all", "fqn": ["aspects", "base", "xapi", "xapi_events_all"], "source_name": "xapi", "source_description": "the xapi database in clickhouse", "loader": "", "identifier": "xapi_events_all", "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": "Base table for raw xAPI events", "columns": {"event_id": {"name": "event_id", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "emission_time": {"name": "emission_time", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "event": {"name": "event", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "`xapi`.`xapi_events_all`", "created_at": 1723229145.1667626}, "source.aspects.event_sink.course_blocks": {"database": "event_sink", "schema": "event_sink", "name": "course_blocks", "resource_type": "source", "package_name": "aspects", "path": "models/courses/sources.yml", "original_file_path": "models/courses/sources.yml", "unique_id": "source.aspects.event_sink.course_blocks", "fqn": ["aspects", "courses", "event_sink", "course_blocks"], "source_name": "event_sink", "source_description": "", "loader": "", "identifier": "course_blocks", "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": {"org": {"name": "org", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "course_key": {"name": "course_key", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "location": {"name": "location", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "display_name": {"name": "display_name", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "xblock_data_json": {"name": "xblock_data_json", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "order": {"name": "order", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "edited_on": {"name": "edited_on", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dump_id": {"name": "dump_id", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "time_last_dumped": {"name": "time_last_dumped", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "`event_sink`.`course_blocks`", "created_at": 1723229145.166928}, "source.aspects.event_sink.course_overviews": {"database": "event_sink", "schema": "event_sink", "name": "course_overviews", "resource_type": "source", "package_name": "aspects", "path": "models/courses/sources.yml", "original_file_path": "models/courses/sources.yml", "unique_id": "source.aspects.event_sink.course_overviews", "fqn": ["aspects", "courses", "event_sink", "course_overviews"], "source_name": "event_sink", "source_description": "", "loader": "", "identifier": "course_overviews", "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": {"org": {"name": "org", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "course_key": {"name": "course_key", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "display_name": {"name": "display_name", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "course_start": {"name": "course_start", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "course_end": {"name": "course_end", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "enrollment_start": {"name": "enrollment_start", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "enrollment_end": {"name": "enrollment_end", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "self_paced": {"name": "self_paced", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "course_data_json": {"name": "course_data_json", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "created": {"name": "created", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "modified": {"name": "modified", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dump_id": {"name": "dump_id", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "time_last_dumped": {"name": "time_last_dumped", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "`event_sink`.`course_overviews`", "created_at": 1723229145.167101}}, "macros": {"macro.aspects.on_cluster": {"name": "on_cluster", "resource_type": "macro", "package_name": "aspects", "path": "macros/cluster_macros.sql", "original_file_path": "macros/cluster_macros.sql", "unique_id": "macro.aspects.on_cluster", "macro_sql": "{% macro on_cluster() -%}\n {%- if env_var(\"CLICKHOUSE_CLUSTER_NAME\", \"\") != \"\" -%}\n ON CLUSTER \"{{ env_var(\"CLICKHOUSE_CLUSTER_NAME\") }}\"\n {%- endif -%}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.1167204, "supported_languages": null}, "macro.aspects.get_engine": {"name": "get_engine", "resource_type": "macro", "package_name": "aspects", "path": "macros/cluster_macros.sql", "original_file_path": "macros/cluster_macros.sql", "unique_id": "macro.aspects.get_engine", "macro_sql": "{% macro get_engine(engine) -%}\n {%- if env_var(\"CLICKHOUSE_CLUSTER_NAME\", \"\") != \"\" -%}\n {{ \"Replicated\" + engine }}\n {% else %}\n {{ engine }}\n {%- endif -%}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.1171856, "supported_languages": null}, "macro.aspects.subsection_from_display": {"name": "subsection_from_display", "resource_type": "macro", "package_name": "aspects", "path": "macros/parse_section_codes.sql", "original_file_path": "macros/parse_section_codes.sql", "unique_id": "macro.aspects.subsection_from_display", "macro_sql": "{% macro subsection_from_display(display_name_with_location) %}\n concat(\n arrayStringConcat(\n splitByString(\n ':', splitByString(' - ', {{ display_name_with_location }})[1], 2\n ),\n ':'\n ),\n ':0'\n )\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.1176205, "supported_languages": null}, "macro.aspects.section_from_display": {"name": "section_from_display", "resource_type": "macro", "package_name": "aspects", "path": "macros/parse_section_codes.sql", "original_file_path": "macros/parse_section_codes.sql", "unique_id": "macro.aspects.section_from_display", "macro_sql": "{% macro section_from_display(display_name_with_location) %}\n concat(\n splitByString(\n ':', splitByString(' - ', {{ display_name_with_location }})[1], 1\n )[1],\n ':0:0'\n )\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.1178274, "supported_languages": null}, "macro.aspects.get_bucket": {"name": "get_bucket", "resource_type": "macro", "package_name": "aspects", "path": "macros/get_bucket.sql", "original_file_path": "macros/get_bucket.sql", "unique_id": "macro.aspects.get_bucket", "macro_sql": "{% macro get_bucket(field) -%}\n case\n when {{ field }} >= 0.9\n then '90-100%'\n when {{ field }} >= 0.8 and {{ field }} < 0.9\n then '80-89%'\n when {{ field }} >= 0.7 and {{ field }} < 0.8\n then '70-79%'\n when {{ field }} >= 0.6 and {{ field }} < 0.7\n then '60-69%'\n when {{ field }} >= 0.5 and {{ field }} < 0.6\n then '50-59%'\n when {{ field }} >= 0.4 and {{ field }} < 0.5\n then '40-49%'\n when {{ field }} >= 0.3 and {{ field }} < 0.4\n then '30-39%'\n when {{ field }} >= 0.2 and {{ field }} < 0.3\n then '20-29%'\n when {{ field }} >= 0.1 and {{ field }} < 0.2\n then '10-19%'\n else '0-9%'\n end\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.1191776, "supported_languages": null}, "macro.aspects.do_drop": {"name": "do_drop", "resource_type": "macro", "package_name": "aspects", "path": "macros/remove_deprecated_models.sql", "original_file_path": "macros/remove_deprecated_models.sql", "unique_id": "macro.aspects.do_drop", "macro_sql": "{% macro do_drop(type, schema, relation) %}\n -- Drop a relation, types are \"view\", \"table\", or \"mv\".\n -- \"mv\" will drop both the expected view and destination table.\n {% if type == \"mv\" %}\n {% do do_drop(\"view\", schema, relation ~ \"_mv\") %}\n {% do do_drop(\"table\", schema, relation) %}\n {% else %}\n {% set cmd = \"drop \" ~ type ~ \" if exists \" ~ schema ~ \".\" ~ relation ~ \";\" %}\n {% print(cmd) %}\n {% do run_query(cmd) %}\n {% endif %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.1215515, "supported_languages": null}, "macro.aspects.remove_deprecated_models": {"name": "remove_deprecated_models", "resource_type": "macro", "package_name": "aspects", "path": "macros/remove_deprecated_models.sql", "original_file_path": "macros/remove_deprecated_models.sql", "unique_id": "macro.aspects.remove_deprecated_models", "macro_sql": "{% macro remove_deprecated_models() %}\n {% set xapi = env_var(\"ASPECTS_XAPI_DATABASE\", \"xapi\") %}\n {% set reporting = env_var(\"DBT_PROFILE_TARGET_DATABASE\", \"reporting\") %}\n {% set event_sink = env_var(\"ASPECTS_EVENT_SINK_DATABASE\", \"event_sink\") %}\n\n {{\n print(\n \"Running remove_deprecated_models on \"\n ~ xapi\n ~ \", \"\n ~ reporting\n ~ \", \"\n ~ event_sink\n ~ \".\"\n )\n }}\n\n -- https://github.com/openedx/aspects-dbt/pull/111/\n {% do do_drop(\"mv\", xapi, \"completion_events\") %}\n {% do do_drop(\"view\", reporting, \"fact_completions\") %}\n {% do do_drop(\"view\", xapi, \"fact_forum_interactions\") %}\n {% do do_drop(\"mv\", xapi, \"forum_events\") %}\n {% do do_drop(\"view\", reporting, \"fact_grades\") %}\n {% do do_drop(\"view\", reporting, \"learner_summary\") %}\n {% do do_drop(\"view\", reporting, \"fact_navigation_dropoff\") %}\n {% do do_drop(\"view\", reporting, \"fact_learner_problem_summary\") %}\n {% do do_drop(\"view\", reporting, \"fact_problem_engagement\") %}\n {% do do_drop(\"view\", reporting, \"fact_problem_engagement_per_subsection\") %}\n {% do do_drop(\"view\", reporting, \"fact_problem_responses_extended\") %}\n {% do do_drop(\"view\", reporting, \"dim_at_risk_learners\") %}\n {% do do_drop(\"view\", reporting, \"fact_transcript_usage\") %}\n {% do do_drop(\"view\", reporting, \"fact_watched_video_segments\") %}\n {% do do_drop(\"mv\", reporting, \"video_transcript_events\") %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.aspects.do_drop"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.1238441, "supported_languages": null}, "macro.aspects.items_per_subsection": {"name": "items_per_subsection", "resource_type": "macro", "package_name": "aspects", "path": "macros/items_per_subsection.sql", "original_file_path": "macros/items_per_subsection.sql", "unique_id": "macro.aspects.items_per_subsection", "macro_sql": "{% macro items_per_subsection(block_pattern) %}\n with\n items_per_subsection as (\n select\n org,\n course_key,\n section_number,\n subsection_number,\n course_order,\n graded,\n count(*) as item_count\n from {{ ref(\"dim_course_blocks\") }}\n where block_id like '{{ block_pattern }}'\n group by\n org, course_key, section_number, subsection_number, course_order, graded\n )\n\n select\n ips.org as org,\n ips.course_key as course_key,\n ips.section_number as section_number,\n section_blocks.display_name_with_location as section_with_name,\n ips.subsection_number as subsection_number,\n subsection_blocks.display_name_with_location as subsection_with_name,\n ips.course_order as course_order,\n ips.graded as graded,\n ips.item_count as item_count,\n subsection_blocks.block_id as subsection_block_id,\n section_blocks.block_id as section_block_id\n from items_per_subsection ips\n left join\n {{ ref(\"dim_course_blocks\") }} section_blocks\n on (\n ips.section_number = section_blocks.hierarchy_location\n and ips.org = section_blocks.org\n and ips.course_key = section_blocks.course_key\n and section_blocks.block_id like '%@chapter+block@%'\n )\n left join\n {{ ref(\"dim_course_blocks\") }} subsection_blocks\n on (\n ips.subsection_number = subsection_blocks.hierarchy_location\n and ips.org = subsection_blocks.org\n and ips.course_key = subsection_blocks.course_key\n and subsection_blocks.block_id like '%@sequential+block@%'\n )\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.1248899, "supported_languages": null}, "macro.aspects.generate_schema_name": {"name": "generate_schema_name", "resource_type": "macro", "package_name": "aspects", "path": "macros/get_custom_schema.sql", "original_file_path": "macros/get_custom_schema.sql", "unique_id": "macro.aspects.generate_schema_name", "macro_sql": "{% macro generate_schema_name(custom_schema_name, node) -%}\n\n {%- set default_schema = target.schema -%}\n {%- if (\n target.name == \"prod\" or node.resource_type == \"seed\"\n ) and custom_schema_name is not none -%}\n\n {{ custom_schema_name | trim }}\n\n {%- else -%} {{ 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": 1723229143.1256065, "supported_languages": null}, "macro.aspects.get_problem_id": {"name": "get_problem_id", "resource_type": "macro", "package_name": "aspects", "path": "macros/get_problem_id.sql", "original_file_path": "macros/get_problem_id.sql", "unique_id": "macro.aspects.get_problem_id", "macro_sql": "{% macro get_problem_id(object_id) %}\n regexpExtract(\n object_id, 'xblock/([\\w\\d-\\+:@]*@problem\\+block@[\\w\\d][^_\\/]*)(_\\d_\\d)?', 1\n )\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.1258237, "supported_languages": null}, "macro.aspects.a_tag": {"name": "a_tag", "resource_type": "macro", "package_name": "aspects", "path": "macros/a_tag.sql", "original_file_path": "macros/a_tag.sql", "unique_id": "macro.aspects.a_tag", "macro_sql": "{% macro a_tag(object_id, object_name) %}\n concat(\n '', {{ object_name }}, ''\n )\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.1261015, "supported_languages": null}, "macro.aspects.test_accepted_values_xapi": {"name": "test_accepted_values_xapi", "resource_type": "macro", "package_name": "aspects", "path": "tests/generic/test_accepted_values_xapi.sql", "original_file_path": "tests/generic/test_accepted_values_xapi.sql", "unique_id": "macro.aspects.test_accepted_values_xapi", "macro_sql": "{% test accepted_values_xapi(model, column_name, values, table, quote=True) %}\n\nwith all_values as (\n\n select distinct\n {{ column_name }} as value_field\n\n from {{ table }}\n\n),\n\nvalidation_errors as (\n\n select\n value_field\n\n from all_values\n where value_field not in (\n {% for value in values -%}\n {% if quote -%}\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{% endtest %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.127013, "supported_languages": null}, "macro.dbt_clickhouse.clickhouse__list_schemas": {"name": "clickhouse__list_schemas", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_clickhouse.clickhouse__list_schemas", "macro_sql": "{% macro clickhouse__list_schemas(database) %}\n {% call statement('list_schemas', fetch_result=True, auto_begin=False) %}\n select name from system.databases\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": 1723229143.1321156, "supported_languages": null}, "macro.dbt_clickhouse.clickhouse__create_schema": {"name": "clickhouse__create_schema", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_clickhouse.clickhouse__create_schema", "macro_sql": "{% macro clickhouse__create_schema(relation) -%}\n {%- call statement('create_schema') -%}\n create database if not exists {{ relation.without_identifier().include(database=False) }}\n {{ on_cluster_clause(relation)}}\n {{ adapter.clickhouse_db_engine_clause() }}\n {% endcall %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt_clickhouse.on_cluster_clause"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.1326542, "supported_languages": null}, "macro.dbt_clickhouse.clickhouse__drop_schema": {"name": "clickhouse__drop_schema", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_clickhouse.clickhouse__drop_schema", "macro_sql": "{% macro clickhouse__drop_schema(relation) -%}\n {%- call statement('drop_schema') -%}\n drop database if exists {{ relation.without_identifier().include(database=False) }} {{ on_cluster_clause(relation)}}\n {%- endcall -%}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt_clickhouse.on_cluster_clause"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.133063, "supported_languages": null}, "macro.dbt_clickhouse.clickhouse__list_relations_without_caching": {"name": "clickhouse__list_relations_without_caching", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_clickhouse.clickhouse__list_relations_without_caching", "macro_sql": "{% macro clickhouse__list_relations_without_caching(schema_relation) %}\n {% call statement('list_relations_without_caching', fetch_result=True) -%}\n select\n t.name as name,\n t.database as schema,\n multiIf(\n engine in ('MaterializedView', 'View'), 'view',\n engine = 'Dictionary', 'dictionary',\n 'table'\n ) as type,\n db.engine as db_engine,\n {%- if adapter.get_clickhouse_cluster_name() -%}\n count(distinct _shard_num) > 1 as is_on_cluster\n from clusterAllReplicas({{ adapter.get_clickhouse_cluster_name() }}, system.tables) as t\n join system.databases as db on t.database = db.name\n where schema = '{{ schema_relation.schema }}'\n group by name, schema, type, db_engine\n {%- else -%}\n 0 as is_on_cluster\n from system.tables as t join system.databases as db on t.database = db.name\n where schema = '{{ schema_relation.schema }}'\n {% endif %}\n\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": 1723229143.1338336, "supported_languages": null}, "macro.dbt_clickhouse.clickhouse__get_columns_in_relation": {"name": "clickhouse__get_columns_in_relation", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_clickhouse.clickhouse__get_columns_in_relation", "macro_sql": "{% macro clickhouse__get_columns_in_relation(relation) -%}\n {% call statement('get_columns', fetch_result=True) %}\n select name, type from system.columns where table = '{{ relation.identifier }}'\n {% if relation.schema %}\n and database = '{{ relation.schema }}'\n {% endif %}\n order by position\n {% endcall %}\n {{ return(sql_convert_columns_in_relation(load_result('get_columns').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": 1723229143.134673, "supported_languages": null}, "macro.dbt_clickhouse.clickhouse__drop_relation": {"name": "clickhouse__drop_relation", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_clickhouse.clickhouse__drop_relation", "macro_sql": "{% macro clickhouse__drop_relation(relation, obj_type='table') -%}\n {% call statement('drop_relation', auto_begin=False) -%}\n {# drop relation on cluster by default if cluster is set #}\n drop {{ obj_type }} if exists {{ relation }} {{ on_cluster_clause(relation.without_identifier(), True)}}\n {%- endcall %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt_clickhouse.on_cluster_clause"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.1354482, "supported_languages": null}, "macro.dbt_clickhouse.clickhouse__rename_relation": {"name": "clickhouse__rename_relation", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_clickhouse.clickhouse__rename_relation", "macro_sql": "{% macro clickhouse__rename_relation(from_relation, to_relation, obj_type='table') -%}\n {% call statement('drop_relation') %}\n drop {{ obj_type }} if exists {{ to_relation }} {{ on_cluster_clause(to_relation.without_identifier())}}\n {% endcall %}\n {% call statement('rename_relation') %}\n rename {{ obj_type }} {{ from_relation }} to {{ to_relation }} {{ on_cluster_clause(from_relation)}}\n {% endcall %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt_clickhouse.on_cluster_clause"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.1363385, "supported_languages": null}, "macro.dbt_clickhouse.clickhouse__truncate_relation": {"name": "clickhouse__truncate_relation", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_clickhouse.clickhouse__truncate_relation", "macro_sql": "{% macro clickhouse__truncate_relation(relation) -%}\n {% call statement('truncate_relation') -%}\n truncate table {{ relation }} {{ on_cluster_clause(relation)}}\n {%- endcall %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt_clickhouse.on_cluster_clause"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.1367939, "supported_languages": null}, "macro.dbt_clickhouse.clickhouse__make_temp_relation": {"name": "clickhouse__make_temp_relation", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_clickhouse.clickhouse__make_temp_relation", "macro_sql": "{% macro clickhouse__make_temp_relation(base_relation, suffix) %}\n {% set tmp_identifier = base_relation.identifier ~ suffix %}\n {% set tmp_relation = base_relation.incorporate(\n path={\"identifier\": tmp_identifier, \"schema\": None}) -%}\n {% do return(tmp_relation) %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.137543, "supported_languages": null}, "macro.dbt_clickhouse.clickhouse__generate_database_name": {"name": "clickhouse__generate_database_name", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_clickhouse.clickhouse__generate_database_name", "macro_sql": "{% macro clickhouse__generate_database_name(custom_database_name=none, node=none) -%}\n {% do return('') %}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.1381352, "supported_languages": null}, "macro.dbt_clickhouse.clickhouse__get_columns_in_query": {"name": "clickhouse__get_columns_in_query", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_clickhouse.clickhouse__get_columns_in_query", "macro_sql": "{% macro clickhouse__get_columns_in_query(select_sql) %}\n {% call statement('get_columns_in_query', fetch_result=True, auto_begin=False) -%}\n select * from (\n {{ select_sql }}\n ) as __dbt_sbq\n limit 0\n {% endcall %}\n\n {{ return(load_result('get_columns_in_query').table.columns | map(attribute='name') | list) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.1388915, "supported_languages": null}, "macro.dbt_clickhouse.clickhouse__alter_column_type": {"name": "clickhouse__alter_column_type", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_clickhouse.clickhouse__alter_column_type", "macro_sql": "{% macro clickhouse__alter_column_type(relation, column_name, new_column_type) -%}\n {% call statement('alter_column_type') %}\n alter table {{ relation }} {{ on_cluster_clause(relation)}} modify column {{ adapter.quote(column_name) }} {{ new_column_type }}\n {% endcall %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt_clickhouse.on_cluster_clause"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.1395178, "supported_languages": null}, "macro.dbt_clickhouse.exchange_tables_atomic": {"name": "exchange_tables_atomic", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_clickhouse.exchange_tables_atomic", "macro_sql": "{% macro exchange_tables_atomic(old_relation, target_relation, obj_types='TABLES') %}\n\n {%- if adapter.get_clickhouse_cluster_name() is not none and obj_types == 'TABLES' and 'Replicated' in engine_clause() %}\n {%- call statement('exchange_table_sync_replica') -%}\n SYSTEM SYNC REPLICA {{ on_cluster_clause(target_relation) }} {{ target_relation.schema }}.{{ target_relation.identifier }}\n {% endcall %}\n {%- endif %}\n {%- call statement('exchange_tables_atomic') -%}\n EXCHANGE {{ obj_types }} {{ old_relation }} AND {{ target_relation }} {{ on_cluster_clause(target_relation)}}\n {% endcall %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_clickhouse.engine_clause", "macro.dbt.statement", "macro.dbt_clickhouse.on_cluster_clause"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.1404054, "supported_languages": null}, "macro.dbt_clickhouse.clickhouse__get_catalog": {"name": "clickhouse__get_catalog", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/catalog.sql", "original_file_path": "macros/catalog.sql", "unique_id": "macro.dbt_clickhouse.clickhouse__get_catalog", "macro_sql": "{% macro clickhouse__get_catalog(information_schema, schemas) -%}\n {%- call statement('catalog', fetch_result=True) -%}\n select\n '' as table_database,\n columns.database as table_schema,\n columns.table as table_name,\n if(tables.engine not in ('MaterializedView', 'View'), 'table', 'view') as table_type,\n nullIf(tables.comment, '') as table_comment,\n columns.name as column_name,\n columns.position as column_index,\n columns.type as column_type,\n nullIf(columns.comment, '') as column_comment,\n null as table_owner\n from system.columns as columns\n join system.tables as tables on tables.database = columns.database and tables.name = columns.table\n where database != 'system' and\n (\n {%- for schema in schemas -%}\n columns.database = '{{ schema }}'\n {%- if not loop.last %} or {% endif -%}\n {%- endfor -%}\n )\n order by columns.database, columns.table, columns.position\n {%- endcall -%}\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": 1723229143.1413422, "supported_languages": null}, "macro.dbt_clickhouse.clickhouse__get_assert_columns_equivalent": {"name": "clickhouse__get_assert_columns_equivalent", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/column_spec_ddl.sql", "original_file_path": "macros/column_spec_ddl.sql", "unique_id": "macro.dbt_clickhouse.clickhouse__get_assert_columns_equivalent", "macro_sql": "{% macro clickhouse__get_assert_columns_equivalent(sql) -%}\n {%- set user_defined_columns = model['columns'] -%}\n\n {%- if not user_defined_columns -%}\n {{ exceptions.raise_contract_error([], []) }}\n {%- endif -%}\n\n {%- set yaml_columns = user_defined_columns.values() -%}\n\n {%- set sql_file_provided_columns = adapter.get_column_schema_from_query(sql) -%}\n {%- set sql_columns = adapter.format_columns(sql_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 {%- 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['data_type'] != yaml_col[0]['data_type'] -%}\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": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.1439695, "supported_languages": null}, "macro.dbt_clickhouse.one_alter_relation": {"name": "one_alter_relation", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/persist_docs.sql", "original_file_path": "macros/persist_docs.sql", "unique_id": "macro.dbt_clickhouse.one_alter_relation", "macro_sql": "{% macro one_alter_relation(relation, alter_comments) %}\n alter table {{ relation }} {{ on_cluster_clause(relation) }} {{ alter_comments }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_clickhouse.on_cluster_clause"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.1457744, "supported_languages": null}, "macro.dbt_clickhouse.one_alter_column_comment": {"name": "one_alter_column_comment", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/persist_docs.sql", "original_file_path": "macros/persist_docs.sql", "unique_id": "macro.dbt_clickhouse.one_alter_column_comment", "macro_sql": "{% macro one_alter_column_comment(relation, column_name, comment) %}\n alter table {{ relation }} {{ on_cluster_clause(relation) }} comment column {{ column_name }} '{{ comment }}'\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_clickhouse.on_cluster_clause"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.1461346, "supported_languages": null}, "macro.dbt_clickhouse.clickhouse__alter_relation_comment": {"name": "clickhouse__alter_relation_comment", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/persist_docs.sql", "original_file_path": "macros/persist_docs.sql", "unique_id": "macro.dbt_clickhouse.clickhouse__alter_relation_comment", "macro_sql": "{% macro clickhouse__alter_relation_comment(relation, comment) %}\n alter table {{ relation }} {{ on_cluster_clause(relation) }} modify comment '{{ comment }}'\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_clickhouse.on_cluster_clause"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.1464026, "supported_languages": null}, "macro.dbt_clickhouse.clickhouse__persist_docs": {"name": "clickhouse__persist_docs", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/persist_docs.sql", "original_file_path": "macros/persist_docs.sql", "unique_id": "macro.dbt_clickhouse.clickhouse__persist_docs", "macro_sql": "{% macro clickhouse__persist_docs(relation, model, for_relation, for_columns) %}\n {%- set alter_comments = [] %}\n\n {%- if for_relation and config.persist_relation_docs() and model.description -%}\n {% set escaped_comment = clickhouse_escape_comment(model.description) %}\n {% do alter_comments.append(\"modify comment {comment}\".format(comment=escaped_comment)) %}\n {%- endif -%}\n\n {%- if for_columns and config.persist_column_docs() and model.columns -%}\n {% set existing_columns = adapter.get_columns_in_relation(relation) | map(attribute=\"name\") | list %}\n {% for column_name in model.columns if (column_name in existing_columns) %}\n {%- set comment = model.columns[column_name]['description'] -%}\n {%- if comment %}\n {% set escaped_comment = clickhouse_escape_comment(comment) %}\n {% do alter_comments.append(\"comment column {column_name} {comment}\".format(column_name=column_name, comment=escaped_comment)) %}\n {%- endif %}\n {%- endfor -%}\n {%- endif -%}\n\n {%- if alter_comments | length > 0 -%}\n {% do run_query(one_alter_relation(relation, alter_comments|join(', '))) %}\n {%- endif -%}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_clickhouse.clickhouse_escape_comment", "macro.dbt.run_query", "macro.dbt_clickhouse.one_alter_relation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.148127, "supported_languages": null}, "macro.dbt_clickhouse.clickhouse_escape_comment": {"name": "clickhouse_escape_comment", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/persist_docs.sql", "original_file_path": "macros/persist_docs.sql", "unique_id": "macro.dbt_clickhouse.clickhouse_escape_comment", "macro_sql": "{% macro clickhouse_escape_comment(comment) -%}\n {% if adapter.is_before_version('21.9.2.17') %}\n {% do exceptions.raise_compiler_error('Unsupported ClickHouse version for using heredoc syntax') %}\n {% endif %}\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": 1723229143.149018, "supported_languages": null}, "macro.dbt_clickhouse.clickhouse__get_test_sql": {"name": "clickhouse__get_test_sql", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/utils/utils.sql", "original_file_path": "macros/utils/utils.sql", "unique_id": "macro.dbt_clickhouse.clickhouse__get_test_sql", "macro_sql": "{% macro clickhouse__get_test_sql(main_sql, fail_calc, warn_if, error_if, limit) -%}\n {% set main_sql_formatted = clickhouse__place_limit(main_sql, limit) if limit !=None else main_sql%}\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_formatted }}\n ) dbt_internal_test\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_clickhouse.clickhouse__place_limit"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.1533535, "supported_languages": null}, "macro.dbt_clickhouse.clickhouse__place_limit": {"name": "clickhouse__place_limit", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/utils/utils.sql", "original_file_path": "macros/utils/utils.sql", "unique_id": "macro.dbt_clickhouse.clickhouse__place_limit", "macro_sql": "{% macro clickhouse__place_limit(query, limit) -%}\n {% if 'settings' in query.lower()%}\n {% if '-- end_of_sql' not in query.lower()%}\n {{exceptions.raise_compiler_error(\"-- end_of_sql must be set when using ClickHouse settings\")}}\n {% endif %}\n {% set split_by_settings_sections = query.split(\"-- end_of_sql\")%}\n {% set split_by_settings_sections_with_limit = split_by_settings_sections[-2] + \"\\n LIMIT \" + limit|string + \"\\n\" %}\n {% set query_with_limit = \"-- end_of_sql\".join(split_by_settings_sections[:-2] + [split_by_settings_sections_with_limit, split_by_settings_sections[-1]])%}\n {{query_with_limit}}\n {% else %}\n {{query}}\n {{\"limit \" ~ limit}}\n {% endif %}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.1544478, "supported_languages": null}, "macro.dbt_clickhouse.clickhouse__any_value": {"name": "clickhouse__any_value", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/utils/utils.sql", "original_file_path": "macros/utils/utils.sql", "unique_id": "macro.dbt_clickhouse.clickhouse__any_value", "macro_sql": "{% macro clickhouse__any_value(expression) -%}\n any({{ expression }})\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.1546218, "supported_languages": null}, "macro.dbt_clickhouse.clickhouse__bool_or": {"name": "clickhouse__bool_or", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/utils/utils.sql", "original_file_path": "macros/utils/utils.sql", "unique_id": "macro.dbt_clickhouse.clickhouse__bool_or", "macro_sql": "{% macro clickhouse__bool_or(expression) -%}\n max({{ expression }}) > 0\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.1547837, "supported_languages": null}, "macro.dbt_clickhouse.clickhouse__cast_bool_to_text": {"name": "clickhouse__cast_bool_to_text", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/utils/utils.sql", "original_file_path": "macros/utils/utils.sql", "unique_id": "macro.dbt_clickhouse.clickhouse__cast_bool_to_text", "macro_sql": "{% macro clickhouse__cast_bool_to_text(field) %}\n multiIf({{ field }} > 0, 'true', {{ field }} = 0, 'false', NULL)\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.1549752, "supported_languages": null}, "macro.dbt_clickhouse.clickhouse__hash": {"name": "clickhouse__hash", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/utils/utils.sql", "original_file_path": "macros/utils/utils.sql", "unique_id": "macro.dbt_clickhouse.clickhouse__hash", "macro_sql": "{% macro clickhouse__hash(field) -%}\n lower(hex(MD5(toString({{ field }} ))))\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.1551352, "supported_languages": null}, "macro.dbt_clickhouse.clickhouse__last_day": {"name": "clickhouse__last_day", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/utils/utils.sql", "original_file_path": "macros/utils/utils.sql", "unique_id": "macro.dbt_clickhouse.clickhouse__last_day", "macro_sql": "\n\n\n{%- macro clickhouse__last_day(date, datepart) -%}\n {{ dbt.dateadd('day', '-1', dbt.dateadd(datepart, '1', dbt.date_trunc(datepart, date)))}}\n{%- endmacro -%}\n\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": 1723229143.155506, "supported_languages": null}, "macro.dbt_clickhouse.clickhouse__split_part": {"name": "clickhouse__split_part", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/utils/utils.sql", "original_file_path": "macros/utils/utils.sql", "unique_id": "macro.dbt_clickhouse.clickhouse__split_part", "macro_sql": "{% macro clickhouse__split_part(string_text, delimiter_text, part_number) %}\n splitByChar('{{delimiter_text}}', {{ string_text }})[{{ part_number }}]\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.1557744, "supported_languages": null}, "macro.dbt_clickhouse.clickhouse__replace": {"name": "clickhouse__replace", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/utils/utils.sql", "original_file_path": "macros/utils/utils.sql", "unique_id": "macro.dbt_clickhouse.clickhouse__replace", "macro_sql": "{% macro clickhouse__replace(field, old_chars, new_chars) %}\n replaceAll({{ field }},'{{ old_chars }}','{{ new_chars }}')\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.1560163, "supported_languages": null}, "macro.dbt_clickhouse.clickhouse__listagg": {"name": "clickhouse__listagg", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/utils/utils.sql", "original_file_path": "macros/utils/utils.sql", "unique_id": "macro.dbt_clickhouse.clickhouse__listagg", "macro_sql": "{% macro clickhouse__listagg(measure, delimiter_text, order_by_clause, limit_num) -%}\n {% if order_by_clause -%}\n {% set arr = \"arrayMap(x -> x.1, arraySort(x -> x.2, arrayZip(array_agg({}), array_agg({}))))\".format(measure, order_by_clause) %}\n {% else -%}\n {% set arr = \"array_agg({})\".format(measure) %}\n {%- endif %}\n\n {% if limit_num -%}\n arrayStringConcat(arraySlice({{ arr }}, 1, {{ limit_num }}), {{delimiter_text}})\n {% else -%}\n arrayStringConcat({{ arr }}, {{delimiter_text}})\n {%- endif %}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.1567163, "supported_languages": null}, "macro.dbt_clickhouse.clickhouse__array_construct": {"name": "clickhouse__array_construct", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/utils/utils.sql", "original_file_path": "macros/utils/utils.sql", "unique_id": "macro.dbt_clickhouse.clickhouse__array_construct", "macro_sql": "{% macro clickhouse__array_construct(inputs, data_type) -%}\n {% if inputs|length > 0 %}\n [ {{ inputs|join(' , ') }} ]\n {% else %}\n emptyArray{{data_type}}()\n {% endif %}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.1570866, "supported_languages": null}, "macro.dbt_clickhouse.clickhouse__array_append": {"name": "clickhouse__array_append", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/utils/utils.sql", "original_file_path": "macros/utils/utils.sql", "unique_id": "macro.dbt_clickhouse.clickhouse__array_append", "macro_sql": "{% macro clickhouse__array_append(array, new_element) -%}\n arrayPushBack({{ array }}, {{ new_element }})\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.15732, "supported_languages": null}, "macro.dbt_clickhouse.clickhouse__array_concat": {"name": "clickhouse__array_concat", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/utils/utils.sql", "original_file_path": "macros/utils/utils.sql", "unique_id": "macro.dbt_clickhouse.clickhouse__array_concat", "macro_sql": "{% macro clickhouse__array_concat(array_1, array_2) -%}\n arrayConcat({{ array_1 }}, {{ array_2 }})\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.1575327, "supported_languages": null}, "macro.dbt_clickhouse.clickhouse__current_timestamp": {"name": "clickhouse__current_timestamp", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/utils/timestamps.sql", "original_file_path": "macros/utils/timestamps.sql", "unique_id": "macro.dbt_clickhouse.clickhouse__current_timestamp", "macro_sql": "{% macro clickhouse__current_timestamp() -%}\n now()\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.157768, "supported_languages": null}, "macro.dbt_clickhouse.clickhouse__snapshot_string_as_time": {"name": "clickhouse__snapshot_string_as_time", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/utils/timestamps.sql", "original_file_path": "macros/utils/timestamps.sql", "unique_id": "macro.dbt_clickhouse.clickhouse__snapshot_string_as_time", "macro_sql": "{% macro clickhouse__snapshot_string_as_time(timestamp) -%}\n {%- set result = \"toDateTime('\" ~ timestamp ~ \"')\" -%}\n {{ return(result) }}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.1580462, "supported_languages": null}, "macro.dbt_clickhouse.clickhouse_s3source": {"name": "clickhouse_s3source", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/materializations/s3.sql", "original_file_path": "macros/materializations/s3.sql", "unique_id": "macro.dbt_clickhouse.clickhouse_s3source", "macro_sql": "{% macro clickhouse_s3source(config_name='', bucket='', path='', fmt='', structure='',\n aws_access_key_id='', aws_secret_access_key='', compression='') %}\n {% if config_name and not config_name.lower().endswith('s3') %}\n {{ exceptions.raise_compiler_error(\"S3 configuration should end with 's3'\") }}\n {% endif %}\n {% set s3config = config.get(config_name, {}) %}\n {{ adapter.s3source_clause(\n config_name=config_name,\n s3_model_config=s3config,\n bucket=bucket,\n path=path,\n fmt=fmt,\n structure=structure,\n aws_access_key_id=aws_access_key_id,\n aws_secret_access_key=aws_secret_access_key,\n compression=compression) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.1594422, "supported_languages": null}, "macro.dbt_clickhouse.materialization_view_clickhouse": {"name": "materialization_view_clickhouse", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/materializations/view.sql", "original_file_path": "macros/materializations/view.sql", "unique_id": "macro.dbt_clickhouse.materialization_view_clickhouse", "macro_sql": "{%- materialization view, adapter='clickhouse' -%}\n\n {%- set existing_relation = load_cached_relation(this) -%}\n {%- set target_relation = this.incorporate(type='view') -%}\n {%- set backup_relation = none -%}\n {%- set preexisting_backup_relation = none -%}\n {%- set preexisting_intermediate_relation = none -%}\n\n {% if existing_relation is not none %}\n {%- set backup_relation_type = existing_relation.type -%}\n {%- set backup_relation = make_backup_relation(target_relation, backup_relation_type) -%}\n {%- set preexisting_backup_relation = load_cached_relation(backup_relation) -%}\n {% if not existing_relation.can_exchange %}\n {%- set intermediate_relation = make_intermediate_relation(target_relation) -%}\n {%- set preexisting_intermediate_relation = load_cached_relation(intermediate_relation) -%}\n {% endif %}\n {% endif %}\n\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 {% if backup_relation is none %}\n {{ log('Creating new relation ' + target_relation.name )}}\n -- There is not existing relation, so we can just create\n {% call statement('main') -%}\n {{ get_create_view_as_sql(target_relation, sql) }}\n {%- endcall %}\n {% elif existing_relation.can_exchange %}\n -- We can do an atomic exchange, so no need for an intermediate\n {% call statement('main') -%}\n {{ get_create_view_as_sql(backup_relation, sql) }}\n {%- endcall %}\n {% do exchange_tables_atomic(backup_relation, existing_relation) %}\n {% else %}\n -- We have to use an intermediate and rename accordingly\n {% call statement('main') -%}\n {{ get_create_view_as_sql(intermediate_relation, sql) }}\n {%- endcall %}\n {{ adapter.rename_relation(existing_relation, backup_relation) }}\n {{ adapter.rename_relation(intermediate_relation, target_relation) }}\n {% endif %}\n\n -- cleanup\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 -%}\n\n\n", "depends_on": {"macros": ["macro.dbt.load_cached_relation", "macro.dbt.make_backup_relation", "macro.dbt.make_intermediate_relation", "macro.dbt.run_hooks", "macro.dbt.drop_relation_if_exists", "macro.dbt.statement", "macro.dbt.get_create_view_as_sql", "macro.dbt_clickhouse.exchange_tables_atomic", "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": 1723229143.165854, "supported_languages": ["sql"]}, "macro.dbt_clickhouse.clickhouse__create_view_as": {"name": "clickhouse__create_view_as", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/materializations/view.sql", "original_file_path": "macros/materializations/view.sql", "unique_id": "macro.dbt_clickhouse.clickhouse__create_view_as", "macro_sql": "{% macro clickhouse__create_view_as(relation, sql) -%}\n {%- set sql_header = config.get('sql_header', none) -%}\n {{ sql_header if sql_header is not none }}\n\n create view {{ relation.include(database=False) }} {{ on_cluster_clause(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 {% if model.get('config').get('materialized') == 'view' %}\n {{ adapter.get_model_settings(model) }}\n {%- endif %}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_clickhouse.on_cluster_clause", "macro.dbt.get_assert_columns_equivalent"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.1668572, "supported_languages": null}, "macro.dbt_clickhouse.materialization_table_clickhouse": {"name": "materialization_table_clickhouse", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/materializations/table.sql", "original_file_path": "macros/materializations/table.sql", "unique_id": "macro.dbt_clickhouse.materialization_table_clickhouse", "macro_sql": "{% materialization table, adapter='clickhouse' %}\n\n {%- set existing_relation = load_cached_relation(this) -%}\n {%- set target_relation = this.incorporate(type='table') -%}\n {%- set backup_relation = none -%}\n {%- set preexisting_backup_relation = none -%}\n {%- set preexisting_intermediate_relation = none -%}\n\n {% if existing_relation is not none %}\n {%- set backup_relation_type = existing_relation.type -%}\n {%- set backup_relation = make_backup_relation(target_relation, backup_relation_type) -%}\n {%- set preexisting_backup_relation = load_cached_relation(backup_relation) -%}\n {% if not existing_relation.can_exchange %}\n {%- set intermediate_relation = make_intermediate_relation(target_relation) -%}\n {%- set preexisting_intermediate_relation = load_cached_relation(intermediate_relation) -%}\n {% endif %}\n {% endif %}\n\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 {% if backup_relation is none %}\n {{ log('Creating new relation ' + target_relation.name )}}\n -- There is not existing relation, so we can just create\n {% call statement('main') -%}\n {{ get_create_table_as_sql(False, target_relation, sql) }}\n {%- endcall %}\n {% elif existing_relation.can_exchange %}\n -- We can do an atomic exchange, so no need for an intermediate\n {% call statement('main') -%}\n {{ get_create_table_as_sql(False, backup_relation, sql) }}\n {%- endcall %}\n {% do exchange_tables_atomic(backup_relation, existing_relation) %}\n {% else %}\n -- We have to use an intermediate and rename accordingly\n {% call statement('main') -%}\n {{ get_create_table_as_sql(False, intermediate_relation, sql) }}\n {%- endcall %}\n {{ adapter.rename_relation(existing_relation, backup_relation) }}\n {{ adapter.rename_relation(intermediate_relation, target_relation) }}\n {% endif %}\n\n -- cleanup\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_backup_relation", "macro.dbt.make_intermediate_relation", "macro.dbt.run_hooks", "macro.dbt.drop_relation_if_exists", "macro.dbt.statement", "macro.dbt.get_create_table_as_sql", "macro.dbt_clickhouse.exchange_tables_atomic", "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": 1723229143.1793406, "supported_languages": ["sql"]}, "macro.dbt_clickhouse.engine_clause": {"name": "engine_clause", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/materializations/table.sql", "original_file_path": "macros/materializations/table.sql", "unique_id": "macro.dbt_clickhouse.engine_clause", "macro_sql": "{% macro engine_clause() %}\n engine = {{ config.get('engine', default='MergeTree()') }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.1796002, "supported_languages": null}, "macro.dbt_clickhouse.partition_cols": {"name": "partition_cols", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/materializations/table.sql", "original_file_path": "macros/materializations/table.sql", "unique_id": "macro.dbt_clickhouse.partition_cols", "macro_sql": "{% macro partition_cols(label) %}\n {%- set cols = config.get('partition_by', validator=validation.any[list, basestring]) -%}\n {%- if cols is not none %}\n {%- if cols is string -%}\n {%- set cols = [cols] -%}\n {%- endif -%}\n {{ label }} (\n {%- for item in cols -%}\n {{ item }}\n {%- if not loop.last -%},{%- endif -%}\n {%- endfor -%}\n )\n {%- endif %}\n{%- endmacro -%}\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.1803706, "supported_languages": null}, "macro.dbt_clickhouse.primary_key_clause": {"name": "primary_key_clause", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/materializations/table.sql", "original_file_path": "macros/materializations/table.sql", "unique_id": "macro.dbt_clickhouse.primary_key_clause", "macro_sql": "{% macro primary_key_clause(label) %}\n {%- set primary_key = config.get('primary_key', validator=validation.any[basestring]) -%}\n\n {%- if primary_key is not none %}\n {{ label }} {{ primary_key }}\n {%- endif %}\n{%- endmacro -%}\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.180795, "supported_languages": null}, "macro.dbt_clickhouse.order_cols": {"name": "order_cols", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/materializations/table.sql", "original_file_path": "macros/materializations/table.sql", "unique_id": "macro.dbt_clickhouse.order_cols", "macro_sql": "{% macro order_cols(label) %}\n {%- set cols = config.get('order_by', validator=validation.any[list, basestring]) -%}\n {%- set engine = config.get('engine', default='MergeTree()') -%}\n {%- set supported = [\n 'HDFS',\n 'MaterializedPostgreSQL',\n 'S3',\n 'EmbeddedRocksDB',\n 'Hive'\n ] -%}\n\n {%- if 'MergeTree' in engine or engine in supported %}\n {%- if cols is not none %}\n {%- if cols is string -%}\n {%- set cols = [cols] -%}\n {%- endif -%}\n {{ label }} (\n {%- for item in cols -%}\n {{ item }}\n {%- if not loop.last -%},{%- endif -%}\n {%- endfor -%}\n )\n {%- else %}\n {{ label }} (tuple())\n {%- endif %}\n {%- endif %}\n{%- endmacro -%}\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.1820352, "supported_languages": null}, "macro.dbt_clickhouse.ttl_config": {"name": "ttl_config", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/materializations/table.sql", "original_file_path": "macros/materializations/table.sql", "unique_id": "macro.dbt_clickhouse.ttl_config", "macro_sql": "{% macro ttl_config(label) %}\n {%- if config.get(\"ttl\")%}\n {{ label }} {{ config.get(\"ttl\") }}\n {%- endif %}\n{%- endmacro -%}\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.182367, "supported_languages": null}, "macro.dbt_clickhouse.on_cluster_clause": {"name": "on_cluster_clause", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/materializations/table.sql", "original_file_path": "macros/materializations/table.sql", "unique_id": "macro.dbt_clickhouse.on_cluster_clause", "macro_sql": "{% macro on_cluster_clause(relation, force_sync) %}\n {% set active_cluster = adapter.get_clickhouse_cluster_name() %}\n {%- if active_cluster is not none and relation.should_on_cluster %}\n {# Add trailing whitespace to avoid problems when this clause is not last #}\n ON CLUSTER {{ active_cluster + ' ' }}\n {%- if force_sync %}\n SYNC\n {%- endif %}\n {%- endif %}\n{%- endmacro -%}\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.1828299, "supported_languages": null}, "macro.dbt_clickhouse.clickhouse__create_table_as": {"name": "clickhouse__create_table_as", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/materializations/table.sql", "original_file_path": "macros/materializations/table.sql", "unique_id": "macro.dbt_clickhouse.clickhouse__create_table_as", "macro_sql": "{% macro clickhouse__create_table_as(temporary, relation, sql) -%}\n {% set has_contract = config.get('contract').enforced %}\n {% set create_table = create_table_or_empty(temporary, relation, sql, has_contract) %}\n {% if adapter.is_before_version('22.7.1.2484') or temporary -%}\n {{ create_table }}\n {%- else %}\n {% call statement('create_table_empty') %}\n {{ create_table }}\n {% endcall %}\n {{ clickhouse__insert_into(relation, sql, has_contract) }}\n {%- endif %}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_clickhouse.create_table_or_empty", "macro.dbt.statement", "macro.dbt_clickhouse.clickhouse__insert_into"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.1836095, "supported_languages": null}, "macro.dbt_clickhouse.create_table_or_empty": {"name": "create_table_or_empty", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/materializations/table.sql", "original_file_path": "macros/materializations/table.sql", "unique_id": "macro.dbt_clickhouse.create_table_or_empty", "macro_sql": "{% macro create_table_or_empty(temporary, relation, sql, has_contract) -%}\n {%- set sql_header = config.get('sql_header', none) -%}\n\n {{ sql_header if sql_header is not none }}\n\n {% if temporary -%}\n create temporary table {{ relation }}\n engine Memory\n {{ adapter.get_model_settings(model) }}\n as (\n {{ sql }}\n )\n {%- else %}\n create table {{ relation }}\n {{ on_cluster_clause(relation)}}\n {%- if has_contract%}\n {{ get_assert_columns_equivalent(sql) }}\n {{ get_table_columns_and_constraints() }}\n {%- endif %}\n {{ engine_clause() }}\n {{ order_cols(label=\"order by\") }}\n {{ primary_key_clause(label=\"primary key\") }}\n {{ partition_cols(label=\"partition by\") }}\n {{ ttl_config(label=\"ttl\")}}\n {{ adapter.get_model_settings(model) }}\n\n {%- if not has_contract %}\n {%- if not adapter.is_before_version('22.7.1.2484') %}\n empty\n {%- endif %}\n as (\n {{ sql }}\n )\n {%- endif %}\n {%- endif %}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_clickhouse.on_cluster_clause", "macro.dbt.get_assert_columns_equivalent", "macro.dbt.get_table_columns_and_constraints", "macro.dbt_clickhouse.engine_clause", "macro.dbt_clickhouse.order_cols", "macro.dbt_clickhouse.primary_key_clause", "macro.dbt_clickhouse.partition_cols", "macro.dbt_clickhouse.ttl_config"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.185043, "supported_languages": null}, "macro.dbt_clickhouse.clickhouse__insert_into": {"name": "clickhouse__insert_into", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/materializations/table.sql", "original_file_path": "macros/materializations/table.sql", "unique_id": "macro.dbt_clickhouse.clickhouse__insert_into", "macro_sql": "{% macro clickhouse__insert_into(target_relation, sql, has_contract) %}\n {%- set dest_columns = adapter.get_columns_in_relation(target_relation) -%}\n {%- set dest_cols_csv = dest_columns | map(attribute='quoted') | join(', ') -%}\n\n insert into {{ target_relation }}\n ({{ dest_cols_csv }})\n {%- if has_contract -%}\n -- Use a subquery to get columns in the right order\n SELECT {{ dest_cols_csv }} FROM ( {{ sql }} )\n {%- else -%}\n {{ sql }}\n {%- endif -%}\n {{ adapter.get_model_query_settings(model) }}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.185852, "supported_languages": null}, "macro.dbt_clickhouse.clickhouse__load_csv_rows": {"name": "clickhouse__load_csv_rows", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/materializations/seed.sql", "original_file_path": "macros/materializations/seed.sql", "unique_id": "macro.dbt_clickhouse.clickhouse__load_csv_rows", "macro_sql": "{% macro clickhouse__load_csv_rows(model, agate_table) %}\n {% set cols_sql = get_seed_column_quoted_csv(model, agate_table.column_names) %}\n {% set data_sql = adapter.get_csv_data(agate_table) %}\n\n {% set sql -%}\n insert into {{ this.render() }} ({{ cols_sql }})\n {{ adapter.get_model_query_settings(model) }}\n format CSV\n {{ data_sql }}\n {%- endset %}\n\n {% do adapter.add_query(sql, bindings=agate_table, abridge_sql_log=True) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_seed_column_quoted_csv"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.1876316, "supported_languages": null}, "macro.dbt_clickhouse.clickhouse__create_csv_table": {"name": "clickhouse__create_csv_table", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/materializations/seed.sql", "original_file_path": "macros/materializations/seed.sql", "unique_id": "macro.dbt_clickhouse.clickhouse__create_csv_table", "macro_sql": "{% macro clickhouse__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() }} {{ on_cluster_clause(this) }} (\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 {{ engine_clause() }}\n {{ order_cols(label='order by') }}\n {{ partition_cols(label='partition by') }}\n {% endset %}\n\n {% call statement('_') -%}\n {{ sql }}\n {%- endcall %}\n\n {{ return(sql) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_clickhouse.on_cluster_clause", "macro.dbt_clickhouse.engine_clause", "macro.dbt_clickhouse.order_cols", "macro.dbt_clickhouse.partition_cols", "macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.189257, "supported_languages": null}, "macro.dbt_clickhouse.clickhouse__snapshot_hash_arguments": {"name": "clickhouse__snapshot_hash_arguments", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/materializations/snapshot.sql", "original_file_path": "macros/materializations/snapshot.sql", "unique_id": "macro.dbt_clickhouse.clickhouse__snapshot_hash_arguments", "macro_sql": "{% macro clickhouse__snapshot_hash_arguments(args) -%}\n halfMD5({%- 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": 1723229143.193632, "supported_languages": null}, "macro.dbt_clickhouse.clickhouse__post_snapshot": {"name": "clickhouse__post_snapshot", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/materializations/snapshot.sql", "original_file_path": "macros/materializations/snapshot.sql", "unique_id": "macro.dbt_clickhouse.clickhouse__post_snapshot", "macro_sql": "{% macro clickhouse__post_snapshot(staging_relation) %}\n {{ drop_relation_if_exists(staging_relation) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.drop_relation_if_exists"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.1938272, "supported_languages": null}, "macro.dbt_clickhouse.build_snapshot_staging_table": {"name": "build_snapshot_staging_table", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/materializations/snapshot.sql", "original_file_path": "macros/materializations/snapshot.sql", "unique_id": "macro.dbt_clickhouse.build_snapshot_staging_table", "macro_sql": "{% macro build_snapshot_staging_table(strategy, sql, target_relation) %}\n {% set tmp_relation = make_temp_relation(target_relation) %}\n\n {% set select = snapshot_staging_table(strategy, sql, target_relation) %}\n\n {% call statement('build_snapshot_staging_relation') %}\n {{ create_table_as(False, tmp_relation, select) }}\n {% endcall %}\n\n {% do return(tmp_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": 1723229143.1944766, "supported_languages": null}, "macro.dbt_clickhouse.clickhouse__snapshot_merge_sql": {"name": "clickhouse__snapshot_merge_sql", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/materializations/snapshot.sql", "original_file_path": "macros/materializations/snapshot.sql", "unique_id": "macro.dbt_clickhouse.clickhouse__snapshot_merge_sql", "macro_sql": "{% macro clickhouse__snapshot_merge_sql(target, source, insert_cols) -%}\n {%- set insert_cols_csv = insert_cols | join(', ') -%}\n {%- set valid_to_col = adapter.quote('dbt_valid_to') -%}\n\n {%- set upsert = target.derivative('__snapshot_upsert') -%}\n {% call statement('create_upsert_relation') %}\n create table if not exists {{ upsert }} as {{ target }}\n {% endcall %}\n\n {% call statement('insert_unchanged_data') %}\n insert into {{ upsert }} ({{ insert_cols_csv }})\n select {% for column in insert_cols -%}\n {{ column }} {%- if not loop.last %}, {%- endif %}\n {%- endfor %}\n from {{ target }}\n where dbt_scd_id not in (\n select {{ source }}.dbt_scd_id from {{ source }} \n )\n {% endcall %}\n\n {% call statement('insert_updated_and_deleted') %}\n insert into {{ upsert }} ({{ insert_cols_csv }})\n with updates_and_deletes as (\n select\n dbt_scd_id,\n dbt_valid_to\n from {{ source }}\n where dbt_change_type IN ('update', 'delete')\n )\n select {% for column in insert_cols %}\n {%- if column == valid_to_col -%}\n updates_and_deletes.dbt_valid_to as dbt_valid_to\n {%- else -%}\n target.{{ column }} as {{ column }}\n {%- endif %} {%- if not loop.last %}, {%- endif %}\n {%- endfor %}\n from {{ target }} target\n join updates_and_deletes on target.dbt_scd_id = updates_and_deletes.dbt_scd_id;\n {% endcall %}\n\n {% call statement('insert_new') %}\n insert into {{ upsert }} ({{ insert_cols_csv }})\n select {% for column in insert_cols -%}\n {{ column }} {%- if not loop.last %}, {%- endif %}\n {%- endfor %}\n from {{ source }}\n where {{ source }}.dbt_change_type IN ('insert');\n {% endcall %}\n\n {% if target.can_exchange %}\n {% do exchange_tables_atomic(upsert, target) %}\n {% call statement('drop_exchanged_relation') %}\n drop table if exists {{ upsert }};\n {% endcall %}\n {% else %}\n {% call statement('drop_target_relation') %}\n drop table if exists {{ target }};\n {% endcall %}\n {% call statement('rename_upsert_relation') %}\n rename table {{ upsert }} to {{ target }};\n {% endcall %}\n {% endif %}\n\n {% do return ('select 1') %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt_clickhouse.exchange_tables_atomic"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.1972096, "supported_languages": null}, "macro.dbt_clickhouse.materialization_materialized_view_clickhouse": {"name": "materialization_materialized_view_clickhouse", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/materializations/materialized_view.sql", "original_file_path": "macros/materializations/materialized_view.sql", "unique_id": "macro.dbt_clickhouse.materialization_materialized_view_clickhouse", "macro_sql": "\n{%- materialization materialized_view, adapter='clickhouse' -%}\n\n {%- set target_relation = this.incorporate(type='table') -%}\n {%- set mv_relation = target_relation.derivative('_mv', 'materialized_view') -%}\n {%- set cluster_clause = on_cluster_clause(target_relation) -%}\n\n {# look for an existing relation for the target table and create backup relations if necessary #}\n {%- set existing_relation = load_cached_relation(this) -%}\n {%- set backup_relation = none -%}\n {%- set preexisting_backup_relation = none -%}\n {%- set preexisting_intermediate_relation = none -%}\n {% if existing_relation is not none %}\n {%- set backup_relation_type = existing_relation.type -%}\n {%- set backup_relation = make_backup_relation(target_relation, backup_relation_type) -%}\n {%- set preexisting_backup_relation = load_cached_relation(backup_relation) -%}\n {% if not existing_relation.can_exchange %}\n {%- set intermediate_relation = make_intermediate_relation(target_relation) -%}\n {%- set preexisting_intermediate_relation = load_cached_relation(intermediate_relation) -%}\n {% endif %}\n {% endif %}\n\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 {% if backup_relation is none %}\n {{ log('Creating new materialized view ' + target_relation.name )}}\n {% call statement('main') -%}\n {{ clickhouse__get_create_materialized_view_as_sql(target_relation, sql) }}\n {%- endcall %}\n {% elif existing_relation.can_exchange %}\n {{ log('Replacing existing materialized view ' + target_relation.name) }}\n {% call statement('drop existing materialized view') %}\n drop view if exists {{ mv_relation }} {{ cluster_clause }}\n {% endcall %}\n {% if should_full_refresh() %}\n {% call statement('main') -%}\n {{ get_create_table_as_sql(False, backup_relation, sql) }}\n {%- endcall %}\n {% do exchange_tables_atomic(backup_relation, existing_relation) %}\n {% else %}\n -- we need to have a 'main' statement\n {% call statement('main') -%}\n select 1\n {%- endcall %}\n {% endif %}\n {% call statement('create new materialized view') %}\n {{ clickhouse__create_mv_sql(mv_relation, existing_relation, cluster_clause, sql) }}\n {% endcall %}\n {% else %}\n {{ log('Replacing existing materialized view ' + target_relation.name) }}\n {{ clickhouse__replace_mv(target_relation, existing_relation, intermediate_relation, backup_relation, sql) }}\n {% endif %}\n\n -- cleanup\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, mv_relation]}) }}\n\n{%- endmaterialization -%}\n\n\n", "depends_on": {"macros": ["macro.dbt_clickhouse.on_cluster_clause", "macro.dbt.load_cached_relation", "macro.dbt.make_backup_relation", "macro.dbt.make_intermediate_relation", "macro.dbt.run_hooks", "macro.dbt.drop_relation_if_exists", "macro.dbt.statement", "macro.dbt_clickhouse.clickhouse__get_create_materialized_view_as_sql", "macro.dbt.should_full_refresh", "macro.dbt.get_create_table_as_sql", "macro.dbt_clickhouse.exchange_tables_atomic", "macro.dbt_clickhouse.clickhouse__create_mv_sql", "macro.dbt_clickhouse.clickhouse__replace_mv", "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": 1723229143.2045858, "supported_languages": ["sql"]}, "macro.dbt_clickhouse.clickhouse__get_create_materialized_view_as_sql": {"name": "clickhouse__get_create_materialized_view_as_sql", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/materializations/materialized_view.sql", "original_file_path": "macros/materializations/materialized_view.sql", "unique_id": "macro.dbt_clickhouse.clickhouse__get_create_materialized_view_as_sql", "macro_sql": "{% macro clickhouse__get_create_materialized_view_as_sql(relation, sql) -%}\n {% call statement('create_target_table') %}\n {{ get_create_table_as_sql(False, relation, sql) }}\n {% endcall %}\n {%- set cluster_clause = on_cluster_clause(relation) -%}\n {%- set mv_relation = relation.derivative('_mv', 'materialized_view') -%}\n {{ clickhouse__create_mv_sql(mv_relation, relation, cluster_clause, sql) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt.get_create_table_as_sql", "macro.dbt_clickhouse.on_cluster_clause", "macro.dbt_clickhouse.clickhouse__create_mv_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.2052886, "supported_languages": null}, "macro.dbt_clickhouse.clickhouse__create_mv_sql": {"name": "clickhouse__create_mv_sql", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/materializations/materialized_view.sql", "original_file_path": "macros/materializations/materialized_view.sql", "unique_id": "macro.dbt_clickhouse.clickhouse__create_mv_sql", "macro_sql": "{% macro clickhouse__create_mv_sql(mv_relation, target_table, cluster_clause, sql) -%}\n create materialized view if not exists {{ mv_relation }} {{ cluster_clause }}\n to {{ target_table }}\n as {{ sql }}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.205581, "supported_languages": null}, "macro.dbt_clickhouse.clickhouse__replace_mv": {"name": "clickhouse__replace_mv", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/materializations/materialized_view.sql", "original_file_path": "macros/materializations/materialized_view.sql", "unique_id": "macro.dbt_clickhouse.clickhouse__replace_mv", "macro_sql": "{% macro clickhouse__replace_mv(target_relation, existing_relation, intermediate_relation, backup_relation, sql) %}\n {# drop existing materialized view while we recreate the target table #}\n {%- set cluster_clause = on_cluster_clause(target_relation) -%}\n {%- set mv_relation = target_relation.derivative('_mv', 'materialized_view') -%}\n {% call statement('drop existing mv') -%}\n drop view if exists {{ mv_relation }} {{ cluster_clause }}\n {%- endcall %}\n\n {# recreate the target table #}\n {% call statement('main') -%}\n {{ get_create_table_as_sql(False, intermediate_relation, sql) }}\n {%- endcall %}\n {{ adapter.rename_relation(existing_relation, backup_relation) }}\n {{ adapter.rename_relation(intermediate_relation, target_relation) }}\n\n {# now that the target table is recreated, we can finally create our new view #}\n {{ clickhouse__create_mv_sql(mv_relation, target_relation, cluster_clause, sql) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_clickhouse.on_cluster_clause", "macro.dbt.statement", "macro.dbt.get_create_table_as_sql", "macro.dbt_clickhouse.clickhouse__create_mv_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.2065935, "supported_languages": null}, "macro.dbt_clickhouse.materialization_dictionary_clickhouse": {"name": "materialization_dictionary_clickhouse", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/materializations/dictionary.sql", "original_file_path": "macros/materializations/dictionary.sql", "unique_id": "macro.dbt_clickhouse.materialization_dictionary_clickhouse", "macro_sql": "{%- materialization dictionary, adapter='clickhouse' -%}\n\n {%- set existing_relation = load_cached_relation(this) -%}\n {%- set target_relation = this.incorporate(type='dictionary') -%}\n {%- set intermediate_relation = make_intermediate_relation(target_relation) -%}\n {%- set existing_intermediate_relation = load_cached_relation(intermediate_relation) -%}\n {%- set backup_relation_type = 'dictionary' if existing_relation is none else existing_relation.type -%}\n {%- set backup_relation = make_backup_relation(target_relation, backup_relation_type) -%}\n {%- set existing_backup_relation = load_cached_relation(backup_relation) -%}\n {%- set cluster_clause = on_cluster_clause(target_relation) -%}\n\n {%- set grant_config = config.get('grants') -%}\n\n {{ run_hooks(pre_hooks, inside_transaction=False) }}\n\n {{ drop_dictionary_if_exists(existing_backup_relation, cluster_clause) }}\n {{ drop_dictionary_if_exists(existing_intermediate_relation, cluster_clause) }}\n\n\n {{ run_hooks(pre_hooks, inside_transaction=True) }}\n\n {# create our new dictionary #}\n {% call statement('main') -%}\n {{ clickhouse__get_create_dictionary_as_sql(intermediate_relation, cluster_clause, sql) }}\n {%- endcall %}\n\n {# cleanup #}\n {% if existing_relation is not none %}\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_dictionary_if_exists(backup_relation) }}\n\n {{ run_hooks(post_hooks, inside_transaction=False) }}\n\n {{ return({'relations': [target_relation]}) }}\n\n{%- endmaterialization -%}\n\n\n", "depends_on": {"macros": ["macro.dbt.load_cached_relation", "macro.dbt.make_intermediate_relation", "macro.dbt.make_backup_relation", "macro.dbt_clickhouse.on_cluster_clause", "macro.dbt.run_hooks", "macro.dbt_clickhouse.drop_dictionary_if_exists", "macro.dbt.statement", "macro.dbt_clickhouse.clickhouse__get_create_dictionary_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": 1723229143.2130122, "supported_languages": ["sql"]}, "macro.dbt_clickhouse.clickhouse__get_create_dictionary_as_sql": {"name": "clickhouse__get_create_dictionary_as_sql", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/materializations/dictionary.sql", "original_file_path": "macros/materializations/dictionary.sql", "unique_id": "macro.dbt_clickhouse.clickhouse__get_create_dictionary_as_sql", "macro_sql": "{% macro clickhouse__get_create_dictionary_as_sql(relation, cluster_clause, sql) %}\n {%- set fields = config.get('fields') -%}\n {%- set source_type = config.get('source_type') -%}\n\n CREATE DICTIONARY {{ relation }} {{ cluster_clause }}\n (\n {%- for (name, data_type) in fields -%}\n {{ name }} {{ data_type }}{%- if not loop.last -%},{%- endif -%}\n {%- endfor -%}\n )\n {{ primary_key_clause(label=\"primary key\") }}\n SOURCE(\n {%- if source_type == 'http' %}\n {{ http_source() }}\n {% else %}\n {{ clickhouse_source(sql) }}\n {% endif -%}\n )\n LAYOUT({{ config.get('layout') }})\n LIFETIME({{ config.get('lifetime') }})\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_clickhouse.primary_key_clause", "macro.dbt_clickhouse.http_source", "macro.dbt_clickhouse.clickhouse_source"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.214243, "supported_languages": null}, "macro.dbt_clickhouse.http_source": {"name": "http_source", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/materializations/dictionary.sql", "original_file_path": "macros/materializations/dictionary.sql", "unique_id": "macro.dbt_clickhouse.http_source", "macro_sql": "{% macro http_source() %}\n HTTP(URL '{{ config.get(\"url\") }}' FORMAT '{{ config.get(\"format\") }}')\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.214519, "supported_languages": null}, "macro.dbt_clickhouse.clickhouse_source": {"name": "clickhouse_source", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/materializations/dictionary.sql", "original_file_path": "macros/materializations/dictionary.sql", "unique_id": "macro.dbt_clickhouse.clickhouse_source", "macro_sql": "{% macro clickhouse_source(sql) %}\n {%- set credentials = adapter.get_credentials(config.get(\"connection_overrides\", {})) -%}\n {%- set table = config.get('table') -%}\n CLICKHOUSE(\n {% if credentials.get(\"user\") -%}\n user '{{ credentials.get(\"user\") }}'\n {%- endif %}\n {% if credentials.get(\"password\") -%}\n password '{{ credentials.get(\"password\") }}'\n {%- endif %}\n {% if credentials.get(\"database\") -%}\n db '{{ credentials.get(\"database\") }}'\n {%- endif %}\n {%- if table is not none %}\n table '{{ table }}'\n {% else %}\n query \"{{ sql }}\"\n {% endif -%}\n )\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.2156498, "supported_languages": null}, "macro.dbt_clickhouse.drop_dictionary_if_exists": {"name": "drop_dictionary_if_exists", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/materializations/dictionary.sql", "original_file_path": "macros/materializations/dictionary.sql", "unique_id": "macro.dbt_clickhouse.drop_dictionary_if_exists", "macro_sql": "{% macro drop_dictionary_if_exists(relation, cluster_clause) %}\n {% if relation.type != 'dictionary' %}\n {{ log(relation ~ ' is not a dictionary; defaulting to drop_relation_if_exists') }}\n {{ drop_relation_if_exists(relation) }}\n {% else %}\n {% call statement('drop_dictionary_if_exists') %}\n drop dictionary if exists {{ relation }} {{ cluster_clause }}\n {% endcall %}\n {% endif %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.drop_relation_if_exists", "macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.216223, "supported_languages": null}, "macro.dbt_clickhouse.materialization_distributed_table_clickhouse": {"name": "materialization_distributed_table_clickhouse", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/materializations/distributed_table.sql", "original_file_path": "macros/materializations/distributed_table.sql", "unique_id": "macro.dbt_clickhouse.materialization_distributed_table_clickhouse", "macro_sql": "{% materialization distributed_table, adapter='clickhouse' %}\n {% set insert_distributed_sync = run_query(\"SELECT value FROM system.settings WHERE name = 'insert_distributed_sync'\")[0][0] %}\n {% if insert_distributed_sync != '1' %}\n {% do exceptions.raise_compiler_error('To use distributed materialization setting insert_distributed_sync should be set to 1') %}\n {% endif %}\n\n {%- set local_suffix = adapter.get_clickhouse_local_suffix() -%}\n {%- set local_db_prefix = adapter.get_clickhouse_local_db_prefix() -%}\n\n {%- set existing_relation = load_cached_relation(this) -%}\n {%- set target_relation = this.incorporate(type='table') -%}\n\n {% set on_cluster = on_cluster_clause(target_relation) %}\n {% if on_cluster.strip() == '' %}\n {% do exceptions.raise_compiler_error('To use distributed materialization cluster setting in dbt profile must be set') %}\n {% endif %}\n\n {% set existing_relation_local = existing_relation.incorporate(path={\"identifier\": this.identifier + local_suffix, \"schema\": local_db_prefix + this.schema}) if existing_relation is not none else none %}\n {% set target_relation_local = target_relation.incorporate(path={\"identifier\": this.identifier + local_suffix, \"schema\": local_db_prefix + this.schema}) if target_relation is not none else none %}\n\n {%- set backup_relation = none -%}\n {%- set preexisting_backup_relation = none -%}\n {%- set preexisting_intermediate_relation = none -%}\n\n {% if existing_relation_local is not none %}\n {%- set backup_relation_type = existing_relation_local.type -%}\n {%- set backup_relation = make_backup_relation(target_relation_local, backup_relation_type) -%}\n {%- set preexisting_backup_relation = load_cached_relation(backup_relation) -%}\n {% if not existing_relation.can_exchange %}\n {%- set intermediate_relation = make_intermediate_relation(target_relation_local) -%}\n {%- set preexisting_intermediate_relation = load_cached_relation(intermediate_relation) -%}\n {% endif %}\n {% endif %}\n {% set view_relation = default__make_temp_relation(target_relation, '__dbt_tmp') %}\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 {{ drop_relation_if_exists(view_relation) }}\n\n {% set grant_config = config.get('grants') %}\n\n {{ run_hooks(pre_hooks, inside_transaction=False) }}\n\n {% call statement('main') %}\n {{ create_view_as(view_relation, sql) }}\n {% endcall %}\n\n {{ run_hooks(pre_hooks, inside_transaction=True) }}\n\n {% if backup_relation is none %}\n {{ create_distributed_local_table(target_relation, target_relation_local, view_relation) }}\n {% elif existing_relation.can_exchange %}\n -- We can do an atomic exchange, so no need for an intermediate\n {% call statement('main') -%}\n {{ create_empty_table_from_relation(backup_relation, view_relation) }}\n {%- endcall %}\n {% do exchange_tables_atomic(backup_relation, existing_relation_local) %}\n {% else %}\n {% do run_query(create_empty_table_from_relation(intermediate_relation, view_relation)) or '' %}\n {{ adapter.rename_relation(existing_relation_local, backup_relation) }}\n {{ adapter.rename_relation(intermediate_relation, target_relation_local) }}\n {% endif %} \n {% do run_query(create_distributed_table(target_relation, target_relation_local)) or '' %}\n {% do run_query(clickhouse__insert_into(target_relation, sql)) or '' %}\n {{ drop_relation_if_exists(view_relation) }}\n -- cleanup\n {% set should_revoke = should_revoke(existing_relation, full_refresh_mode=True) %}\n {% do apply_grants(target_relation_local, grant_config, should_revoke=should_revoke) %}\n {% do apply_grants(target_relation, grant_config, should_revoke=should_revoke) %}\n\n {% do persist_docs(target_relation, model) %}\n {{ run_hooks(post_hooks, inside_transaction=True) }}\n {{ adapter.commit() }}\n {{ drop_relation_if_exists(backup_relation) }}\n {{ run_hooks(post_hooks, inside_transaction=False) }}\n {{ return({'relations': [target_relation]}) }}\n\n{% endmaterialization %}", "depends_on": {"macros": ["macro.dbt.run_query", "macro.dbt.load_cached_relation", "macro.dbt_clickhouse.on_cluster_clause", "macro.dbt.make_backup_relation", "macro.dbt.make_intermediate_relation", "macro.dbt.default__make_temp_relation", "macro.dbt.drop_relation_if_exists", "macro.dbt.run_hooks", "macro.dbt.statement", "macro.dbt.create_view_as", "macro.dbt_clickhouse.create_distributed_local_table", "macro.dbt_clickhouse.create_empty_table_from_relation", "macro.dbt_clickhouse.exchange_tables_atomic", "macro.dbt_clickhouse.create_distributed_table", "macro.dbt_clickhouse.clickhouse__insert_into", "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": 1723229143.2312946, "supported_languages": ["sql"]}, "macro.dbt_clickhouse.create_distributed_table": {"name": "create_distributed_table", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/materializations/distributed_table.sql", "original_file_path": "macros/materializations/distributed_table.sql", "unique_id": "macro.dbt_clickhouse.create_distributed_table", "macro_sql": "{% macro create_distributed_table(relation, local_relation) %}\n {%- set cluster = adapter.get_clickhouse_cluster_name() -%}\n {% if cluster is none %}\n {% do exceptions.raise_compiler_error('Cluster name should be defined for using distributed materializations, current is None') %}\n {% endif %}\n\n {%- set cluster = cluster[1:-1] -%}\n {%- set sharding = config.get('sharding_key') -%}\n\n create or replace table {{ relation }} {{ on_cluster_clause(relation) }} as {{ local_relation }}\n ENGINE = Distributed('{{ cluster}}', '{{ local_relation.schema }}', '{{ local_relation.name }}'\n {%- if sharding is not none and sharding.strip() != '' -%}\n , {{ sharding }}\n {%- else %}\n , rand()\n {% endif -%}\n )\n {% endmacro %}", "depends_on": {"macros": ["macro.dbt_clickhouse.on_cluster_clause"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.2324255, "supported_languages": null}, "macro.dbt_clickhouse.create_empty_table_from_relation": {"name": "create_empty_table_from_relation", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/materializations/distributed_table.sql", "original_file_path": "macros/materializations/distributed_table.sql", "unique_id": "macro.dbt_clickhouse.create_empty_table_from_relation", "macro_sql": "{% macro create_empty_table_from_relation(relation, source_relation) -%}\n {%- set sql_header = config.get('sql_header', none) -%}\n {%- set columns = adapter.get_columns_in_relation(source_relation) | list -%}\n \n\n {%- set col_list = [] -%}\n {% for col in columns %}\n {{col_list.append(col.name + ' ' + col.data_type) or '' }}\n {% endfor %}\n {{ sql_header if sql_header is not none }}\n\n create table {{ relation.include(database=False) }}\n {{ on_cluster_clause(relation) }} (\n {{col_list | join(', ')}}\n )\n \n {{ engine_clause() }}\n {{ order_cols(label=\"order by\") }}\n {{ primary_key_clause(label=\"primary key\") }}\n {{ partition_cols(label=\"partition by\") }}\n {{ adapter.get_model_settings(model) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_clickhouse.on_cluster_clause", "macro.dbt_clickhouse.engine_clause", "macro.dbt_clickhouse.order_cols", "macro.dbt_clickhouse.primary_key_clause", "macro.dbt_clickhouse.partition_cols"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.2336884, "supported_languages": null}, "macro.dbt_clickhouse.create_distributed_local_table": {"name": "create_distributed_local_table", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/materializations/distributed_table.sql", "original_file_path": "macros/materializations/distributed_table.sql", "unique_id": "macro.dbt_clickhouse.create_distributed_local_table", "macro_sql": "{% macro create_distributed_local_table(distributed_relation, shard_relation, structure_relation, sql_query=none) -%}\n {{ drop_relation_if_exists(shard_relation) }}\n {{ drop_relation_if_exists(distributed_relation) }}\n {{ create_schema(shard_relation) }}\n {% do run_query(create_empty_table_from_relation(shard_relation, structure_relation)) or '' %}\n {% do run_query(create_distributed_table(distributed_relation, shard_relation)) or '' %}\n {% if sql_query is not none %}\n {% do run_query(clickhouse__insert_into(distributed_relation, sql_query)) or '' %}\n {% endif %}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.drop_relation_if_exists", "macro.dbt.create_schema", "macro.dbt.run_query", "macro.dbt_clickhouse.create_empty_table_from_relation", "macro.dbt_clickhouse.create_distributed_table", "macro.dbt_clickhouse.clickhouse__insert_into"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.2345548, "supported_languages": null}, "macro.dbt_clickhouse.materialization_incremental_clickhouse": {"name": "materialization_incremental_clickhouse", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/materializations/incremental/incremental.sql", "original_file_path": "macros/materializations/incremental/incremental.sql", "unique_id": "macro.dbt_clickhouse.materialization_incremental_clickhouse", "macro_sql": "{% materialization incremental, adapter='clickhouse' %}\n\n {%- set existing_relation = load_cached_relation(this) -%}\n {%- set target_relation = this.incorporate(type='table') -%}\n\n {%- set unique_key = config.get('unique_key') -%}\n {% if unique_key is not none and unique_key|length == 0 %}\n {% set unique_key = none %}\n {% endif %}\n {% if unique_key is iterable and (unique_key is not string and unique_key is not mapping) %}\n {% set unique_key = unique_key|join(', ') %}\n {% endif %}\n {%- set inserts_only = config.get('inserts_only') -%}\n {%- set grant_config = config.get('grants') -%}\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 {%- 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 {%- set preexisting_intermediate_relation = load_cached_relation(intermediate_relation)-%}\n {%- set preexisting_backup_relation = load_cached_relation(backup_relation) -%}\n\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 {{ run_hooks(pre_hooks, inside_transaction=True) }}\n {% set to_drop = [] %}\n\n {% if existing_relation is none %}\n -- No existing table, simply create a new one\n {% call statement('main') %}\n {{ get_create_table_as_sql(False, target_relation, sql) }}\n {% endcall %}\n\n {% elif full_refresh_mode %}\n -- Completely replacing the old table, so create a temporary table and then swap it\n {% call statement('main') %}\n {{ get_create_table_as_sql(False, intermediate_relation, sql) }}\n {% endcall %}\n {% set need_swap = true %}\n\n {% elif inserts_only or unique_key is none -%}\n -- There are no updates/deletes or duplicate keys are allowed. Simply add all of the new rows to the existing\n -- table. It is the user's responsibility to avoid duplicates. Note that \"inserts_only\" is a ClickHouse adapter\n -- specific configurable that is used to avoid creating an expensive intermediate table.\n {% call statement('main') %}\n {{ clickhouse__insert_into(target_relation, sql) }}\n {% endcall %}\n\n {% else %}\n {% set column_changes = none %}\n {% set incremental_strategy = adapter.calculate_incremental_strategy(config.get('incremental_strategy')) %}\n {% set incremental_predicates = config.get('predicates', none) or config.get('incremental_predicates', none) %}\n {%- if on_schema_change != 'ignore' %}\n {%- set column_changes = adapter.check_incremental_schema_changes(on_schema_change, existing_relation, sql) -%}\n {%- if column_changes %}\n {%- if incremental_strategy in ('append', 'delete_insert') %}\n {% set incremental_strategy = 'legacy' %}\n {{ log('Schema changes detected, switching to legacy incremental strategy') }}\n {%- endif %}\n {% endif %}\n {% endif %}\n {% if incremental_strategy != 'delete_insert' and incremental_predicates %}\n {% do exceptions.raise_compiler_error('Cannot apply incremental predicates with ' + incremental_strategy + ' strategy.') %}\n {% endif %}\n {% if incremental_strategy == 'legacy' %}\n {% do clickhouse__incremental_legacy(existing_relation, intermediate_relation, column_changes, unique_key) %}\n {% set need_swap = true %}\n {% elif incremental_strategy == 'delete_insert' %}\n {% do clickhouse__incremental_delete_insert(existing_relation, unique_key, incremental_predicates) %}\n {% elif incremental_strategy == 'append' %}\n {% call statement('main') %}\n {{ clickhouse__insert_into(target_relation, sql) }}\n {% endcall %}\n {% endif %}\n {% endif %}\n\n {% if need_swap %}\n {% if existing_relation.can_exchange %}\n {% do adapter.rename_relation(intermediate_relation, backup_relation) %}\n {% do exchange_tables_atomic(backup_relation, target_relation) %}\n {% else %}\n {% do adapter.rename_relation(target_relation, backup_relation) %}\n {% do adapter.rename_relation(intermediate_relation, target_relation) %}\n {% endif %}\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 {% 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.should_full_refresh", "macro.dbt.incremental_validate_on_schema_change", "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_clickhouse.clickhouse__insert_into", "macro.dbt_clickhouse.clickhouse__incremental_legacy", "macro.dbt_clickhouse.clickhouse__incremental_delete_insert", "macro.dbt_clickhouse.exchange_tables_atomic", "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": 1723229143.2768135, "supported_languages": ["sql"]}, "macro.dbt_clickhouse.clickhouse__incremental_legacy": {"name": "clickhouse__incremental_legacy", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/materializations/incremental/incremental.sql", "original_file_path": "macros/materializations/incremental/incremental.sql", "unique_id": "macro.dbt_clickhouse.clickhouse__incremental_legacy", "macro_sql": "{% macro clickhouse__incremental_legacy(existing_relation, intermediate_relation, column_changes, unique_key, is_distributed=False) %}\n {% set new_data_relation = existing_relation.incorporate(path={\"identifier\": existing_relation.identifier + '__dbt_new_data'}) %}\n {{ drop_relation_if_exists(new_data_relation) }}\n\n {%- set inserted_relation = intermediate_relation -%}\n {%- set inserting_relation = new_data_relation -%}\n\n -- First create a temporary table for all of the new data\n {% if is_distributed %}\n {% if column_changes %}\n {% do exceptions.raise_compiler_error('Schema changes not supported with Distributed tables ') %}\n {% endif %}\n -- Need to use distributed table to have data on all shards\n {%- set distributed_new_data_relation = existing_relation.incorporate(path={\"identifier\": existing_relation.identifier + '__dbt_distributed_new_data'}) -%}\n {%- set inserting_relation = distributed_new_data_relation -%}\n {{ create_distributed_local_table(distributed_new_data_relation, new_data_relation, existing_relation, sql) }}\n {% elif column_changes %}\n {% call statement('create_new_data_temp') %}\n {{ get_create_table_as_sql(False, new_data_relation, sql) }}\n {% endcall %}\n {% else %}\n {% call statement('create_new_data_temp') %}\n {{ get_create_table_as_sql(False, new_data_relation, sql) }}\n {% endcall %}\n {% endif %}\n\n -- Next create another temporary table that will eventually be used to replace the existing table. We can't\n -- use the table just created in the previous step because we don't want to override any updated rows with\n -- old rows when we insert the old data\n {% if is_distributed %}\n {%- set distributed_intermediate_relation = make_intermediate_relation(existing_relation) -%}\n {%- set inserted_relation = distributed_intermediate_relation -%}\n {{ create_distributed_local_table(distributed_intermediate_relation, intermediate_relation, existing_relation) }}\n {% else %}\n {% call statement('main') %}\n create table {{ intermediate_relation }} {{ on_cluster_clause(existing_relation) }} as {{ new_data_relation }}\n {% endcall %}\n {% endif %}\n\n -- Insert all the existing rows into the new temporary table, ignoring any rows that have keys in the \"new data\"\n -- table.\n {%- set source_columns = adapter.get_columns_in_relation(existing_relation) -%}\n {%- set source_columns_csv = source_columns | map(attribute='quoted') | join(', ') -%}\n {% call statement('insert_existing_data') %}\n insert into {{ inserted_relation }} ({{ source_columns_csv }})\n select {{ source_columns_csv }}\n from {{ existing_relation }}\n where ({{ unique_key }}) not in (\n select {{ unique_key }}\n from {{ inserting_relation }}\n )\n {{ adapter.get_model_query_settings(model) }}\n {% endcall %}\n\n -- Insert all of the new data into the temporary table\n {% if column_changes %}\n {%- set dest_columns = adapter.get_columns_in_relation(new_data_relation) -%}\n {%- set dest_columns_csv = dest_columns | map(attribute='quoted') | join(', ') -%}\n {% else %}\n {%- set dest_columns_csv = source_columns_csv %}\n {% endif %}\n {% call statement('insert_new_data') %}\n insert into {{ inserted_relation }} ({{ dest_columns_csv }})\n select {{ dest_columns_csv }}\n from {{ inserting_relation }}\n {{ adapter.get_model_query_settings(model) }}\n {% endcall %}\n\n {% do adapter.drop_relation(new_data_relation) %}\n {% if is_distributed %}\n {{ drop_relation_if_exists(distributed_new_data_relation) }}\n {{ drop_relation_if_exists(distributed_intermediate_relation) }}\n {% endif %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.drop_relation_if_exists", "macro.dbt_clickhouse.create_distributed_local_table", "macro.dbt.statement", "macro.dbt.get_create_table_as_sql", "macro.dbt.make_intermediate_relation", "macro.dbt_clickhouse.on_cluster_clause"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.2806454, "supported_languages": null}, "macro.dbt_clickhouse.clickhouse__incremental_delete_insert": {"name": "clickhouse__incremental_delete_insert", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/materializations/incremental/incremental.sql", "original_file_path": "macros/materializations/incremental/incremental.sql", "unique_id": "macro.dbt_clickhouse.clickhouse__incremental_delete_insert", "macro_sql": "{% macro clickhouse__incremental_delete_insert(existing_relation, unique_key, incremental_predicates, is_distributed=False) %}\n {% set new_data_relation = existing_relation.incorporate(path={\"identifier\": existing_relation.identifier\n + '__dbt_new_data_' + invocation_id.replace('-', '_')}) %}\n {{ drop_relation_if_exists(new_data_relation) }}\n {%- set distributed_new_data_relation = existing_relation.incorporate(path={\"identifier\": existing_relation.identifier + '__dbt_distributed_new_data'}) -%}\n\n {%- set inserting_relation = new_data_relation -%}\n\n {%- set local_suffix = adapter.get_clickhouse_local_suffix() -%}\n {%- set local_db_prefix = adapter.get_clickhouse_local_db_prefix() -%}\n\n {% if is_distributed %}\n -- Need to use distributed table to have data on all shards\n {%- set inserting_relation = distributed_new_data_relation -%}\n {{ create_distributed_local_table(distributed_new_data_relation, new_data_relation, existing_relation, sql) }}\n {% else %}\n {% call statement('main') %}\n {{ get_create_table_as_sql(False, new_data_relation, sql) }}\n {% endcall %}\n {% endif %}\n\n {% call statement('delete_existing_data') %}\n {% if is_distributed %}\n {% set existing_local = existing_relation.incorporate(path={\"identifier\": this.identifier + local_suffix, \"schema\": local_db_prefix + this.schema}) if existing_relation is not none else none %}\n delete from {{ existing_local }} {{ on_cluster_clause(existing_relation) }} where ({{ unique_key }}) in (select {{ unique_key }}\n from {{ inserting_relation }})\n {% else %}\n delete from {{ existing_relation }} where ({{ unique_key }}) in (select {{ unique_key }}\n from {{ inserting_relation }})\n {% endif %}\n {%- if incremental_predicates %}\n {% for predicate in incremental_predicates %}\n and {{ predicate }}\n {% endfor %}\n {%- endif -%}\n {{ adapter.get_model_query_settings(model) }}\n {% endcall %}\n\n {%- set dest_columns = adapter.get_columns_in_relation(existing_relation) -%}\n {%- set dest_cols_csv = dest_columns | map(attribute='quoted') | join(', ') -%}\n {% call statement('insert_new_data') %}\n insert into {{ existing_relation }} select {{ dest_cols_csv }} from {{ inserting_relation }} {{ adapter.get_model_query_settings(model) }}\n {% endcall %}\n {% do adapter.drop_relation(new_data_relation) %}\n {{ drop_relation_if_exists(distributed_new_data_relation) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.replace", "macro.dbt.drop_relation_if_exists", "macro.dbt_clickhouse.create_distributed_local_table", "macro.dbt.statement", "macro.dbt.get_create_table_as_sql", "macro.dbt_clickhouse.on_cluster_clause"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.2836285, "supported_languages": null}, "macro.dbt_clickhouse.is_incremental": {"name": "is_incremental", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/materializations/incremental/is_incremental.sql", "original_file_path": "macros/materializations/incremental/is_incremental.sql", "unique_id": "macro.dbt_clickhouse.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' or model.config.materialized == 'distributed_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": 1723229143.284721, "supported_languages": null}, "macro.dbt_clickhouse.materialization_distributed_incremental_clickhouse": {"name": "materialization_distributed_incremental_clickhouse", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/materializations/incremental/distributed_incremental.sql", "original_file_path": "macros/materializations/incremental/distributed_incremental.sql", "unique_id": "macro.dbt_clickhouse.materialization_distributed_incremental_clickhouse", "macro_sql": "{% materialization distributed_incremental, adapter='clickhouse' %}\n {% set insert_distributed_sync = run_query(\"SELECT value FROM system.settings WHERE name = 'insert_distributed_sync'\")[0][0] %}\n {% if insert_distributed_sync != '1' %}\n {% do exceptions.raise_compiler_error('To use distributed materialization setting insert_distributed_sync should be set to 1') %}\n {% endif %}\n\n {%- set local_suffix = adapter.get_clickhouse_local_suffix() -%}\n {%- set local_db_prefix = adapter.get_clickhouse_local_db_prefix() -%}\n\n {%- set existing_relation = load_cached_relation(this) -%}\n {%- set target_relation = this.incorporate(type='table') -%}\n\n {% set on_cluster = on_cluster_clause(target_relation) %}\n {% if on_cluster.strip() == '' %}\n {% do exceptions.raise_compiler_error('To use distributed materializations cluster setting in dbt profile must be set') %}\n {% endif %}\n\n {% set existing_relation_local = existing_relation.incorporate(path={\"identifier\": this.identifier + local_suffix, \"schema\": local_db_prefix + this.schema}) if existing_relation is not none else none %}\n {% set target_relation_local = target_relation.incorporate(path={\"identifier\": this.identifier + local_suffix, \"schema\": local_db_prefix + this.schema}) if target_relation is not none else none %}\n\n {%- set unique_key = config.get('unique_key') -%}\n {% if unique_key is not none and unique_key|length == 0 %}\n {% set unique_key = none %}\n {% endif %}\n {% if unique_key is iterable and (unique_key is not string and unique_key is not mapping) %}\n {% set unique_key = unique_key|join(', ') %}\n {% endif %}\n {%- set inserts_only = config.get('inserts_only') -%}\n {%- set grant_config = config.get('grants') -%}\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\n {{ create_schema(target_relation_local) }}\n {%- set intermediate_relation = make_intermediate_relation(target_relation_local)-%}\n {%- set distributed_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_local, backup_relation_type) -%}\n {%- set distributed_backup_relation = make_backup_relation(target_relation, backup_relation_type) -%}\n {%- set preexisting_intermediate_relation = load_cached_relation(intermediate_relation)-%}\n {%- set preexisting_backup_relation = load_cached_relation(backup_relation) -%}\n {%- set view_relation = default__make_temp_relation(target_relation, '__dbt_view_tmp') -%}\n\n {{ drop_relation_if_exists(preexisting_intermediate_relation) }}\n {{ drop_relation_if_exists(preexisting_backup_relation) }}\n {{ drop_relation_if_exists(view_relation) }}\n {{ drop_relation_if_exists(distributed_intermediate_relation) }}\n\n {{ run_hooks(pre_hooks, inside_transaction=False) }}\n {{ run_hooks(pre_hooks, inside_transaction=True) }}\n {% set to_drop = [] %}\n {% set schema_changes = none %}\n\n {% call statement('main') %}\n {{ create_view_as(view_relation, sql) }}\n {% endcall %}\n\n {% if existing_relation is none %}\n -- No existing table, simply create a new one\n {{ create_distributed_local_table(target_relation, target_relation_local, view_relation, sql) }}\n\n {% elif full_refresh_mode %}\n -- Completely replacing the old table, so create a temporary table and then swap it\n {{ create_distributed_local_table(distributed_intermediate_relation, intermediate_relation, view_relation, sql) }}\n {% do adapter.drop_relation(distributed_intermediate_relation) or '' %}\n {% set need_swap = true %}\n\n {% elif inserts_only or unique_key is none -%}\n -- There are no updates/deletes or duplicate keys are allowed. Simply add all of the new rows to the existing\n -- table. It is the user's responsibility to avoid duplicates. Note that \"inserts_only\" is a ClickHouse adapter\n -- specific configurable that is used to avoid creating an expensive intermediate table.\n {% call statement('main') %}\n {{ clickhouse__insert_into(target_relation, sql) }}\n {% endcall %}\n\n {% else %}\n {% set incremental_strategy = adapter.calculate_incremental_strategy(config.get('incremental_strategy')) %}\n {% set incremental_predicates = config.get('predicates', none) or config.get('incremental_predicates', none) %}\n {% if on_schema_change != 'ignore' %}\n {%- set schema_changes = check_for_schema_changes(existing_relation, target_relation) -%}\n {% if schema_changes['schema_changed'] and incremental_strategy in ('append', 'delete_insert') %}\n {% set incremental_strategy = 'legacy' %}\n {% do log('Schema changes detected, switching to legacy incremental strategy') %}\n {% endif %}\n {% endif %}\n {% if incremental_strategy != 'delete_insert' and incremental_predicates %}\n {% do exceptions.raise_compiler_error('Cannot apply incremental predicates with ' + incremental_strategy + ' strategy.') %}\n {% endif %}\n {% if incremental_strategy == 'legacy' %}\n {% do clickhouse__incremental_legacy(existing_relation, intermediate_relation, schema_changes, unique_key, True) %}\n {% set need_swap = true %}\n {% elif incremental_strategy == 'delete_insert' %}\n {% do clickhouse__incremental_delete_insert(existing_relation, unique_key, incremental_predicates, True) %}\n {% elif incremental_strategy == 'append' %}\n {% call statement('main') %}\n {{ clickhouse__insert_into(target_relation, sql) }}\n {% endcall %}\n {% endif %}\n {% endif %}\n\n {% if need_swap %}\n {% if False %}\n {% do adapter.rename_relation(intermediate_relation, backup_relation) %}\n {% do exchange_tables_atomic(backup_relation, target_relation_local) %}\n {% else %}\n {% do adapter.rename_relation(target_relation_local, backup_relation) %}\n {% do adapter.rename_relation(intermediate_relation, target_relation_local) %}\n {% endif %}\n\n -- Structure could have changed, need to update distributed table from replaced local table\n {% set target_relation_new = target_relation.incorporate(path={\"identifier\": target_relation.identifier + '_temp'}) %}\n {{ drop_relation_if_exists(target_relation_new) }}\n {% do run_query(create_distributed_table(target_relation_new, target_relation_local)) %}\n\n {% if False %}\n {% do adapter.rename_relation(target_relation_new, distributed_backup_relation) %}\n {% do exchange_tables_atomic(distributed_backup_relation, target_relation) %}\n {% else %}\n {% do adapter.rename_relation(target_relation, distributed_backup_relation) %}\n {% do adapter.rename_relation(target_relation_new, target_relation) %}\n {% endif %}\n\n {% do to_drop.append(backup_relation) %}\n {% do to_drop.append(distributed_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 {% do apply_grants(target_relation_local, 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 {% 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.run_query", "macro.dbt.load_cached_relation", "macro.dbt_clickhouse.on_cluster_clause", "macro.dbt.should_full_refresh", "macro.dbt.incremental_validate_on_schema_change", "macro.dbt.create_schema", "macro.dbt.make_intermediate_relation", "macro.dbt.make_backup_relation", "macro.dbt.default__make_temp_relation", "macro.dbt.drop_relation_if_exists", "macro.dbt.run_hooks", "macro.dbt.statement", "macro.dbt.create_view_as", "macro.dbt_clickhouse.create_distributed_local_table", "macro.dbt_clickhouse.clickhouse__insert_into", "macro.dbt.check_for_schema_changes", "macro.dbt_clickhouse.clickhouse__incremental_legacy", "macro.dbt_clickhouse.clickhouse__incremental_delete_insert", "macro.dbt_clickhouse.exchange_tables_atomic", "macro.dbt_clickhouse.create_distributed_table", "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": 1723229143.3074782, "supported_languages": ["sql"]}, "macro.dbt_clickhouse.clickhouse__test_relationships": {"name": "clickhouse__test_relationships", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/schema_tests/relationships.sql", "original_file_path": "macros/schema_tests/relationships.sql", "unique_id": "macro.dbt_clickhouse.clickhouse__test_relationships", "macro_sql": "{% macro clickhouse__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-- end_of_sql\nsettings join_use_nulls = 1\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.308131, "supported_languages": null}, "macro.dbt_clickhouse.clickhouse__get_show_grant_sql": {"name": "clickhouse__get_show_grant_sql", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt_clickhouse.clickhouse__get_show_grant_sql", "macro_sql": "{% macro clickhouse__get_show_grant_sql(relation) %}\n SELECT access_type as privilege_type, COALESCE(user_name, role_name) as grantee from system.grants where table = '{{ relation.name }}'\n AND database = '{{ relation.schema }}'\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.3088317, "supported_languages": null}, "macro.dbt_clickhouse.clickhouse__call_dcl_statements": {"name": "clickhouse__call_dcl_statements", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt_clickhouse.clickhouse__call_dcl_statements", "macro_sql": "{% macro clickhouse__call_dcl_statements(dcl_statement_list) %}\n {% for dcl_statement in dcl_statement_list %}\n {% call statement('dcl') %}\n {{ dcl_statement }};\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": 1723229143.3092098, "supported_languages": null}, "macro.dbt_clickhouse.clickhouse__get_grant_sql": {"name": "clickhouse__get_grant_sql", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt_clickhouse.clickhouse__get_grant_sql", "macro_sql": "\n\n\n{%- macro clickhouse__get_grant_sql(relation, privilege, grantees) -%}\n grant {{ on_cluster_clause(relation)}} {{ privilege }} on {{ relation }} to {{ grantees | join(', ') }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt_clickhouse.on_cluster_clause"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.3095975, "supported_languages": null}, "macro.dbt_clickhouse.clickhouse__get_revoke_sql": {"name": "clickhouse__get_revoke_sql", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt_clickhouse.clickhouse__get_revoke_sql", "macro_sql": "{%- macro clickhouse__get_revoke_sql(relation, privilege, grantees) -%}\n revoke {{ on_cluster_clause(relation)}} {{ privilege }} on {{ relation }} from {{ grantees | join(', ') }}\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt_clickhouse.on_cluster_clause"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.309935, "supported_languages": null}, "macro.dbt_clickhouse.clickhouse__get_or_create_relation": {"name": "clickhouse__get_or_create_relation", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "unique_id": "macro.dbt_clickhouse.clickhouse__get_or_create_relation", "macro_sql": "{% macro clickhouse__get_or_create_relation(database, schema, identifier, type) %}\n {%- set target_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) %}\n {% if target_relation %}\n {% do return([true, target_relation]) %}\n {% endif %}\n\n {%- set can_exchange = adapter.can_exchange(schema, type) %}\n {%- set should_on_cluster = adapter.should_on_cluster(config.get('materialized'), engine_clause()) %}\n {%- set new_relation = api.Relation.create(\n database=None,\n schema=schema,\n identifier=identifier,\n type=type,\n can_exchange=can_exchange,\n can_on_cluster=should_on_cluster\n ) -%}\n {% do return([false, new_relation]) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_clickhouse.engine_clause"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.311457, "supported_languages": null}, "macro.dbt_clickhouse.clickhouse__get_database": {"name": "clickhouse__get_database", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "unique_id": "macro.dbt_clickhouse.clickhouse__get_database", "macro_sql": "{% macro clickhouse__get_database(database) %}\n {% call statement('get_database', fetch_result=True) %}\n select name, engine, comment\n from system.databases\n where name = '{{ database }}'\n {% endcall %}\n {% do return(load_result('get_database').table) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.3118665, "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": 1723229143.3122363, "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": 1723229143.3126693, "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": 1723229143.3131628, "supported_languages": null}, "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": 1723229143.3140464, "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": 1723229143.3151667, "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": 1723229143.3169384, "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": 1723229143.3174746, "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": 1723229143.3178632, "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": 1723229143.3188875, "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": 1723229143.31954, "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_clickhouse.clickhouse__rename_relation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.3198564, "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.render() }} 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": 1723229143.3202982, "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": 1723229143.3209748, "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": 1723229143.3216434, "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": 1723229143.322137, "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": 1723229143.3224442, "supported_languages": null}, "macro.dbt.drop_schema_named": {"name": "drop_schema_named", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/schema.sql", "original_file_path": "macros/relations/schema.sql", "unique_id": "macro.dbt.drop_schema_named", "macro_sql": "{% macro drop_schema_named(schema_name) %}\n {{ return(adapter.dispatch('drop_schema_named', 'dbt') (schema_name)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__drop_schema_named"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.3228273, "supported_languages": null}, "macro.dbt.default__drop_schema_named": {"name": "default__drop_schema_named", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/schema.sql", "original_file_path": "macros/relations/schema.sql", "unique_id": "macro.dbt.default__drop_schema_named", "macro_sql": "{% macro default__drop_schema_named(schema_name) %}\n {% set schema_relation = api.Relation.create(schema=schema_name) %}\n {{ adapter.drop_schema(schema_relation) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.3232627, "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": 1723229143.32381, "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": 1723229143.3241777, "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": 1723229143.3251886, "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.render() }} 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": 1723229143.3258162, "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_clickhouse.clickhouse__drop_relation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.326088, "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": 1723229143.32641, "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": 1723229143.3267028, "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": 1723229143.3271646, "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": 1723229143.3274639, "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.default__get_replace_table_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.3278506, "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": 1723229143.3280714, "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.default__get_rename_table_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.3284843, "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": 1723229143.3287125, "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": 1723229143.32999, "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": 1723229143.3302698, "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_clickhouse.clickhouse__create_table_as"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.3308957, "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": 1723229143.3318965, "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": 1723229143.332623, "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": 1723229143.3329086, "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": 1723229143.333177, "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 {{- adapter.dispatch('drop_table', 'dbt')(relation) -}}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__drop_table"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.3335862, "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.render() }} cascade\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.3337774, "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.default__get_replace_view_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.335033, "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": 1723229143.3352625, "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": 1723229143.3370328, "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": 1723229143.3373508, "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.render() ~ \" 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": 1723229143.3377037, "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.default__get_rename_view_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.3381076, "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": 1723229143.3383293, "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": 1723229143.3389199, "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": 1723229143.3391562, "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_clickhouse.clickhouse__create_view_as"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.339423, "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.render() }}\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": 1723229143.340099, "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 {{- adapter.dispatch('drop_view', 'dbt')(relation) -}}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__drop_view"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.340465, "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.render() }} cascade\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.340651, "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": 1723229143.3420815, "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": 1723229143.342263, "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": 1723229143.3430421, "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_clickhouse.clickhouse__get_assert_columns_equivalent"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.343289, "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": 1723229143.3434925, "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": 1723229143.3453708, "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.codegen.format_column", "macro.dbt.default__format_column"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.3459427, "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": 1723229143.3464677, "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": 1723229143.3468797, "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": 1723229143.347105, "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.default__get_rename_materialized_view_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.3475103, "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": 1723229143.3477368, "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_clickhouse.clickhouse__get_create_materialized_view_as_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.3481338, "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": 1723229143.3483624, "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.default__refresh_materialized_view"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.3488095, "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": 1723229143.3490143, "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.default__get_alter_materialized_view_as_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.3500524, "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": 1723229143.350345, "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.default__get_materialized_view_configuration_changes"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.3507557, "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": 1723229143.350973, "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 {{- adapter.dispatch('drop_materialized_view', 'dbt')(relation) -}}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__drop_materialized_view"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.3513432, "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.render() }} cascade\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.351528, "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_clickhouse.clickhouse__replace"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.3519876, "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": 1723229143.352234, "supported_languages": null}, "macro.dbt.cast": {"name": "cast", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/cast.sql", "original_file_path": "macros/utils/cast.sql", "unique_id": "macro.dbt.cast", "macro_sql": "{% macro cast(field, type) %}\n {{ return(adapter.dispatch('cast', 'dbt') (field, type)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__cast"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.3526247, "supported_languages": null}, "macro.dbt.default__cast": {"name": "default__cast", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/cast.sql", "original_file_path": "macros/utils/cast.sql", "unique_id": "macro.dbt.default__cast", "macro_sql": "{% macro default__cast(field, type) %}\n cast({{field}} as {{type}})\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.3528192, "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_clickhouse.clickhouse__array_concat"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.3532085, "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": 1723229143.353438, "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.default__dateadd"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.3539226, "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": 1723229143.354172, "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": 1723229143.3545792, "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": 1723229143.3547916, "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_clickhouse.clickhouse__last_day"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.3552723, "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": 1723229143.355652, "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": 1723229143.3558774, "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": 1723229143.3562849, "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": 1723229143.3565106, "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": 1723229143.3568404, "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": 1723229143.3569624, "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": 1723229143.3573587, "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": 1723229143.357529, "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_clickhouse.clickhouse__any_value"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.3578863, "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": 1723229143.3580508, "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": 1723229143.3584666, "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": 1723229143.3587985, "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": 1723229143.360033, "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": 1723229143.3606577, "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": 1723229143.3609354, "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": 1723229143.361732, "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": 1723229143.362202, "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": 1723229143.3624187, "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": 1723229143.3627708, "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": 1723229143.3629282, "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_clickhouse.clickhouse__split_part"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.3636436, "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": 1723229143.3638933, "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": 1723229143.3642278, "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_clickhouse.clickhouse__array_append"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.36467, "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": 1723229143.36488, "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_clickhouse.clickhouse__bool_or"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.3652601, "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": 1723229143.3654253, "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": 1723229143.3658063, "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": 1723229143.3660257, "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": 1723229143.3663733, "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": 1723229143.3665981, "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": 1723229143.3669264, "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": 1723229143.3670492, "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_clickhouse.clickhouse__listagg"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.3679218, "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": 1723229143.3685462, "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.default__datediff"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.3690252, "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": 1723229143.3693018, "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_clickhouse.clickhouse__array_construct"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.3698552, "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": 1723229143.3703513, "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": 1723229143.3713658, "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": 1723229143.3722434, "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": 1723229143.3725786, "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": 1723229143.373131, "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_clickhouse.clickhouse__hash"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.373543, "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": 1723229143.3737814, "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": 1723229143.3752563, "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": 1723229143.3755426, "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": 1723229143.3758414, "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": 1723229143.3761315, "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": 1723229143.3764281, "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": 1723229143.3766825, "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": 1723229143.3769236, "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": 1723229143.3771837, "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": 1723229143.3774996, "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": 1723229143.3777363, "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": 1723229143.3779776, "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": 1723229143.378197, "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": 1723229143.3784459, "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": 1723229143.37867, "supported_languages": null}, "macro.dbt.date": {"name": "date", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/date.sql", "original_file_path": "macros/utils/date.sql", "unique_id": "macro.dbt.date", "macro_sql": "{% macro date(year, month, day) %}\n {{ return(adapter.dispatch('date', 'dbt') (year, month, day)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__date"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.3791661, "supported_languages": null}, "macro.dbt.default__date": {"name": "default__date", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/date.sql", "original_file_path": "macros/utils/date.sql", "unique_id": "macro.dbt.default__date", "macro_sql": "{% macro default__date(year, month, day) -%}\n {%- set dt = modules.datetime.date(year, month, day) -%}\n {%- set iso_8601_formatted_date = dt.strftime('%Y-%m-%d') -%}\n to_date('{{ iso_8601_formatted_date }}', 'YYYY-MM-DD')\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.379598, "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_clickhouse.clickhouse__cast_bool_to_text"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.380022, "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": 1723229143.3802824, "supported_languages": null}, "macro.dbt.get_fixture_sql": {"name": "get_fixture_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/unit_test_sql/get_fixture_sql.sql", "original_file_path": "macros/unit_test_sql/get_fixture_sql.sql", "unique_id": "macro.dbt.get_fixture_sql", "macro_sql": "{% macro get_fixture_sql(rows, column_name_to_data_types) %}\n-- Fixture for {{ model.name }}\n{% set default_row = {} %}\n\n{%- if not column_name_to_data_types -%}\n{#-- Use defer_relation IFF it is available in the manifest and 'this' is missing from the database --#}\n{%- set this_or_defer_relation = defer_relation if (defer_relation and not load_relation(this)) else this -%}\n{%- set columns_in_relation = adapter.get_columns_in_relation(this_or_defer_relation) -%}\n\n{%- set column_name_to_data_types = {} -%}\n{%- for column in columns_in_relation -%}\n{#-- This needs to be a case-insensitive comparison --#}\n{%- do column_name_to_data_types.update({column.name|lower: column.data_type}) -%}\n{%- endfor -%}\n{%- endif -%}\n\n{%- if not column_name_to_data_types -%}\n {{ exceptions.raise_compiler_error(\"Not able to get columns for unit test '\" ~ model.name ~ \"' from relation \" ~ this ~ \" because the relation doesn't exist\") }}\n{%- endif -%}\n\n{%- for column_name, column_type in column_name_to_data_types.items() -%}\n {%- do default_row.update({column_name: (safe_cast(\"null\", column_type) | trim )}) -%}\n{%- endfor -%}\n\n{{ validate_fixture_rows(rows, row_number) }}\n\n{%- for row in rows -%}\n{%- set formatted_row = format_row(row, column_name_to_data_types) -%}\n{%- set default_row_copy = default_row.copy() -%}\n{%- do default_row_copy.update(formatted_row) -%}\nselect\n{%- for column_name, column_value in default_row_copy.items() %} {{ column_value }} as {{ column_name }}{% if not loop.last -%}, {%- endif %}\n{%- endfor %}\n{%- if not loop.last %}\nunion all\n{% endif %}\n{%- endfor -%}\n\n{%- if (rows | length) == 0 -%}\n select\n {%- for column_name, column_value in default_row.items() %} {{ column_value }} as {{ column_name }}{% if not loop.last -%},{%- endif %}\n {%- endfor %}\n limit 0\n{%- endif -%}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.load_relation", "macro.dbt.safe_cast", "macro.dbt.validate_fixture_rows", "macro.dbt.format_row"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.3854547, "supported_languages": null}, "macro.dbt.get_expected_sql": {"name": "get_expected_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/unit_test_sql/get_fixture_sql.sql", "original_file_path": "macros/unit_test_sql/get_fixture_sql.sql", "unique_id": "macro.dbt.get_expected_sql", "macro_sql": "{% macro get_expected_sql(rows, column_name_to_data_types) %}\n\n{%- if (rows | length) == 0 -%}\n select * from dbt_internal_unit_test_actual\n limit 0\n{%- else -%}\n{%- for row in rows -%}\n{%- set formatted_row = format_row(row, column_name_to_data_types) -%}\nselect\n{%- for column_name, column_value in formatted_row.items() %} {{ column_value }} as {{ column_name }}{% if not loop.last -%}, {%- endif %}\n{%- endfor %}\n{%- if not loop.last %}\nunion all\n{% endif %}\n{%- endfor -%}\n{%- endif -%}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.format_row"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.3863869, "supported_languages": null}, "macro.dbt.format_row": {"name": "format_row", "resource_type": "macro", "package_name": "dbt", "path": "macros/unit_test_sql/get_fixture_sql.sql", "original_file_path": "macros/unit_test_sql/get_fixture_sql.sql", "unique_id": "macro.dbt.format_row", "macro_sql": "\n\n{%- macro format_row(row, column_name_to_data_types) -%}\n {#-- generate case-insensitive formatted row --#}\n {% set formatted_row = {} %}\n {%- for column_name, column_value in row.items() -%}\n {% set column_name = column_name|lower %}\n\n {%- if column_name not in column_name_to_data_types %}\n {#-- if user-provided row contains column name that relation does not contain, raise an error --#}\n {% set fixture_name = \"expected output\" if model.resource_type == 'unit_test' else (\"'\" ~ model.name ~ \"'\") %}\n {{ exceptions.raise_compiler_error(\n \"Invalid column name: '\" ~ column_name ~ \"' in unit test fixture for \" ~ fixture_name ~ \".\"\n \"\\nAccepted columns for \" ~ fixture_name ~ \" are: \" ~ (column_name_to_data_types.keys()|list)\n ) }}\n {%- endif -%}\n\n {%- set column_type = column_name_to_data_types[column_name] %}\n\n {#-- sanitize column_value: wrap yaml strings in quotes, apply cast --#}\n {%- set column_value_clean = column_value -%}\n {%- if column_value is string -%}\n {%- set column_value_clean = dbt.string_literal(dbt.escape_single_quotes(column_value)) -%}\n {%- elif column_value is none -%}\n {%- set column_value_clean = 'null' -%}\n {%- endif -%}\n\n {%- set row_update = {column_name: safe_cast(column_value_clean, column_type) } -%}\n {%- do formatted_row.update(row_update) -%}\n {%- endfor -%}\n {{ return(formatted_row) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt.string_literal", "macro.dbt.escape_single_quotes", "macro.dbt.safe_cast"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.3880703, "supported_languages": null}, "macro.dbt.validate_fixture_rows": {"name": "validate_fixture_rows", "resource_type": "macro", "package_name": "dbt", "path": "macros/unit_test_sql/get_fixture_sql.sql", "original_file_path": "macros/unit_test_sql/get_fixture_sql.sql", "unique_id": "macro.dbt.validate_fixture_rows", "macro_sql": "{%- macro validate_fixture_rows(rows, row_number) -%}\n {{ return(adapter.dispatch('validate_fixture_rows', 'dbt')(rows, row_number)) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt.default__validate_fixture_rows"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.388389, "supported_languages": null}, "macro.dbt.default__validate_fixture_rows": {"name": "default__validate_fixture_rows", "resource_type": "macro", "package_name": "dbt", "path": "macros/unit_test_sql/get_fixture_sql.sql", "original_file_path": "macros/unit_test_sql/get_fixture_sql.sql", "unique_id": "macro.dbt.default__validate_fixture_rows", "macro_sql": "{%- macro default__validate_fixture_rows(rows, row_number) -%}\n {# This is an abstract method for adapter overrides as needed #}\n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.388568, "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": 1723229143.389352, "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": 1723229143.3897603, "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": 1723229143.390259, "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": 1723229143.3908792, "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": 1723229143.3914635, "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_clickhouse.clickhouse__generate_database_name"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.3920891, "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": 1723229143.3924854, "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": 1723229143.3930528, "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": 1723229143.393547, "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": 1723229143.394001, "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": 1723229143.3955646, "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": 1723229143.3958793, "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": 1723229143.3960972, "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": 1723229143.3963091, "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": 1723229143.3965502, "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": 1723229143.397128, "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": 1723229143.397747, "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": 1723229143.4020078, "supported_languages": ["sql"]}, "macro.dbt.materialization_unit_default": {"name": "materialization_unit_default", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/tests/unit.sql", "original_file_path": "macros/materializations/tests/unit.sql", "unique_id": "macro.dbt.materialization_unit_default", "macro_sql": "{%- materialization unit, default -%}\n\n {% set relations = [] %}\n\n {% set expected_rows = config.get('expected_rows') %}\n {% set expected_sql = config.get('expected_sql') %}\n {% set tested_expected_column_names = expected_rows[0].keys() if (expected_rows | length ) > 0 else get_columns_in_query(sql) %} %}\n\n {%- set target_relation = this.incorporate(type='table') -%}\n {%- set temp_relation = make_temp_relation(target_relation)-%}\n {% do run_query(get_create_table_as_sql(True, temp_relation, get_empty_subquery_sql(sql))) %}\n {%- set columns_in_relation = adapter.get_columns_in_relation(temp_relation) -%}\n {%- set column_name_to_data_types = {} -%}\n {%- for column in columns_in_relation -%}\n {%- do column_name_to_data_types.update({column.name|lower: column.data_type}) -%}\n {%- endfor -%}\n\n {% if not expected_sql %}\n {% set expected_sql = get_expected_sql(expected_rows, column_name_to_data_types) %}\n {% endif %}\n {% set unit_test_sql = get_unit_test_sql(sql, expected_sql, tested_expected_column_names) %}\n\n {% call statement('main', fetch_result=True) -%}\n\n {{ unit_test_sql }}\n\n {%- endcall %}\n\n {% do adapter.drop_relation(temp_relation) %}\n\n {{ return({'relations': relations}) }}\n\n{%- endmaterialization -%}", "depends_on": {"macros": ["macro.dbt.get_columns_in_query", "macro.dbt.make_temp_relation", "macro.dbt.run_query", "macro.dbt.get_create_table_as_sql", "macro.dbt.get_empty_subquery_sql", "macro.dbt.get_expected_sql", "macro.dbt.get_unit_test_sql", "macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.4046288, "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_clickhouse.clickhouse__get_test_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.4062166, "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": 1723229143.4066663, "supported_languages": null}, "macro.dbt.get_unit_test_sql": {"name": "get_unit_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_unit_test_sql", "macro_sql": "{% macro get_unit_test_sql(main_sql, expected_fixture_sql, expected_column_names) -%}\n {{ adapter.dispatch('get_unit_test_sql', 'dbt')(main_sql, expected_fixture_sql, expected_column_names) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_unit_test_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.4069648, "supported_languages": null}, "macro.dbt.default__get_unit_test_sql": {"name": "default__get_unit_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_unit_test_sql", "macro_sql": "{% macro default__get_unit_test_sql(main_sql, expected_fixture_sql, expected_column_names) -%}\n-- Build actual result given inputs\nwith dbt_internal_unit_test_actual as (\n select\n {% for expected_column_name in expected_column_names %}{{expected_column_name}}{% if not loop.last -%},{% endif %}{%- endfor -%}, {{ dbt.string_literal(\"actual\") }} as {{ adapter.quote(\"actual_or_expected\") }}\n from (\n {{ main_sql }}\n ) _dbt_internal_unit_test_actual\n),\n-- Build expected result\ndbt_internal_unit_test_expected as (\n select\n {% for expected_column_name in expected_column_names %}{{expected_column_name}}{% if not loop.last -%}, {% endif %}{%- endfor -%}, {{ dbt.string_literal(\"expected\") }} as {{ adapter.quote(\"actual_or_expected\") }}\n from (\n {{ expected_fixture_sql }}\n ) _dbt_internal_unit_test_expected\n)\n-- Union actual and expected results\nselect * from dbt_internal_unit_test_actual\nunion all\nselect * from dbt_internal_unit_test_expected\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.string_literal"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.4078584, "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": 1723229143.4161365, "supported_languages": ["sql"]}, "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": 1723229143.4211342, "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.render() }} 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": 1723229143.4215994, "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_clickhouse.clickhouse__post_snapshot"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.4218488, "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": 1723229143.4219904, "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": 1723229143.4222069, "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": 1723229143.4223852, "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": 1723229143.4226885, "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": 1723229143.4239788, "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": 1723229143.4242723, "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": 1723229143.4246511, "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": 1723229143.425308, "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_clickhouse.clickhouse__snapshot_merge_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.4259355, "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.render() }} 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": 1723229143.4263647, "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": 1723229143.4312277, "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_clickhouse.clickhouse__snapshot_hash_arguments"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.431487, "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": 1723229143.4318328, "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": 1723229143.4329906, "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_clickhouse.clickhouse__snapshot_string_as_time"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.4332757, "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": 1723229143.433571, "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": 1723229143.4356365, "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": 1723229143.4375293, "supported_languages": null}, "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": 1723229143.4416413, "supported_languages": ["sql"]}, "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": 1723229143.445659, "supported_languages": ["sql"]}, "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": 1723229143.4520676, "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": 1723229143.4526422, "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": 1723229143.4530098, "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.render() ~ \"`\") }}\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.render() ~ \"`\") }}\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": 1723229143.454956, "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": 1723229143.455305, "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": 1723229143.4562547, "supported_languages": null}, "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": 1723229143.456604, "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": 1723229143.4567797, "supported_languages": null}, "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": 1723229143.4571996, "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.render() }} clone {{ defer_relation.render() }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.457482, "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.render() ~ \" 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.render()) }}\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": 1723229143.4624634, "supported_languages": ["sql"]}, "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 {% set contract_config = config.get('contract') %}\n {% if not contract_config or not contract_config.enforced %}\n {% do adapter.expand_target_column_types(\n from_relation=temp_relation,\n to_relation=target_relation) %}\n {% endif %}\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": 1723229143.469899, "supported_languages": ["sql"]}, "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": 1723229143.4721298, "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": 1723229143.4729428, "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": 1723229143.4739177, "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": 1723229143.4742606, "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": 1723229143.4753087, "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": 1723229143.4822593, "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": 1723229143.484003, "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": 1723229143.4857743, "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": 1723229143.4870696, "supported_languages": null}, "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": 1723229143.487956, "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": 1723229143.495552, "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": 1723229143.4979086, "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": 1723229143.4982896, "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": 1723229143.4997897, "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": 1723229143.5001664, "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": 1723229143.5011308, "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": 1723229143.5024087, "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": 1723229143.5027492, "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": 1723229143.5030313, "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": 1723229143.503448, "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": 1723229143.5037222, "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": 1723229143.5041332, "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": 1723229143.5044048, "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": 1723229143.504778, "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.default__get_incremental_default_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.5050423, "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": 1723229143.505681, "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": 1723229143.5061028, "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.render())) }}\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": 1723229143.5106485, "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_clickhouse.clickhouse__create_csv_table"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.5170615, "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": 1723229143.5184164, "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": 1723229143.5187602, "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.render() %}\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": 1723229143.519484, "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": 1723229143.5197675, "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": 1723229143.5199704, "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": 1723229143.520183, "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": 1723229143.5203574, "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": 1723229143.5205894, "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": 1723229143.5207698, "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": 1723229143.5215194, "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_clickhouse.clickhouse__load_csv_rows"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.5217955, "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": 1723229143.5235612, "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": 1723229143.5258381, "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": 1723229143.5260758, "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": 1723229143.5272913, "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": 1723229143.52789, "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": 1723229143.5287387, "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": 1723229143.5294473, "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": 1723229143.5295672, "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.default__copy_grants"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.5319104, "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": 1723229143.532092, "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": 1723229143.5323408, "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": 1723229143.532637, "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": 1723229143.5331554, "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_clickhouse.clickhouse__get_show_grant_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.533456, "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.render() }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.5336459, "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_clickhouse.clickhouse__get_grant_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.5339768, "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.render() }} 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": 1723229143.534284, "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_clickhouse.clickhouse__get_revoke_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.5346127, "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.render() }} 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": 1723229143.5349176, "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": 1723229143.535249, "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": 1723229143.5362399, "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_clickhouse.clickhouse__call_dcl_statements"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.536515, "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": 1723229143.5368855, "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": 1723229143.537237, "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.render() ~': 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": 1723229143.538933, "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.default__get_catalog_relations"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.5436063, "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": 1723229143.5439973, "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_clickhouse.clickhouse__get_catalog"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.5442932, "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": 1723229143.5446784, "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.default__information_schema_name"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.544953, "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": 1723229143.5451944, "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_clickhouse.clickhouse__list_schemas"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.5454767, "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": 1723229143.545848, "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.default__check_schema_exists"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.5461447, "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": 1723229143.5465884, "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_clickhouse.clickhouse__list_relations_without_caching"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.5468662, "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": 1723229143.5471046, "supported_languages": null}, "macro.dbt.get_catalog_for_single_relation": {"name": "get_catalog_for_single_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "unique_id": "macro.dbt.get_catalog_for_single_relation", "macro_sql": "{% macro get_catalog_for_single_relation(relation) %}\n {{ return(adapter.dispatch('get_catalog_for_single_relation', 'dbt')(relation)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_catalog_for_single_relation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.5474973, "supported_languages": null}, "macro.dbt.default__get_catalog_for_single_relation": {"name": "default__get_catalog_for_single_relation", "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_for_single_relation", "macro_sql": "{% macro default__get_catalog_for_single_relation(relation) %}\n {{ exceptions.raise_not_implemented(\n 'get_catalog_for_single_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": 1723229143.547739, "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.default__get_relations"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.547979, "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": 1723229143.5482035, "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": 1723229143.5485013, "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": 1723229143.548758, "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.default__alter_column_comment"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.5497427, "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": 1723229143.5499973, "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_clickhouse.clickhouse__alter_relation_comment"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.550291, "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": 1723229143.5505402, "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_clickhouse.clickhouse__persist_docs"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.5509248, "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": 1723229143.551649, "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": 1723229143.5520687, "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": 1723229143.5523973, "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 is not none -%}\n {{ sql_header }}\n {%- endif %}\n {{ get_limit_subquery_sql(compiled_code, limit) }}\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": 1723229143.5529659, "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": "\n{%- macro get_limit_subquery_sql(sql, limit) -%}\n {{ adapter.dispatch('get_limit_sql', 'dbt')(sql, limit) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt.default__get_limit_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.5532568, "supported_languages": null}, "macro.dbt.default__get_limit_sql": {"name": "default__get_limit_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_sql", "macro_sql": "{% macro default__get_limit_sql(sql, limit) %}\n {{ compiled_code }}\n {% if limit is not none %}\n limit {{ limit }}\n {%- endif -%}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.5535564, "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_clickhouse.clickhouse__create_schema"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.554092, "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": 1723229143.554365, "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_clickhouse.clickhouse__drop_schema"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.5546103, "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": 1723229143.554883, "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_clickhouse.clickhouse__get_columns_in_relation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.5578873, "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": 1723229143.5581343, "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": 1723229143.5585907, "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": 1723229143.5589042, "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": 1723229143.5592098, "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": 1723229143.5594752, "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', 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": ["macro.dbt.cast"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.5613437, "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": 1723229143.561868, "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_clickhouse.clickhouse__get_columns_in_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.56214, "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": 1723229143.5626454, "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_clickhouse.clickhouse__alter_column_type"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.5629709, "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.render() }} add column {{ adapter.quote(tmp_column) }} {{ new_column_type }};\n update {{ relation.render() }} set {{ adapter.quote(tmp_column) }} = {{ adapter.quote(column_name) }};\n alter table {{ relation.render() }} drop column {{ adapter.quote(column_name) }} cascade;\n alter table {{ relation.render() }} 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": 1723229143.5639062, "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": 1723229143.5642698, "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.render() }}\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": 1723229143.5654936, "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.default__get_create_index_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.566679, "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": 1723229143.5668864, "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": 1723229143.5671215, "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": 1723229143.5676985, "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.default__get_drop_index_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.5679684, "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": 1723229143.5681744, "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.default__get_show_indexes_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.5684059, "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": 1723229143.5685952, "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.default__make_intermediate_relation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.5713573, "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": 1723229143.5716217, "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_clickhouse.clickhouse__make_temp_relation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.571951, "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": 1723229143.5723815, "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.default__make_backup_relation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.5727437, "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": 1723229143.5732114, "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_clickhouse.clickhouse__truncate_relation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.573497, "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.render() }}\n {%- endcall %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.5737636, "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_clickhouse.clickhouse__get_or_create_relation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.5741246, "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": 1723229143.574952, "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": 1723229143.575411, "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": 1723229143.5756242, "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_clickhouse.clickhouse__current_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.576325, "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": 1723229143.5765512, "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.default__snapshot_get_time"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.5767632, "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": 1723229143.5769224, "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.default__current_timestamp_backcompat"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.5771627, "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": 1723229143.577304, "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.default__current_timestamp_in_utc_backcompat"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.577548, "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.default__current_timestamp_backcompat"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.5777915, "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": 1723229143.5783854, "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": 1723229143.5790257, "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": 1723229143.5811234, "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": 1723229143.5820153, "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": 1723229143.5824473, "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": 1723229143.584921, "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": 1723229143.586749, "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": 1723229143.5878484, "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": 1723229143.5881858, "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": 1723229143.5889726, "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": 1723229143.589374, "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": 1723229143.589834, "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_clickhouse.clickhouse__test_relationships"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.5902631, "supported_languages": null}, "macro.dbt_utils.degrees_to_radians": {"name": "degrees_to_radians", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/haversine_distance.sql", "original_file_path": "macros/sql/haversine_distance.sql", "unique_id": "macro.dbt_utils.degrees_to_radians", "macro_sql": "{% macro degrees_to_radians(degrees) -%}\n acos(-1) * {{degrees}} / 180\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.5918765, "supported_languages": null}, "macro.dbt_utils.haversine_distance": {"name": "haversine_distance", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/haversine_distance.sql", "original_file_path": "macros/sql/haversine_distance.sql", "unique_id": "macro.dbt_utils.haversine_distance", "macro_sql": "{% macro haversine_distance(lat1, lon1, lat2, lon2, unit='mi') -%}\n {{ return(adapter.dispatch('haversine_distance', 'dbt_utils')(lat1,lon1,lat2,lon2,unit)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__haversine_distance"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.5922863, "supported_languages": null}, "macro.dbt_utils.default__haversine_distance": {"name": "default__haversine_distance", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/haversine_distance.sql", "original_file_path": "macros/sql/haversine_distance.sql", "unique_id": "macro.dbt_utils.default__haversine_distance", "macro_sql": "{% macro default__haversine_distance(lat1, lon1, lat2, lon2, unit='mi') -%}\n{%- if unit == 'mi' %}\n {% set conversion_rate = 1 %}\n{% elif unit == 'km' %}\n {% set conversion_rate = 1.60934 %}\n{% else %}\n {{ exceptions.raise_compiler_error(\"unit input must be one of 'mi' or 'km'. Got \" ~ unit) }}\n{% endif %}\n\n 2 * 3961 * asin(sqrt(power((sin(radians(({{ lat2 }} - {{ lat1 }}) / 2))), 2) +\n cos(radians({{lat1}})) * cos(radians({{lat2}})) *\n power((sin(radians(({{ lon2 }} - {{ lon1 }}) / 2))), 2))) * {{ conversion_rate }}\n\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.5932953, "supported_languages": null}, "macro.dbt_utils.bigquery__haversine_distance": {"name": "bigquery__haversine_distance", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/haversine_distance.sql", "original_file_path": "macros/sql/haversine_distance.sql", "unique_id": "macro.dbt_utils.bigquery__haversine_distance", "macro_sql": "{% macro bigquery__haversine_distance(lat1, lon1, lat2, lon2, unit='mi') -%}\n{% set radians_lat1 = dbt_utils.degrees_to_radians(lat1) %}\n{% set radians_lat2 = dbt_utils.degrees_to_radians(lat2) %}\n{% set radians_lon1 = dbt_utils.degrees_to_radians(lon1) %}\n{% set radians_lon2 = dbt_utils.degrees_to_radians(lon2) %}\n{%- if unit == 'mi' %}\n {% set conversion_rate = 1 %}\n{% elif unit == 'km' %}\n {% set conversion_rate = 1.60934 %}\n{% else %}\n {{ exceptions.raise_compiler_error(\"unit input must be one of 'mi' or 'km'. Got \" ~ unit) }}\n{% endif %}\n 2 * 3961 * asin(sqrt(power(sin(({{ radians_lat2 }} - {{ radians_lat1 }}) / 2), 2) +\n cos({{ radians_lat1 }}) * cos({{ radians_lat2 }}) *\n power(sin(({{ radians_lon2 }} - {{ radians_lon1 }}) / 2), 2))) * {{ conversion_rate }}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.degrees_to_radians"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.5945399, "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": 1723229143.5951934, "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": 1723229143.5956185, "supported_languages": null}, "macro.dbt_utils.safe_divide": {"name": "safe_divide", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/safe_divide.sql", "original_file_path": "macros/sql/safe_divide.sql", "unique_id": "macro.dbt_utils.safe_divide", "macro_sql": "{% macro safe_divide(numerator, denominator) -%}\n {{ return(adapter.dispatch('safe_divide', 'dbt_utils')(numerator, denominator)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__safe_divide"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.596035, "supported_languages": null}, "macro.dbt_utils.default__safe_divide": {"name": "default__safe_divide", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/safe_divide.sql", "original_file_path": "macros/sql/safe_divide.sql", "unique_id": "macro.dbt_utils.default__safe_divide", "macro_sql": "{% macro default__safe_divide(numerator, denominator) %}\n ( {{ numerator }} ) / nullif( ( {{ denominator }} ), 0)\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.5962427, "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": 1723229143.596948, "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": 1723229143.598049, "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": 1723229143.5986154, "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": 1723229143.5989656, "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": 1723229143.599541, "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": 1723229143.6003904, "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": 1723229143.6021795, "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": 1723229143.604651, "supported_languages": null}, "macro.dbt_utils.get_query_results_as_dict": {"name": "get_query_results_as_dict", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_query_results_as_dict.sql", "original_file_path": "macros/sql/get_query_results_as_dict.sql", "unique_id": "macro.dbt_utils.get_query_results_as_dict", "macro_sql": "{% macro get_query_results_as_dict(query) %}\n {{ return(adapter.dispatch('get_query_results_as_dict', 'dbt_utils')(query)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__get_query_results_as_dict"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.6052675, "supported_languages": null}, "macro.dbt_utils.default__get_query_results_as_dict": {"name": "default__get_query_results_as_dict", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_query_results_as_dict.sql", "original_file_path": "macros/sql/get_query_results_as_dict.sql", "unique_id": "macro.dbt_utils.default__get_query_results_as_dict", "macro_sql": "{% macro default__get_query_results_as_dict(query) %}\n\n{# This macro returns a dictionary of the form {column_name: (tuple_of_results)} #}\n\n {%- call statement('get_query_results', fetch_result=True,auto_begin=false) -%}\n\n {{ query }}\n\n {%- endcall -%}\n\n {% set sql_results={} %}\n\n {%- if execute -%}\n {% set sql_results_table = load_result('get_query_results').table.columns %}\n {% for column_name, column in sql_results_table.items() %}\n {% do sql_results.update({column_name: column.values()}) %}\n {% endfor %}\n {%- endif -%}\n\n {{ return(sql_results) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.6061528, "supported_languages": null}, "macro.dbt_utils.group_by": {"name": "group_by", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/groupby.sql", "original_file_path": "macros/sql/groupby.sql", "unique_id": "macro.dbt_utils.group_by", "macro_sql": "{%- macro group_by(n) -%}\n {{ return(adapter.dispatch('group_by', 'dbt_utils')(n)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__group_by"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.6065624, "supported_languages": null}, "macro.dbt_utils.default__group_by": {"name": "default__group_by", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/groupby.sql", "original_file_path": "macros/sql/groupby.sql", "unique_id": "macro.dbt_utils.default__group_by", "macro_sql": "\n\n{%- macro default__group_by(n) -%}\n\n group by {% for i in range(1, n + 1) -%}\n {{ i }}{{ ',' if not loop.last }} \n {%- endfor -%}\n\n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.6069334, "supported_languages": null}, "macro.dbt_utils.union_relations": {"name": "union_relations", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/union.sql", "original_file_path": "macros/sql/union.sql", "unique_id": "macro.dbt_utils.union_relations", "macro_sql": "{%- macro union_relations(relations, column_override=none, include=[], exclude=[], source_column_name='_dbt_source_relation', where=none) -%}\n {{ return(adapter.dispatch('union_relations', 'dbt_utils')(relations, column_override, include, exclude, source_column_name, where)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__union_relations"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.610918, "supported_languages": null}, "macro.dbt_utils.default__union_relations": {"name": "default__union_relations", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/union.sql", "original_file_path": "macros/sql/union.sql", "unique_id": "macro.dbt_utils.default__union_relations", "macro_sql": "\n\n{%- macro default__union_relations(relations, column_override=none, include=[], exclude=[], source_column_name='_dbt_source_relation', where=none) -%}\n\n {%- if exclude and include -%}\n {{ exceptions.raise_compiler_error(\"Both an exclude and include list were provided to the `union` macro. Only one is allowed\") }}\n {%- endif -%}\n\n {#-- Prevent querying of db in parsing mode. This works because this macro does not create any new refs. -#}\n {%- if not execute %}\n {{ return('') }}\n {% endif -%}\n\n {%- set column_override = column_override if column_override is not none else {} -%}\n\n {%- set relation_columns = {} -%}\n {%- set column_superset = {} -%}\n {%- set all_excludes = [] -%}\n {%- set all_includes = [] -%}\n\n {%- if exclude -%}\n {%- for exc in exclude -%}\n {%- do all_excludes.append(exc | lower) -%}\n {%- endfor -%}\n {%- endif -%}\n\n {%- if include -%}\n {%- for inc in include -%}\n {%- do all_includes.append(inc | lower) -%}\n {%- endfor -%}\n {%- endif -%}\n\n {%- for relation in relations -%}\n\n {%- do relation_columns.update({relation: []}) -%}\n\n {%- do dbt_utils._is_relation(relation, 'union_relations') -%}\n {%- do dbt_utils._is_ephemeral(relation, 'union_relations') -%}\n {%- set cols = adapter.get_columns_in_relation(relation) -%}\n {%- for col in cols -%}\n\n {#- If an exclude list was provided and the column is in the list, do nothing -#}\n {%- if exclude and col.column | lower in all_excludes -%}\n\n {#- If an include list was provided and the column is not in the list, do nothing -#}\n {%- elif include and col.column | lower not in all_includes -%}\n\n {#- Otherwise add the column to the column superset -#}\n {%- else -%}\n\n {#- update the list of columns in this relation -#}\n {%- do relation_columns[relation].append(col.column) -%}\n\n {%- if col.column in column_superset -%}\n\n {%- set stored = column_superset[col.column] -%}\n {%- if col.is_string() and stored.is_string() and col.string_size() > stored.string_size() -%}\n\n {%- do column_superset.update({col.column: col}) -%}\n\n {%- endif %}\n\n {%- else -%}\n\n {%- do column_superset.update({col.column: col}) -%}\n\n {%- endif -%}\n\n {%- endif -%}\n\n {%- endfor -%}\n {%- endfor -%}\n\n {%- set ordered_column_names = column_superset.keys() -%}\n {%- 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": 1723229143.6161978, "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": 1723229143.6180303, "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": 1723229143.620373, "supported_languages": null}, "macro.dbt_utils.get_table_types_sql": {"name": "get_table_types_sql", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_table_types_sql.sql", "original_file_path": "macros/sql/get_table_types_sql.sql", "unique_id": "macro.dbt_utils.get_table_types_sql", "macro_sql": "{%- macro get_table_types_sql() -%}\n {{ return(adapter.dispatch('get_table_types_sql', 'dbt_utils')()) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt_utils.default__get_table_types_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.6211264, "supported_languages": null}, "macro.dbt_utils.default__get_table_types_sql": {"name": "default__get_table_types_sql", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_table_types_sql.sql", "original_file_path": "macros/sql/get_table_types_sql.sql", "unique_id": "macro.dbt_utils.default__get_table_types_sql", "macro_sql": "{% macro default__get_table_types_sql() %}\n case table_type\n when 'BASE TABLE' then 'table'\n when 'EXTERNAL TABLE' then 'external'\n when 'MATERIALIZED VIEW' then 'materializedview'\n else lower(table_type)\n end as {{ adapter.quote('table_type') }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.62139, "supported_languages": null}, "macro.dbt_utils.postgres__get_table_types_sql": {"name": "postgres__get_table_types_sql", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_table_types_sql.sql", "original_file_path": "macros/sql/get_table_types_sql.sql", "unique_id": "macro.dbt_utils.postgres__get_table_types_sql", "macro_sql": "{% macro postgres__get_table_types_sql() %}\n case table_type\n when 'BASE TABLE' then 'table'\n when 'FOREIGN' then 'external'\n when 'MATERIALIZED VIEW' then 'materializedview'\n else lower(table_type)\n end as {{ adapter.quote('table_type') }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.621635, "supported_languages": null}, "macro.dbt_utils.databricks__get_table_types_sql": {"name": "databricks__get_table_types_sql", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_table_types_sql.sql", "original_file_path": "macros/sql/get_table_types_sql.sql", "unique_id": "macro.dbt_utils.databricks__get_table_types_sql", "macro_sql": "{% macro databricks__get_table_types_sql() %}\n case table_type\n when 'MANAGED' then 'table'\n when 'BASE TABLE' then 'table'\n when 'MATERIALIZED VIEW' then 'materializedview'\n else lower(table_type)\n end as {{ adapter.quote('table_type') }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.6218562, "supported_languages": null}, "macro.dbt_utils.get_powers_of_two": {"name": "get_powers_of_two", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/generate_series.sql", "original_file_path": "macros/sql/generate_series.sql", "unique_id": "macro.dbt_utils.get_powers_of_two", "macro_sql": "{% macro get_powers_of_two(upper_bound) %}\n {{ return(adapter.dispatch('get_powers_of_two', 'dbt_utils')(upper_bound)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__get_powers_of_two"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.6230006, "supported_languages": null}, "macro.dbt_utils.default__get_powers_of_two": {"name": "default__get_powers_of_two", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/generate_series.sql", "original_file_path": "macros/sql/generate_series.sql", "unique_id": "macro.dbt_utils.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": 1723229143.6236038, "supported_languages": null}, "macro.dbt_utils.generate_series": {"name": "generate_series", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/generate_series.sql", "original_file_path": "macros/sql/generate_series.sql", "unique_id": "macro.dbt_utils.generate_series", "macro_sql": "{% macro generate_series(upper_bound) %}\n {{ return(adapter.dispatch('generate_series', 'dbt_utils')(upper_bound)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__generate_series"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.6238751, "supported_languages": null}, "macro.dbt_utils.default__generate_series": {"name": "default__generate_series", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/generate_series.sql", "original_file_path": "macros/sql/generate_series.sql", "unique_id": "macro.dbt_utils.default__generate_series", "macro_sql": "{% macro default__generate_series(upper_bound) %}\n\n {% set n = dbt_utils.get_powers_of_two(upper_bound) %}\n\n with p as (\n select 0 as generated_number union all select 1\n ), unioned as (\n\n select\n\n {% for i in range(n) %}\n p{{i}}.generated_number * 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_utils.get_powers_of_two"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.6246917, "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": 1723229143.6256444, "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": 1723229143.6268852, "supported_languages": null}, "macro.dbt_utils.get_tables_by_pattern_sql": {"name": "get_tables_by_pattern_sql", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_tables_by_pattern_sql.sql", "original_file_path": "macros/sql/get_tables_by_pattern_sql.sql", "unique_id": "macro.dbt_utils.get_tables_by_pattern_sql", "macro_sql": "{% macro get_tables_by_pattern_sql(schema_pattern, table_pattern, exclude='', database=target.database) %}\n {{ return(adapter.dispatch('get_tables_by_pattern_sql', 'dbt_utils')\n (schema_pattern, table_pattern, exclude, database)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__get_tables_by_pattern_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.6290464, "supported_languages": null}, "macro.dbt_utils.default__get_tables_by_pattern_sql": {"name": "default__get_tables_by_pattern_sql", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_tables_by_pattern_sql.sql", "original_file_path": "macros/sql/get_tables_by_pattern_sql.sql", "unique_id": "macro.dbt_utils.default__get_tables_by_pattern_sql", "macro_sql": "{% macro default__get_tables_by_pattern_sql(schema_pattern, table_pattern, exclude='', database=target.database) %}\n\n select distinct\n table_schema as {{ adapter.quote('table_schema') }},\n table_name as {{ adapter.quote('table_name') }},\n {{ dbt_utils.get_table_types_sql() }}\n from {{ database }}.information_schema.tables\n where table_schema ilike '{{ schema_pattern }}'\n and table_name ilike '{{ table_pattern }}'\n and table_name not ilike '{{ exclude }}'\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.get_table_types_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.6296005, "supported_languages": null}, "macro.dbt_utils.bigquery__get_tables_by_pattern_sql": {"name": "bigquery__get_tables_by_pattern_sql", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_tables_by_pattern_sql.sql", "original_file_path": "macros/sql/get_tables_by_pattern_sql.sql", "unique_id": "macro.dbt_utils.bigquery__get_tables_by_pattern_sql", "macro_sql": "{% macro bigquery__get_tables_by_pattern_sql(schema_pattern, table_pattern, exclude='', database=target.database) %}\n\n {% if '%' in schema_pattern %}\n {% set schemata=dbt_utils._bigquery__get_matching_schemata(schema_pattern, database) %}\n {% else %}\n {% set schemata=[schema_pattern] %}\n {% endif %}\n\n {% set sql %}\n {% for schema in schemata %}\n select distinct\n table_schema,\n table_name,\n {{ dbt_utils.get_table_types_sql() }}\n\n from {{ adapter.quote(database) }}.{{ schema }}.INFORMATION_SCHEMA.TABLES\n where lower(table_name) like lower ('{{ table_pattern }}')\n and lower(table_name) not like lower ('{{ exclude }}')\n\n {% if not loop.last %} union all {% endif %}\n\n {% endfor %}\n {% endset %}\n\n {{ return(sql) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils._bigquery__get_matching_schemata", "macro.dbt_utils.get_table_types_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.6306553, "supported_languages": null}, "macro.dbt_utils._bigquery__get_matching_schemata": {"name": "_bigquery__get_matching_schemata", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_tables_by_pattern_sql.sql", "original_file_path": "macros/sql/get_tables_by_pattern_sql.sql", "unique_id": "macro.dbt_utils._bigquery__get_matching_schemata", "macro_sql": "{% macro _bigquery__get_matching_schemata(schema_pattern, database) %}\n {% if execute %}\n\n {% set sql %}\n select schema_name from {{ adapter.quote(database) }}.INFORMATION_SCHEMA.SCHEMATA\n where lower(schema_name) like lower('{{ schema_pattern }}')\n {% endset %}\n\n {% set results=run_query(sql) %}\n\n {% set schemata=results.columns['schema_name'].values() %}\n\n {{ return(schemata) }}\n\n {% else %}\n\n {{ return([]) }}\n\n {% endif %}\n\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.6313891, "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": 1723229143.6323383, "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": 1723229143.6336136, "supported_languages": null}, "macro.dbt_utils.get_column_values": {"name": "get_column_values", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_column_values.sql", "original_file_path": "macros/sql/get_column_values.sql", "unique_id": "macro.dbt_utils.get_column_values", "macro_sql": "{% macro get_column_values(table, column, order_by='count(*) desc', max_records=none, default=none, where=none) -%}\n {{ return(adapter.dispatch('get_column_values', 'dbt_utils')(table, column, order_by, max_records, default, where)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__get_column_values"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.6351392, "supported_languages": null}, "macro.dbt_utils.default__get_column_values": {"name": "default__get_column_values", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_column_values.sql", "original_file_path": "macros/sql/get_column_values.sql", "unique_id": "macro.dbt_utils.default__get_column_values", "macro_sql": "{% macro default__get_column_values(table, column, order_by='count(*) desc', max_records=none, default=none, where=none) -%}\n {#-- Prevent querying of db in parsing mode. This works because this macro does not create any new refs. #}\n {%- if not execute -%}\n {% set default = [] if not default %}\n {{ return(default) }}\n {% endif %}\n\n {%- do dbt_utils._is_ephemeral(table, 'get_column_values') -%}\n\n {# Not all relations are tables. Renaming for internal clarity without breaking functionality for anyone using named arguments #}\n {# TODO: Change the method signature in a future 0.x.0 release #}\n {%- set target_relation = table -%}\n\n {# adapter.load_relation is a convenience wrapper to avoid building a Relation when we already have one #}\n {% set relation_exists = (load_relation(target_relation)) is not none %}\n\n {%- call statement('get_column_values', fetch_result=true) %}\n\n {%- if not relation_exists and default is none -%}\n\n {{ exceptions.raise_compiler_error(\"In get_column_values(): relation \" ~ target_relation ~ \" does not exist and no default value was provided.\") }}\n\n {%- elif not relation_exists and default is not none -%}\n\n {{ log(\"Relation \" ~ target_relation ~ \" does not exist. Returning the default value: \" ~ default) }}\n\n {{ return(default) }}\n\n {%- else -%}\n\n\n select\n {{ column }} as value\n\n from {{ target_relation }}\n\n {% if where is not none %}\n where {{ where }}\n {% endif %}\n\n group by {{ column }}\n order by {{ order_by }}\n\n {% if max_records is not none %}\n limit {{ max_records }}\n {% endif %}\n\n {% endif %}\n\n {%- endcall -%}\n\n {%- set value_list = load_result('get_column_values') -%}\n\n {%- if value_list and value_list['data'] -%}\n {%- set values = value_list['data'] | map(attribute=0) | list %}\n {{ return(values) }}\n {%- else -%}\n {{ return(default) }}\n {%- endif -%}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_utils._is_ephemeral", "macro.dbt.load_relation", "macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.6374915, "supported_languages": null}, "macro.dbt_utils.safe_add": {"name": "safe_add", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/safe_add.sql", "original_file_path": "macros/sql/safe_add.sql", "unique_id": "macro.dbt_utils.safe_add", "macro_sql": "{%- macro safe_add(field_list) -%}\n {{ return(adapter.dispatch('safe_add', 'dbt_utils')(field_list)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__safe_add"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.6380596, "supported_languages": null}, "macro.dbt_utils.default__safe_add": {"name": "default__safe_add", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/safe_add.sql", "original_file_path": "macros/sql/safe_add.sql", "unique_id": "macro.dbt_utils.default__safe_add", "macro_sql": "\n\n{%- macro default__safe_add(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_add` macro now 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.warn(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": 1723229143.6388698, "supported_languages": null}, "macro.dbt_utils.get_filtered_columns_in_relation": {"name": "get_filtered_columns_in_relation", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_filtered_columns_in_relation.sql", "original_file_path": "macros/sql/get_filtered_columns_in_relation.sql", "unique_id": "macro.dbt_utils.get_filtered_columns_in_relation", "macro_sql": "{% macro get_filtered_columns_in_relation(from, except=[]) -%}\n {{ return(adapter.dispatch('get_filtered_columns_in_relation', 'dbt_utils')(from, except)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__get_filtered_columns_in_relation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.639532, "supported_languages": null}, "macro.dbt_utils.default__get_filtered_columns_in_relation": {"name": "default__get_filtered_columns_in_relation", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_filtered_columns_in_relation.sql", "original_file_path": "macros/sql/get_filtered_columns_in_relation.sql", "unique_id": "macro.dbt_utils.default__get_filtered_columns_in_relation", "macro_sql": "{% macro default__get_filtered_columns_in_relation(from, except=[]) -%}\n {%- do dbt_utils._is_relation(from, 'get_filtered_columns_in_relation') -%}\n {%- do dbt_utils._is_ephemeral(from, 'get_filtered_columns_in_relation') -%}\n\n {# -- Prevent querying of db in parsing mode. This works because this macro does not create any new refs. #}\n {%- if not execute -%}\n {{ return('') }}\n {% endif %}\n\n {%- set include_cols = [] %}\n {%- set cols = adapter.get_columns_in_relation(from) -%}\n {%- set except = except | map(\"lower\") | list %}\n {%- for col in cols -%}\n {%- if col.column|lower not in except -%}\n {% do include_cols.append(col.column) %}\n {%- endif %}\n {%- endfor %}\n\n {{ return(include_cols) }}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_utils._is_relation", "macro.dbt_utils._is_ephemeral"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.6406345, "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": 1723229143.641701, "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": 1723229143.6424131, "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": 1723229143.6427512, "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": 1723229143.6434026, "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": 1723229143.6443422, "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": 1723229143.6448753, "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": 1723229143.6454067, "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.default__deduplicate"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.6464164, "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": 1723229143.6467435, "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": 1723229143.6470385, "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": 1723229143.6473322, "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": 1723229143.6475875, "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": 1723229143.6478586, "supported_languages": null}, "macro.dbt_utils.nullcheck_table": {"name": "nullcheck_table", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/nullcheck_table.sql", "original_file_path": "macros/sql/nullcheck_table.sql", "unique_id": "macro.dbt_utils.nullcheck_table", "macro_sql": "{% macro nullcheck_table(relation) %}\n {{ return(adapter.dispatch('nullcheck_table', 'dbt_utils')(relation)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__nullcheck_table"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.6482997, "supported_languages": null}, "macro.dbt_utils.default__nullcheck_table": {"name": "default__nullcheck_table", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/nullcheck_table.sql", "original_file_path": "macros/sql/nullcheck_table.sql", "unique_id": "macro.dbt_utils.default__nullcheck_table", "macro_sql": "{% macro default__nullcheck_table(relation) %}\n\n {%- do dbt_utils._is_relation(relation, 'nullcheck_table') -%}\n {%- do dbt_utils._is_ephemeral(relation, 'nullcheck_table') -%}\n {% set cols = adapter.get_columns_in_relation(relation) %}\n\n select {{ dbt_utils.nullcheck(cols) }}\n from {{relation}}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils._is_relation", "macro.dbt_utils._is_ephemeral", "macro.dbt_utils.nullcheck"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.648795, "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": 1723229143.6497595, "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": 1723229143.6506605, "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": 1723229143.6509964, "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": 1723229143.6515195, "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": 1723229143.652976, "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": 1723229143.654375, "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": 1723229143.6549432, "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": 1723229143.6557653, "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": 1723229143.6564162, "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": 1723229143.6574006, "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": 1723229143.6578612, "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": 1723229143.6583285, "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": 1723229143.658701, "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": 1723229143.6589508, "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": 1723229143.6595747, "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": 1723229143.6599698, "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": 1723229143.6602528, "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": 1723229143.6611335, "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": 1723229143.6623774, "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": 1723229143.662766, "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": 1723229143.6630182, "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": 1723229143.6638982, "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": 1723229143.6651366, "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": 1723229143.6658208, "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": 1723229143.666499, "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": 1723229143.670959, "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": 1723229143.673413, "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": 1723229143.6741235, "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": 1723229143.674574, "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": 1723229143.6754568, "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": 1723229143.676172, "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": 1723229143.676757, "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": 1723229143.6773129, "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": 1723229143.6781979, "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": 1723229143.6793485, "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": 1723229143.6802256, "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": 1723229143.6807268, "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": 1723229143.6814873, "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": 1723229143.6820045, "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": 1723229143.6827667, "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": 1723229143.6833475, "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": 1723229143.6842048, "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": 1723229143.6852095, "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": 1723229143.6867251, "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": 1723229143.6882446, "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": 1723229143.689269, "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": 1723229143.6904812, "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": 1723229143.691495, "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": 1723229143.692849, "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": 1723229143.6941, "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": 1723229143.6956165, "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": 1723229143.696811, "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": 1723229143.6984425, "supported_languages": null}, "macro.codegen.create_base_models": {"name": "create_base_models", "resource_type": "macro", "package_name": "codegen", "path": "macros/create_base_models.sql", "original_file_path": "macros/create_base_models.sql", "unique_id": "macro.codegen.create_base_models", "macro_sql": "{% macro create_base_models(source_name, tables) %}\n {{ return(adapter.dispatch('create_base_models', 'codegen')(source_name, tables)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.codegen.default__create_base_models"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.6990619, "supported_languages": null}, "macro.codegen.default__create_base_models": {"name": "default__create_base_models", "resource_type": "macro", "package_name": "codegen", "path": "macros/create_base_models.sql", "original_file_path": "macros/create_base_models.sql", "unique_id": "macro.codegen.default__create_base_models", "macro_sql": "{% macro default__create_base_models(source_name, tables) %}\n\n{% set source_name = \"\"~ source_name ~\"\" %}\n\n{% set zsh_command_models = \"source dbt_packages/codegen/bash_scripts/base_model_creation.sh \"\"\"~ source_name ~\"\"\" \" %}\n\n{%- set models_array = [] -%}\n\n{% for t in tables %}\n {% set help_command = zsh_command_models + t %}\n {{ models_array.append(help_command) }}\n{% endfor %}\n\n{{ log(\"Run these commands in your shell to generate the models:\\n\" ~ models_array|join(' && \\n'), info=True) }}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.699828, "supported_languages": null}, "macro.codegen.generate_column_yaml": {"name": "generate_column_yaml", "resource_type": "macro", "package_name": "codegen", "path": "macros/generate_model_yaml.sql", "original_file_path": "macros/generate_model_yaml.sql", "unique_id": "macro.codegen.generate_column_yaml", "macro_sql": "{% macro generate_column_yaml(column, model_yaml, column_desc_dict, include_data_types, parent_column_name=\"\") %}\n {{ return(adapter.dispatch('generate_column_yaml', 'codegen')(column, model_yaml, column_desc_dict, include_data_types, parent_column_name)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.codegen.default__generate_column_yaml"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.7028697, "supported_languages": null}, "macro.codegen.default__generate_column_yaml": {"name": "default__generate_column_yaml", "resource_type": "macro", "package_name": "codegen", "path": "macros/generate_model_yaml.sql", "original_file_path": "macros/generate_model_yaml.sql", "unique_id": "macro.codegen.default__generate_column_yaml", "macro_sql": "{% macro default__generate_column_yaml(column, model_yaml, column_desc_dict, include_data_types, parent_column_name) %}\n {% if parent_column_name %}\n {% set column_name = parent_column_name ~ \".\" ~ column.name %}\n {% else %}\n {% set column_name = column.name %}\n {% endif %}\n\n {% do model_yaml.append(' - name: ' ~ column_name | lower ) %}\n {% if include_data_types %}\n {% do model_yaml.append(' data_type: ' ~ codegen.data_type_format_model(column)) %}\n {% endif %}\n {% do model_yaml.append(' description: \"' ~ column_desc_dict.get(column.name | lower,'') ~ '\"') %}\n {% do model_yaml.append('') %}\n\n {% if column.fields|length > 0 %}\n {% for child_column in column.fields %}\n {% set model_yaml = codegen.generate_column_yaml(child_column, model_yaml, column_desc_dict, include_data_types, parent_column_name=column_name) %}\n {% endfor %}\n {% endif %}\n {% do return(model_yaml) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.codegen.data_type_format_model", "macro.codegen.generate_column_yaml"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.7043989, "supported_languages": null}, "macro.codegen.generate_model_yaml": {"name": "generate_model_yaml", "resource_type": "macro", "package_name": "codegen", "path": "macros/generate_model_yaml.sql", "original_file_path": "macros/generate_model_yaml.sql", "unique_id": "macro.codegen.generate_model_yaml", "macro_sql": "{% macro generate_model_yaml(model_names=[], upstream_descriptions=False, include_data_types=True) -%}\n {{ return(adapter.dispatch('generate_model_yaml', 'codegen')(model_names, upstream_descriptions, include_data_types)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.codegen.default__generate_model_yaml"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.7047944, "supported_languages": null}, "macro.codegen.default__generate_model_yaml": {"name": "default__generate_model_yaml", "resource_type": "macro", "package_name": "codegen", "path": "macros/generate_model_yaml.sql", "original_file_path": "macros/generate_model_yaml.sql", "unique_id": "macro.codegen.default__generate_model_yaml", "macro_sql": "{% macro default__generate_model_yaml(model_names, upstream_descriptions, include_data_types) %}\n\n {% set model_yaml=[] %}\n\n {% do model_yaml.append('version: 2') %}\n {% do model_yaml.append('') %}\n {% do model_yaml.append('models:') %}\n\n {% if model_names is string %}\n {{ exceptions.raise_compiler_error(\"The `model_names` argument must always be a list, even if there is only one model.\") }}\n {% else %}\n {% for model in model_names %}\n {% do model_yaml.append(' - name: ' ~ model | lower) %}\n {% do model_yaml.append(' description: \"\"') %}\n {% do model_yaml.append(' columns:') %}\n\n {% set relation=ref(model) %}\n {%- set columns = adapter.get_columns_in_relation(relation) -%}\n {% set column_desc_dict = codegen.build_dict_column_descriptions(model) if upstream_descriptions else {} %}\n\n {% for column in columns %}\n {% set model_yaml = codegen.generate_column_yaml(column, model_yaml, column_desc_dict, include_data_types) %}\n {% endfor %}\n {% endfor %}\n {% endif %}\n\n{% if execute %}\n\n {% set joined = model_yaml | join ('\\n') %}\n {{ print(joined) }}\n {% do return(joined) %}\n\n{% endif %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.codegen.build_dict_column_descriptions", "macro.codegen.generate_column_yaml"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.7067266, "supported_languages": null}, "macro.codegen.generate_model_import_ctes": {"name": "generate_model_import_ctes", "resource_type": "macro", "package_name": "codegen", "path": "macros/generate_model_import_ctes.sql", "original_file_path": "macros/generate_model_import_ctes.sql", "unique_id": "macro.codegen.generate_model_import_ctes", "macro_sql": "{% macro generate_model_import_ctes(model_name, leading_commas = False) %}\n {{ return(adapter.dispatch('generate_model_import_ctes', 'codegen')(model_name, leading_commas)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.codegen.default__generate_model_import_ctes"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.715557, "supported_languages": null}, "macro.codegen.default__generate_model_import_ctes": {"name": "default__generate_model_import_ctes", "resource_type": "macro", "package_name": "codegen", "path": "macros/generate_model_import_ctes.sql", "original_file_path": "macros/generate_model_import_ctes.sql", "unique_id": "macro.codegen.default__generate_model_import_ctes", "macro_sql": "{% macro default__generate_model_import_ctes(model_name, leading_commas) %}\n\n {%- if execute -%}\n {%- set nodes = graph.nodes.values() -%}\n\n {%- set model = (nodes\n | selectattr('name', 'equalto', model_name) \n | selectattr('resource_type', 'equalto', 'model')\n | list).pop() -%}\n\n {%- set model_raw_sql = model.raw_sql or model.raw_code -%}\n {%- else -%}\n {%- set model_raw_sql = '' -%}\n {%- endif -%}\n\n {#-\n\n REGEX Explanations\n\n # with_regex\n - matches (start of file followed by anything then whitespace\n or whitespace\n or a comma) followed by the word with then a space \n\n # from_ref \n - matches (from or join) followed by some spaces and then {{ref()}}\n\n # from_source \n - matches (from or join) followed by some spaces and then {{source(,)}}\n\n # from_var_1\n - matches (from or join) followed by some spaces and then {{var()}}\n\n # from_var_2\n - matches (from or join) followed by some spaces and then {{var(,)}}\n\n # from_table_1\n - matches (from or join) followed by some spaces and then .\n where each is enclosed by (` or [ or \" or ' or nothing)\n\n # from_table_2\n - matches (from or join) followed by some spaces and then ..\n where each is enclosed by (` or [ or \" or ' or nothing)\n\n # from_table_3\n - matches (from or join) followed by some spaces and then \n where is enclosed by (` or [ or \" or ')\n\n # config block\n - matches the start of the file followed by anything and then {{config()}}\n\n -#}\n\n {%- set re = modules.re -%}\n\n {%- set with_regex = '(?i)(?s)(^.*\\s*|\\s+|,)with\\s' -%}\n {%- set does_raw_sql_contain_cte = re.search(with_regex, model_raw_sql) -%}\n\n {%- set from_regexes = {\n 'from_ref':\n '(?ix)\n\n # first matching group\n # from or join followed by at least 1 whitespace character\n (from|join)\\s+\n\n # second matching group\n # opening {{, 0 or more whitespace character(s), ref, 0 or more whitespace character(s), an opening parenthesis, 0 or more whitespace character(s), 1 or 0 quotation mark\n ({{\\s*ref\\s*\\(\\s*[\\'\\\"]?)\n \n # third matching group\n # at least 1 of anything except a parenthesis or quotation mark\n ([^)\\'\\\"]+)\n \n # fourth matching group\n # 1 or 0 quotation mark, 0 or more whitespace character(s)\n ([\\'\\\"]?\\s*)\n\n # fifth matching group\n # a closing parenthesis, 0 or more whitespace character(s), closing }}\n (\\)\\s*}})\n \n ',\n 'from_source':\n '(?ix)\n\n # first matching group\n # from or join followed by at least 1 whitespace character\n (from|join)\\s+\n\n # second matching group\n # opening {{, 0 or more whitespace character(s), source, 0 or more whitespace character(s), an opening parenthesis, 0 or more whitespace character(s), 1 or 0 quotation mark\n ({{\\s*source\\s*\\(\\s*[\\'\\\"]?)\n\n # third matching group\n # at least 1 of anything except a parenthesis or quotation mark\n ([^)\\'\\\"]+)\n\n # fourth matching group\n # 1 or 0 quotation mark, 0 or more whitespace character(s)\n ([\\'\\\"]?\\s*)\n\n # fifth matching group\n # a comma\n (,)\n\n # sixth matching group\n # 0 or more whitespace character(s), 1 or 0 quotation mark\n (\\s*[\\'\\\"]?)\n\n # seventh matching group\n # at least 1 of anything except a parenthesis or quotation mark\n ([^)\\'\\\"]+)\n\n # eighth matching group\n # 1 or 0 quotation mark, 0 or more whitespace character(s)\n ([\\'\\\"]?\\s*)\n\n # ninth matching group\n # a closing parenthesis, 0 or more whitespace character(s), closing }}\n (\\)\\s*}})\n\n ',\n 'from_var_1':\n '(?ix)\n\n # first matching group\n # from or join followed by at least 1 whitespace character\n (from|join)\\s+\n\n # second matching group\n # opening {{, 0 or more whitespace character(s), var, 0 or more whitespace character(s), an opening parenthesis, 0 or more whitespace character(s), 1 or 0 quotation mark\n ({{\\s*var\\s*\\(\\s*[\\'\\\"]?)\n\n # third matching group\n # at least 1 of anything except a parenthesis or quotation mark\n ([^)\\'\\\"]+)\n\n # fourth matching group\n # 1 or 0 quotation mark, 0 or more whitespace character(s)\n ([\\'\\\"]?\\s*)\n\n # fifth matching group\n # a closing parenthesis, 0 or more whitespace character(s), closing }}\n (\\)\\s*}})\n \n ',\n 'from_var_2':\n '(?ix)\n\n # first matching group\n # from or join followed by at least 1 whitespace character\n (from|join)\\s+\n \n # second matching group\n # opening {{, 0 or more whitespace character(s), var, 0 or more whitespace character(s), an opening parenthesis, 0 or more whitespace character(s), 1 or 0 quotation mark\n ({{\\s*var\\s*\\(\\s*[\\'\\\"]?)\n\n # third matching group\n # at least 1 of anything except a parenthesis or quotation mark \n ([^)\\'\\\"]+)\n \n # fourth matching group\n # 1 or 0 quotation mark, 0 or more whitespace character(s)\n ([\\'\\\"]?\\s*)\n\n # fifth matching group\n # a comma\n (,)\n\n # sixth matching group\n # 0 or more whitespace character(s), 1 or 0 quotation mark \n (\\s*[\\'\\\"]?)\n\n # seventh matching group\n # at least 1 of anything except a parenthesis or quotation mark \n ([^)\\'\\\"]+)\n\n # eighth matching group\n # 1 or 0 quotation mark, 0 or more whitespace character(s) \n ([\\'\\\"]?\\s*)\n\n # ninth matching group\n # a closing parenthesis, 0 or more whitespace character(s), closing }} \n (\\)\\s*}})\n \n ',\n 'from_table_1':\n '(?ix)\n \n # first matching group\n # from or join followed by at least 1 whitespace character \n (from|join)\\s+\n \n # second matching group\n # 1 or 0 of (opening bracket, backtick, or quotation mark)\n ([\\[`\\\"\\']?)\n \n # third matching group\n # at least 1 word character\n (\\w+)\n \n # fouth matching group\n # 1 or 0 of (closing bracket, backtick, or quotation mark)\n ([\\]`\\\"\\']?)\n \n # fifth matching group\n # a period\n (\\.)\n \n # sixth matching group\n # 1 or 0 of (opening bracket, backtick, or quotation mark)\n ([\\[`\\\"\\']?)\n \n # seventh matching group\n # at least 1 word character\n (\\w+)\n \n # eighth matching group\n # 1 or 0 of (closing bracket, backtick, or quotation mark) folowed by a whitespace character or end of string\n ([\\]`\\\"\\']?)(?=\\s|$)\n \n ',\n 'from_table_2':\n '(?ix)\n\n # first matching group\n # from or join followed by at least 1 whitespace character \n (from|join)\\s+\n \n # second matching group\n # 1 or 0 of (opening bracket, backtick, or quotation mark) \n ([\\[`\\\"\\']?)\n \n # third matching group\n # at least 1 word character\n (\\w+)\n\n # fouth matching group\n # 1 or 0 of (closing bracket, backtick, or quotation mark) \n ([\\]`\\\"\\']?)\n \n # fifth matching group\n # a period \n (\\.)\n \n # sixth matching group\n # 1 or 0 of (opening bracket, backtick, or quotation mark)\n ([\\[`\\\"\\']?)\n\n # seventh matching group\n # at least 1 word character \n (\\w+)\n \n # eighth matching group\n # 1 or 0 of (closing bracket, backtick, or quotation mark) \n ([\\]`\\\"\\']?)\n \n # ninth matching group\n # a period \n (\\.)\n \n # tenth matching group\n # 1 or 0 of (closing bracket, backtick, or quotation mark) \n ([\\[`\\\"\\']?)\n \n # eleventh matching group\n # at least 1 word character \n (\\w+)\n\n # twelfth matching group\n # 1 or 0 of (closing bracket, backtick, or quotation mark) folowed by a whitespace character or end of string\n ([\\]`\\\"\\']?)(?=\\s|$)\n \n ',\n 'from_table_3':\n '(?ix)\n\n # first matching group\n # from or join followed by at least 1 whitespace character \n (from|join)\\s+\n \n # second matching group\n # 1 or 0 of (opening bracket, backtick, or quotation mark) \n ([\\[`\\\"\\'])\n \n # third matching group\n # at least 1 word character or space \n ([\\w ]+)\n\n # fourth matching group\n # 1 or 0 of (closing bracket, backtick, or quotation mark) folowed by a whitespace character or end of string\n ([\\]`\\\"\\'])(?=\\s|$)\n \n ',\n 'config_block':'(?i)(?s)^.*{{\\s*config\\s*\\([^)]+\\)\\s*}}'\n } -%}\n\n {%- set from_list = [] -%}\n {%- set config_list = [] -%}\n {%- set ns = namespace(model_sql = model_raw_sql) -%}\n\n {%- for regex_name, regex_pattern in from_regexes.items() -%}\n\n {%- set all_regex_matches = re.findall(regex_pattern, model_raw_sql) -%}\n\n {%- for match in all_regex_matches -%}\n\n {%- if regex_name == 'config_block' -%}\n {%- set match_tuple = (match|trim, regex_name) -%}\n {%- do config_list.append(match_tuple) -%}\n {%- elif regex_name == 'from_source' -%} \n {%- set full_from_clause = match[1:]|join|trim -%}\n {%- set cte_name = 'source_' + match[6]|lower -%}\n {%- set match_tuple = (cte_name, full_from_clause, regex_name) -%}\n {%- do from_list.append(match_tuple) -%} \n {%- elif regex_name == 'from_table_1' -%}\n {%- set full_from_clause = match[1:]|join()|trim -%}\n {%- set cte_name = match[2]|lower + '_' + match[6]|lower -%}\n {%- set match_tuple = (cte_name, full_from_clause, regex_name) -%}\n {%- do from_list.append(match_tuple) -%} \n {%- elif regex_name == 'from_table_2' -%}\n {%- set full_from_clause = match[1:]|join()|trim -%}\n {%- set cte_name = match[2]|lower + '_' + match[6]|lower + '_' + match[10]|lower -%}\n {%- set match_tuple = (cte_name, full_from_clause, regex_name) -%}\n {%- do from_list.append(match_tuple) -%} \n {%- else -%}\n {%- set full_from_clause = match[1:]|join|trim -%}\n {%- set cte_name = match[2]|trim|lower -%}\n {%- set match_tuple = (cte_name, full_from_clause, regex_name) -%}\n {%- do from_list.append(match_tuple) -%}\n {%- endif -%}\n\n {%- endfor -%}\n\n {%- if regex_name == 'config_block' -%}\n {%- elif regex_name == 'from_source' -%}\n {%- set ns.model_sql = re.sub(regex_pattern, '\\g<1> source_\\g<7>', ns.model_sql) -%} \n {%- elif regex_name == 'from_table_1' -%}\n {%- set ns.model_sql = re.sub(regex_pattern, '\\g<1> \\g<3>_\\g<7>', ns.model_sql) -%} \n {%- elif regex_name == 'from_table_2' -%}\n {%- set ns.model_sql = re.sub(regex_pattern, '\\g<1> \\g<3>_\\g<7>_\\g<11>', ns.model_sql) -%} \n {%- else -%} \n {%- set ns.model_sql = re.sub(regex_pattern, '\\g<1> \\g<3>', ns.model_sql) -%} \n {% endif %}\n\n {%- endfor -%}\n\n{%- if from_list|length > 0 -%}\n\n{%- set model_import_ctes -%}\n\n {%- for config_obj in config_list -%}\n\n {%- set ns.model_sql = ns.model_sql|replace(config_obj[0], '') -%}\n\n{{ config_obj[0] }}\n\n{% endfor -%}\n\n {%- for from_obj in from_list|unique|sort -%}\n\n{%- if loop.first -%}with {% else -%}{%- if leading_commas -%},{%- endif -%}{%- endif -%}{{ from_obj[0] }} as (\n\n select * from {{ from_obj[1] }}\n {%- if from_obj[2] == 'from_source' and from_list|length > 1 %} \n -- CAUTION: It's best practice to create staging layer for raw sources\n {%- elif from_obj[2] == 'from_table_1' or from_obj[2] == 'from_table_2' or from_obj[2] == 'from_table_3' %}\n -- CAUTION: It's best practice to use the ref or source function instead of a direct reference\n {%- elif from_obj[2] == 'from_var_1' or from_obj[2] == 'from_var_2' %}\n -- CAUTION: It's best practice to use the ref or source function instead of a var\n {%- endif %}\n \n){%- if ((loop.last and does_raw_sql_contain_cte) or (not loop.last)) and not leading_commas -%},{%- endif %}\n\n{% endfor -%}\n\n{%- if does_raw_sql_contain_cte -%}\n {%- if leading_commas -%}\n {%- set replace_with = '\\g<1>,' -%}\n {%- else -%}\n {%- set replace_with = '\\g<1>' -%}\n {%- endif -%}\n{{ re.sub(with_regex, replace_with, ns.model_sql, 1)|trim }}\n{%- else -%}\n{{ ns.model_sql|trim }}\n{%- endif -%}\n\n{%- endset -%}\n\n{%- else -%}\n\n{% set model_import_ctes = model_raw_sql %}\n\n{%- endif -%}\n\n{%- if execute -%}\n\n{{ print(model_import_ctes) }}\n{% do return(model_import_ctes) %}\n\n{% endif %}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.7235794, "supported_languages": null}, "macro.codegen.generate_base_model": {"name": "generate_base_model", "resource_type": "macro", "package_name": "codegen", "path": "macros/generate_base_model.sql", "original_file_path": "macros/generate_base_model.sql", "unique_id": "macro.codegen.generate_base_model", "macro_sql": "{% macro generate_base_model(source_name, table_name, leading_commas=False, case_sensitive_cols=False, materialized=None) %}\n {{ return(adapter.dispatch('generate_base_model', 'codegen')(source_name, table_name, leading_commas, case_sensitive_cols, materialized)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.codegen.default__generate_base_model"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.725328, "supported_languages": null}, "macro.codegen.default__generate_base_model": {"name": "default__generate_base_model", "resource_type": "macro", "package_name": "codegen", "path": "macros/generate_base_model.sql", "original_file_path": "macros/generate_base_model.sql", "unique_id": "macro.codegen.default__generate_base_model", "macro_sql": "{% macro default__generate_base_model(source_name, table_name, leading_commas, case_sensitive_cols, materialized) %}\n\n{%- set source_relation = source(source_name, table_name) -%}\n\n{%- set columns = adapter.get_columns_in_relation(source_relation) -%}\n{% set column_names=columns | map(attribute='name') %}\n{% set base_model_sql %}\n\n{%- if materialized is not none -%}\n {{ \"{{ config(materialized='\" ~ materialized ~ \"') }}\" }}\n{%- endif %}\n\nwith source as (\n\n select * from {% raw %}{{ source({% endraw %}'{{ source_name }}', '{{ table_name }}'{% raw %}) }}{% endraw %}\n\n),\n\nrenamed as (\n\n select\n {%- if leading_commas -%}\n {%- for column in column_names %}\n {{\", \" if not loop.first}}{% if not case_sensitive_cols %}{{ column | lower }}{% elif target.type == \"bigquery\" %}{{ column }}{% else %}{{ \"\\\"\" ~ column ~ \"\\\"\" }}{% endif %}\n {%- endfor %}\n {%- else -%}\n {%- for column in column_names %}\n {% if not case_sensitive_cols %}{{ column | lower }}{% elif target.type == \"bigquery\" %}{{ column }}{% else %}{{ \"\\\"\" ~ column ~ \"\\\"\" }}{% endif %}{{\",\" if not loop.last}}\n {%- endfor -%}\n {%- endif %}\n\n from source\n\n)\n\nselect * from renamed\n{% endset %}\n\n{% if execute %}\n\n{{ print(base_model_sql) }}\n{% do return(base_model_sql) %}\n\n{% endif %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.72731, "supported_languages": null}, "macro.codegen.get_tables_in_schema": {"name": "get_tables_in_schema", "resource_type": "macro", "package_name": "codegen", "path": "macros/generate_source.sql", "original_file_path": "macros/generate_source.sql", "unique_id": "macro.codegen.get_tables_in_schema", "macro_sql": "{% macro get_tables_in_schema(schema_name, database_name=target.database, table_pattern='%', exclude='') %}\n \n {% set tables=dbt_utils.get_relations_by_pattern(\n schema_pattern=schema_name,\n database=database_name,\n table_pattern=table_pattern,\n exclude=exclude\n ) %}\n\n {% set table_list= tables | map(attribute='identifier') %}\n\n {{ return(table_list | sort) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.get_relations_by_pattern"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.7308593, "supported_languages": null}, "macro.codegen.generate_source": {"name": "generate_source", "resource_type": "macro", "package_name": "codegen", "path": "macros/generate_source.sql", "original_file_path": "macros/generate_source.sql", "unique_id": "macro.codegen.generate_source", "macro_sql": "{% macro generate_source(schema_name, database_name=target.database, generate_columns=False, include_descriptions=False, include_data_types=True, table_pattern='%', exclude='', name=schema_name, table_names=None, include_database=False, include_schema=False) %}\n {{ return(adapter.dispatch('generate_source', 'codegen')(schema_name, database_name, generate_columns, include_descriptions, include_data_types, table_pattern, exclude, name, table_names, include_database, include_schema)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.codegen.default__generate_source"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.7316065, "supported_languages": null}, "macro.codegen.default__generate_source": {"name": "default__generate_source", "resource_type": "macro", "package_name": "codegen", "path": "macros/generate_source.sql", "original_file_path": "macros/generate_source.sql", "unique_id": "macro.codegen.default__generate_source", "macro_sql": "{% macro default__generate_source(schema_name, database_name, generate_columns, include_descriptions, include_data_types, table_pattern, exclude, name, table_names, include_database, include_schema) %}\n\n{% set sources_yaml=[] %}\n{% do sources_yaml.append('version: 2') %}\n{% do sources_yaml.append('') %}\n{% do sources_yaml.append('sources:') %}\n{% do sources_yaml.append(' - name: ' ~ name | lower) %}\n\n{% if include_descriptions %}\n {% do sources_yaml.append(' description: \"\"' ) %}\n{% endif %}\n\n{% if database_name != target.database or include_database %}\n{% do sources_yaml.append(' database: ' ~ database_name | lower) %}\n{% endif %}\n\n{% if schema_name != name or include_schema %}\n{% do sources_yaml.append(' schema: ' ~ schema_name | lower) %}\n{% endif %}\n\n{% do sources_yaml.append(' tables:') %}\n\n{% if table_names is none %}\n{% set tables=codegen.get_tables_in_schema(schema_name, database_name, table_pattern, exclude) %}\n{% else %}\n{% set tables = table_names %}\n{% endif %}\n\n{% for table in tables %}\n {% do sources_yaml.append(' - name: ' ~ table | lower ) %}\n {% if include_descriptions %}\n {% do sources_yaml.append(' description: \"\"' ) %}\n {% endif %}\n {% if generate_columns %}\n {% do sources_yaml.append(' columns:') %}\n\n {% set table_relation=api.Relation.create(\n database=database_name,\n schema=schema_name,\n identifier=table\n ) %}\n\n {% set columns=adapter.get_columns_in_relation(table_relation) %}\n\n {% for column in columns %}\n {% do sources_yaml.append(' - name: ' ~ column.name | lower ) %}\n {% if include_data_types %}\n {% do sources_yaml.append(' data_type: ' ~ codegen.data_type_format_source(column)) %}\n {% endif %}\n {% if include_descriptions %}\n {% do sources_yaml.append(' description: \"\"' ) %}\n {% endif %}\n {% endfor %}\n {% do sources_yaml.append('') %}\n\n {% endif %}\n\n{% endfor %}\n\n{% if execute %}\n\n {% set joined = sources_yaml | join ('\\n') %}\n {{ print(joined) }}\n {% do return(joined) %}\n\n{% endif %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.codegen.get_tables_in_schema", "macro.codegen.data_type_format_source"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.7350504, "supported_languages": null}, "macro.codegen.get_model_dependencies": {"name": "get_model_dependencies", "resource_type": "macro", "package_name": "codegen", "path": "macros/helpers/helpers.sql", "original_file_path": "macros/helpers/helpers.sql", "unique_id": "macro.codegen.get_model_dependencies", "macro_sql": "{% macro get_model_dependencies(model_name) %}\n {% for node in graph.nodes.values() | selectattr('name', \"equalto\", model_name) %}\n {{ return(node.depends_on.nodes) }}\n {% endfor %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.7370584, "supported_languages": null}, "macro.codegen.add_model_column_descriptions_to_dict": {"name": "add_model_column_descriptions_to_dict", "resource_type": "macro", "package_name": "codegen", "path": "macros/helpers/helpers.sql", "original_file_path": "macros/helpers/helpers.sql", "unique_id": "macro.codegen.add_model_column_descriptions_to_dict", "macro_sql": "{% macro add_model_column_descriptions_to_dict(model_name,dict_with_descriptions={}) %}\n {% for node in graph.nodes.values() | selectattr('name', \"equalto\", model_name) %}\n {% for col_name, col_values in node.columns.items() %}\n {% do dict_with_descriptions.update( {col_name: col_values.description} ) %}\n {% endfor %}\n {% endfor %}\n {{ return(dict_with_descriptions) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.7378192, "supported_languages": null}, "macro.codegen.build_dict_column_descriptions": {"name": "build_dict_column_descriptions", "resource_type": "macro", "package_name": "codegen", "path": "macros/helpers/helpers.sql", "original_file_path": "macros/helpers/helpers.sql", "unique_id": "macro.codegen.build_dict_column_descriptions", "macro_sql": "{% macro build_dict_column_descriptions(model_name) %}\n {% if execute %}\n {% set glob_dict = {} %}\n {% for full_model in codegen.get_model_dependencies(model_name) %}\n {% do codegen.add_model_column_descriptions_to_dict(full_model.split('.')[-1],glob_dict) %}\n {% endfor %}\n {{ return(glob_dict) }}\n {% endif %}\n{% endmacro %}", "depends_on": {"macros": ["macro.codegen.get_model_dependencies", "macro.codegen.add_model_column_descriptions_to_dict"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.7384632, "supported_languages": null}, "macro.codegen.get_models": {"name": "get_models", "resource_type": "macro", "package_name": "codegen", "path": "macros/helpers/helpers.sql", "original_file_path": "macros/helpers/helpers.sql", "unique_id": "macro.codegen.get_models", "macro_sql": "{% macro get_models(directory=None, prefix=None) %}\n {% set model_names=[] %}\n {% set models = graph.nodes.values() | selectattr('resource_type', \"equalto\", 'model') %}\n {% if directory and prefix %}\n {% for model in models %}\n {% set model_path = \"/\".join(model.path.split(\"/\")[:-1]) %}\n {% if model_path == directory and model.name.startswith(prefix) %}\n {% do model_names.append(model.name) %}\n {% endif %} \n {% endfor %}\n {% elif directory %}\n {% for model in models %}\n {% set model_path = \"/\".join(model.path.split(\"/\")[:-1]) %}\n {% if model_path == directory %}\n {% do model_names.append(model.name) %}\n {% endif %}\n {% endfor %}\n {% elif prefix %}\n {% for model in models if model.name.startswith(prefix) %}\n {% do model_names.append(model.name) %}\n {% endfor %}\n {% else %}\n {% for model in models %}\n {% do model_names.append(model.name) %}\n {% endfor %}\n {% endif %}\n {{ return(model_names) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.7405028, "supported_languages": null}, "macro.codegen.data_type_format_source": {"name": "data_type_format_source", "resource_type": "macro", "package_name": "codegen", "path": "macros/helpers/helpers.sql", "original_file_path": "macros/helpers/helpers.sql", "unique_id": "macro.codegen.data_type_format_source", "macro_sql": "{% macro data_type_format_source(column) -%}\n {{ return(adapter.dispatch('data_type_format_source', 'codegen')(column)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.codegen.default__data_type_format_source"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.7407842, "supported_languages": null}, "macro.codegen.default__data_type_format_source": {"name": "default__data_type_format_source", "resource_type": "macro", "package_name": "codegen", "path": "macros/helpers/helpers.sql", "original_file_path": "macros/helpers/helpers.sql", "unique_id": "macro.codegen.default__data_type_format_source", "macro_sql": "{% macro default__data_type_format_source(column) %}\n {% set formatted = codegen.format_column(column) %}\n {{ return(formatted['data_type'] | lower) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.codegen.format_column"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.7411067, "supported_languages": null}, "macro.codegen.data_type_format_model": {"name": "data_type_format_model", "resource_type": "macro", "package_name": "codegen", "path": "macros/helpers/helpers.sql", "original_file_path": "macros/helpers/helpers.sql", "unique_id": "macro.codegen.data_type_format_model", "macro_sql": "{% macro data_type_format_model(column) -%}\n {{ return(adapter.dispatch('data_type_format_model', 'codegen')(column)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.codegen.default__data_type_format_model"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.741393, "supported_languages": null}, "macro.codegen.default__data_type_format_model": {"name": "default__data_type_format_model", "resource_type": "macro", "package_name": "codegen", "path": "macros/helpers/helpers.sql", "original_file_path": "macros/helpers/helpers.sql", "unique_id": "macro.codegen.default__data_type_format_model", "macro_sql": "{% macro default__data_type_format_model(column) %}\n {% set formatted = codegen.format_column(column) %}\n {{ return(formatted['data_type'] | lower) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.codegen.format_column"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723229143.741719, "supported_languages": null}, "macro.codegen.format_column": {"name": "format_column", "resource_type": "macro", "package_name": "codegen", "path": "macros/vendored/dbt_core/format_column.sql", "original_file_path": "macros/vendored/dbt_core/format_column.sql", "unique_id": "macro.codegen.format_column", "macro_sql": "{% macro 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": 1723229143.7423162, "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": {"unit_tests": {"name": "unit_tests", "definition": {"method": "test_type", "value": "unit"}}, "non_unit_tests": {"name": "non_unit_tests", "definition": {"union": [{"method": "fqn", "value": "*"}, {"exclude": [{"method": "test_type", "value": "unit", "indirect_selection": "empty"}]}]}, "default": true}, "all_tests": {"name": "all_tests", "definition": {"method": "fqn", "value": "*"}}}, "disabled": {}, "parent_map": {"model.aspects.dim_user_pii": ["model.aspects.user_pii"], "model.aspects.user_pii": ["source.aspects.event_sink.external_id", "source.aspects.event_sink.user_profile"], "model.aspects.fact_enrollments": ["model.aspects.course_names", "model.aspects.dim_user_pii", "model.aspects.enrollment_events"], "model.aspects.fact_enrollment_status": ["model.aspects.enrollment_events"], "model.aspects.enrollment_events": ["model.aspects.xapi_events_all_parsed"], "model.aspects.fact_instance_enrollments": ["model.aspects.enrollment_events"], "model.aspects.fact_instance_actors": ["model.aspects.xapi_events_all_parsed"], "model.aspects.fact_instance_courses": ["model.aspects.xapi_events_all_parsed"], "model.aspects.fact_instance_events": ["model.aspects.xapi_events_all_parsed"], "model.aspects.fact_learner_course_grade": ["model.aspects.grading_events"], "model.aspects.grading_events": ["model.aspects.xapi_events_all_parsed"], "model.aspects.fact_learner_course_status": ["model.aspects.grading_events"], "model.aspects.fact_student_status": ["model.aspects.course_names", "model.aspects.dim_user_pii", "model.aspects.fact_enrollment_status", "model.aspects.fact_learner_course_grade", "model.aspects.fact_learner_course_status"], "model.aspects.fact_problem_responses": ["model.aspects.dim_course_blocks", "model.aspects.dim_user_pii", "model.aspects.problem_events"], "model.aspects.int_problems_per_subsection": ["model.aspects.dim_course_blocks"], "model.aspects.int_problem_hints": ["model.aspects.dim_course_blocks", "model.aspects.problem_events"], "model.aspects.subsection_problem_engagement": ["model.aspects.dim_course_blocks", "model.aspects.int_problems_per_subsection", "model.aspects.problem_events"], "model.aspects.section_problem_engagement": ["model.aspects.dim_course_blocks", "model.aspects.int_problems_per_subsection", "model.aspects.problem_events"], "model.aspects.responses": ["model.aspects.problem_events"], "model.aspects.problem_events": ["model.aspects.xapi_events_all_parsed"], "model.aspects.int_problem_results": ["model.aspects.dim_course_blocks", "model.aspects.problem_events", "model.aspects.responses"], "model.aspects.xapi_events_all_parsed": ["source.aspects.xapi.xapi_events_all"], "model.aspects.int_pages_per_subsection": ["model.aspects.dim_course_blocks"], "model.aspects.fact_learner_last_course_visit": ["model.aspects.navigation_events"], "model.aspects.subsection_page_engagement": ["model.aspects.dim_course_blocks", "model.aspects.int_pages_per_subsection", "model.aspects.navigation_events"], "model.aspects.fact_pageview_engagement": ["model.aspects.dim_course_blocks", "model.aspects.dim_user_pii", "model.aspects.section_page_engagement", "model.aspects.subsection_page_engagement"], "model.aspects.fact_navigation": ["model.aspects.dim_course_blocks", "model.aspects.dim_user_pii", "model.aspects.navigation_events"], "model.aspects.fact_navigation_completion": ["model.aspects.fact_navigation", "model.aspects.int_pages_per_subsection"], "model.aspects.navigation_events": ["model.aspects.xapi_events_all_parsed"], "model.aspects.section_page_engagement": ["model.aspects.dim_course_blocks", "model.aspects.int_pages_per_subsection", "model.aspects.navigation_events"], "model.aspects.most_recent_course_blocks": ["source.aspects.event_sink.course_blocks"], "model.aspects.course_block_names": ["model.aspects.most_recent_course_blocks"], "model.aspects.dim_course_blocks": ["model.aspects.course_block_names", "model.aspects.course_names"], "model.aspects.course_names": ["source.aspects.event_sink.course_overviews"], "model.aspects.dim_course_blocks_extended": ["model.aspects.dim_course_blocks"], "model.aspects.fact_video_plays": ["model.aspects.dim_course_blocks_extended", "model.aspects.dim_user_pii", "model.aspects.video_playback_events"], "model.aspects.fact_video_engagement": ["model.aspects.dim_course_blocks", "model.aspects.dim_user_pii", "model.aspects.section_video_engagement", "model.aspects.subsection_video_engagement"], "model.aspects.section_video_engagement": ["model.aspects.fact_video_plays", "model.aspects.int_videos_per_subsection"], "model.aspects.video_playback_events": ["model.aspects.xapi_events_all_parsed"], "model.aspects.subsection_video_engagement": ["model.aspects.fact_video_plays", "model.aspects.int_videos_per_subsection"], "model.aspects.int_videos_per_subsection": ["model.aspects.dim_course_blocks"], "test.aspects.get_problem_id_with_ccx": [], "test.aspects.get_problem_id": [], "test.aspects.a_tag": [], "test.aspects.accepted_values_fact_enrollments_enrollment_status__registered__unregistered.f8d10203f4": ["model.aspects.fact_enrollments"], "test.aspects.accepted_values_fact_enrollment_status_enrollment_status__registered__unregistered.893527c11f": ["model.aspects.fact_enrollment_status"], "test.aspects.accepted_values_xapi_fact_instance_enrollments_enrollment_status__xapi_fact_instance_enrollments__registered__unregistered.744ab867be": ["model.aspects.fact_instance_enrollments"], "test.aspects.accepted_values_fact_learner_course_status_approving_state__passed__failed.f9c0c1b85f": ["model.aspects.fact_learner_course_status"], "test.aspects.accepted_values_fact_student_status_enrollment_status__registered__unregistered.53cae8a0f3": ["model.aspects.fact_student_status"], "test.aspects.accepted_values_xapi_section_problem_engagement_engagement_level__xapi_section_problem_engagement__No_problems_attempted_yet__All_problems_attempted__At_least_one_problem_attempted.48ca5955e3": ["model.aspects.section_problem_engagement"], "test.aspects.accepted_values_xapi_subsection_problem_engagement_engagement_level__xapi_subsection_problem_engagement__No_problems_attempted_yet__All_problems_attempted__At_least_one_problem_attempted.51aa37af55": ["model.aspects.subsection_problem_engagement"], "test.aspects.accepted_values_fact_pageview_engagement_content_level__section__subsection.dd9e9af3ed": ["model.aspects.fact_pageview_engagement"], "test.aspects.accepted_values_xapi_section_page_engagement_engagement_level__xapi_section_page_engagement__No_pages_viewed_yet__All_pages_viewed__At_least_one_page_viewed.f10135df89": ["model.aspects.section_page_engagement"], "test.aspects.accepted_values_xapi_subsection_page_engagement_engagement_level__xapi_subsection_page_engagement__No_pages_viewed_yet__All_pages_viewed__At_least_one_page_viewed.bcd23fe35f": ["model.aspects.subsection_page_engagement"], "test.aspects.accepted_values_fact_video_engagement_content_level__section__subsection.636c5e7005": ["model.aspects.fact_video_engagement"], "test.aspects.accepted_values_fact_video_engagement_section_subsection_video_engagement__No_videos_viewed_yet__At_least_one_video_viewed__All_videos_viewed.91f6ccbf80": ["model.aspects.fact_video_engagement"], "test.aspects.accepted_values_xapi_section_video_engagement_engagement_level__xapi_section_video_engagement__No_videos_viewed_yet__All_videos_viewed__At_least_one_video_viewed.597c4fb289": ["model.aspects.section_video_engagement"], "test.aspects.accepted_values_xapi_subsection_video_engagement_engagement_level__xapi_subsection_video_engagement__No_videos_viewed_yet__All_videos_viewed__At_least_one_video_viewed.c9b49600d3": ["model.aspects.subsection_video_engagement"], "source.aspects.event_sink.user_profile": [], "source.aspects.event_sink.external_id": [], "source.aspects.xapi.xapi_events_all": [], "source.aspects.event_sink.course_blocks": [], "source.aspects.event_sink.course_overviews": [], "unit_test.aspects.user_pii.test_user_pii": ["model.aspects.user_pii"], "unit_test.aspects.fact_enrollments.test_fact_enrollments": ["model.aspects.fact_enrollments"], "unit_test.aspects.enrollment_events.test_enrollment_events": ["model.aspects.enrollment_events"], "unit_test.aspects.fact_enrollment_status.test_fact_enrollment_status": ["model.aspects.fact_enrollment_status"], "unit_test.aspects.fact_instance_enrollments.test_fact_instance_enrollments": ["model.aspects.fact_instance_enrollments"], "unit_test.aspects.grading_events.test_grading_events": ["model.aspects.grading_events"], "unit_test.aspects.fact_learner_course_grade.test_fact_learner_course_grade": ["model.aspects.fact_learner_course_grade"], "unit_test.aspects.fact_learner_course_status.test_fact_learner_course_status": ["model.aspects.fact_learner_course_status"], "unit_test.aspects.fact_student_status.test_fact_student_status": ["model.aspects.fact_student_status"], "unit_test.aspects.problem_events.test_problem_events": ["model.aspects.problem_events"], "unit_test.aspects.fact_problem_responses.test_fact_problem_responses": ["model.aspects.fact_problem_responses"], "unit_test.aspects.int_problem_hints.test_int_problem_hints": ["model.aspects.int_problem_hints"], "unit_test.aspects.responses.test_responses": ["model.aspects.responses"], "unit_test.aspects.int_problem_results.test_int_problem_results": ["model.aspects.int_problem_results"], "unit_test.aspects.subsection_problem_engagement.test_subsection_problem_engagement": ["model.aspects.subsection_problem_engagement"], "unit_test.aspects.xapi_events_all_parsed.test_xapi_events_all_parsed": ["model.aspects.xapi_events_all_parsed"], "unit_test.aspects.navigation_events.test_navigation_events": ["model.aspects.navigation_events"], "unit_test.aspects.fact_navigation.test_fact_navigation": ["model.aspects.fact_navigation"], "unit_test.aspects.fact_navigation_completion.test_fact_navigation_completion": ["model.aspects.fact_navigation_completion"], "unit_test.aspects.section_page_engagement.test_section_page_engagement": ["model.aspects.section_page_engagement"], "unit_test.aspects.subsection_page_engagement.test_subsection_page_engagement": ["model.aspects.subsection_page_engagement"], "unit_test.aspects.fact_pageview_engagement.test_fact_pageview_engagement": ["model.aspects.fact_pageview_engagement"], "unit_test.aspects.int_pages_per_subsection.test_macro_items_per_subsection": ["model.aspects.int_pages_per_subsection"], "unit_test.aspects.most_recent_course_blocks.test_most_recent_course_blocks": ["model.aspects.most_recent_course_blocks"], "unit_test.aspects.course_names.test_course_names": ["model.aspects.course_names"], "unit_test.aspects.dim_course_blocks.test_dim_course_blocks": ["model.aspects.dim_course_blocks"], "unit_test.aspects.dim_course_blocks_extended.test_dim_course_blocks_extended": ["model.aspects.dim_course_blocks_extended"], "unit_test.aspects.video_playback_events.test_video_playback_events": ["model.aspects.video_playback_events"], "unit_test.aspects.fact_video_plays.test_fact_video_plays": ["model.aspects.fact_video_plays"], "unit_test.aspects.section_video_engagement.test_section_video_engagement": ["model.aspects.section_video_engagement"], "unit_test.aspects.fact_video_engagement.test_fact_video_engagement": ["model.aspects.fact_video_engagement"]}, "child_map": {"model.aspects.dim_user_pii": ["model.aspects.fact_enrollments", "model.aspects.fact_navigation", "model.aspects.fact_pageview_engagement", "model.aspects.fact_problem_responses", "model.aspects.fact_student_status", "model.aspects.fact_video_engagement", "model.aspects.fact_video_plays"], "model.aspects.user_pii": ["model.aspects.dim_user_pii", "unit_test.aspects.user_pii.test_user_pii"], "model.aspects.fact_enrollments": ["test.aspects.accepted_values_fact_enrollments_enrollment_status__registered__unregistered.f8d10203f4", "unit_test.aspects.fact_enrollments.test_fact_enrollments"], "model.aspects.fact_enrollment_status": ["model.aspects.fact_student_status", "test.aspects.accepted_values_fact_enrollment_status_enrollment_status__registered__unregistered.893527c11f", "unit_test.aspects.fact_enrollment_status.test_fact_enrollment_status"], "model.aspects.enrollment_events": ["model.aspects.fact_enrollment_status", "model.aspects.fact_enrollments", "model.aspects.fact_instance_enrollments", "unit_test.aspects.enrollment_events.test_enrollment_events"], "model.aspects.fact_instance_enrollments": ["test.aspects.accepted_values_xapi_fact_instance_enrollments_enrollment_status__xapi_fact_instance_enrollments__registered__unregistered.744ab867be", "unit_test.aspects.fact_instance_enrollments.test_fact_instance_enrollments"], "model.aspects.fact_instance_actors": [], "model.aspects.fact_instance_courses": [], "model.aspects.fact_instance_events": [], "model.aspects.fact_learner_course_grade": ["model.aspects.fact_student_status", "unit_test.aspects.fact_learner_course_grade.test_fact_learner_course_grade"], "model.aspects.grading_events": ["model.aspects.fact_learner_course_grade", "model.aspects.fact_learner_course_status", "unit_test.aspects.grading_events.test_grading_events"], "model.aspects.fact_learner_course_status": ["model.aspects.fact_student_status", "test.aspects.accepted_values_fact_learner_course_status_approving_state__passed__failed.f9c0c1b85f", "unit_test.aspects.fact_learner_course_status.test_fact_learner_course_status"], "model.aspects.fact_student_status": ["test.aspects.accepted_values_fact_student_status_enrollment_status__registered__unregistered.53cae8a0f3", "unit_test.aspects.fact_student_status.test_fact_student_status"], "model.aspects.fact_problem_responses": ["unit_test.aspects.fact_problem_responses.test_fact_problem_responses"], "model.aspects.int_problems_per_subsection": ["model.aspects.section_problem_engagement", "model.aspects.subsection_problem_engagement"], "model.aspects.int_problem_hints": ["unit_test.aspects.int_problem_hints.test_int_problem_hints"], "model.aspects.subsection_problem_engagement": ["test.aspects.accepted_values_xapi_subsection_problem_engagement_engagement_level__xapi_subsection_problem_engagement__No_problems_attempted_yet__All_problems_attempted__At_least_one_problem_attempted.51aa37af55", "unit_test.aspects.subsection_problem_engagement.test_subsection_problem_engagement"], "model.aspects.section_problem_engagement": ["test.aspects.accepted_values_xapi_section_problem_engagement_engagement_level__xapi_section_problem_engagement__No_problems_attempted_yet__All_problems_attempted__At_least_one_problem_attempted.48ca5955e3"], "model.aspects.responses": ["model.aspects.int_problem_results", "unit_test.aspects.responses.test_responses"], "model.aspects.problem_events": ["model.aspects.fact_problem_responses", "model.aspects.int_problem_hints", "model.aspects.int_problem_results", "model.aspects.responses", "model.aspects.section_problem_engagement", "model.aspects.subsection_problem_engagement", "unit_test.aspects.problem_events.test_problem_events"], "model.aspects.int_problem_results": ["unit_test.aspects.int_problem_results.test_int_problem_results"], "model.aspects.xapi_events_all_parsed": ["model.aspects.enrollment_events", "model.aspects.fact_instance_actors", "model.aspects.fact_instance_courses", "model.aspects.fact_instance_events", "model.aspects.grading_events", "model.aspects.navigation_events", "model.aspects.problem_events", "model.aspects.video_playback_events", "unit_test.aspects.xapi_events_all_parsed.test_xapi_events_all_parsed"], "model.aspects.int_pages_per_subsection": ["model.aspects.fact_navigation_completion", "model.aspects.section_page_engagement", "model.aspects.subsection_page_engagement", "unit_test.aspects.int_pages_per_subsection.test_macro_items_per_subsection"], "model.aspects.fact_learner_last_course_visit": [], "model.aspects.subsection_page_engagement": ["model.aspects.fact_pageview_engagement", "test.aspects.accepted_values_xapi_subsection_page_engagement_engagement_level__xapi_subsection_page_engagement__No_pages_viewed_yet__All_pages_viewed__At_least_one_page_viewed.bcd23fe35f", "unit_test.aspects.subsection_page_engagement.test_subsection_page_engagement"], "model.aspects.fact_pageview_engagement": ["test.aspects.accepted_values_fact_pageview_engagement_content_level__section__subsection.dd9e9af3ed", "unit_test.aspects.fact_pageview_engagement.test_fact_pageview_engagement"], "model.aspects.fact_navigation": ["model.aspects.fact_navigation_completion", "unit_test.aspects.fact_navigation.test_fact_navigation"], "model.aspects.fact_navigation_completion": ["unit_test.aspects.fact_navigation_completion.test_fact_navigation_completion"], "model.aspects.navigation_events": ["model.aspects.fact_learner_last_course_visit", "model.aspects.fact_navigation", "model.aspects.section_page_engagement", "model.aspects.subsection_page_engagement", "unit_test.aspects.navigation_events.test_navigation_events"], "model.aspects.section_page_engagement": ["model.aspects.fact_pageview_engagement", "test.aspects.accepted_values_xapi_section_page_engagement_engagement_level__xapi_section_page_engagement__No_pages_viewed_yet__All_pages_viewed__At_least_one_page_viewed.f10135df89", "unit_test.aspects.section_page_engagement.test_section_page_engagement"], "model.aspects.most_recent_course_blocks": ["model.aspects.course_block_names", "unit_test.aspects.most_recent_course_blocks.test_most_recent_course_blocks"], "model.aspects.course_block_names": ["model.aspects.dim_course_blocks"], "model.aspects.dim_course_blocks": ["model.aspects.dim_course_blocks_extended", "model.aspects.fact_navigation", "model.aspects.fact_pageview_engagement", "model.aspects.fact_problem_responses", "model.aspects.fact_video_engagement", "model.aspects.int_pages_per_subsection", "model.aspects.int_problem_hints", "model.aspects.int_problem_results", "model.aspects.int_problems_per_subsection", "model.aspects.int_videos_per_subsection", "model.aspects.section_page_engagement", "model.aspects.section_problem_engagement", "model.aspects.subsection_page_engagement", "model.aspects.subsection_problem_engagement", "unit_test.aspects.dim_course_blocks.test_dim_course_blocks"], "model.aspects.course_names": ["model.aspects.dim_course_blocks", "model.aspects.fact_enrollments", "model.aspects.fact_student_status", "unit_test.aspects.course_names.test_course_names"], "model.aspects.dim_course_blocks_extended": ["model.aspects.fact_video_plays", "unit_test.aspects.dim_course_blocks_extended.test_dim_course_blocks_extended"], "model.aspects.fact_video_plays": ["model.aspects.section_video_engagement", "model.aspects.subsection_video_engagement", "unit_test.aspects.fact_video_plays.test_fact_video_plays"], "model.aspects.fact_video_engagement": ["test.aspects.accepted_values_fact_video_engagement_content_level__section__subsection.636c5e7005", "test.aspects.accepted_values_fact_video_engagement_section_subsection_video_engagement__No_videos_viewed_yet__At_least_one_video_viewed__All_videos_viewed.91f6ccbf80", "unit_test.aspects.fact_video_engagement.test_fact_video_engagement"], "model.aspects.section_video_engagement": ["model.aspects.fact_video_engagement", "test.aspects.accepted_values_xapi_section_video_engagement_engagement_level__xapi_section_video_engagement__No_videos_viewed_yet__All_videos_viewed__At_least_one_video_viewed.597c4fb289", "unit_test.aspects.section_video_engagement.test_section_video_engagement"], "model.aspects.video_playback_events": ["model.aspects.fact_video_plays", "unit_test.aspects.video_playback_events.test_video_playback_events"], "model.aspects.subsection_video_engagement": ["model.aspects.fact_video_engagement", "test.aspects.accepted_values_xapi_subsection_video_engagement_engagement_level__xapi_subsection_video_engagement__No_videos_viewed_yet__All_videos_viewed__At_least_one_video_viewed.c9b49600d3"], "model.aspects.int_videos_per_subsection": ["model.aspects.section_video_engagement", "model.aspects.subsection_video_engagement"], "test.aspects.get_problem_id_with_ccx": [], "test.aspects.get_problem_id": [], "test.aspects.a_tag": [], "test.aspects.accepted_values_fact_enrollments_enrollment_status__registered__unregistered.f8d10203f4": [], "test.aspects.accepted_values_fact_enrollment_status_enrollment_status__registered__unregistered.893527c11f": [], "test.aspects.accepted_values_xapi_fact_instance_enrollments_enrollment_status__xapi_fact_instance_enrollments__registered__unregistered.744ab867be": [], "test.aspects.accepted_values_fact_learner_course_status_approving_state__passed__failed.f9c0c1b85f": [], "test.aspects.accepted_values_fact_student_status_enrollment_status__registered__unregistered.53cae8a0f3": [], "test.aspects.accepted_values_xapi_section_problem_engagement_engagement_level__xapi_section_problem_engagement__No_problems_attempted_yet__All_problems_attempted__At_least_one_problem_attempted.48ca5955e3": [], "test.aspects.accepted_values_xapi_subsection_problem_engagement_engagement_level__xapi_subsection_problem_engagement__No_problems_attempted_yet__All_problems_attempted__At_least_one_problem_attempted.51aa37af55": [], "test.aspects.accepted_values_fact_pageview_engagement_content_level__section__subsection.dd9e9af3ed": [], "test.aspects.accepted_values_xapi_section_page_engagement_engagement_level__xapi_section_page_engagement__No_pages_viewed_yet__All_pages_viewed__At_least_one_page_viewed.f10135df89": [], "test.aspects.accepted_values_xapi_subsection_page_engagement_engagement_level__xapi_subsection_page_engagement__No_pages_viewed_yet__All_pages_viewed__At_least_one_page_viewed.bcd23fe35f": [], "test.aspects.accepted_values_fact_video_engagement_content_level__section__subsection.636c5e7005": [], "test.aspects.accepted_values_fact_video_engagement_section_subsection_video_engagement__No_videos_viewed_yet__At_least_one_video_viewed__All_videos_viewed.91f6ccbf80": [], "test.aspects.accepted_values_xapi_section_video_engagement_engagement_level__xapi_section_video_engagement__No_videos_viewed_yet__All_videos_viewed__At_least_one_video_viewed.597c4fb289": [], "test.aspects.accepted_values_xapi_subsection_video_engagement_engagement_level__xapi_subsection_video_engagement__No_videos_viewed_yet__All_videos_viewed__At_least_one_video_viewed.c9b49600d3": [], "source.aspects.event_sink.user_profile": ["model.aspects.user_pii"], "source.aspects.event_sink.external_id": ["model.aspects.user_pii"], "source.aspects.xapi.xapi_events_all": ["model.aspects.xapi_events_all_parsed"], "source.aspects.event_sink.course_blocks": ["model.aspects.most_recent_course_blocks"], "source.aspects.event_sink.course_overviews": ["model.aspects.course_names"], "unit_test.aspects.user_pii.test_user_pii": [], "unit_test.aspects.fact_enrollments.test_fact_enrollments": [], "unit_test.aspects.enrollment_events.test_enrollment_events": [], "unit_test.aspects.fact_enrollment_status.test_fact_enrollment_status": [], "unit_test.aspects.fact_instance_enrollments.test_fact_instance_enrollments": [], "unit_test.aspects.grading_events.test_grading_events": [], "unit_test.aspects.fact_learner_course_grade.test_fact_learner_course_grade": [], "unit_test.aspects.fact_learner_course_status.test_fact_learner_course_status": [], "unit_test.aspects.fact_student_status.test_fact_student_status": [], "unit_test.aspects.problem_events.test_problem_events": [], "unit_test.aspects.fact_problem_responses.test_fact_problem_responses": [], "unit_test.aspects.int_problem_hints.test_int_problem_hints": [], "unit_test.aspects.responses.test_responses": [], "unit_test.aspects.int_problem_results.test_int_problem_results": [], "unit_test.aspects.subsection_problem_engagement.test_subsection_problem_engagement": [], "unit_test.aspects.xapi_events_all_parsed.test_xapi_events_all_parsed": [], "unit_test.aspects.navigation_events.test_navigation_events": [], "unit_test.aspects.fact_navigation.test_fact_navigation": [], "unit_test.aspects.fact_navigation_completion.test_fact_navigation_completion": [], "unit_test.aspects.section_page_engagement.test_section_page_engagement": [], "unit_test.aspects.subsection_page_engagement.test_subsection_page_engagement": [], "unit_test.aspects.fact_pageview_engagement.test_fact_pageview_engagement": [], "unit_test.aspects.int_pages_per_subsection.test_macro_items_per_subsection": [], "unit_test.aspects.most_recent_course_blocks.test_most_recent_course_blocks": [], "unit_test.aspects.course_names.test_course_names": [], "unit_test.aspects.dim_course_blocks.test_dim_course_blocks": [], "unit_test.aspects.dim_course_blocks_extended.test_dim_course_blocks_extended": [], "unit_test.aspects.video_playback_events.test_video_playback_events": [], "unit_test.aspects.fact_video_plays.test_fact_video_plays": [], "unit_test.aspects.section_video_engagement.test_section_video_engagement": [], "unit_test.aspects.fact_video_engagement.test_fact_video_engagement": []}, "group_map": {}, "saved_queries": {}, "semantic_models": {}, "unit_tests": {"unit_test.aspects.user_pii.test_user_pii": {"model": "user_pii", "given": [{"input": "source(\"event_sink\", \"user_profile\")", "rows": "select * from event_sink.user_profile", "format": "sql", "fixture": null}, {"input": "source(\"event_sink\", \"external_id\")", "rows": "select * from event_sink.external_id", "format": "sql", "fixture": null}], "expect": {"rows": [{"user_id": "0", "external_user_id": "d1396620-e0d3-499c-ada0-f3ba27f9463b", "username": "actor_0", "name": "Actor 0", "email": "actor_0@aspects.invalid"}, {"user_id": "1", "external_user_id": "8cdaa227-33f8-4d0c-8996-b75373f7394b", "username": "actor_1", "name": "Actor 1", "email": "actor_1@aspects.invalid"}, {"user_id": "2", "external_user_id": "ac483c85-5bcc-41d1-8aad-3d84305ee3a5", "username": "actor_2", "name": "Actor 2", "email": "actor_2@aspects.invalid"}, {"user_id": "3", "external_user_id": "e8b54e57-c400-40d9-bab4-a73f2d4aa7ae", "username": "actor_3", "name": "Actor 3", "email": "actor_3@aspects.invalid"}, {"user_id": "4", "external_user_id": "602fedf5-a7ca-41ce-b14d-7f8945e1969a", "username": "actor_4", "name": "Actor 4", "email": "actor_4@aspects.invalid"}, {"user_id": "5", "external_user_id": "6c0eb8ab-6be1-47d2-bd0d-cf507fd763dc", "username": "actor_5", "name": "Actor 5", "email": "actor_5@aspects.invalid"}, {"user_id": "6", "external_user_id": "2369d68b-899d-458a-b780-77ebf4e5f4c3", "username": "actor_6", "name": "Actor 6", "email": "actor_6@aspects.invalid"}, {"user_id": "7", "external_user_id": "a499a2bb-c627-4916-92d1-f6ae6ac57a71", "username": "actor_7", "name": "Actor 7", "email": "actor_7@aspects.invalid"}, {"user_id": "8", "external_user_id": "9066f98a-4696-4dab-9de6-1c04a769f9ac", "username": "actor_8", "name": "Actor 8", "email": "actor_8@aspects.invalid"}, {"user_id": "9", "external_user_id": "168168ea-84e1-4e8c-8e36-db11d23eb1b8", "username": "actor_9", "name": "Actor 9", "email": "actor_9@aspects.invalid"}, {"user_id": "10", "external_user_id": "f8b778fb-aff9-4b63-8fe3-d578f3891dd8", "username": "actor_10", "name": "Actor 10", "email": "actor_10@aspects.invalid"}, {"user_id": "11", "external_user_id": "47f03e71-bf89-470b-8cb5-8affbc109aff", "username": "actor_11", "name": "Actor 11", "email": "actor_11@aspects.invalid"}, {"user_id": "12", "external_user_id": "154fd129-9ceb-4303-9984-d7736031117b", "username": "actor_12", "name": "Actor 12", "email": "actor_12@aspects.invalid"}, {"user_id": "13", "external_user_id": "58d4edfa-97c1-42ba-9ea4-3428c4e3cad9", "username": "actor_13", "name": "Actor 13", "email": "actor_13@aspects.invalid"}, {"user_id": "14", "external_user_id": "6ef32de8-9503-46ed-9764-559e1df8f75e", "username": "actor_14", "name": "Actor 14", "email": "actor_14@aspects.invalid"}, {"user_id": "15", "external_user_id": "a15dee08-edd3-4b54-98b2-e7d2f60a4c19", "username": "actor_15", "name": "Actor 15", "email": "actor_15@aspects.invalid"}, {"user_id": "16", "external_user_id": "5acd076a-e3f8-48e6-9c13-aad953166b68", "username": "actor_16", "name": "Actor 16", "email": "actor_16@aspects.invalid"}, {"user_id": "17", "external_user_id": "c838016f-6640-44d9-a038-33a7cc4018a9", "username": "actor_17", "name": "Actor 17", "email": "actor_17@aspects.invalid"}, {"user_id": "18", "external_user_id": "ac01d5b9-84a7-4df4-bfba-e91dcfad1c14", "username": "actor_18", "name": "Actor 18", "email": "actor_18@aspects.invalid"}, {"user_id": "19", "external_user_id": "96ab90f0-078f-477c-a011-7eda70eba32a", "username": "actor_19", "name": "Actor 19", "email": "actor_19@aspects.invalid"}, {"user_id": "20", "external_user_id": "d5e4ca2b-d877-4bb5-bb8b-8d51bc76f31a", "username": "actor_20", "name": "Actor 20", "email": "actor_20@aspects.invalid"}, {"user_id": "21", "external_user_id": "510eda4f-80fe-4a8c-9dd6-349415991e6d", "username": "actor_21", "name": "Actor 21", "email": "actor_21@aspects.invalid"}, {"user_id": "22", "external_user_id": "2c29167a-6b35-4a92-9615-84e63516f935", "username": "actor_22", "name": "Actor 22", "email": "actor_22@aspects.invalid"}, {"user_id": "23", "external_user_id": "8d500f3f-f97a-4c45-b786-c814ced84bff", "username": "actor_23", "name": "Actor 23", "email": "actor_23@aspects.invalid"}, {"user_id": "24", "external_user_id": "44b445b8-97e5-4208-abcd-5e1b08ee9569", "username": "actor_24", "name": "Actor 24", "email": "actor_24@aspects.invalid"}, {"user_id": "25", "external_user_id": "272f9b05-b2c8-4755-aa4b-087875c8104b", "username": "actor_25", "name": "Actor 25", "email": "actor_25@aspects.invalid"}, {"user_id": "26", "external_user_id": "3ae0a6e3-21af-4185-b3f1-c7125d1c2ac3", "username": "actor_26", "name": "Actor 26", "email": "actor_26@aspects.invalid"}, {"user_id": "27", "external_user_id": "007761a3-b622-4cb9-8461-b2c6daffb402", "username": "actor_27", "name": "Actor 27", "email": "actor_27@aspects.invalid"}, {"user_id": "28", "external_user_id": "af648aba-2da8-4c60-b982-adfc2f42fe78", "username": "actor_28", "name": "Actor 28", "email": "actor_28@aspects.invalid"}, {"user_id": "29", "external_user_id": "d48677ac-2373-457c-8318-30cd736ed206", "username": "actor_29", "name": "Actor 29", "email": "actor_29@aspects.invalid"}, {"user_id": "30", "external_user_id": "baba0235-70c8-45a8-a1e1-72477205b858", "username": "actor_30", "name": "Actor 30", "email": "actor_30@aspects.invalid"}, {"user_id": "31", "external_user_id": "c9d7fefc-f8bd-4162-8a2c-bdba6da6b624", "username": "actor_31", "name": "Actor 31", "email": "actor_31@aspects.invalid"}, {"user_id": "32", "external_user_id": "4e4f1903-4d45-4b85-94d5-af29757b8396", "username": "actor_32", "name": "Actor 32", "email": "actor_32@aspects.invalid"}, {"user_id": "33", "external_user_id": "2c2553fa-e3c2-40d9-82f4-ce6b8bdc85cf", "username": "actor_33", "name": "Actor 33", "email": "actor_33@aspects.invalid"}, {"user_id": "34", "external_user_id": "9344e7e6-2388-4b1b-b6b8-5040aad08ff7", "username": "actor_34", "name": "Actor 34", "email": "actor_34@aspects.invalid"}, {"user_id": "35", "external_user_id": "49d7023e-84c3-4396-9df7-5536b203ac32", "username": "actor_35", "name": "Actor 35", "email": "actor_35@aspects.invalid"}, {"user_id": "36", "external_user_id": "d26c103e-89ba-47f0-89b5-0df2141a43b8", "username": "actor_36", "name": "Actor 36", "email": "actor_36@aspects.invalid"}, {"user_id": "37", "external_user_id": "2f34c036-b8b2-4cf2-8180-1044c4e231ae", "username": "actor_37", "name": "Actor 37", "email": "actor_37@aspects.invalid"}, {"user_id": "38", "external_user_id": "c85ec8e1-26e4-41c5-bf0f-ce4d10e5b3b1", "username": "actor_38", "name": "Actor 38", "email": "actor_38@aspects.invalid"}, {"user_id": "39", "external_user_id": "c3ba8c7b-9b3a-49e3-b54a-4573613dc392", "username": "actor_39", "name": "Actor 39", "email": "actor_39@aspects.invalid"}, {"user_id": "40", "external_user_id": "28613776-d1b8-4d1d-a94f-1095f09efc2b", "username": "actor_40", "name": "Actor 40", "email": "actor_40@aspects.invalid"}, {"user_id": "41", "external_user_id": "f360e005-29c1-4ad8-92a8-308d7047dc6e", "username": "actor_41", "name": "Actor 41", "email": "actor_41@aspects.invalid"}, {"user_id": "42", "external_user_id": "70b53781-f71d-4051-9760-3874b4473a57", "username": "actor_42", "name": "Actor 42", "email": "actor_42@aspects.invalid"}, {"user_id": "43", "external_user_id": "78dc54d4-e68f-4853-b5e3-7a65357fe6ac", "username": "actor_43", "name": "Actor 43", "email": "actor_43@aspects.invalid"}, {"user_id": "44", "external_user_id": "e6e3c0f5-1a3a-4bcc-a3dd-fe2801585240", "username": "actor_44", "name": "Actor 44", "email": "actor_44@aspects.invalid"}, {"user_id": "45", "external_user_id": "9fa89875-36d7-465e-9bae-a05c0e252db4", "username": "actor_45", "name": "Actor 45", "email": "actor_45@aspects.invalid"}, {"user_id": "46", "external_user_id": "fbfb0998-6d7e-4047-9235-266965fda410", "username": "actor_46", "name": "Actor 46", "email": "actor_46@aspects.invalid"}, {"user_id": "47", "external_user_id": "7924fe6c-4fb8-4c08-83c8-8c9f770d37d7", "username": "actor_47", "name": "Actor 47", "email": "actor_47@aspects.invalid"}, {"user_id": "48", "external_user_id": "3760462a-fbb0-45dc-b5e5-76e6c60c72e1", "username": "actor_48", "name": "Actor 48", "email": "actor_48@aspects.invalid"}, {"user_id": "49", "external_user_id": "ed2421ea-45e4-4610-85b1-d58b2cdf628a", "username": "actor_49", "name": "Actor 49", "email": "actor_49@aspects.invalid"}, {"user_id": "50", "external_user_id": "1bf5ad2e-5eb7-4209-bb1c-ca2f4c8826e0", "username": "actor_50", "name": "Actor 50", "email": "actor_50@aspects.invalid"}, {"user_id": "51", "external_user_id": "3f5c36e9-d6ac-422d-9c83-ca3f1d38aa71", "username": "actor_51", "name": "Actor 51", "email": "actor_51@aspects.invalid"}, {"user_id": "52", "external_user_id": "f5975641-7160-4d20-9989-c7f9a993d32c", "username": "actor_52", "name": "Actor 52", "email": "actor_52@aspects.invalid"}, {"user_id": "53", "external_user_id": "3058e600-5bee-4018-920e-52a311963d88", "username": "actor_53", "name": "Actor 53", "email": "actor_53@aspects.invalid"}, {"user_id": "54", "external_user_id": "33909a28-f02d-414f-9794-58bfb18cb977", "username": "actor_54", "name": "Actor 54", "email": "actor_54@aspects.invalid"}, {"user_id": "55", "external_user_id": "465fe6bb-9894-4480-b8ef-e54d97d77fea", "username": "actor_55", "name": "Actor 55", "email": "actor_55@aspects.invalid"}, {"user_id": "56", "external_user_id": "fc35c856-a8c5-4110-b4b4-15b2025094d8", "username": "actor_56", "name": "Actor 56", "email": "actor_56@aspects.invalid"}, {"user_id": "57", "external_user_id": "95af96c4-e45b-401e-b700-e1f147d36297", "username": "actor_57", "name": "Actor 57", "email": "actor_57@aspects.invalid"}, {"user_id": "58", "external_user_id": "0f764bed-e5da-4d50-89d3-66aac42b50e5", "username": "actor_58", "name": "Actor 58", "email": "actor_58@aspects.invalid"}, {"user_id": "59", "external_user_id": "b3abecb9-10c6-4cfd-93ae-92883b2ab749", "username": "actor_59", "name": "Actor 59", "email": "actor_59@aspects.invalid"}, {"user_id": "60", "external_user_id": "bc9d00aa-2239-4a94-90de-b3ea4d390bc0", "username": "actor_60", "name": "Actor 60", "email": "actor_60@aspects.invalid"}, {"user_id": "61", "external_user_id": "43e0dba8-fc43-4567-824d-68bfabb1f312", "username": "actor_61", "name": "Actor 61", "email": "actor_61@aspects.invalid"}, {"user_id": "62", "external_user_id": "49a47dcd-f33e-4ad5-9416-a248494a85af", "username": "actor_62", "name": "Actor 62", "email": "actor_62@aspects.invalid"}, {"user_id": "63", "external_user_id": "4143359b-4690-4687-a2b8-dbe39f5cb330", "username": "actor_63", "name": "Actor 63", "email": "actor_63@aspects.invalid"}, {"user_id": "64", "external_user_id": "68195b77-86d9-4a90-988e-ec5f38d3a929", "username": "actor_64", "name": "Actor 64", "email": "actor_64@aspects.invalid"}, {"user_id": "65", "external_user_id": "2bb929b4-35ff-427e-9c80-addf897d76e7", "username": "actor_65", "name": "Actor 65", "email": "actor_65@aspects.invalid"}, {"user_id": "66", "external_user_id": "a1de350b-e587-4b57-8fc3-48feb69fd890", "username": "actor_66", "name": "Actor 66", "email": "actor_66@aspects.invalid"}, {"user_id": "67", "external_user_id": "ee648ff3-a442-43af-b1f8-d9880957ec86", "username": "actor_67", "name": "Actor 67", "email": "actor_67@aspects.invalid"}, {"user_id": "68", "external_user_id": "1479a01b-d058-4b00-89cf-3e51531f3fb8", "username": "actor_68", "name": "Actor 68", "email": "actor_68@aspects.invalid"}, {"user_id": "69", "external_user_id": "494ed100-58c9-4510-b39a-f7093ea8e906", "username": "actor_69", "name": "Actor 69", "email": "actor_69@aspects.invalid"}, {"user_id": "70", "external_user_id": "8af5a761-d765-4331-8ed3-071c8b282dca", "username": "actor_70", "name": "Actor 70", "email": "actor_70@aspects.invalid"}, {"user_id": "71", "external_user_id": "d9d644d5-2619-4c87-8ce3-f3efae37c2b8", "username": "actor_71", "name": "Actor 71", "email": "actor_71@aspects.invalid"}, {"user_id": "72", "external_user_id": "1efff542-8cfc-4bc9-863d-1bdd3c521515", "username": "actor_72", "name": "Actor 72", "email": "actor_72@aspects.invalid"}, {"user_id": "73", "external_user_id": "abb4911f-0c4a-4904-8004-aacfeb710346", "username": "actor_73", "name": "Actor 73", "email": "actor_73@aspects.invalid"}, {"user_id": "74", "external_user_id": "63c1c83c-725c-47cf-8686-4775d5fa0cf9", "username": "actor_74", "name": "Actor 74", "email": "actor_74@aspects.invalid"}, {"user_id": "75", "external_user_id": "f376194f-4c5c-4357-aae6-780707fcf36a", "username": "actor_75", "name": "Actor 75", "email": "actor_75@aspects.invalid"}, {"user_id": "76", "external_user_id": "dca7ea78-c883-4106-a698-87d5428c9207", "username": "actor_76", "name": "Actor 76", "email": "actor_76@aspects.invalid"}, {"user_id": "77", "external_user_id": "c217b4e2-3bf7-44db-9193-e1abbd905533", "username": "actor_77", "name": "Actor 77", "email": "actor_77@aspects.invalid"}, {"user_id": "78", "external_user_id": "d44a9bd9-6afe-4f1c-9f21-9aef3194c24a", "username": "actor_78", "name": "Actor 78", "email": "actor_78@aspects.invalid"}, {"user_id": "79", "external_user_id": "10063b09-875d-4c3b-8b9c-283aef97a348", "username": "actor_79", "name": "Actor 79", "email": "actor_79@aspects.invalid"}, {"user_id": "80", "external_user_id": "a28e2d80-0b93-4730-973f-15f8b18696de", "username": "actor_80", "name": "Actor 80", "email": "actor_80@aspects.invalid"}, {"user_id": "81", "external_user_id": "107459eb-506c-4347-93d5-22637996edf1", "username": "actor_81", "name": "Actor 81", "email": "actor_81@aspects.invalid"}, {"user_id": "82", "external_user_id": "ff10a27a-fe60-41b6-aa8e-823770c210a3", "username": "actor_82", "name": "Actor 82", "email": "actor_82@aspects.invalid"}, {"user_id": "83", "external_user_id": "9e2f08c5-77f0-4508-99c6-88549bf7c0b4", "username": "actor_83", "name": "Actor 83", "email": "actor_83@aspects.invalid"}, {"user_id": "84", "external_user_id": "14f0b50a-e45e-496f-9511-7437473dba2f", "username": "actor_84", "name": "Actor 84", "email": "actor_84@aspects.invalid"}, {"user_id": "85", "external_user_id": "9d97277c-9df9-475e-a231-1af77bf3311f", "username": "actor_85", "name": "Actor 85", "email": "actor_85@aspects.invalid"}, {"user_id": "86", "external_user_id": "4e0fc096-65d9-4b41-bcbd-564b054e532e", "username": "actor_86", "name": "Actor 86", "email": "actor_86@aspects.invalid"}, {"user_id": "87", "external_user_id": "668402da-eccf-4daf-b931-4c5948668f84", "username": "actor_87", "name": "Actor 87", "email": "actor_87@aspects.invalid"}, {"user_id": "88", "external_user_id": "273d802c-af43-4e17-a03c-0dd9da357be1", "username": "actor_88", "name": "Actor 88", "email": "actor_88@aspects.invalid"}, {"user_id": "89", "external_user_id": "100752b0-091b-40a3-9087-52f0d4aaeb8c", "username": "actor_89", "name": "Actor 89", "email": "actor_89@aspects.invalid"}, {"user_id": "90", "external_user_id": "3044ff34-06c7-4d33-bfe3-405b0f05b984", "username": "actor_90", "name": "Actor 90", "email": "actor_90@aspects.invalid"}, {"user_id": "91", "external_user_id": "060967b4-0899-411a-abba-2fa9528211d9", "username": "actor_91", "name": "Actor 91", "email": "actor_91@aspects.invalid"}, {"user_id": "92", "external_user_id": "39762ebc-1c5b-4ae9-8694-758f6a74b8f3", "username": "actor_92", "name": "Actor 92", "email": "actor_92@aspects.invalid"}, {"user_id": "93", "external_user_id": "61570f19-557c-4dbd-9cd2-9f3c573beb4b", "username": "actor_93", "name": "Actor 93", "email": "actor_93@aspects.invalid"}, {"user_id": "94", "external_user_id": "7ba12e72-5cb4-43f4-b3a9-729e6724ef6a", "username": "actor_94", "name": "Actor 94", "email": "actor_94@aspects.invalid"}, {"user_id": "95", "external_user_id": "3c83b6e9-d3d3-4c18-b6d6-956c1d8334a2", "username": "actor_95", "name": "Actor 95", "email": "actor_95@aspects.invalid"}, {"user_id": "96", "external_user_id": "c3c0c4b2-b284-4f3f-aa18-934e435b6c3c", "username": "actor_96", "name": "Actor 96", "email": "actor_96@aspects.invalid"}, {"user_id": "97", "external_user_id": "829a9444-ced3-4273-9e4b-e8a8bb790c48", "username": "actor_97", "name": "Actor 97", "email": "actor_97@aspects.invalid"}, {"user_id": "98", "external_user_id": "a5a50fa7-26c3-405d-95bb-d1b351ffa191", "username": "actor_98", "name": "Actor 98", "email": "actor_98@aspects.invalid"}, {"user_id": "99", "external_user_id": "7f9d4c07-e6b8-4d48-b207-08ee0f755933", "username": "actor_99", "name": "Actor 99", "email": "actor_99@aspects.invalid"}], "format": "csv", "fixture": "user_pii_expected"}, "name": "test_user_pii", "resource_type": "unit_test", "package_name": "aspects", "path": "users/unit_tests.yaml", "original_file_path": "models/users/unit_tests.yaml", "unique_id": "unit_test.aspects.user_pii.test_user_pii", "fqn": ["aspects", "users", "user_pii", "test_user_pii"], "description": "", "overrides": null, "depends_on": {"macros": [], "nodes": ["model.aspects.user_pii"]}, "config": {"tags": ["ci"], "meta": {}}, "checksum": "2419c73556f5016efddb78316ce28a6c6557a87a1907136ae299d0fc5a79a653", "schema": "xapi", "created_at": 1723229145.1125407, "versions": null, "version": null}, "unit_test.aspects.fact_enrollments.test_fact_enrollments": {"model": "fact_enrollments", "given": [{"input": "ref('course_names')", "rows": "select * from course_names", "format": "sql", "fixture": null}, {"input": "ref('enrollment_events')", "rows": "select * from enrollment_events", "format": "sql", "fixture": null}, {"input": "ref('dim_user_pii')", "rows": "select * from dim_user_pii", "format": "sql", "fixture": null}], "expect": {"rows": "select * from fact_enrollments_expected", "format": "sql", "fixture": null}, "name": "test_fact_enrollments", "resource_type": "unit_test", "package_name": "aspects", "path": "enrollment/unit_tests.yaml", "original_file_path": "models/enrollment/unit_tests.yaml", "unique_id": "unit_test.aspects.fact_enrollments.test_fact_enrollments", "fqn": ["aspects", "enrollment", "fact_enrollments", "test_fact_enrollments"], "description": "", "overrides": null, "depends_on": {"macros": [], "nodes": ["model.aspects.fact_enrollments"]}, "config": {"tags": ["ci"], "meta": {}}, "checksum": "c50232f2c9b3bf9b4e65f5df9e83747c63e20c99f38872bb8e85c62b46b9cfa3", "schema": "xapi", "created_at": 1723229145.1161358, "versions": null, "version": null}, "unit_test.aspects.enrollment_events.test_enrollment_events": {"model": "enrollment_events", "given": [{"input": "ref('xapi_events_all_parsed')", "rows": "select * from xapi.xapi_events_all_parsed", "format": "sql", "fixture": null}], "expect": {"rows": "select * from enrollment_events_expected", "format": "sql", "fixture": null}, "name": "test_enrollment_events", "resource_type": "unit_test", "package_name": "aspects", "path": "enrollment/unit_tests.yaml", "original_file_path": "models/enrollment/unit_tests.yaml", "unique_id": "unit_test.aspects.enrollment_events.test_enrollment_events", "fqn": ["aspects", "enrollment", "enrollment_events", "test_enrollment_events"], "description": "", "overrides": null, "depends_on": {"macros": [], "nodes": ["model.aspects.enrollment_events"]}, "config": {"tags": ["ci"], "meta": {}}, "checksum": "0db3696ea218753a1074842bbedfc293fd39ba95c0364f65e57464a1e9ae7633", "schema": "xapi", "created_at": 1723229145.1179662, "versions": null, "version": null}, "unit_test.aspects.fact_enrollment_status.test_fact_enrollment_status": {"model": "fact_enrollment_status", "given": [{"input": "ref('enrollment_events')", "rows": "select * from enrollment_events", "format": "sql", "fixture": null}], "expect": {"rows": "select * from fact_enrollment_status_expected", "format": "sql", "fixture": null}, "name": "test_fact_enrollment_status", "resource_type": "unit_test", "package_name": "aspects", "path": "enrollment/unit_tests.yaml", "original_file_path": "models/enrollment/unit_tests.yaml", "unique_id": "unit_test.aspects.fact_enrollment_status.test_fact_enrollment_status", "fqn": ["aspects", "enrollment", "fact_enrollment_status", "test_fact_enrollment_status"], "description": "", "overrides": null, "depends_on": {"macros": [], "nodes": ["model.aspects.fact_enrollment_status"]}, "config": {"tags": ["ci"], "meta": {}}, "checksum": "36553adcd997d44cb273afab06f6246b8aa61a5b9e5bf1e40be86dfe2d37f14d", "schema": "xapi", "created_at": 1723229145.1189601, "versions": null, "version": null}, "unit_test.aspects.fact_instance_enrollments.test_fact_instance_enrollments": {"model": "fact_instance_enrollments", "given": [{"input": "ref('enrollment_events')", "rows": "select * from enrollment_events", "format": "sql", "fixture": null}], "expect": {"rows": "select * from fact_instance_enrollments_expected", "format": "sql", "fixture": null}, "name": "test_fact_instance_enrollments", "resource_type": "unit_test", "package_name": "aspects", "path": "instance/unit_tests.yaml", "original_file_path": "models/instance/unit_tests.yaml", "unique_id": "unit_test.aspects.fact_instance_enrollments.test_fact_instance_enrollments", "fqn": ["aspects", "instance", "fact_instance_enrollments", "test_fact_instance_enrollments"], "description": "", "overrides": null, "depends_on": {"macros": [], "nodes": ["model.aspects.fact_instance_enrollments"]}, "config": {"tags": ["ci"], "meta": {}}, "checksum": "cd5503c4cc82480aabbb53a9758f679f51fcab67732c4e00ed60e383175f78a5", "schema": "xapi", "created_at": 1723229145.1200628, "versions": null, "version": null}, "unit_test.aspects.grading_events.test_grading_events": {"model": "grading_events", "given": [{"input": "ref('xapi_events_all_parsed')", "rows": "select * from xapi_events_all_parsed", "format": "sql", "fixture": null}], "expect": {"rows": "select * from grading_events_expected", "format": "sql", "fixture": null}, "name": "test_grading_events", "resource_type": "unit_test", "package_name": "aspects", "path": "grading/unit_tests.yaml", "original_file_path": "models/grading/unit_tests.yaml", "unique_id": "unit_test.aspects.grading_events.test_grading_events", "fqn": ["aspects", "grading", "grading_events", "test_grading_events"], "description": "", "overrides": null, "depends_on": {"macros": [], "nodes": ["model.aspects.grading_events"]}, "config": {"tags": ["ci"], "meta": {}}, "checksum": "61dd0d8c98bcedaa4de06acf0020fa16474254bd62790b05bbc4370b07257c5c", "schema": "xapi", "created_at": 1723229145.1214795, "versions": null, "version": null}, "unit_test.aspects.fact_learner_course_grade.test_fact_learner_course_grade": {"model": "fact_learner_course_grade", "given": [{"input": "ref('grading_events')", "rows": "select * from grading_events", "format": "sql", "fixture": null}], "expect": {"rows": [{"org": "Org0", "course_key": "course-v1:Org0+DemoX+2bc51b", "actor_id": "1bf5ad2e-5eb7-4209-bb1c-ca2f4c8826e0", "course_grade": "0.9523809523809523", "emission_time": "2024-03-02 07:57:47"}, {"org": "Org0", "course_key": "course-v1:Org0+DemoX+2bc51b", "actor_id": "2369d68b-899d-458a-b780-77ebf4e5f4c3", "course_grade": "0.7422680412371134", "emission_time": "2024-03-09 17:33:29"}, {"org": "Org0", "course_key": "course-v1:Org0+DemoX+2bc51b", "actor_id": "273d802c-af43-4e17-a03c-0dd9da357be1", "course_grade": "0.45714285714285713", "emission_time": "2024-02-26 15:47:12"}, {"org": "Org0", "course_key": "course-v1:Org0+DemoX+2bc51b", "actor_id": "3c83b6e9-d3d3-4c18-b6d6-956c1d8334a2", "course_grade": "0.9841269841269841", "emission_time": "2024-02-15 09:45:51"}, {"org": "Org0", "course_key": "course-v1:Org0+DemoX+2bc51b", "actor_id": "44b445b8-97e5-4208-abcd-5e1b08ee9569", "course_grade": "0.5", "emission_time": "2024-03-12 10:03:24"}, {"org": "Org0", "course_key": "course-v1:Org0+DemoX+2bc51b", "actor_id": "4e0fc096-65d9-4b41-bcbd-564b054e532e", "course_grade": "0.0425531914893617", "emission_time": "2024-01-27 21:40:19"}, {"org": "Org0", "course_key": "course-v1:Org0+DemoX+2bc51b", "actor_id": "abb4911f-0c4a-4904-8004-aacfeb710346", "course_grade": "0.5", "emission_time": "2024-02-09 02:22:26"}, {"org": "Org0", "course_key": "course-v1:Org0+DemoX+2bc51b", "actor_id": "b3abecb9-10c6-4cfd-93ae-92883b2ab749", "course_grade": "0.8947368421052632", "emission_time": "2023-12-21 11:09:43"}, {"org": "Org0", "course_key": "course-v1:Org0+DemoX+2bc51b", "actor_id": "c85ec8e1-26e4-41c5-bf0f-ce4d10e5b3b1", "course_grade": "0.9240506329113924", "emission_time": "2024-02-23 11:14:00"}, {"org": "Org0", "course_key": "course-v1:Org0+DemoX+2bc51b", "actor_id": "ed2421ea-45e4-4610-85b1-d58b2cdf628a", "course_grade": "0.29411764705882354", "emission_time": "2024-02-16 11:13:49"}, {"org": "Org0", "course_key": "course-v1:Org0+DemoX+2bc51b", "actor_id": "f376194f-4c5c-4357-aae6-780707fcf36a", "course_grade": "0", "emission_time": "2024-02-21 17:29:58"}, {"org": "Org0", "course_key": "course-v1:Org0+DemoX+2bc51b", "actor_id": "f5975641-7160-4d20-9989-c7f9a993d32c", "course_grade": "0.925", "emission_time": "2024-02-28 10:00:34"}, {"org": "Org0", "course_key": "course-v1:Org0+DemoX+81bba1", "actor_id": "100752b0-091b-40a3-9087-52f0d4aaeb8c", "course_grade": "0.2727272727272727", "emission_time": "2020-10-02 10:39:56"}, {"org": "Org0", "course_key": "course-v1:Org0+DemoX+81bba1", "actor_id": "1efff542-8cfc-4bc9-863d-1bdd3c521515", "course_grade": "0.38461538461538464", "emission_time": "2020-08-18 01:32:55"}, {"org": "Org0", "course_key": "course-v1:Org0+DemoX+81bba1", "actor_id": "273d802c-af43-4e17-a03c-0dd9da357be1", "course_grade": "0.3157894736842105", "emission_time": "2020-09-29 21:02:35"}, {"org": "Org0", "course_key": "course-v1:Org0+DemoX+81bba1", "actor_id": "2f34c036-b8b2-4cf2-8180-1044c4e231ae", "course_grade": "0.97", "emission_time": "2020-08-19 09:55:20"}, {"org": "Org0", "course_key": "course-v1:Org0+DemoX+81bba1", "actor_id": "5acd076a-e3f8-48e6-9c13-aad953166b68", "course_grade": "0.09333333333333334", "emission_time": "2020-08-16 17:39:29"}, {"org": "Org0", "course_key": "course-v1:Org0+DemoX+81bba1", "actor_id": "9e2f08c5-77f0-4508-99c6-88549bf7c0b4", "course_grade": "0.45", "emission_time": "2020-09-28 05:18:47"}, {"org": "Org0", "course_key": "course-v1:Org0+DemoX+81bba1", "actor_id": "c838016f-6640-44d9-a038-33a7cc4018a9", "course_grade": "0.9054054054054054", "emission_time": "2020-09-16 09:48:10"}, {"org": "Org1", "course_key": "course-v1:Org1+DemoX+1937e7", "actor_id": "272f9b05-b2c8-4755-aa4b-087875c8104b", "course_grade": "0.75", "emission_time": "2021-07-28 17:01:18"}, {"org": "Org1", "course_key": "course-v1:Org1+DemoX+1937e7", "actor_id": "2f34c036-b8b2-4cf2-8180-1044c4e231ae", "course_grade": "0.5555555555555556", "emission_time": "2021-06-08 23:03:09"}, {"org": "Org1", "course_key": "course-v1:Org1+DemoX+1937e7", "actor_id": "3c83b6e9-d3d3-4c18-b6d6-956c1d8334a2", "course_grade": "0.3333333333333333", "emission_time": "2021-07-11 11:57:37"}, {"org": "Org1", "course_key": "course-v1:Org1+DemoX+1937e7", "actor_id": "3f5c36e9-d6ac-422d-9c83-ca3f1d38aa71", "course_grade": "0", "emission_time": "2021-07-27 06:30:19"}, {"org": "Org1", "course_key": "course-v1:Org1+DemoX+1937e7", "actor_id": "44b445b8-97e5-4208-abcd-5e1b08ee9569", "course_grade": "0.42528735632183906", "emission_time": "2021-07-01 18:31:57"}, {"org": "Org1", "course_key": "course-v1:Org1+DemoX+1937e7", "actor_id": "510eda4f-80fe-4a8c-9dd6-349415991e6d", "course_grade": "0.9333333333333333", "emission_time": "2021-07-06 05:58:00"}, {"org": "Org1", "course_key": "course-v1:Org1+DemoX+1937e7", "actor_id": "63c1c83c-725c-47cf-8686-4775d5fa0cf9", "course_grade": "0.0425531914893617", "emission_time": "2021-07-14 01:22:24"}, {"org": "Org1", "course_key": "course-v1:Org1+DemoX+1937e7", "actor_id": "9066f98a-4696-4dab-9de6-1c04a769f9ac", "course_grade": "0", "emission_time": "2021-07-11 04:26:08"}, {"org": "Org1", "course_key": "course-v1:Org1+DemoX+1937e7", "actor_id": "9fa89875-36d7-465e-9bae-a05c0e252db4", "course_grade": "0.55", "emission_time": "2021-07-18 20:34:16"}, {"org": "Org1", "course_key": "course-v1:Org1+DemoX+1937e7", "actor_id": "a15dee08-edd3-4b54-98b2-e7d2f60a4c19", "course_grade": "0.2823529411764706", "emission_time": "2021-06-17 12:59:49"}, {"org": "Org1", "course_key": "course-v1:Org1+DemoX+1937e7", "actor_id": "a499a2bb-c627-4916-92d1-f6ae6ac57a71", "course_grade": "0.945054945054945", "emission_time": "2021-07-29 08:50:10"}, {"org": "Org1", "course_key": "course-v1:Org1+DemoX+1937e7", "actor_id": "baba0235-70c8-45a8-a1e1-72477205b858", "course_grade": "0.6527777777777778", "emission_time": "2021-07-30 17:06:48"}, {"org": "Org1", "course_key": "course-v1:Org1+DemoX+1937e7", "actor_id": "d9d644d5-2619-4c87-8ce3-f3efae37c2b8", "course_grade": "0.125", "emission_time": "2021-07-06 13:41:30"}, {"org": "Org1", "course_key": "course-v1:Org1+DemoX+1937e7", "actor_id": "e6e3c0f5-1a3a-4bcc-a3dd-fe2801585240", "course_grade": "0.4583333333333333", "emission_time": "2021-07-23 03:33:57"}, {"org": "Org2", "course_key": "course-v1:Org2+DemoX+682526", "actor_id": "107459eb-506c-4347-93d5-22637996edf1", "course_grade": "0.9655172413793104", "emission_time": "2021-12-30 15:58:03"}, {"org": "Org2", "course_key": "course-v1:Org2+DemoX+682526", "actor_id": "44b445b8-97e5-4208-abcd-5e1b08ee9569", "course_grade": "0.35294117647058826", "emission_time": "2021-12-04 11:33:59"}, {"org": "Org2", "course_key": "course-v1:Org2+DemoX+682526", "actor_id": "49a47dcd-f33e-4ad5-9416-a248494a85af", "course_grade": "0.47368421052631576", "emission_time": "2021-12-14 16:05:55"}, {"org": "Org2", "course_key": "course-v1:Org2+DemoX+682526", "actor_id": "4e4f1903-4d45-4b85-94d5-af29757b8396", "course_grade": "0.9166666666666666", "emission_time": "2021-12-31 12:45:01"}, {"org": "Org2", "course_key": "course-v1:Org2+DemoX+682526", "actor_id": "8af5a761-d765-4331-8ed3-071c8b282dca", "course_grade": "0.3333333333333333", "emission_time": "2021-12-01 18:37:19"}, {"org": "Org2", "course_key": "course-v1:Org2+DemoX+682526", "actor_id": "9344e7e6-2388-4b1b-b6b8-5040aad08ff7", "course_grade": "1", "emission_time": "2021-11-05 10:50:55"}, {"org": "Org2", "course_key": "course-v1:Org2+DemoX+682526", "actor_id": "9e2f08c5-77f0-4508-99c6-88549bf7c0b4", "course_grade": "0.6060606060606061", "emission_time": "2022-01-07 07:23:56"}, {"org": "Org2", "course_key": "course-v1:Org2+DemoX+682526", "actor_id": "bc9d00aa-2239-4a94-90de-b3ea4d390bc0", "course_grade": "0.803921568627451", "emission_time": "2021-12-28 10:13:01"}, {"org": "Org2", "course_key": "course-v1:Org2+DemoX+682526", "actor_id": "d9d644d5-2619-4c87-8ce3-f3efae37c2b8", "course_grade": "0.0975609756097561", "emission_time": "2022-01-05 19:22:53"}, {"org": "Org2", "course_key": "course-v1:Org2+DemoX+682526", "actor_id": "e6e3c0f5-1a3a-4bcc-a3dd-fe2801585240", "course_grade": "0.05357142857142857", "emission_time": "2021-12-20 23:24:24"}, {"org": "Org2", "course_key": "course-v1:Org2+DemoX+682526", "actor_id": "ed2421ea-45e4-4610-85b1-d58b2cdf628a", "course_grade": "1", "emission_time": "2022-01-05 00:38:53"}, {"org": "Org2", "course_key": "course-v1:Org2+DemoX+682526", "actor_id": "f5975641-7160-4d20-9989-c7f9a993d32c", "course_grade": "0", "emission_time": "2021-12-29 04:09:26"}, {"org": "Org2", "course_key": "course-v1:Org2+DemoX+e4380c", "actor_id": "060967b4-0899-411a-abba-2fa9528211d9", "course_grade": "0.3333333333333333", "emission_time": "2022-03-12 03:19:12"}, {"org": "Org2", "course_key": "course-v1:Org2+DemoX+e4380c", "actor_id": "1479a01b-d058-4b00-89cf-3e51531f3fb8", "course_grade": "0.2558139534883721", "emission_time": "2022-02-03 03:38:51"}, {"org": "Org2", "course_key": "course-v1:Org2+DemoX+e4380c", "actor_id": "14f0b50a-e45e-496f-9511-7437473dba2f", "course_grade": "0.9", "emission_time": "2022-02-16 20:50:57"}, {"org": "Org2", "course_key": "course-v1:Org2+DemoX+e4380c", "actor_id": "154fd129-9ceb-4303-9984-d7736031117b", "course_grade": "0.4235294117647059", "emission_time": "2021-12-19 01:38:39"}, {"org": "Org2", "course_key": "course-v1:Org2+DemoX+e4380c", "actor_id": "168168ea-84e1-4e8c-8e36-db11d23eb1b8", "course_grade": "0.9736842105263158", "emission_time": "2022-03-10 16:00:16"}, {"org": "Org2", "course_key": "course-v1:Org2+DemoX+e4380c", "actor_id": "1bf5ad2e-5eb7-4209-bb1c-ca2f4c8826e0", "course_grade": "0.7971014492753623", "emission_time": "2022-03-08 22:02:57"}, {"org": "Org2", "course_key": "course-v1:Org2+DemoX+e4380c", "actor_id": "3044ff34-06c7-4d33-bfe3-405b0f05b984", "course_grade": "0.2", "emission_time": "2022-02-23 15:32:09"}, {"org": "Org2", "course_key": "course-v1:Org2+DemoX+e4380c", "actor_id": "33909a28-f02d-414f-9794-58bfb18cb977", "course_grade": "0.16923076923076924", "emission_time": "2022-02-23 01:36:33"}, {"org": "Org2", "course_key": "course-v1:Org2+DemoX+e4380c", "actor_id": "39762ebc-1c5b-4ae9-8694-758f6a74b8f3", "course_grade": "0.203125", "emission_time": "2022-03-10 03:23:14"}, {"org": "Org2", "course_key": "course-v1:Org2+DemoX+e4380c", "actor_id": "47f03e71-bf89-470b-8cb5-8affbc109aff", "course_grade": "0.2222222222222222", "emission_time": "2022-02-25 09:11:16"}, {"org": "Org2", "course_key": "course-v1:Org2+DemoX+e4380c", "actor_id": "61570f19-557c-4dbd-9cd2-9f3c573beb4b", "course_grade": "0.34375", "emission_time": "2022-03-07 16:50:59"}, {"org": "Org2", "course_key": "course-v1:Org2+DemoX+e4380c", "actor_id": "8af5a761-d765-4331-8ed3-071c8b282dca", "course_grade": "0.41304347826086957", "emission_time": "2021-12-28 08:00:26"}, {"org": "Org2", "course_key": "course-v1:Org2+DemoX+e4380c", "actor_id": "8d500f3f-f97a-4c45-b786-c814ced84bff", "course_grade": "0.7037037037037037", "emission_time": "2021-12-29 07:59:57"}, {"org": "Org2", "course_key": "course-v1:Org2+DemoX+e4380c", "actor_id": "a5a50fa7-26c3-405d-95bb-d1b351ffa191", "course_grade": "0.9491525423728814", "emission_time": "2022-02-11 14:03:00"}, {"org": "Org2", "course_key": "course-v1:Org2+DemoX+e4380c", "actor_id": "c9d7fefc-f8bd-4162-8a2c-bdba6da6b624", "course_grade": "0.32558139534883723", "emission_time": "2022-02-13 19:10:54"}, {"org": "Org2", "course_key": "course-v1:Org2+DemoX+e4380c", "actor_id": "f360e005-29c1-4ad8-92a8-308d7047dc6e", "course_grade": "0.5", "emission_time": "2022-02-10 04:52:18"}, {"org": "Org2", "course_key": "course-v1:Org2+DemoX+e4380c", "actor_id": "f8b778fb-aff9-4b63-8fe3-d578f3891dd8", "course_grade": "1", "emission_time": "2021-12-13 07:00:13"}, {"org": "Org3", "course_key": "course-v1:Org3+DemoX+528fdd", "actor_id": "3f5c36e9-d6ac-422d-9c83-ca3f1d38aa71", "course_grade": "0", "emission_time": "2019-10-22 22:26:25"}, {"org": "Org3", "course_key": "course-v1:Org3+DemoX+528fdd", "actor_id": "43e0dba8-fc43-4567-824d-68bfabb1f312", "course_grade": "1", "emission_time": "2019-11-24 00:00:12"}, {"org": "Org3", "course_key": "course-v1:Org3+DemoX+528fdd", "actor_id": "465fe6bb-9894-4480-b8ef-e54d97d77fea", "course_grade": "0", "emission_time": "2019-11-20 13:49:47"}, {"org": "Org3", "course_key": "course-v1:Org3+DemoX+528fdd", "actor_id": "49a47dcd-f33e-4ad5-9416-a248494a85af", "course_grade": "0.8333333333333334", "emission_time": "2019-12-04 20:09:37"}, {"org": "Org3", "course_key": "course-v1:Org3+DemoX+528fdd", "actor_id": "9e2f08c5-77f0-4508-99c6-88549bf7c0b4", "course_grade": "0.8611111111111112", "emission_time": "2019-10-18 09:21:54"}, {"org": "Org3", "course_key": "course-v1:Org3+DemoX+528fdd", "actor_id": "9fa89875-36d7-465e-9bae-a05c0e252db4", "course_grade": "0.14285714285714285", "emission_time": "2019-11-28 00:41:08"}, {"org": "Org3", "course_key": "course-v1:Org3+DemoX+528fdd", "actor_id": "c217b4e2-3bf7-44db-9193-e1abbd905533", "course_grade": "0.2727272727272727", "emission_time": "2019-11-19 20:36:08"}, {"org": "Org3", "course_key": "course-v1:Org3+DemoX+528fdd", "actor_id": "c838016f-6640-44d9-a038-33a7cc4018a9", "course_grade": "0.9722222222222222", "emission_time": "2019-11-23 01:27:41"}, {"org": "Org3", "course_key": "course-v1:Org3+DemoX+528fdd", "actor_id": "c9d7fefc-f8bd-4162-8a2c-bdba6da6b624", "course_grade": "0.09782608695652174", "emission_time": "2019-12-09 12:59:07"}, {"org": "Org3", "course_key": "course-v1:Org3+DemoX+528fdd", "actor_id": "d48677ac-2373-457c-8318-30cd736ed206", "course_grade": "0.6379310344827587", "emission_time": "2019-11-22 01:07:06"}, {"org": "Org4", "course_key": "course-v1:Org4+DemoX+0b1656", "actor_id": "060967b4-0899-411a-abba-2fa9528211d9", "course_grade": "1", "emission_time": "2019-10-06 19:31:46"}, {"org": "Org4", "course_key": "course-v1:Org4+DemoX+0b1656", "actor_id": "100752b0-091b-40a3-9087-52f0d4aaeb8c", "course_grade": "1", "emission_time": "2019-10-02 21:06:02"}, {"org": "Org4", "course_key": "course-v1:Org4+DemoX+0b1656", "actor_id": "1bf5ad2e-5eb7-4209-bb1c-ca2f4c8826e0", "course_grade": "0.25862068965517243", "emission_time": "2019-09-22 20:50:58"}, {"org": "Org4", "course_key": "course-v1:Org4+DemoX+0b1656", "actor_id": "3760462a-fbb0-45dc-b5e5-76e6c60c72e1", "course_grade": "0.9636363636363636", "emission_time": "2019-09-05 22:04:51"}, {"org": "Org4", "course_key": "course-v1:Org4+DemoX+0b1656", "actor_id": "3ae0a6e3-21af-4185-b3f1-c7125d1c2ac3", "course_grade": "0.1724137931034483", "emission_time": "2019-10-01 14:24:07"}, {"org": "Org4", "course_key": "course-v1:Org4+DemoX+0b1656", "actor_id": "43e0dba8-fc43-4567-824d-68bfabb1f312", "course_grade": "0.21212121212121213", "emission_time": "2019-07-08 23:55:34"}, {"org": "Org4", "course_key": "course-v1:Org4+DemoX+0b1656", "actor_id": "47f03e71-bf89-470b-8cb5-8affbc109aff", "course_grade": "0.631578947368421", "emission_time": "2019-09-09 11:41:04"}, {"org": "Org4", "course_key": "course-v1:Org4+DemoX+0b1656", "actor_id": "4e4f1903-4d45-4b85-94d5-af29757b8396", "course_grade": "0.14285714285714285", "emission_time": "2019-07-28 08:23:52"}, {"org": "Org4", "course_key": "course-v1:Org4+DemoX+0b1656", "actor_id": "78dc54d4-e68f-4853-b5e3-7a65357fe6ac", "course_grade": "0.21739130434782608", "emission_time": "2019-10-03 02:59:34"}, {"org": "Org4", "course_key": "course-v1:Org4+DemoX+0b1656", "actor_id": "829a9444-ced3-4273-9e4b-e8a8bb790c48", "course_grade": "0.10204081632653061", "emission_time": "2019-09-30 13:11:31"}, {"org": "Org4", "course_key": "course-v1:Org4+DemoX+0b1656", "actor_id": "8cdaa227-33f8-4d0c-8996-b75373f7394b", "course_grade": "0.9523809523809523", "emission_time": "2019-08-16 19:06:11"}, {"org": "Org4", "course_key": "course-v1:Org4+DemoX+0b1656", "actor_id": "a1de350b-e587-4b57-8fc3-48feb69fd890", "course_grade": "0.8717948717948718", "emission_time": "2019-08-14 21:57:51"}, {"org": "Org4", "course_key": "course-v1:Org4+DemoX+0b1656", "actor_id": "abb4911f-0c4a-4904-8004-aacfeb710346", "course_grade": "0.21568627450980393", "emission_time": "2019-08-20 04:43:18"}, {"org": "Org4", "course_key": "course-v1:Org4+DemoX+0b1656", "actor_id": "ac01d5b9-84a7-4df4-bfba-e91dcfad1c14", "course_grade": "0.8526315789473684", "emission_time": "2019-10-06 08:54:14"}, {"org": "Org4", "course_key": "course-v1:Org4+DemoX+0b1656", "actor_id": "d48677ac-2373-457c-8318-30cd736ed206", "course_grade": "0", "emission_time": "2019-10-07 19:16:02"}, {"org": "Org4", "course_key": "course-v1:Org4+DemoX+0b1656", "actor_id": "f360e005-29c1-4ad8-92a8-308d7047dc6e", "course_grade": "0.3723404255319149", "emission_time": "2019-09-11 10:42:56"}, {"org": "Org4", "course_key": "course-v1:Org4+DemoX+0b1656", "actor_id": "f5975641-7160-4d20-9989-c7f9a993d32c", "course_grade": "0.7777777777777778", "emission_time": "2019-09-12 07:39:30"}, {"org": "Org4", "course_key": "course-v1:Org4+DemoX+0b1656", "actor_id": "fc35c856-a8c5-4110-b4b4-15b2025094d8", "course_grade": "0.5535714285714286", "emission_time": "2019-08-19 20:27:06"}, {"org": "Org4", "course_key": "course-v1:Org4+DemoX+db4c73", "actor_id": "0f764bed-e5da-4d50-89d3-66aac42b50e5", "course_grade": "0.17857142857142858", "emission_time": "2021-09-18 00:19:01"}, {"org": "Org4", "course_key": "course-v1:Org4+DemoX+db4c73", "actor_id": "10063b09-875d-4c3b-8b9c-283aef97a348", "course_grade": "0.9047619047619048", "emission_time": "2021-08-09 09:04:46"}, {"org": "Org4", "course_key": "course-v1:Org4+DemoX+db4c73", "actor_id": "107459eb-506c-4347-93d5-22637996edf1", "course_grade": "0.29411764705882354", "emission_time": "2021-08-16 00:10:13"}, {"org": "Org4", "course_key": "course-v1:Org4+DemoX+db4c73", "actor_id": "272f9b05-b2c8-4755-aa4b-087875c8104b", "course_grade": "0.2727272727272727", "emission_time": "2021-09-03 08:51:59"}, {"org": "Org4", "course_key": "course-v1:Org4+DemoX+db4c73", "actor_id": "3058e600-5bee-4018-920e-52a311963d88", "course_grade": "0.7857142857142857", "emission_time": "2021-08-03 14:26:15"}, {"org": "Org4", "course_key": "course-v1:Org4+DemoX+db4c73", "actor_id": "3c83b6e9-d3d3-4c18-b6d6-956c1d8334a2", "course_grade": "0.21739130434782608", "emission_time": "2021-06-15 19:29:47"}, {"org": "Org4", "course_key": "course-v1:Org4+DemoX+db4c73", "actor_id": "4e0fc096-65d9-4b41-bcbd-564b054e532e", "course_grade": "0.6862745098039216", "emission_time": "2021-09-14 07:34:12"}, {"org": "Org4", "course_key": "course-v1:Org4+DemoX+db4c73", "actor_id": "4e4f1903-4d45-4b85-94d5-af29757b8396", "course_grade": "0.40425531914893614", "emission_time": "2021-09-02 13:46:02"}, {"org": "Org4", "course_key": "course-v1:Org4+DemoX+db4c73", "actor_id": "58d4edfa-97c1-42ba-9ea4-3428c4e3cad9", "course_grade": "0.7457627118644068", "emission_time": "2021-09-16 14:42:06"}, {"org": "Org4", "course_key": "course-v1:Org4+DemoX+db4c73", "actor_id": "70b53781-f71d-4051-9760-3874b4473a57", "course_grade": "0.8867924528301887", "emission_time": "2021-09-08 05:14:22"}, {"org": "Org4", "course_key": "course-v1:Org4+DemoX+db4c73", "actor_id": "9344e7e6-2388-4b1b-b6b8-5040aad08ff7", "course_grade": "0.6", "emission_time": "2021-08-23 13:23:55"}, {"org": "Org4", "course_key": "course-v1:Org4+DemoX+db4c73", "actor_id": "9d97277c-9df9-475e-a231-1af77bf3311f", "course_grade": "0.38095238095238093", "emission_time": "2021-07-20 07:37:47"}, {"org": "Org4", "course_key": "course-v1:Org4+DemoX+db4c73", "actor_id": "a499a2bb-c627-4916-92d1-f6ae6ac57a71", "course_grade": "0.625", "emission_time": "2021-09-12 19:25:10"}, {"org": "Org4", "course_key": "course-v1:Org4+DemoX+db4c73", "actor_id": "ac01d5b9-84a7-4df4-bfba-e91dcfad1c14", "course_grade": "0.0273972602739726", "emission_time": "2021-09-18 11:05:55"}, {"org": "Org7", "course_key": "course-v1:Org7+DemoX+57295b", "actor_id": "0f764bed-e5da-4d50-89d3-66aac42b50e5", "course_grade": "0.09090909090909091", "emission_time": "2023-12-15 11:12:04"}, {"org": "Org7", "course_key": "course-v1:Org7+DemoX+57295b", "actor_id": "1efff542-8cfc-4bc9-863d-1bdd3c521515", "course_grade": "0.5675675675675675", "emission_time": "2023-12-20 05:07:30"}, {"org": "Org7", "course_key": "course-v1:Org7+DemoX+57295b", "actor_id": "3ae0a6e3-21af-4185-b3f1-c7125d1c2ac3", "course_grade": "0.6111111111111112", "emission_time": "2023-12-10 07:41:10"}, {"org": "Org7", "course_key": "course-v1:Org7+DemoX+57295b", "actor_id": "3c83b6e9-d3d3-4c18-b6d6-956c1d8334a2", "course_grade": "0.9104477611940298", "emission_time": "2023-12-22 16:39:38"}, {"org": "Org7", "course_key": "course-v1:Org7+DemoX+57295b", "actor_id": "43e0dba8-fc43-4567-824d-68bfabb1f312", "course_grade": "0.711340206185567", "emission_time": "2023-09-17 02:02:42"}, {"org": "Org7", "course_key": "course-v1:Org7+DemoX+57295b", "actor_id": "49a47dcd-f33e-4ad5-9416-a248494a85af", "course_grade": "0.3488372093023256", "emission_time": "2023-10-02 16:15:16"}, {"org": "Org7", "course_key": "course-v1:Org7+DemoX+57295b", "actor_id": "78dc54d4-e68f-4853-b5e3-7a65357fe6ac", "course_grade": "0.09302325581395349", "emission_time": "2023-11-29 14:24:49"}, {"org": "Org7", "course_key": "course-v1:Org7+DemoX+57295b", "actor_id": "829a9444-ced3-4273-9e4b-e8a8bb790c48", "course_grade": "0.8494623655913979", "emission_time": "2023-12-15 04:25:38"}, {"org": "Org7", "course_key": "course-v1:Org7+DemoX+57295b", "actor_id": "95af96c4-e45b-401e-b700-e1f147d36297", "course_grade": "0.15853658536585366", "emission_time": "2023-12-21 16:27:34"}, {"org": "Org7", "course_key": "course-v1:Org7+DemoX+57295b", "actor_id": "a28e2d80-0b93-4730-973f-15f8b18696de", "course_grade": "0.4444444444444444", "emission_time": "2023-12-27 05:57:32"}, {"org": "Org7", "course_key": "course-v1:Org7+DemoX+57295b", "actor_id": "bc9d00aa-2239-4a94-90de-b3ea4d390bc0", "course_grade": "0.8214285714285714", "emission_time": "2023-11-13 15:42:57"}, {"org": "Org7", "course_key": "course-v1:Org7+DemoX+57295b", "actor_id": "d1396620-e0d3-499c-ada0-f3ba27f9463b", "course_grade": "1", "emission_time": "2023-11-10 07:11:07"}, {"org": "Org7", "course_key": "course-v1:Org7+DemoX+57295b", "actor_id": "fc35c856-a8c5-4110-b4b4-15b2025094d8", "course_grade": "0.8571428571428571", "emission_time": "2023-12-05 11:01:22"}, {"org": "Org7", "course_key": "course-v1:Org7+DemoX+57295b", "actor_id": "ff10a27a-fe60-41b6-aa8e-823770c210a3", "course_grade": "0.3645833333333333", "emission_time": "2023-12-03 15:54:23"}, {"org": "Org8", "course_key": "course-v1:Org8+DemoX+3fefec", "actor_id": "0f764bed-e5da-4d50-89d3-66aac42b50e5", "course_grade": "0.1", "emission_time": "2021-04-10 23:21:35"}, {"org": "Org8", "course_key": "course-v1:Org8+DemoX+3fefec", "actor_id": "33909a28-f02d-414f-9794-58bfb18cb977", "course_grade": "0.75", "emission_time": "2021-04-12 09:21:01"}, {"org": "Org8", "course_key": "course-v1:Org8+DemoX+3fefec", "actor_id": "3c83b6e9-d3d3-4c18-b6d6-956c1d8334a2", "course_grade": "1", "emission_time": "2021-03-23 22:47:43"}, {"org": "Org8", "course_key": "course-v1:Org8+DemoX+3fefec", "actor_id": "44b445b8-97e5-4208-abcd-5e1b08ee9569", "course_grade": "0.18181818181818182", "emission_time": "2021-04-21 01:45:15"}, {"org": "Org8", "course_key": "course-v1:Org8+DemoX+3fefec", "actor_id": "465fe6bb-9894-4480-b8ef-e54d97d77fea", "course_grade": "0.9382716049382716", "emission_time": "2021-04-19 09:57:38"}, {"org": "Org8", "course_key": "course-v1:Org8+DemoX+3fefec", "actor_id": "6c0eb8ab-6be1-47d2-bd0d-cf507fd763dc", "course_grade": "0.6578947368421053", "emission_time": "2021-04-06 22:23:38"}, {"org": "Org8", "course_key": "course-v1:Org8+DemoX+3fefec", "actor_id": "9344e7e6-2388-4b1b-b6b8-5040aad08ff7", "course_grade": "0.8333333333333334", "emission_time": "2021-03-05 00:11:51"}, {"org": "Org8", "course_key": "course-v1:Org8+DemoX+3fefec", "actor_id": "abb4911f-0c4a-4904-8004-aacfeb710346", "course_grade": "0.7096774193548387", "emission_time": "2021-03-11 05:21:54"}, {"org": "Org8", "course_key": "course-v1:Org8+DemoX+3fefec", "actor_id": "bc9d00aa-2239-4a94-90de-b3ea4d390bc0", "course_grade": "0.18333333333333332", "emission_time": "2021-04-17 21:51:01"}, {"org": "Org8", "course_key": "course-v1:Org8+DemoX+3fefec", "actor_id": "c9d7fefc-f8bd-4162-8a2c-bdba6da6b624", "course_grade": "0", "emission_time": "2021-04-20 03:12:51"}, {"org": "Org8", "course_key": "course-v1:Org8+DemoX+3fefec", "actor_id": "fbfb0998-6d7e-4047-9235-266965fda410", "course_grade": "0.8095238095238095", "emission_time": "2021-02-20 06:41:40"}], "format": "csv", "fixture": "fact_learner_course_grade_expected"}, "name": "test_fact_learner_course_grade", "resource_type": "unit_test", "package_name": "aspects", "path": "grading/unit_tests.yaml", "original_file_path": "models/grading/unit_tests.yaml", "unique_id": "unit_test.aspects.fact_learner_course_grade.test_fact_learner_course_grade", "fqn": ["aspects", "grading", "fact_learner_course_grade", "test_fact_learner_course_grade"], "description": "", "overrides": null, "depends_on": {"macros": [], "nodes": ["model.aspects.fact_learner_course_grade"]}, "config": {"tags": ["ci"], "meta": {}}, "checksum": "ea54220153538b9c11778368139019c147f9ebdc52b57da85a807dffc7073f9d", "schema": "xapi", "created_at": 1723229145.1230211, "versions": null, "version": null}, "unit_test.aspects.fact_learner_course_status.test_fact_learner_course_status": {"model": "fact_learner_course_status", "given": [{"input": "ref('grading_events')", "rows": "select * from grading_events", "format": "sql", "fixture": null}], "expect": {"rows": [{"org": "Org1", "course_key": "course-v1:Org1+DemoX+1937e7", "actor_id": "3f5c36e9-d6ac-422d-9c83-ca3f1d38aa71", "emission_time": "2021-07-27 06:30:19", "approving_state": "passed"}, {"org": "Org3", "course_key": "course-v1:Org3+DemoX+528fdd", "actor_id": "465fe6bb-9894-4480-b8ef-e54d97d77fea", "emission_time": "2019-11-20 13:49:47", "approving_state": "passed"}, {"org": "Org8", "course_key": "course-v1:Org8+DemoX+3fefec", "actor_id": "c9d7fefc-f8bd-4162-8a2c-bdba6da6b624", "emission_time": "2021-04-20 03:12:51", "approving_state": "passed"}], "format": "csv", "fixture": "fact_learner_course_status_expected"}, "name": "test_fact_learner_course_status", "resource_type": "unit_test", "package_name": "aspects", "path": "grading/unit_tests.yaml", "original_file_path": "models/grading/unit_tests.yaml", "unique_id": "unit_test.aspects.fact_learner_course_status.test_fact_learner_course_status", "fqn": ["aspects", "grading", "fact_learner_course_status", "test_fact_learner_course_status"], "description": "", "overrides": null, "depends_on": {"macros": [], "nodes": ["model.aspects.fact_learner_course_status"]}, "config": {"tags": ["ci"], "meta": {}}, "checksum": "362e4a4eebc4c3164564992707f103c5eb190adba16e06d2797667a07c56df7f", "schema": "xapi", "created_at": 1723229145.124392, "versions": null, "version": null}, "unit_test.aspects.fact_student_status.test_fact_student_status": {"model": "fact_student_status", "given": [{"input": "ref('fact_enrollment_status')", "rows": "select * from fact_enrollment_status", "format": "sql", "fixture": null}, {"input": "ref('fact_learner_course_status')", "rows": "select * from fact_learner_course_status", "format": "sql", "fixture": null}, {"input": "ref('fact_learner_course_grade')", "rows": "select * from fact_learner_course_grade", "format": "sql", "fixture": null}, {"input": "ref('course_names')", "rows": "select * from course_names", "format": "sql", "fixture": null}, {"input": "ref('dim_user_pii')", "rows": "select * from dim_user_pii", "format": "sql", "fixture": null}], "expect": {"rows": "select * from fact_student_status_expected", "format": "sql", "fixture": null}, "name": "test_fact_student_status", "resource_type": "unit_test", "package_name": "aspects", "path": "grading/unit_tests.yaml", "original_file_path": "models/grading/unit_tests.yaml", "unique_id": "unit_test.aspects.fact_student_status.test_fact_student_status", "fqn": ["aspects", "grading", "fact_student_status", "test_fact_student_status"], "description": "", "overrides": null, "depends_on": {"macros": [], "nodes": ["model.aspects.fact_student_status"]}, "config": {"tags": ["ci"], "meta": {}}, "checksum": "a3667d982d1bef6cc84064449881785273c7d4564621a737a5eeed4f8be7e527", "schema": "xapi", "created_at": 1723229145.1271937, "versions": null, "version": null}, "unit_test.aspects.problem_events.test_problem_events": {"model": "problem_events", "given": [{"input": "ref('xapi_events_all_parsed')", "rows": "select * from xapi_events_all_parsed", "format": "sql", "fixture": null}], "expect": {"rows": "select * from problem_events_expected", "format": "sql", "fixture": null}, "name": "test_problem_events", "resource_type": "unit_test", "package_name": "aspects", "path": "problems/unit_tests.yaml", "original_file_path": "models/problems/unit_tests.yaml", "unique_id": "unit_test.aspects.problem_events.test_problem_events", "fqn": ["aspects", "problems", "problem_events", "test_problem_events"], "description": "", "overrides": null, "depends_on": {"macros": [], "nodes": ["model.aspects.problem_events"]}, "config": {"tags": ["ci"], "meta": {}}, "checksum": "352c286e0047ec054a2c0c1b485462a4aa739337df3ddb3860afe528def98d75", "schema": "xapi", "created_at": 1723229145.128271, "versions": null, "version": null}, "unit_test.aspects.fact_problem_responses.test_fact_problem_responses": {"model": "fact_problem_responses", "given": [{"input": "ref('problem_events')", "rows": "select * from problem_events", "format": "sql", "fixture": null}, {"input": "ref('dim_course_blocks')", "rows": "select * from dim_course_blocks", "format": "sql", "fixture": null}, {"input": "ref('dim_user_pii')", "rows": "select * from dim_user_pii", "format": "sql", "fixture": null}], "expect": {"rows": "select * from fact_problem_responses_expected", "format": "sql", "fixture": null}, "name": "test_fact_problem_responses", "resource_type": "unit_test", "package_name": "aspects", "path": "problems/unit_tests.yaml", "original_file_path": "models/problems/unit_tests.yaml", "unique_id": "unit_test.aspects.fact_problem_responses.test_fact_problem_responses", "fqn": ["aspects", "problems", "fact_problem_responses", "test_fact_problem_responses"], "description": "", "overrides": null, "depends_on": {"macros": [], "nodes": ["model.aspects.fact_problem_responses"]}, "config": {"tags": ["ci"], "meta": {}}, "checksum": "e957e394172f6eaa9ab43f4f302abfd41a9cba125d0133f94eceb14f14ed9982", "schema": "xapi", "created_at": 1723229145.130464, "versions": null, "version": null}, "unit_test.aspects.int_problem_hints.test_int_problem_hints": {"model": "int_problem_hints", "given": [{"input": "ref('problem_events')", "rows": "select * from problem_events", "format": "sql", "fixture": null}, {"input": "ref('dim_course_blocks')", "rows": "select * from dim_course_blocks", "format": "sql", "fixture": null}], "expect": {"rows": "select * from int_problem_hints_expected", "format": "sql", "fixture": null}, "name": "test_int_problem_hints", "resource_type": "unit_test", "package_name": "aspects", "path": "problems/unit_tests.yaml", "original_file_path": "models/problems/unit_tests.yaml", "unique_id": "unit_test.aspects.int_problem_hints.test_int_problem_hints", "fqn": ["aspects", "problems", "int_problem_hints", "test_int_problem_hints"], "description": "", "overrides": null, "depends_on": {"macros": [], "nodes": ["model.aspects.int_problem_hints"]}, "config": {"tags": ["ci"], "meta": {}}, "checksum": "41308fff3889e1752293620f111585da9b583b14795b83372f97711487b7a8ad", "schema": "xapi", "created_at": 1723229145.1316092, "versions": null, "version": null}, "unit_test.aspects.responses.test_responses": {"model": "responses", "given": [{"input": "ref('problem_events')", "rows": "select * from problem_events", "format": "sql", "fixture": null}], "expect": {"rows": "select * from responses_expected", "format": "sql", "fixture": null}, "name": "test_responses", "resource_type": "unit_test", "package_name": "aspects", "path": "problems/unit_tests.yaml", "original_file_path": "models/problems/unit_tests.yaml", "unique_id": "unit_test.aspects.responses.test_responses", "fqn": ["aspects", "problems", "responses", "test_responses"], "description": "", "overrides": null, "depends_on": {"macros": [], "nodes": ["model.aspects.responses"]}, "config": {"tags": ["ci"], "meta": {}}, "checksum": "66aef0a07a9e15aa96ec14eb1b0071616382606ed81fd00d41f1ba6dae6db5b8", "schema": "xapi", "created_at": 1723229145.1325734, "versions": null, "version": null}, "unit_test.aspects.int_problem_results.test_int_problem_results": {"model": "int_problem_results", "given": [{"input": "ref('problem_events')", "rows": "select * from problem_events", "format": "sql", "fixture": null}, {"input": "ref('responses')", "rows": "select * from responses", "format": "sql", "fixture": null}, {"input": "ref('dim_course_blocks')", "rows": "select * from dim_course_blocks", "format": "sql", "fixture": null}], "expect": {"rows": "select * from int_problem_results_expected", "format": "sql", "fixture": null}, "name": "test_int_problem_results", "resource_type": "unit_test", "package_name": "aspects", "path": "problems/unit_tests.yaml", "original_file_path": "models/problems/unit_tests.yaml", "unique_id": "unit_test.aspects.int_problem_results.test_int_problem_results", "fqn": ["aspects", "problems", "int_problem_results", "test_int_problem_results"], "description": "", "overrides": null, "depends_on": {"macros": [], "nodes": ["model.aspects.int_problem_results"]}, "config": {"tags": ["ci"], "meta": {}}, "checksum": "18bcd158430358f0068ffb2a3037c0d3fac2213d0d3ec9c77a00d9362fb52736", "schema": "xapi", "created_at": 1723229145.134254, "versions": null, "version": null}, "unit_test.aspects.subsection_problem_engagement.test_subsection_problem_engagement": {"model": "subsection_problem_engagement", "given": [{"input": "ref('problem_events')", "rows": "select * from problem_events", "format": "sql", "fixture": null}, {"input": "ref('int_problems_per_subsection')", "rows": "select * from int_problems_per_subsection", "format": "sql", "fixture": null}, {"input": "ref('dim_course_blocks')", "rows": "select * from dim_course_blocks", "format": "sql", "fixture": null}], "expect": {"rows": "select * from subsection_problem_engagement_expected", "format": "sql", "fixture": null}, "name": "test_subsection_problem_engagement", "resource_type": "unit_test", "package_name": "aspects", "path": "problems/unit_tests.yaml", "original_file_path": "models/problems/unit_tests.yaml", "unique_id": "unit_test.aspects.subsection_problem_engagement.test_subsection_problem_engagement", "fqn": ["aspects", "problems", "subsection_problem_engagement", "test_subsection_problem_engagement"], "description": "", "overrides": null, "depends_on": {"macros": [], "nodes": ["model.aspects.subsection_problem_engagement"]}, "config": {"tags": ["ci"], "meta": {}}, "checksum": "4bb2fce399c9042b27a07c3ca8edf6cfe2417e7f6bb1ddc1f6e5a68984703c5c", "schema": "xapi", "created_at": 1723229145.135838, "versions": null, "version": null}, "unit_test.aspects.xapi_events_all_parsed.test_xapi_events_all_parsed": {"model": "xapi_events_all_parsed", "given": [{"input": "source(\"xapi\", \"xapi_events_all\")", "rows": "select * from xapi.xapi_events_all", "format": "sql", "fixture": null}], "expect": {"rows": "select * from xapi_events_all_parsed_expected", "format": "sql", "fixture": null}, "name": "test_xapi_events_all_parsed", "resource_type": "unit_test", "package_name": "aspects", "path": "base/unit_tests.yaml", "original_file_path": "models/base/unit_tests.yaml", "unique_id": "unit_test.aspects.xapi_events_all_parsed.test_xapi_events_all_parsed", "fqn": ["aspects", "base", "xapi_events_all_parsed", "test_xapi_events_all_parsed"], "description": "", "overrides": null, "depends_on": {"macros": [], "nodes": ["model.aspects.xapi_events_all_parsed"]}, "config": {"tags": ["ci"], "meta": {}}, "checksum": "e55872e02e74e32a8161ece04cf51ac51f14cdc261fd50ffc7ecdd51aba24f6e", "schema": "xapi", "created_at": 1723229145.1374247, "versions": null, "version": null}, "unit_test.aspects.navigation_events.test_navigation_events": {"model": "navigation_events", "given": [{"input": "ref('xapi_events_all_parsed')", "rows": "select * from xapi_events_all_parsed", "format": "sql", "fixture": null}], "expect": {"rows": "select * from navigation_events_expected", "format": "sql", "fixture": null}, "name": "test_navigation_events", "resource_type": "unit_test", "package_name": "aspects", "path": "navigation/unit_tests.yaml", "original_file_path": "models/navigation/unit_tests.yaml", "unique_id": "unit_test.aspects.navigation_events.test_navigation_events", "fqn": ["aspects", "navigation", "navigation_events", "test_navigation_events"], "description": "", "overrides": null, "depends_on": {"macros": [], "nodes": ["model.aspects.navigation_events"]}, "config": {"tags": ["ci"], "meta": {}}, "checksum": "7cec5caa66ef5a15c87c60f5b65f10bdacd71eb7839e96d6af8280de91fa49b6", "schema": "xapi", "created_at": 1723229145.138517, "versions": null, "version": null}, "unit_test.aspects.fact_navigation.test_fact_navigation": {"model": "fact_navigation", "given": [{"input": "ref('navigation_events')", "rows": "select * from navigation_events", "format": "sql", "fixture": null}, {"input": "ref('dim_course_blocks')", "rows": "select * from dim_course_blocks", "format": "sql", "fixture": null}, {"input": "ref('dim_user_pii')", "rows": "select * from dim_user_pii", "format": "sql", "fixture": null}], "expect": {"rows": "select * from fact_navigation_expected", "format": "sql", "fixture": null}, "name": "test_fact_navigation", "resource_type": "unit_test", "package_name": "aspects", "path": "navigation/unit_tests.yaml", "original_file_path": "models/navigation/unit_tests.yaml", "unique_id": "unit_test.aspects.fact_navigation.test_fact_navigation", "fqn": ["aspects", "navigation", "fact_navigation", "test_fact_navigation"], "description": "", "overrides": null, "depends_on": {"macros": [], "nodes": ["model.aspects.fact_navigation"]}, "config": {"tags": ["ci"], "meta": {}}, "checksum": "4480e7af0cff1f530650ef13062f065249858147eff1f31bbc2ab19634dc3614", "schema": "xapi", "created_at": 1723229145.140089, "versions": null, "version": null}, "unit_test.aspects.fact_navigation_completion.test_fact_navigation_completion": {"model": "fact_navigation_completion", "given": [{"input": "ref('fact_navigation')", "rows": "select * from fact_navigation", "format": "sql", "fixture": null}, {"input": "ref('int_pages_per_subsection')", "rows": "select * from int_pages_per_subsection", "format": "sql", "fixture": null}], "expect": {"rows": "select * from fact_navigation_completion_expected", "format": "sql", "fixture": null}, "name": "test_fact_navigation_completion", "resource_type": "unit_test", "package_name": "aspects", "path": "navigation/unit_tests.yaml", "original_file_path": "models/navigation/unit_tests.yaml", "unique_id": "unit_test.aspects.fact_navigation_completion.test_fact_navigation_completion", "fqn": ["aspects", "navigation", "fact_navigation_completion", "test_fact_navigation_completion"], "description": "", "overrides": null, "depends_on": {"macros": [], "nodes": ["model.aspects.fact_navigation_completion"]}, "config": {"tags": ["ci"], "meta": {}}, "checksum": "bd36fe9a7986de81ad13b417ef0d6148ecf61d2c332ecb43a9657181b74aa563", "schema": "xapi", "created_at": 1723229145.1423516, "versions": null, "version": null}, "unit_test.aspects.section_page_engagement.test_section_page_engagement": {"model": "section_page_engagement", "given": [{"input": "ref('navigation_events')", "rows": "select * from navigation_events", "format": "sql", "fixture": null}, {"input": "ref('dim_course_blocks')", "rows": "select * from dim_course_blocks", "format": "sql", "fixture": null}, {"input": "ref('int_pages_per_subsection')", "rows": "select * from int_pages_per_subsection", "format": "sql", "fixture": null}], "expect": {"rows": "select * from section_page_engagement_expected", "format": "sql", "fixture": null}, "name": "test_section_page_engagement", "resource_type": "unit_test", "package_name": "aspects", "path": "navigation/unit_tests.yaml", "original_file_path": "models/navigation/unit_tests.yaml", "unique_id": "unit_test.aspects.section_page_engagement.test_section_page_engagement", "fqn": ["aspects", "navigation", "section_page_engagement", "test_section_page_engagement"], "description": "", "overrides": null, "depends_on": {"macros": [], "nodes": ["model.aspects.section_page_engagement"]}, "config": {"tags": ["ci"], "meta": {}}, "checksum": "5b26c7db58692ccf3ead8571cb55812c451a362a2dbbe56eacf4689d38c41081", "schema": "xapi", "created_at": 1723229145.1434224, "versions": null, "version": null}, "unit_test.aspects.subsection_page_engagement.test_subsection_page_engagement": {"model": "subsection_page_engagement", "given": [{"input": "ref('navigation_events')", "rows": "select * from navigation_events", "format": "sql", "fixture": null}, {"input": "ref('dim_course_blocks')", "rows": "select * from dim_course_blocks", "format": "sql", "fixture": null}, {"input": "ref('int_pages_per_subsection')", "rows": "select * from int_pages_per_subsection", "format": "sql", "fixture": null}], "expect": {"rows": "select * from subsection_page_engagement_expected", "format": "sql", "fixture": null}, "name": "test_subsection_page_engagement", "resource_type": "unit_test", "package_name": "aspects", "path": "navigation/unit_tests.yaml", "original_file_path": "models/navigation/unit_tests.yaml", "unique_id": "unit_test.aspects.subsection_page_engagement.test_subsection_page_engagement", "fqn": ["aspects", "navigation", "subsection_page_engagement", "test_subsection_page_engagement"], "description": "", "overrides": null, "depends_on": {"macros": [], "nodes": ["model.aspects.subsection_page_engagement"]}, "config": {"tags": ["ci"], "meta": {}}, "checksum": "52ae3a98f428ab05b748e9d79cf9d5b0ece49edeb533954d21c16b5e0bd6ded9", "schema": "xapi", "created_at": 1723229145.1444707, "versions": null, "version": null}, "unit_test.aspects.fact_pageview_engagement.test_fact_pageview_engagement": {"model": "fact_pageview_engagement", "given": [{"input": "ref('subsection_page_engagement')", "rows": "select * from subsection_page_engagement", "format": "sql", "fixture": null}, {"input": "ref('section_page_engagement')", "rows": "select * from section_page_engagement", "format": "sql", "fixture": null}, {"input": "ref('dim_course_blocks')", "rows": "select * from dim_course_blocks", "format": "sql", "fixture": null}, {"input": "ref('dim_user_pii')", "rows": "select * from dim_user_pii", "format": "sql", "fixture": null}], "expect": {"rows": "select * from fact_pageview_engagement_expected", "format": "sql", "fixture": null}, "name": "test_fact_pageview_engagement", "resource_type": "unit_test", "package_name": "aspects", "path": "navigation/unit_tests.yaml", "original_file_path": "models/navigation/unit_tests.yaml", "unique_id": "unit_test.aspects.fact_pageview_engagement.test_fact_pageview_engagement", "fqn": ["aspects", "navigation", "fact_pageview_engagement", "test_fact_pageview_engagement"], "description": "", "overrides": null, "depends_on": {"macros": [], "nodes": ["model.aspects.fact_pageview_engagement"]}, "config": {"tags": ["ci"], "meta": {}}, "checksum": "9d81886ab08d129ec0aeb600d3f2de8f66637e18deb9b5c2a6f322c7dcbe964a", "schema": "xapi", "created_at": 1723229145.1466718, "versions": null, "version": null}, "unit_test.aspects.int_pages_per_subsection.test_macro_items_per_subsection": {"model": "int_pages_per_subsection", "given": [{"input": "ref('dim_course_blocks')", "rows": "select * from dim_course_blocks", "format": "sql", "fixture": null}], "expect": {"rows": "select * from items_per_subsection_expected", "format": "sql", "fixture": null}, "name": "test_macro_items_per_subsection", "resource_type": "unit_test", "package_name": "aspects", "path": "navigation/unit_tests.yaml", "original_file_path": "models/navigation/unit_tests.yaml", "unique_id": "unit_test.aspects.int_pages_per_subsection.test_macro_items_per_subsection", "fqn": ["aspects", "navigation", "int_pages_per_subsection", "test_macro_items_per_subsection"], "description": "", "overrides": null, "depends_on": {"macros": [], "nodes": ["model.aspects.int_pages_per_subsection"]}, "config": {"tags": ["ci"], "meta": {}}, "checksum": "b927cade7608af7b5c3fc9532a629c530c9a16f181b7da1fc68a55621520f439", "schema": "xapi", "created_at": 1723229145.1476154, "versions": null, "version": null}, "unit_test.aspects.most_recent_course_blocks.test_most_recent_course_blocks": {"model": "most_recent_course_blocks", "given": [{"input": "source(\"event_sink\", \"course_blocks\")", "rows": "select * from event_sink.course_blocks", "format": "sql", "fixture": null}], "expect": {"rows": "select * from most_recent_course_blocks_expected", "format": "sql", "fixture": null}, "name": "test_most_recent_course_blocks", "resource_type": "unit_test", "package_name": "aspects", "path": "courses/unit_tests.yaml", "original_file_path": "models/courses/unit_tests.yaml", "unique_id": "unit_test.aspects.most_recent_course_blocks.test_most_recent_course_blocks", "fqn": ["aspects", "courses", "most_recent_course_blocks", "test_most_recent_course_blocks"], "description": "", "overrides": null, "depends_on": {"macros": [], "nodes": ["model.aspects.most_recent_course_blocks"]}, "config": {"tags": ["ci"], "meta": {}}, "checksum": "1d63c905aa77f271bec958f3c616c858a1e7e8402f5993d656ddcb6946619d17", "schema": "xapi", "created_at": 1723229145.1492019, "versions": null, "version": null}, "unit_test.aspects.course_names.test_course_names": {"model": "course_names", "given": [{"input": "source(\"event_sink\", \"course_overviews\")", "rows": "select * from event_sink.course_overviews", "format": "sql", "fixture": null}], "expect": {"rows": [{"course_key": "course-v1:Org0+DemoX+2bc51b", "course_name": "2bc51b (small)", "course_run": "2bc51b", "org": "Org0"}, {"course_key": "course-v1:Org0+DemoX+81bba1", "course_name": "81bba1 (small)", "course_run": "81bba1", "org": "Org0"}, {"course_key": "course-v1:Org3+DemoX+528fdd", "course_name": "528fdd (small)", "course_run": "528fdd", "org": "Org3"}, {"course_key": "course-v1:Org2+DemoX+682526", "course_name": "682526 (medium)", "course_run": "682526", "org": "Org2"}, {"course_key": "course-v1:Org7+DemoX+57295b", "course_name": "57295b (medium)", "course_run": "57295b", "org": "Org7"}, {"course_key": "course-v1:Org8+DemoX+3fefec", "course_name": "3fefec (medium)", "course_run": "3fefec", "org": "Org8"}, {"course_key": "course-v1:Org4+DemoX+db4c73", "course_name": "db4c73 (large)", "course_run": "db4c73", "org": "Org4"}, {"course_key": "course-v1:Org1+DemoX+1937e7", "course_name": "1937e7 (large)", "course_run": "1937e7", "org": "Org1"}, {"course_key": "course-v1:Org4+DemoX+0b1656", "course_name": "0b1656 (huge)", "course_run": "0b1656", "org": "Org4"}, {"course_key": "course-v1:Org2+DemoX+e4380c", "course_name": "e4380c (huge)", "course_run": "e4380c", "org": "Org2"}], "format": "csv", "fixture": "course_names_expected"}, "name": "test_course_names", "resource_type": "unit_test", "package_name": "aspects", "path": "courses/unit_tests.yaml", "original_file_path": "models/courses/unit_tests.yaml", "unique_id": "unit_test.aspects.course_names.test_course_names", "fqn": ["aspects", "courses", "course_names", "test_course_names"], "description": "", "overrides": null, "depends_on": {"macros": [], "nodes": ["model.aspects.course_names"]}, "config": {"tags": ["ci"], "meta": {}}, "checksum": "bda2d82f5e5fc74232acab18da06bd276915a0a7d3411e3ebe0b1f299175b4ba", "schema": "xapi", "created_at": 1723229145.1508687, "versions": null, "version": null}, "unit_test.aspects.dim_course_blocks.test_dim_course_blocks": {"model": "dim_course_blocks", "given": [{"input": "ref('course_block_names')", "rows": "select * from course_block_names", "format": "sql", "fixture": null}, {"input": "ref('course_names')", "rows": "select * from course_names", "format": "sql", "fixture": null}], "expect": {"rows": "select * from dim_course_blocks_expected", "format": "sql", "fixture": null}, "name": "test_dim_course_blocks", "resource_type": "unit_test", "package_name": "aspects", "path": "courses/unit_tests.yaml", "original_file_path": "models/courses/unit_tests.yaml", "unique_id": "unit_test.aspects.dim_course_blocks.test_dim_course_blocks", "fqn": ["aspects", "courses", "dim_course_blocks", "test_dim_course_blocks"], "description": "", "overrides": null, "depends_on": {"macros": [], "nodes": ["model.aspects.dim_course_blocks"]}, "config": {"tags": ["dim"], "meta": {}}, "checksum": "4f76f7c6e9c15a6282c34b86bfe6b480fffdcb2326f852cc5321ec196f0d2e41", "schema": "xapi", "created_at": 1723229145.1526542, "versions": null, "version": null}, "unit_test.aspects.dim_course_blocks_extended.test_dim_course_blocks_extended": {"model": "dim_course_blocks_extended", "given": [{"input": "ref('dim_course_blocks')", "rows": "select * from dim_course_blocks", "format": "sql", "fixture": null}], "expect": {"rows": "select * from dim_course_blocks_extended_expected", "format": "sql", "fixture": null}, "name": "test_dim_course_blocks_extended", "resource_type": "unit_test", "package_name": "aspects", "path": "courses/unit_tests.yaml", "original_file_path": "models/courses/unit_tests.yaml", "unique_id": "unit_test.aspects.dim_course_blocks_extended.test_dim_course_blocks_extended", "fqn": ["aspects", "courses", "dim_course_blocks_extended", "test_dim_course_blocks_extended"], "description": "", "overrides": null, "depends_on": {"macros": [], "nodes": ["model.aspects.dim_course_blocks_extended"]}, "config": {"tags": ["ci"], "meta": {}}, "checksum": "ae4110b53564fe97df009dde3e834992d7c5e0347d550c5c320ffa049275e4e5", "schema": "xapi", "created_at": 1723229145.1537082, "versions": null, "version": null}, "unit_test.aspects.video_playback_events.test_video_playback_events": {"model": "video_playback_events", "given": [{"input": "ref('xapi_events_all_parsed')", "rows": "select * from xapi_events_all_parsed", "format": "sql", "fixture": null}], "expect": {"rows": "select * from video_playback_events_expected", "format": "sql", "fixture": null}, "name": "test_video_playback_events", "resource_type": "unit_test", "package_name": "aspects", "path": "video/unit_tests.yaml", "original_file_path": "models/video/unit_tests.yaml", "unique_id": "unit_test.aspects.video_playback_events.test_video_playback_events", "fqn": ["aspects", "video", "video_playback_events", "test_video_playback_events"], "description": "", "overrides": null, "depends_on": {"macros": [], "nodes": ["model.aspects.video_playback_events"]}, "config": {"tags": ["ci"], "meta": {}}, "checksum": "33ff2d6867c179cebb572692ad4c06e9023c4efba1c5d4d8a257dc3f95da1ef3", "schema": "xapi", "created_at": 1723229145.1547484, "versions": null, "version": null}, "unit_test.aspects.fact_video_plays.test_fact_video_plays": {"model": "fact_video_plays", "given": [{"input": "ref('video_playback_events')", "rows": "select * from video_playback_events", "format": "sql", "fixture": null}, {"input": "ref('dim_course_blocks_extended')", "rows": "select * from dim_course_blocks_extended", "format": "sql", "fixture": null}, {"input": "ref('dim_user_pii')", "rows": "select * from dim_user_pii", "format": "sql", "fixture": null}], "expect": {"rows": "select * from fact_video_plays_expected", "format": "sql", "fixture": null}, "name": "test_fact_video_plays", "resource_type": "unit_test", "package_name": "aspects", "path": "video/unit_tests.yaml", "original_file_path": "models/video/unit_tests.yaml", "unique_id": "unit_test.aspects.fact_video_plays.test_fact_video_plays", "fqn": ["aspects", "video", "fact_video_plays", "test_fact_video_plays"], "description": "", "overrides": null, "depends_on": {"macros": [], "nodes": ["model.aspects.fact_video_plays"]}, "config": {"tags": ["ci"], "meta": {}}, "checksum": "e591d0b99775a64721229686a4de8907339e9c7d9af1ae19358be61663edc6e9", "schema": "xapi", "created_at": 1723229145.156886, "versions": null, "version": null}, "unit_test.aspects.section_video_engagement.test_section_video_engagement": {"model": "section_video_engagement", "given": [{"input": "ref('fact_video_plays')", "rows": "select * from fact_video_plays", "format": "sql", "fixture": null}, {"input": "ref('int_videos_per_subsection')", "rows": "select * from int_videos_per_subsection", "format": "sql", "fixture": null}], "expect": {"rows": "select * from section_video_engagement_expected", "format": "sql", "fixture": null}, "name": "test_section_video_engagement", "resource_type": "unit_test", "package_name": "aspects", "path": "video/unit_tests.yaml", "original_file_path": "models/video/unit_tests.yaml", "unique_id": "unit_test.aspects.section_video_engagement.test_section_video_engagement", "fqn": ["aspects", "video", "section_video_engagement", "test_section_video_engagement"], "description": "", "overrides": null, "depends_on": {"macros": [], "nodes": ["model.aspects.section_video_engagement"]}, "config": {"tags": ["ci"], "meta": {}}, "checksum": "c8da9653c2ff5f15ef11c60e5756a97c4ecaa6b7c39c9f440db0615b96ae31b2", "schema": "xapi", "created_at": 1723229145.1598475, "versions": null, "version": null}, "unit_test.aspects.fact_video_engagement.test_fact_video_engagement": {"model": "fact_video_engagement", "given": [{"input": "ref('subsection_video_engagement')", "rows": "select * from subsection_video_engagement", "format": "sql", "fixture": null}, {"input": "ref('section_video_engagement')", "rows": "select * from section_video_engagement", "format": "sql", "fixture": null}, {"input": "ref('dim_course_blocks')", "rows": "select * from dim_course_blocks", "format": "sql", "fixture": null}, {"input": "ref('dim_user_pii')", "rows": "select * from dim_user_pii", "format": "sql", "fixture": null}], "expect": {"rows": "select * from fact_video_engagement_expected", "format": "sql", "fixture": null}, "name": "test_fact_video_engagement", "resource_type": "unit_test", "package_name": "aspects", "path": "video/unit_tests.yaml", "original_file_path": "models/video/unit_tests.yaml", "unique_id": "unit_test.aspects.fact_video_engagement.test_fact_video_engagement", "fqn": ["aspects", "video", "fact_video_engagement", "test_fact_video_engagement"], "description": "", "overrides": null, "depends_on": {"macros": [], "nodes": ["model.aspects.fact_video_engagement"]}, "config": {"tags": ["ci"], "meta": {}}, "checksum": "e9e7f0776f20dc886c4a396ce85341788ab019a67ec521bb9637fcf9f0344217", "schema": "xapi", "created_at": 1723229145.1620193, "versions": null, "version": null}}}
\ No newline at end of file
+{"metadata": {"dbt_schema_version": "https://schemas.getdbt.com/dbt/manifest/v12.json", "dbt_version": "1.8.5", "generated_at": "2024-08-15T21:11:17.069327Z", "invocation_id": "8b4070f2-5f6a-4318-8b6e-0095cfa33985", "env": {}, "project_name": "aspects", "project_id": "9074d4992d118978696669561f06dfcc", "user_id": "de1b83de-7cd4-40ff-8cd2-c96955079cb2", "send_anonymous_usage_stats": true, "adapter_type": "clickhouse"}, "nodes": {"model.aspects.dim_user_pii": {"database": "", "schema": "xapi", "name": "dim_user_pii", "resource_type": "model", "package_name": "aspects", "path": "users/dim_user_pii.sql", "original_file_path": "models/users/dim_user_pii.sql", "unique_id": "model.aspects.dim_user_pii", "fqn": ["aspects", "users", "dim_user_pii"], "alias": "dim_user_pii", "checksum": {"name": "sha256", "checksum": "ff3243c8cf092b7ca0122d07ef2ef5cf937b44af60f7980ce0a29ab2c9e1d224"}, "config": {"enabled": true, "alias": null, "schema": null, "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": "A denormalized table of user PII information", "columns": {"external_user_id": {"name": "external_user_id", "description": "The external user id", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "username": {"name": "username", "description": "The username", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "name": {"name": "name", "description": "The name of the user", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "email": {"name": "email", "description": "The email of the user", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "aspects://models/users/schema.yml", "build_path": null, "unrendered_config": {}, "created_at": 1723756272.2678454, "relation_name": "`xapi`.`dim_user_pii`", "raw_code": "select external_user_id, username, name, email from {{ ref(\"user_pii\") }} user_pii", "language": "sql", "refs": [{"name": "user_pii", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.aspects.user_pii"]}, "compiled_path": "target/compiled/aspects/models/users/dim_user_pii.sql", "compiled": true, "compiled_code": "select external_user_id, username, name, email from `xapi`.`user_pii` user_pii", "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.aspects.user_pii": {"database": "", "schema": "xapi", "name": "user_pii", "resource_type": "model", "package_name": "aspects", "path": "users/user_pii.sql", "original_file_path": "models/users/user_pii.sql", "unique_id": "model.aspects.user_pii", "fqn": ["aspects", "users", "user_pii"], "alias": "user_pii", "checksum": {"name": "sha256", "checksum": "a2f8fb4eafd60aba015b18f1842c4ea28409c8a5103b947fedf791e6f5a1d9e8"}, "config": {"enabled": true, "alias": null, "schema": "event_sink", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "dictionary", "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", "fields": [["user_id", "Int32"], ["external_user_id", "UUID"], ["username", "String"], ["name", "String"], ["email", "String"]], "primary_key": "(user_id, external_user_id)", "layout": "COMPLEX_KEY_SPARSE_HASHED()", "lifetime": "120", "source_type": "clickhouse", "connection_overrides": {"host": "localhost"}}, "tags": [], "description": "The user PII table for reports.", "columns": {"user_id": {"name": "user_id", "description": "The user id", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "external_user_id": {"name": "external_user_id", "description": "The external user id", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "username": {"name": "username", "description": "The username of the user", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "name": {"name": "name", "description": "The name of the user", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "email": {"name": "email", "description": "The email of the user", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "aspects://models/users/schema.yml", "build_path": null, "unrendered_config": {"materialized": "dictionary", "schema": "event_sink", "fields": [["user_id", "Int32"], ["external_user_id", "UUID"], ["username", "String"], ["name", "String"], ["email", "String"]], "primary_key": "(user_id, external_user_id)", "layout": "COMPLEX_KEY_SPARSE_HASHED()", "lifetime": "120", "source_type": "clickhouse", "connection_overrides": {"host": "localhost"}}, "created_at": 1723756272.2671487, "relation_name": "`xapi`.`user_pii`", "raw_code": "{{\n config(\n materialized=\"dictionary\",\n schema=env_var(\"ASPECTS_EVENT_SINK_DATABASE\", \"event_sink\"),\n fields=[\n (\"user_id\", \"Int32\"),\n (\"external_user_id\", \"UUID\"),\n (\"username\", \"String\"),\n (\"name\", \"String\"),\n (\"email\", \"String\"),\n ],\n primary_key=\"(user_id, external_user_id)\",\n layout=\"COMPLEX_KEY_SPARSE_HASHED()\",\n lifetime=env_var(\"ASPECTS_PII_CACHE_LIFETIME\", \"120\"),\n source_type=\"clickhouse\",\n connection_overrides={\n \"host\": \"localhost\",\n },\n )\n}}\n\nwith\n most_recent_user_profile as (\n select user_id, max(time_last_dumped) as time_last_dumped\n from {{ source(\"event_sink\", \"user_profile\") }}\n group by user_id\n )\nselect ex.user_id as user_id, ex.external_user_id, ex.username, up.name, up.email\nfrom {{ source(\"event_sink\", \"external_id\") }} ex\nleft outer join most_recent_user_profile mrup on mrup.user_id = ex.user_id\nleft outer join\n {{ source(\"event_sink\", \"user_profile\") }} up\n on up.user_id = mrup.user_id\n and up.time_last_dumped = mrup.time_last_dumped", "language": "sql", "refs": [], "sources": [["event_sink", "user_profile"], ["event_sink", "external_id"], ["event_sink", "user_profile"]], "metrics": [], "depends_on": {"macros": [], "nodes": ["source.aspects.event_sink.user_profile", "source.aspects.event_sink.external_id"]}, "compiled_path": "target/compiled/aspects/models/users/user_pii.sql", "compiled": true, "compiled_code": "\n\nwith\n most_recent_user_profile as (\n select user_id, max(time_last_dumped) as time_last_dumped\n from `event_sink`.`user_profile`\n group by user_id\n )\nselect ex.user_id as user_id, ex.external_user_id, ex.username, up.name, up.email\nfrom `event_sink`.`external_id` ex\nleft outer join most_recent_user_profile mrup on mrup.user_id = ex.user_id\nleft outer join\n `event_sink`.`user_profile` up\n on up.user_id = mrup.user_id\n and up.time_last_dumped = mrup.time_last_dumped", "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.aspects.fact_enrollments": {"database": "", "schema": "xapi", "name": "fact_enrollments", "resource_type": "model", "package_name": "aspects", "path": "enrollment/fact_enrollments.sql", "original_file_path": "models/enrollment/fact_enrollments.sql", "unique_id": "model.aspects.fact_enrollments", "fqn": ["aspects", "enrollment", "fact_enrollments"], "alias": "fact_enrollments", "checksum": {"name": "sha256", "checksum": "9cf04dc27c049a785918a39f058a51bf2607b1134a7c8416a77309ac50b5db30"}, "config": {"enabled": true, "alias": null, "schema": null, "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": "A record for each enrollment event", "columns": {"emission_time": {"name": "emission_time", "description": "Timestamp, to the second, of when this event was emitted", "meta": {}, "data_type": "DateTime", "constraints": [], "quote": null, "tags": []}, "org": {"name": "org", "description": "The organization that the course belongs to", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_key": {"name": "course_key", "description": "The course key for the course", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_name": {"name": "course_name", "description": "The name of the course", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_run": {"name": "course_run", "description": "The course run for the course", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "actor_id": {"name": "actor_id", "description": "The xAPI actor identifier", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "enrollment_mode": {"name": "enrollment_mode", "description": "The mode of enrollment", "meta": {}, "data_type": "LowCardinality(String)", "constraints": [], "quote": null, "tags": []}, "enrollment_status": {"name": "enrollment_status", "description": "Whether a learner is actively enrolled in a course", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "username": {"name": "username", "description": "The username of the learner", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "name": {"name": "name", "description": "The full name of the learner", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "email": {"name": "email", "description": "The email address of the learner", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "aspects://models/enrollment/schema.yml", "build_path": null, "unrendered_config": {"materialized": "view"}, "created_at": 1723756272.271658, "relation_name": "`xapi`.`fact_enrollments`", "raw_code": "with\n enrollments as (\n select\n emission_time,\n org,\n course_key,\n actor_id,\n enrollment_mode,\n splitByString('/', verb_id)[-1] as enrollment_status\n from {{ ref(\"enrollment_events\") }}\n )\n\nselect\n enrollments.emission_time as emission_time,\n enrollments.org as org,\n enrollments.course_key as course_key,\n courses.course_name as course_name,\n courses.course_run as course_run,\n enrollments.actor_id as actor_id,\n enrollments.enrollment_mode as enrollment_mode,\n enrollments.enrollment_status as enrollment_status,\n users.username as username,\n users.name as name,\n users.email as email\nfrom enrollments\njoin {{ ref(\"course_names\") }} courses on enrollments.course_key = courses.course_key\nleft outer join\n {{ ref(\"dim_user_pii\") }} users on toUUID(actor_id) = users.external_user_id", "language": "sql", "refs": [{"name": "enrollment_events", "package": null, "version": null}, {"name": "course_names", "package": null, "version": null}, {"name": "dim_user_pii", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.aspects.enrollment_events", "model.aspects.course_names", "model.aspects.dim_user_pii"]}, "compiled_path": "target/compiled/aspects/models/enrollment/fact_enrollments.sql", "compiled": true, "compiled_code": "with\n enrollments as (\n select\n emission_time,\n org,\n course_key,\n actor_id,\n enrollment_mode,\n splitByString('/', verb_id)[-1] as enrollment_status\n from `xapi`.`enrollment_events`\n )\n\nselect\n enrollments.emission_time as emission_time,\n enrollments.org as org,\n enrollments.course_key as course_key,\n courses.course_name as course_name,\n courses.course_run as course_run,\n enrollments.actor_id as actor_id,\n enrollments.enrollment_mode as enrollment_mode,\n enrollments.enrollment_status as enrollment_status,\n users.username as username,\n users.name as name,\n users.email as email\nfrom enrollments\njoin `xapi`.`course_names` courses on enrollments.course_key = courses.course_key\nleft outer join\n `xapi`.`dim_user_pii` users on toUUID(actor_id) = users.external_user_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.aspects.fact_enrollment_status": {"database": "", "schema": "xapi", "name": "fact_enrollment_status", "resource_type": "model", "package_name": "aspects", "path": "enrollment/fact_enrollment_status.sql", "original_file_path": "models/enrollment/fact_enrollment_status.sql", "unique_id": "model.aspects.fact_enrollment_status", "fqn": ["aspects", "enrollment", "fact_enrollment_status"], "alias": "fact_enrollment_status", "checksum": {"name": "sha256", "checksum": "e77614db9ce84f1d643ada3263c531c8c3764d0808d7bc4633bd40fffac4d6b2"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": [], "meta": {}, "group": null, "materialized": "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", "engine": "\n ReplacingMergeTree()", "order_by": "(org, course_key, actor_id)", "primary_key": "(org, course_key, actor_id)"}, "tags": [], "description": "One record per learner per course for the most recent enrollment status", "columns": {"org": {"name": "org", "description": "The organization that the course belongs to", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_key": {"name": "course_key", "description": "The course key for the course", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "actor_id": {"name": "actor_id", "description": "The xAPI actor identifier", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "enrollment_status": {"name": "enrollment_status", "description": "Whether a learner is actively enrolled in a course", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "enrollment_mode": {"name": "enrollment_mode", "description": "The mode of enrollment", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "emission_time": {"name": "emission_time", "description": "The time the enrollment status was emitted", "meta": {}, "data_type": "DateTime", "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "aspects://models/enrollment/schema.yml", "build_path": null, "unrendered_config": {"materialized": "materialized_view", "engine": "\n ReplacingMergeTree()", "primary_key": "(org, course_key, actor_id)", "order_by": "(org, course_key, actor_id)"}, "created_at": 1723756272.274287, "relation_name": "`xapi`.`fact_enrollment_status`", "raw_code": "{{\n config(\n materialized=\"materialized_view\",\n engine=get_engine(\"ReplacingMergeTree()\"),\n primary_key=\"(org, course_key, actor_id)\",\n order_by=\"(org, course_key, actor_id)\",\n )\n}}\n\nwith\n ranked_enrollments as (\n select\n emission_time,\n org,\n course_key,\n actor_id,\n enrollment_mode,\n splitByString('/', verb_id)[-1] as enrollment_status,\n row_number() over (\n partition by org, course_key, actor_id order by emission_time desc\n ) as rn\n from {{ ref(\"enrollment_events\") }}\n )\n\nselect org, course_key, actor_id, enrollment_status, enrollment_mode, emission_time\nfrom ranked_enrollments\nwhere rn = 1", "language": "sql", "refs": [{"name": "enrollment_events", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.aspects.get_engine"], "nodes": ["model.aspects.enrollment_events"]}, "compiled_path": "target/compiled/aspects/models/enrollment/fact_enrollment_status.sql", "compiled": true, "compiled_code": "\n\nwith\n ranked_enrollments as (\n select\n emission_time,\n org,\n course_key,\n actor_id,\n enrollment_mode,\n splitByString('/', verb_id)[-1] as enrollment_status,\n row_number() over (\n partition by org, course_key, actor_id order by emission_time desc\n ) as rn\n from `xapi`.`enrollment_events`\n )\n\nselect org, course_key, actor_id, enrollment_status, enrollment_mode, emission_time\nfrom ranked_enrollments\nwhere rn = 1", "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.aspects.enrollment_events": {"database": "", "schema": "xapi", "name": "enrollment_events", "resource_type": "model", "package_name": "aspects", "path": "enrollment/enrollment_events.sql", "original_file_path": "models/enrollment/enrollment_events.sql", "unique_id": "model.aspects.enrollment_events", "fqn": ["aspects", "enrollment", "enrollment_events"], "alias": "enrollment_events", "checksum": {"name": "sha256", "checksum": "f5465a9f486856ae14336c1bedc0f57886bd8a558f684ecb235302f377ef4ff8"}, "config": {"enabled": true, "alias": null, "schema": "xapi", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "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", "engine": "\n ReplacingMergeTree()", "order_by": "(org, course_key, emission_time, actor_id, enrollment_mode, event_id)", "partition_by": "(toYYYYMM(emission_time))", "ttl": "", "primary_key": "(org, course_key)"}, "tags": [], "description": "A materialized view for xAPI events related to course enrollment", "columns": {"event_id": {"name": "event_id", "description": "The unique identifier for the event", "meta": {}, "data_type": "UUID", "constraints": [], "quote": null, "tags": []}, "emission_time": {"name": "emission_time", "description": "The time the event was emitted", "meta": {}, "data_type": "DateTime", "constraints": [], "quote": null, "tags": []}, "actor_id": {"name": "actor_id", "description": "The xAPI actor identifier", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "object_id": {"name": "object_id", "description": "The xAPI object identifier", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_key": {"name": "course_key", "description": "The course identifier", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "org": {"name": "org", "description": "The organization that the course belongs to", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "verb_id": {"name": "verb_id", "description": "The xAPI verb identifier", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "enrollment_mode": {"name": "enrollment_mode", "description": "The mode of enrollment", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "aspects://models/enrollment/schema.yml", "build_path": null, "unrendered_config": {"materialized": "materialized_view", "schema": "xapi", "engine": "\n ReplacingMergeTree()", "primary_key": "(org, course_key)", "order_by": "(org, course_key, emission_time, actor_id, enrollment_mode, event_id)", "partition_by": "(toYYYYMM(emission_time))", "ttl": ""}, "created_at": 1723756272.2735217, "relation_name": "`xapi`.`enrollment_events`", "raw_code": "{{\n config(\n materialized=\"materialized_view\",\n schema=env_var(\"ASPECTS_XAPI_DATABASE\", \"xapi\"),\n engine=get_engine(\"ReplacingMergeTree()\"),\n primary_key=\"(org, course_key)\",\n order_by=\"(org, course_key, emission_time, actor_id, enrollment_mode, event_id)\",\n partition_by=\"(toYYYYMM(emission_time))\",\n ttl=env_var(\"ASPECTS_DATA_TTL_EXPRESSION\", \"\"),\n )\n}}\n\nselect\n event_id,\n cast(emission_time as DateTime) as emission_time,\n actor_id,\n object_id,\n course_key,\n org,\n verb_id,\n toLowCardinality(\n JSON_VALUE(\n event,\n '$.object.definition.extensions.\"https://w3id.org/xapi/acrossx/extensions/type\"'\n )\n ) as enrollment_mode\nfrom {{ ref(\"xapi_events_all_parsed\") }}\nwhere\n verb_id in (\n 'http://adlnet.gov/expapi/verbs/registered',\n 'http://id.tincanapi.com/verb/unregistered'\n )", "language": "sql", "refs": [{"name": "xapi_events_all_parsed", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.aspects.get_engine"], "nodes": ["model.aspects.xapi_events_all_parsed"]}, "compiled_path": "target/compiled/aspects/models/enrollment/enrollment_events.sql", "compiled": true, "compiled_code": "\n\nselect\n event_id,\n cast(emission_time as DateTime) as emission_time,\n actor_id,\n object_id,\n course_key,\n org,\n verb_id,\n toLowCardinality(\n JSON_VALUE(\n event,\n '$.object.definition.extensions.\"https://w3id.org/xapi/acrossx/extensions/type\"'\n )\n ) as enrollment_mode\nfrom `xapi`.`xapi_events_all_parsed`\nwhere\n verb_id in (\n 'http://adlnet.gov/expapi/verbs/registered',\n 'http://id.tincanapi.com/verb/unregistered'\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.aspects.fact_instance_enrollments": {"database": "", "schema": "xapi", "name": "fact_instance_enrollments", "resource_type": "model", "package_name": "aspects", "path": "instance/fact_instance_enrollments.sql", "original_file_path": "models/instance/fact_instance_enrollments.sql", "unique_id": "model.aspects.fact_instance_enrollments", "fqn": ["aspects", "instance", "fact_instance_enrollments"], "alias": "fact_instance_enrollments", "checksum": {"name": "sha256", "checksum": "c305918eced6c4301f6d32582f622e3b9ba4a08bc20798cd7e981fc79304ebb3"}, "config": {"enabled": true, "alias": null, "schema": "xapi", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "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", "engine": "\n SummingMergeTree()", "order_by": "(emission_day, course_key, enrollment_mode, enrollment_status)", "partition_by": "(toYYYYMM(emission_day))"}, "tags": [], "description": "A materialized view for summarizing site-wide enrollment activity", "columns": {"emission_day": {"name": "emission_day", "description": "Time of summary, truncated to the day", "meta": {}, "data_type": "DateTime", "constraints": [], "quote": null, "tags": []}, "course_name": {"name": "course_name", "description": "The name of the course", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_key": {"name": "course_key", "description": "The course key for the course", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "enrollment_mode": {"name": "enrollment_mode", "description": "The name of the enrollment mode (ex: audit, honor)", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "enrollment_status": {"name": "enrollment_status", "description": "The type of enrollment event (ex: registered, unregistered)", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_enrollment_mode_status_cnt": {"name": "course_enrollment_mode_status_cnt", "description": "The number of enrollment events for this mode that occurred in the given hour", "meta": {}, "data_type": "Int", "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "aspects://models/instance/schema.yml", "build_path": null, "unrendered_config": {"materialized": "materialized_view", "schema": "xapi", "engine": "\n SummingMergeTree()", "order_by": "(emission_day, course_key, enrollment_mode, enrollment_status)", "partition_by": "(toYYYYMM(emission_day))"}, "created_at": 1723756272.368007, "relation_name": "`xapi`.`fact_instance_enrollments`", "raw_code": "{{\n config(\n materialized=\"materialized_view\",\n schema=env_var(\"ASPECTS_XAPI_DATABASE\", \"xapi\"),\n engine=get_engine(\"SummingMergeTree()\"),\n order_by=\"(emission_day, course_key, enrollment_mode, enrollment_status)\",\n partition_by=\"(toYYYYMM(emission_day))\",\n )\n}}\n\nwith\n enrollments as (\n select\n emission_time,\n course_key,\n enrollment_mode,\n splitByString('/', verb_id)[-1] as enrollment_status\n from {{ ref(\"enrollment_events\") }}\n )\n\nselect\n date_trunc('day', emission_time) as emission_day,\n enrollments.course_key,\n enrollments.enrollment_mode as enrollment_mode,\n enrollments.enrollment_status as enrollment_status,\n count() as course_enrollment_mode_status_cnt\nfrom enrollments\ngroup by emission_day, course_key, enrollment_mode, enrollment_status", "language": "sql", "refs": [{"name": "enrollment_events", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.aspects.get_engine"], "nodes": ["model.aspects.enrollment_events"]}, "compiled_path": "target/compiled/aspects/models/instance/fact_instance_enrollments.sql", "compiled": true, "compiled_code": "\n\nwith\n enrollments as (\n select\n emission_time,\n course_key,\n enrollment_mode,\n splitByString('/', verb_id)[-1] as enrollment_status\n from `xapi`.`enrollment_events`\n )\n\nselect\n date_trunc('day', emission_time) as emission_day,\n enrollments.course_key,\n enrollments.enrollment_mode as enrollment_mode,\n enrollments.enrollment_status as enrollment_status,\n count() as course_enrollment_mode_status_cnt\nfrom enrollments\ngroup by emission_day, course_key, enrollment_mode, enrollment_status", "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.aspects.fact_instance_actors": {"database": "", "schema": "xapi", "name": "fact_instance_actors", "resource_type": "model", "package_name": "aspects", "path": "instance/fact_instance_actors.sql", "original_file_path": "models/instance/fact_instance_actors.sql", "unique_id": "model.aspects.fact_instance_actors", "fqn": ["aspects", "instance", "fact_instance_actors"], "alias": "fact_instance_actors", "checksum": {"name": "sha256", "checksum": "3dc087e4035b4b76542573dfb033742cd6e08ecd38c51c644a35f2127bd97f5f"}, "config": {"enabled": true, "alias": null, "schema": "xapi", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "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", "engine": "\n AggregatingMergeTree()", "order_by": "(emission_day)", "partition_by": "(toYYYYMM(emission_day))"}, "tags": [], "description": "A materialized view summarizing site-wide user activity", "columns": {"emission_day": {"name": "emission_day", "description": "Time of summary, truncated to the day", "meta": {}, "data_type": "DateTime", "constraints": [], "quote": null, "tags": []}, "actors_cnt": {"name": "actors_cnt", "description": "The number of xAPI actors active in the given hour", "meta": {}, "data_type": "Int", "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "aspects://models/instance/schema.yml", "build_path": null, "unrendered_config": {"materialized": "materialized_view", "schema": "xapi", "engine": "\n AggregatingMergeTree()", "order_by": "(emission_day)", "partition_by": "(toYYYYMM(emission_day))"}, "created_at": 1723756272.3670144, "relation_name": "`xapi`.`fact_instance_actors`", "raw_code": "{{\n config(\n materialized=\"materialized_view\",\n schema=env_var(\"ASPECTS_XAPI_DATABASE\", \"xapi\"),\n engine=get_engine(\"AggregatingMergeTree()\"),\n order_by=\"(emission_day)\",\n partition_by=\"(toYYYYMM(emission_day))\",\n )\n}}\n\nselect\n date_trunc('day', emission_time) as emission_day,\n uniqCombinedState(actor_id) as actors_cnt\nfrom {{ ref(\"xapi_events_all_parsed\") }}\ngroup by emission_day", "language": "sql", "refs": [{"name": "xapi_events_all_parsed", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.aspects.get_engine"], "nodes": ["model.aspects.xapi_events_all_parsed"]}, "compiled_path": "target/compiled/aspects/models/instance/fact_instance_actors.sql", "compiled": true, "compiled_code": "\n\nselect\n date_trunc('day', emission_time) as emission_day,\n uniqCombinedState(actor_id) as actors_cnt\nfrom `xapi`.`xapi_events_all_parsed`\ngroup by emission_day", "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.aspects.fact_instance_courses": {"database": "", "schema": "xapi", "name": "fact_instance_courses", "resource_type": "model", "package_name": "aspects", "path": "instance/fact_instance_courses.sql", "original_file_path": "models/instance/fact_instance_courses.sql", "unique_id": "model.aspects.fact_instance_courses", "fqn": ["aspects", "instance", "fact_instance_courses"], "alias": "fact_instance_courses", "checksum": {"name": "sha256", "checksum": "f4ad165686c10a3ff85f8cdd6e6a32e970e1d1503612995e1f4fadb7a87b5a4f"}, "config": {"enabled": true, "alias": null, "schema": "xapi", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "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", "engine": "\n AggregatingMergeTree()", "order_by": "(emission_hour)", "partition_by": "(toYYYYMM(emission_hour))"}, "tags": [], "description": "A materialized view summarizing site-wide course activity", "columns": {"emission_hour": {"name": "emission_hour", "description": "Time of summary, rounded to the nearest hour", "meta": {}, "data_type": "DateTime(64)", "constraints": [], "quote": null, "tags": []}, "courses_cnt": {"name": "courses_cnt", "description": "The number of xAPI courses active in the given hour", "meta": {}, "data_type": "Int", "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "aspects://models/instance/schema.yml", "build_path": null, "unrendered_config": {"materialized": "materialized_view", "schema": "xapi", "engine": "\n AggregatingMergeTree()", "order_by": "(emission_hour)", "partition_by": "(toYYYYMM(emission_hour))"}, "created_at": 1723756272.364908, "relation_name": "`xapi`.`fact_instance_courses`", "raw_code": "{{\n config(\n materialized=\"materialized_view\",\n schema=env_var(\"ASPECTS_XAPI_DATABASE\", \"xapi\"),\n engine=get_engine(\"AggregatingMergeTree()\"),\n order_by=\"(emission_hour)\",\n partition_by=\"(toYYYYMM(emission_hour))\",\n )\n}}\n\nselect\n date_trunc('hour', emission_time) as emission_hour,\n uniqCombinedState(course_id) as courses_cnt\nfrom {{ ref(\"xapi_events_all_parsed\") }}\ngroup by emission_hour", "language": "sql", "refs": [{"name": "xapi_events_all_parsed", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.aspects.get_engine"], "nodes": ["model.aspects.xapi_events_all_parsed"]}, "compiled_path": "target/compiled/aspects/models/instance/fact_instance_courses.sql", "compiled": true, "compiled_code": "\n\nselect\n date_trunc('hour', emission_time) as emission_hour,\n uniqCombinedState(course_id) as courses_cnt\nfrom `xapi`.`xapi_events_all_parsed`\ngroup by emission_hour", "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.aspects.fact_instance_events": {"database": "", "schema": "xapi", "name": "fact_instance_events", "resource_type": "model", "package_name": "aspects", "path": "instance/fact_instance_events.sql", "original_file_path": "models/instance/fact_instance_events.sql", "unique_id": "model.aspects.fact_instance_events", "fqn": ["aspects", "instance", "fact_instance_events"], "alias": "fact_instance_events", "checksum": {"name": "sha256", "checksum": "4769f8d269c17cc93946adbc44d2209af542698ae0c5ca17025b6bacdccf6669"}, "config": {"enabled": true, "alias": null, "schema": "xapi", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "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", "engine": "\n AggregatingMergeTree()", "order_by": "(emission_day)", "partition_by": "(toYYYYMM(emission_day))"}, "tags": [], "description": "A materialized view summarizing site-wide xAPI event activity", "columns": {"emission_day": {"name": "emission_day", "description": "Time of summary, truncated to the day", "meta": {}, "data_type": "DateTime", "constraints": [], "quote": null, "tags": []}, "events_cnt": {"name": "events_cnt", "description": "The number of xAPI events that occurred in the given hour", "meta": {}, "data_type": "Int", "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "aspects://models/instance/schema.yml", "build_path": null, "unrendered_config": {"materialized": "materialized_view", "schema": "xapi", "engine": "\n AggregatingMergeTree()", "order_by": "(emission_day)", "partition_by": "(toYYYYMM(emission_day))"}, "created_at": 1723756272.366208, "relation_name": "`xapi`.`fact_instance_events`", "raw_code": "{{\n config(\n materialized=\"materialized_view\",\n schema=env_var(\"ASPECTS_XAPI_DATABASE\", \"xapi\"),\n engine=get_engine(\"AggregatingMergeTree()\"),\n order_by=\"(emission_day)\",\n partition_by=\"(toYYYYMM(emission_day))\",\n )\n}}\n\nselect\n date_trunc('day', emission_time) as emission_day,\n uniqCombinedState(event_id) as events_cnt\nfrom {{ ref(\"xapi_events_all_parsed\") }}\ngroup by emission_day", "language": "sql", "refs": [{"name": "xapi_events_all_parsed", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.aspects.get_engine"], "nodes": ["model.aspects.xapi_events_all_parsed"]}, "compiled_path": "target/compiled/aspects/models/instance/fact_instance_events.sql", "compiled": true, "compiled_code": "\n\nselect\n date_trunc('day', emission_time) as emission_day,\n uniqCombinedState(event_id) as events_cnt\nfrom `xapi`.`xapi_events_all_parsed`\ngroup by emission_day", "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.aspects.fact_learner_course_grade": {"database": "", "schema": "xapi", "name": "fact_learner_course_grade", "resource_type": "model", "package_name": "aspects", "path": "grading/fact_learner_course_grade.sql", "original_file_path": "models/grading/fact_learner_course_grade.sql", "unique_id": "model.aspects.fact_learner_course_grade", "fqn": ["aspects", "grading", "fact_learner_course_grade"], "alias": "fact_learner_course_grade", "checksum": {"name": "sha256", "checksum": "65bd38f1afb16919483eff0217b13bc2f58d64041c1a5034457d45e461de4340"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": [], "meta": {}, "group": null, "materialized": "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", "engine": "\n ReplacingMergeTree()", "order_by": "(org, course_key, actor_id)", "primary_key": "(org, course_key, actor_id)"}, "tags": [], "description": "One record per learner per course for the most recent grade", "columns": {"org": {"name": "org", "description": "The organization that the course belongs to", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_key": {"name": "course_key", "description": "The course key for the course", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "actor_id": {"name": "actor_id", "description": "The xAPI actor identifier", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_grade": {"name": "course_grade", "description": "The most recent grade for the learner", "meta": {}, "data_type": "float64", "constraints": [], "quote": null, "tags": []}, "emission_time": {"name": "emission_time", "description": "The time the event was emitted", "meta": {}, "data_type": "DateTime", "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "aspects://models/grading/schema.yml", "build_path": null, "unrendered_config": {"materialized": "materialized_view", "engine": "\n ReplacingMergeTree()", "primary_key": "(org, course_key, actor_id)", "order_by": "(org, course_key, actor_id)"}, "created_at": 1723756272.3749802, "relation_name": "`xapi`.`fact_learner_course_grade`", "raw_code": "{{\n config(\n materialized=\"materialized_view\",\n engine=get_engine(\"ReplacingMergeTree()\"),\n primary_key=\"(org, course_key, actor_id)\",\n order_by=\"(org, course_key, actor_id)\",\n )\n}}\n\nwith\n ranked_grades as (\n select\n emission_time,\n org,\n course_key,\n actor_id,\n scaled_score as course_grade,\n row_number() over (\n partition by org, course_key, actor_id order by emission_time desc\n ) as rn\n from {{ ref(\"grading_events\") }}\n where object_id like '%/course/%'\n )\n\nselect org, course_key, actor_id, course_grade, emission_time\nfrom ranked_grades\nwhere rn = 1", "language": "sql", "refs": [{"name": "grading_events", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.aspects.get_engine"], "nodes": ["model.aspects.grading_events"]}, "compiled_path": "target/compiled/aspects/models/grading/fact_learner_course_grade.sql", "compiled": true, "compiled_code": "\n\nwith\n ranked_grades as (\n select\n emission_time,\n org,\n course_key,\n actor_id,\n scaled_score as course_grade,\n row_number() over (\n partition by org, course_key, actor_id order by emission_time desc\n ) as rn\n from `xapi`.`grading_events`\n where object_id like '%/course/%'\n )\n\nselect org, course_key, actor_id, course_grade, emission_time\nfrom ranked_grades\nwhere rn = 1", "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.aspects.grading_events": {"database": "", "schema": "xapi", "name": "grading_events", "resource_type": "model", "package_name": "aspects", "path": "grading/grading_events.sql", "original_file_path": "models/grading/grading_events.sql", "unique_id": "model.aspects.grading_events", "fqn": ["aspects", "grading", "grading_events"], "alias": "grading_events", "checksum": {"name": "sha256", "checksum": "560e180b3c8684ea507910a88f1a2e616db7cf1fb751ea6b93b0475d519fd7ac"}, "config": {"enabled": true, "alias": null, "schema": "xapi", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "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", "engine": "\n ReplacingMergeTree()", "order_by": "(org, course_key, verb_id, emission_time, actor_id, object_id, scaled_score, event_id)", "partition_by": "(toYYYYMM(emission_time))", "ttl": "", "primary_key": "(org, course_key, verb_id)"}, "tags": [], "description": "Events related to grading", "columns": {"event_id": {"name": "event_id", "description": "The unique identifier for the event", "meta": {}, "data_type": "UUID", "constraints": [], "quote": null, "tags": []}, "emission_time": {"name": "emission_time", "description": "The time the event was emitted", "meta": {}, "data_type": "DateTime", "constraints": [], "quote": null, "tags": []}, "actor_id": {"name": "actor_id", "description": "The xAPI actor identifier", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "object_id": {"name": "object_id", "description": "The xAPI object identifier", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_key": {"name": "course_key", "description": "The course identifier", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "org": {"name": "org", "description": "The organization that the course belongs to", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "verb_id": {"name": "verb_id", "description": "The xAPI verb identifier", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "scaled_score": {"name": "scaled_score", "description": "A ratio between 0 and 1, inclusive, of the learner's grade", "meta": {}, "data_type": "float64", "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "aspects://models/grading/schema.yml", "build_path": null, "unrendered_config": {"materialized": "materialized_view", "schema": "xapi", "engine": "\n ReplacingMergeTree()", "primary_key": "(org, course_key, verb_id)", "order_by": "(org, course_key, verb_id, emission_time, actor_id, object_id, scaled_score, event_id)", "partition_by": "(toYYYYMM(emission_time))", "ttl": ""}, "created_at": 1723756272.3769653, "relation_name": "`xapi`.`grading_events`", "raw_code": "{{\n config(\n materialized=\"materialized_view\",\n schema=env_var(\"ASPECTS_XAPI_DATABASE\", \"xapi\"),\n engine=get_engine(\"ReplacingMergeTree()\"),\n primary_key=\"(org, course_key, verb_id)\",\n order_by=\"(org, course_key, verb_id, emission_time, actor_id, object_id, scaled_score, event_id)\",\n partition_by=\"(toYYYYMM(emission_time))\",\n ttl=env_var(\"ASPECTS_DATA_TTL_EXPRESSION\", \"\"),\n )\n}}\n\n\nselect\n event_id,\n CAST(emission_time, 'DateTime') as emission_time,\n actor_id,\n object_id,\n course_key,\n org,\n verb_id,\n JSONExtractFloat(event, 'result', 'score', 'scaled') as scaled_score\nfrom {{ ref(\"xapi_events_all_parsed\") }}\nwhere\n verb_id in (\n 'http://id.tincanapi.com/verb/earned',\n 'https://w3id.org/xapi/acrossx/verbs/evaluated'\n )\n or (\n verb_id in (\n 'http://adlnet.gov/expapi/verbs/passed',\n 'http://adlnet.gov/expapi/verbs/failed'\n )\n and JSON_VALUE(event::String, '$.object.definition.type')\n = 'http://adlnet.gov/expapi/activities/course'\n )", "language": "sql", "refs": [{"name": "xapi_events_all_parsed", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.aspects.get_engine"], "nodes": ["model.aspects.xapi_events_all_parsed"]}, "compiled_path": "target/compiled/aspects/models/grading/grading_events.sql", "compiled": true, "compiled_code": "\n\n\nselect\n event_id,\n CAST(emission_time, 'DateTime') as emission_time,\n actor_id,\n object_id,\n course_key,\n org,\n verb_id,\n JSONExtractFloat(event, 'result', 'score', 'scaled') as scaled_score\nfrom `xapi`.`xapi_events_all_parsed`\nwhere\n verb_id in (\n 'http://id.tincanapi.com/verb/earned',\n 'https://w3id.org/xapi/acrossx/verbs/evaluated'\n )\n or (\n verb_id in (\n 'http://adlnet.gov/expapi/verbs/passed',\n 'http://adlnet.gov/expapi/verbs/failed'\n )\n and JSON_VALUE(event::String, '$.object.definition.type')\n = 'http://adlnet.gov/expapi/activities/course'\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.aspects.fact_learner_course_status": {"database": "", "schema": "xapi", "name": "fact_learner_course_status", "resource_type": "model", "package_name": "aspects", "path": "grading/fact_learner_course_status.sql", "original_file_path": "models/grading/fact_learner_course_status.sql", "unique_id": "model.aspects.fact_learner_course_status", "fqn": ["aspects", "grading", "fact_learner_course_status"], "alias": "fact_learner_course_status", "checksum": {"name": "sha256", "checksum": "b222a83595d291ea6410e32e2c9c55afff79efe3c0268c415edf3154f4b60ee4"}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": [], "meta": {}, "group": null, "materialized": "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", "engine": "\n ReplacingMergeTree()", "order_by": "(org, course_key, actor_id)", "primary_key": "(org, course_key, actor_id)"}, "tags": [], "description": "One record per learner per course for the most recent approving status", "columns": {"org": {"name": "org", "description": "The organization that the course belongs to", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_key": {"name": "course_key", "description": "The course key for the course", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "actor_id": {"name": "actor_id", "description": "The xAPI actor identifier", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "emission_time": {"name": "emission_time", "description": "The time the event was emitted", "meta": {}, "data_type": "DateTime", "constraints": [], "quote": null, "tags": []}, "approving_state": {"name": "approving_state", "description": "The most recent approving_state of the learner's grade", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "aspects://models/grading/schema.yml", "build_path": null, "unrendered_config": {"materialized": "materialized_view", "engine": "\n ReplacingMergeTree()", "primary_key": "(org, course_key, actor_id)", "order_by": "(org, course_key, actor_id)"}, "created_at": 1723756272.3759282, "relation_name": "`xapi`.`fact_learner_course_status`", "raw_code": "{{\n config(\n materialized=\"materialized_view\",\n engine=get_engine(\"ReplacingMergeTree()\"),\n primary_key=\"(org, course_key, actor_id)\",\n order_by=\"(org, course_key, actor_id)\",\n )\n}}\n\nwith\n ranked_status as (\n select\n org,\n course_key,\n actor_id,\n splitByString('/', verb_id)[-1] as approving_state,\n emission_time,\n row_number() over (\n partition by org, course_key, actor_id order by emission_time desc\n ) as rn\n from {{ ref(\"grading_events\") }}\n where\n verb_id in (\n 'http://adlnet.gov/expapi/verbs/passed',\n 'http://adlnet.gov/expapi/verbs/failed'\n )\n )\n\nselect org, course_key, actor_id, approving_state, emission_time\nfrom ranked_status\nwhere rn = 1", "language": "sql", "refs": [{"name": "grading_events", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.aspects.get_engine"], "nodes": ["model.aspects.grading_events"]}, "compiled_path": "target/compiled/aspects/models/grading/fact_learner_course_status.sql", "compiled": true, "compiled_code": "\n\nwith\n ranked_status as (\n select\n org,\n course_key,\n actor_id,\n splitByString('/', verb_id)[-1] as approving_state,\n emission_time,\n row_number() over (\n partition by org, course_key, actor_id order by emission_time desc\n ) as rn\n from `xapi`.`grading_events`\n where\n verb_id in (\n 'http://adlnet.gov/expapi/verbs/passed',\n 'http://adlnet.gov/expapi/verbs/failed'\n )\n )\n\nselect org, course_key, actor_id, approving_state, emission_time\nfrom ranked_status\nwhere rn = 1", "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.aspects.fact_student_status": {"database": "", "schema": "xapi", "name": "fact_student_status", "resource_type": "model", "package_name": "aspects", "path": "grading/fact_student_status.sql", "original_file_path": "models/grading/fact_student_status.sql", "unique_id": "model.aspects.fact_student_status", "fqn": ["aspects", "grading", "fact_student_status"], "alias": "fact_student_status", "checksum": {"name": "sha256", "checksum": "6a873b9bd0a579367e3e9ccd2e5a9b2ef96ce0c44ea12eced299a7a96b56535e"}, "config": {"enabled": true, "alias": null, "schema": null, "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": "One record per learner per course for the most recent grade and enrollment status", "columns": {"org": {"name": "org", "description": "The organization that the course belongs to", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_key": {"name": "course_key", "description": "The course key for the course", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "actor_id": {"name": "actor_id", "description": "The xAPI actor identifier", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_name": {"name": "course_name", "description": "The name of the course", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_run": {"name": "course_run", "description": "The course run for the course", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "approving_state": {"name": "approving_state", "description": "The most recent approving state for the learner", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "enrollment_mode": {"name": "enrollment_mode", "description": "The mode of enrollment", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "enrollment_status": {"name": "enrollment_status", "description": "Whether a learner is actively enrolled in a course", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "course_grade": {"name": "course_grade", "description": "The most recent grade for the learner", "meta": {}, "data_type": "float64", "constraints": [], "quote": null, "tags": []}, "grade_bucket": {"name": "grade_bucket", "description": "A displayable value of grades sorted into 10% buckets. Useful for grouping grades together to show high-level learner performance", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "username": {"name": "username", "description": "The username of the learner", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "name": {"name": "name", "description": "The full name of the learner", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "email": {"name": "email", "description": "The email address of the learner", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "enrolled_at": {"name": "enrolled_at", "description": "The timestamp, to the second, of the most recent enrollment action for this learner and course.", "meta": {}, "data_type": "DateTime", "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "aspects://models/grading/schema.yml", "build_path": null, "unrendered_config": {}, "created_at": 1723756272.3785098, "relation_name": "`xapi`.`fact_student_status`", "raw_code": "select\n fes.org as org,\n fes.course_key as course_key,\n fes.actor_id as actor_id,\n courses.course_name as course_name,\n courses.course_run as course_run,\n if(empty(approving_state), 'failed', approving_state) as approving_state,\n enrollment_mode,\n enrollment_status,\n course_grade,\n {{ get_bucket(\"course_grade\") }} as grade_bucket,\n users.username as username,\n users.name as name,\n users.email as email,\n fes.emission_time as enrolled_at\nfrom {{ ref(\"fact_enrollment_status\") }} fes\nleft join\n {{ ref(\"fact_learner_course_status\") }} lg\n on fes.org = lg.org\n and fes.course_key = lg.course_key\n and fes.actor_id = lg.actor_id\nleft join\n {{ ref(\"fact_learner_course_grade\") }} ls\n on fes.org = ls.org\n and fes.course_key = ls.course_key\n and fes.actor_id = ls.actor_id\njoin\n {{ ref(\"course_names\") }} courses\n on fes.org = courses.org\n and fes.course_key = courses.course_key\nleft outer join\n {{ ref(\"dim_user_pii\") }} users on toUUID(actor_id) = users.external_user_id", "language": "sql", "refs": [{"name": "fact_enrollment_status", "package": null, "version": null}, {"name": "fact_learner_course_status", "package": null, "version": null}, {"name": "fact_learner_course_grade", "package": null, "version": null}, {"name": "course_names", "package": null, "version": null}, {"name": "dim_user_pii", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.aspects.get_bucket"], "nodes": ["model.aspects.fact_enrollment_status", "model.aspects.fact_learner_course_status", "model.aspects.fact_learner_course_grade", "model.aspects.course_names", "model.aspects.dim_user_pii"]}, "compiled_path": "target/compiled/aspects/models/grading/fact_student_status.sql", "compiled": true, "compiled_code": "select\n fes.org as org,\n fes.course_key as course_key,\n fes.actor_id as actor_id,\n courses.course_name as course_name,\n courses.course_run as course_run,\n if(empty(approving_state), 'failed', approving_state) as approving_state,\n enrollment_mode,\n enrollment_status,\n course_grade,\n case\n when course_grade >= 0.9\n then '90-100%'\n when course_grade >= 0.8 and course_grade < 0.9\n then '80-89%'\n when course_grade >= 0.7 and course_grade < 0.8\n then '70-79%'\n when course_grade >= 0.6 and course_grade < 0.7\n then '60-69%'\n when course_grade >= 0.5 and course_grade < 0.6\n then '50-59%'\n when course_grade >= 0.4 and course_grade < 0.5\n then '40-49%'\n when course_grade >= 0.3 and course_grade < 0.4\n then '30-39%'\n when course_grade >= 0.2 and course_grade < 0.3\n then '20-29%'\n when course_grade >= 0.1 and course_grade < 0.2\n then '10-19%'\n else '0-9%'\n end as grade_bucket,\n users.username as username,\n users.name as name,\n users.email as email,\n fes.emission_time as enrolled_at\nfrom `xapi`.`fact_enrollment_status` fes\nleft join\n `xapi`.`fact_learner_course_status` lg\n on fes.org = lg.org\n and fes.course_key = lg.course_key\n and fes.actor_id = lg.actor_id\nleft join\n `xapi`.`fact_learner_course_grade` ls\n on fes.org = ls.org\n and fes.course_key = ls.course_key\n and fes.actor_id = ls.actor_id\njoin\n `xapi`.`course_names` courses\n on fes.org = courses.org\n and fes.course_key = courses.course_key\nleft outer join\n `xapi`.`dim_user_pii` users on toUUID(actor_id) = users.external_user_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.aspects.fact_problem_responses": {"database": "", "schema": "xapi", "name": "fact_problem_responses", "resource_type": "model", "package_name": "aspects", "path": "problems/fact_problem_responses.sql", "original_file_path": "models/problems/fact_problem_responses.sql", "unique_id": "model.aspects.fact_problem_responses", "fqn": ["aspects", "problems", "fact_problem_responses"], "alias": "fact_problem_responses", "checksum": {"name": "sha256", "checksum": "eb6b76a7274cba5c47c75273374aa21e690b6c6f9ca335dd3db360c827f18b2a"}, "config": {"enabled": true, "alias": null, "schema": null, "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": "One record for each submitted response to a problem", "columns": {"emission_time": {"name": "emission_time", "description": "Timestamp, to the second, of when this event was emitted", "meta": {}, "data_type": "DateTime", "constraints": [], "quote": null, "tags": []}, "org": {"name": "org", "description": "The organization that the course belongs to", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_key": {"name": "course_key", "description": "The course key for the course", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_name": {"name": "course_name", "description": "The name of the course", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_run": {"name": "course_run", "description": "The course run for the course", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "problem_id": {"name": "problem_id", "description": "The problem's unique identifier", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "problem_name": {"name": "problem_name", "description": "The problem's name", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "problem_name_with_location": {"name": "problem_name_with_location", "description": "The problem's display name with section, subsection, and unit prepended to the name. This provides additional context when looking at problem names and can help data consumers understand which problem they are analyzing", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "problem_link": {"name": "problem_link", "description": "An anchor tag with a link to the problem", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "graded": {"name": "graded", "description": "Boolean indicating this block is graded", "meta": {}, "data_type": "bool", "constraints": [], "quote": null, "tags": []}, "actor_id": {"name": "actor_id", "description": "The xAPI actor identifier", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "responses": {"name": "responses", "description": "The responses for this submission. If a problem has multiple parts, values for all parts will be in this field", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "success": {"name": "success", "description": "Boolean indicating whether the responses were correct", "meta": {}, "data_type": "Bool", "constraints": [], "quote": null, "tags": []}, "attempts": {"name": "attempts", "description": "Number indicating which attempt this was", "meta": {}, "data_type": "Int16", "constraints": [], "quote": null, "tags": []}, "interaction_type": {"name": "interaction_type", "description": "The type of interaction - e.g. multiple choice", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "username": {"name": "username", "description": "The username of the learner", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "name": {"name": "name", "description": "The full name of the learner", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "email": {"name": "email", "description": "The email address of the learner", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_order": {"name": "course_order", "description": "The sort order of this block in the course across all course blocks", "meta": {}, "data_type": "Int32", "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "aspects://models/problems/schema.yml", "build_path": null, "unrendered_config": {}, "created_at": 1723756272.3912663, "relation_name": "`xapi`.`fact_problem_responses`", "raw_code": "with\n responses as (\n select\n emission_time,\n org,\n course_key,\n object_id,\n problem_id,\n actor_id,\n responses,\n success,\n attempts,\n interaction_type\n from {{ ref(\"problem_events\") }}\n where verb_id = 'https://w3id.org/xapi/acrossx/verbs/evaluated'\n )\n\nselect\n responses.emission_time as emission_time,\n responses.org as org,\n responses.course_key as course_key,\n blocks.course_name as course_name,\n blocks.course_run as course_run,\n responses.problem_id as problem_id,\n blocks.block_name as problem_name,\n blocks.display_name_with_location as problem_name_with_location,\n {{ a_tag(\"responses.object_id\", \"blocks.block_name\") }} as problem_link,\n blocks.graded as graded,\n course_order as course_order,\n responses.actor_id as actor_id,\n responses.responses as responses,\n responses.success as success,\n responses.attempts as attempts,\n responses.interaction_type as interaction_type,\n users.username as username,\n users.name as name,\n users.email as email\nfrom responses\njoin\n {{ ref(\"dim_course_blocks\") }} blocks\n on (\n responses.course_key = blocks.course_key\n and responses.problem_id = blocks.block_id\n )\nleft outer join\n {{ ref(\"dim_user_pii\") }} users on toUUID(actor_id) = users.external_user_id\ngroup by\n -- multi-part questions include an extra record for the response to the first\n -- part of the question. this group by clause eliminates the duplicate record\n emission_time,\n org,\n course_key,\n course_name,\n course_run,\n problem_id,\n problem_name,\n problem_name_with_location,\n problem_link,\n actor_id,\n responses,\n success,\n attempts,\n course_order,\n graded,\n interaction_type,\n username,\n name,\n email", "language": "sql", "refs": [{"name": "problem_events", "package": null, "version": null}, {"name": "dim_course_blocks", "package": null, "version": null}, {"name": "dim_user_pii", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.aspects.a_tag"], "nodes": ["model.aspects.problem_events", "model.aspects.dim_course_blocks", "model.aspects.dim_user_pii"]}, "compiled_path": "target/compiled/aspects/models/problems/fact_problem_responses.sql", "compiled": true, "compiled_code": "with\n responses as (\n select\n emission_time,\n org,\n course_key,\n object_id,\n problem_id,\n actor_id,\n responses,\n success,\n attempts,\n interaction_type\n from `xapi`.`problem_events`\n where verb_id = 'https://w3id.org/xapi/acrossx/verbs/evaluated'\n )\n\nselect\n responses.emission_time as emission_time,\n responses.org as org,\n responses.course_key as course_key,\n blocks.course_name as course_name,\n blocks.course_run as course_run,\n responses.problem_id as problem_id,\n blocks.block_name as problem_name,\n blocks.display_name_with_location as problem_name_with_location,\n \n concat(\n '', blocks.block_name, ''\n )\n as problem_link,\n blocks.graded as graded,\n course_order as course_order,\n responses.actor_id as actor_id,\n responses.responses as responses,\n responses.success as success,\n responses.attempts as attempts,\n responses.interaction_type as interaction_type,\n users.username as username,\n users.name as name,\n users.email as email\nfrom responses\njoin\n `xapi`.`dim_course_blocks` blocks\n on (\n responses.course_key = blocks.course_key\n and responses.problem_id = blocks.block_id\n )\nleft outer join\n `xapi`.`dim_user_pii` users on toUUID(actor_id) = users.external_user_id\ngroup by\n -- multi-part questions include an extra record for the response to the first\n -- part of the question. this group by clause eliminates the duplicate record\n emission_time,\n org,\n course_key,\n course_name,\n course_run,\n problem_id,\n problem_name,\n problem_name_with_location,\n problem_link,\n actor_id,\n responses,\n success,\n attempts,\n course_order,\n graded,\n interaction_type,\n username,\n name,\n email", "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.aspects.int_problems_per_subsection": {"database": "", "schema": "xapi", "name": "int_problems_per_subsection", "resource_type": "model", "package_name": "aspects", "path": "problems/int_problems_per_subsection.sql", "original_file_path": "models/problems/int_problems_per_subsection.sql", "unique_id": "model.aspects.int_problems_per_subsection", "fqn": ["aspects", "problems", "int_problems_per_subsection"], "alias": "int_problems_per_subsection", "checksum": {"name": "sha256", "checksum": "8ef5aa318ccd2200d1cc3ecd3332004099cdb2050f6d8ff83e98124fdab1ee31"}, "config": {"enabled": true, "alias": null, "schema": null, "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": "A dimension table with the number of problems per subsection", "columns": {"org": {"name": "org", "description": "The organization that the course belongs to", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_key": {"name": "course_key", "description": "The course key for the course", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "section_number": {"name": "section_number", "description": "The location of this section in the course, represented as section:0:0", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "section_with_name": {"name": "section_with_name", "description": "The name of the section this subsection belongs to, with section_number prepended", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "subsection_number": {"name": "subsection_number", "description": "The location of this subsection in the course, represented as section:subsection:0", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "subsection_with_name": {"name": "subsection_with_name", "description": "The name of the subsection, with section_number prepended", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "graded": {"name": "graded", "description": "Whether this subsection block is graded", "meta": {}, "data_type": "bool", "constraints": [], "quote": null, "tags": []}, "item_count": {"name": "item_count", "description": "The number of problems in this subsection", "meta": {}, "data_type": "UInt64", "constraints": [], "quote": null, "tags": []}, "course_order": {"name": "course_order", "description": "The sort order of this block in the course across all course blocks", "meta": {}, "data_type": "Int32", "constraints": [], "quote": null, "tags": []}, "subsection_block_id": {"name": "subsection_block_id", "description": "The unique identifier for the subsection block", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "section_block_id": {"name": "section_block_id", "description": "The unique identifier for the section block", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "aspects://models/problems/schema.yml", "build_path": null, "unrendered_config": {}, "created_at": 1723756272.398332, "relation_name": "`xapi`.`int_problems_per_subsection`", "raw_code": "select * from ({{ items_per_subsection(\"%@problem+block@%\") }})", "language": "sql", "refs": [{"name": "dim_course_blocks", "package": null, "version": null}, {"name": "dim_course_blocks", "package": null, "version": null}, {"name": "dim_course_blocks", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.aspects.items_per_subsection"], "nodes": ["model.aspects.dim_course_blocks"]}, "compiled_path": "target/compiled/aspects/models/problems/int_problems_per_subsection.sql", "compiled": true, "compiled_code": "select * from (\n with\n items_per_subsection as (\n select\n org,\n course_key,\n section_number,\n subsection_number,\n course_order,\n graded,\n count(*) as item_count\n from `xapi`.`dim_course_blocks`\n where block_id like '%@problem+block@%'\n group by\n org, course_key, section_number, subsection_number, course_order, graded\n )\n\n select\n ips.org as org,\n ips.course_key as course_key,\n ips.section_number as section_number,\n section_blocks.display_name_with_location as section_with_name,\n ips.subsection_number as subsection_number,\n subsection_blocks.display_name_with_location as subsection_with_name,\n ips.course_order as course_order,\n ips.graded as graded,\n ips.item_count as item_count,\n subsection_blocks.block_id as subsection_block_id,\n section_blocks.block_id as section_block_id\n from items_per_subsection ips\n left join\n `xapi`.`dim_course_blocks` section_blocks\n on (\n ips.section_number = section_blocks.hierarchy_location\n and ips.org = section_blocks.org\n and ips.course_key = section_blocks.course_key\n and section_blocks.block_id like '%@chapter+block@%'\n )\n left join\n `xapi`.`dim_course_blocks` subsection_blocks\n on (\n ips.subsection_number = subsection_blocks.hierarchy_location\n and ips.org = subsection_blocks.org\n and ips.course_key = subsection_blocks.course_key\n and subsection_blocks.block_id like '%@sequential+block@%'\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.aspects.int_problem_hints": {"database": "", "schema": "xapi", "name": "int_problem_hints", "resource_type": "model", "package_name": "aspects", "path": "problems/int_problem_hints.sql", "original_file_path": "models/problems/int_problem_hints.sql", "unique_id": "model.aspects.int_problem_hints", "fqn": ["aspects", "problems", "int_problem_hints"], "alias": "int_problem_hints", "checksum": {"name": "sha256", "checksum": "4c77d1d17128bfe3f033aedd32977c54f03fb141af58589715fd1efb1b7dec25"}, "config": {"enabled": true, "alias": null, "schema": null, "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": "Internal table for problem hints", "columns": {"emission_time": {"name": "emission_time", "description": "Timestamp, to the second, of when this event was emitted", "meta": {}, "data_type": "DateTime", "constraints": [], "quote": null, "tags": []}, "org": {"name": "org", "description": "The organization that the course belongs to", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_key": {"name": "course_key", "description": "The course key for the course", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_name": {"name": "course_name", "description": "The name of the course", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_run": {"name": "course_run", "description": "The course run for the course", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "problem_id": {"name": "problem_id", "description": "The problem's unique identifier", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "problem_name": {"name": "problem_name", "description": "The problem's name", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "problem_name_with_location": {"name": "problem_name_with_location", "description": "The problem's display name with section, subsection, and unit prepended to the name. This provides additional context when looking at problem names and can help data consumers understand which problem they are analyzing", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "actor_id": {"name": "actor_id", "description": "The xAPI actor identifier", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "help_type": {"name": "help_type", "description": "The type of help requested", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_order": {"name": "course_order", "description": "The sort order of this block in the course across all course blocks", "meta": {}, "data_type": "Int32", "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "aspects://models/problems/schema.yml", "build_path": null, "unrendered_config": {}, "created_at": 1723756272.3926084, "relation_name": "`xapi`.`int_problem_hints`", "raw_code": "with\n hints as (\n select\n emission_time,\n org,\n course_key,\n problem_id,\n actor_id,\n case\n when object_id like '%/hint%'\n then 'hint'\n when object_id like '%/answer%'\n then 'answer'\n else 'N/A'\n end as help_type\n from {{ ref(\"problem_events\") }}\n where verb_id = 'http://adlnet.gov/expapi/verbs/asked'\n )\n\nselect\n hints.emission_time as emission_time,\n hints.org as org,\n hints.course_key as course_key,\n blocks.course_name as course_name,\n blocks.course_run as course_run,\n hints.problem_id as problem_id,\n blocks.block_name as problem_name,\n blocks.display_name_with_location as problem_name_with_location,\n blocks.course_order as course_order,\n hints.actor_id as actor_id,\n hints.help_type as help_type\nfrom hints\njoin\n {{ ref(\"dim_course_blocks\") }} blocks\n on (hints.course_key = blocks.course_key and hints.problem_id = blocks.block_id)", "language": "sql", "refs": [{"name": "problem_events", "package": null, "version": null}, {"name": "dim_course_blocks", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.aspects.problem_events", "model.aspects.dim_course_blocks"]}, "compiled_path": "target/compiled/aspects/models/problems/int_problem_hints.sql", "compiled": true, "compiled_code": "with\n hints as (\n select\n emission_time,\n org,\n course_key,\n problem_id,\n actor_id,\n case\n when object_id like '%/hint%'\n then 'hint'\n when object_id like '%/answer%'\n then 'answer'\n else 'N/A'\n end as help_type\n from `xapi`.`problem_events`\n where verb_id = 'http://adlnet.gov/expapi/verbs/asked'\n )\n\nselect\n hints.emission_time as emission_time,\n hints.org as org,\n hints.course_key as course_key,\n blocks.course_name as course_name,\n blocks.course_run as course_run,\n hints.problem_id as problem_id,\n blocks.block_name as problem_name,\n blocks.display_name_with_location as problem_name_with_location,\n blocks.course_order as course_order,\n hints.actor_id as actor_id,\n hints.help_type as help_type\nfrom hints\njoin\n `xapi`.`dim_course_blocks` blocks\n on (hints.course_key = blocks.course_key and hints.problem_id = blocks.block_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.aspects.subsection_problem_engagement": {"database": "", "schema": "xapi", "name": "subsection_problem_engagement", "resource_type": "model", "package_name": "aspects", "path": "problems/subsection_problem_engagement.sql", "original_file_path": "models/problems/subsection_problem_engagement.sql", "unique_id": "model.aspects.subsection_problem_engagement", "fqn": ["aspects", "problems", "subsection_problem_engagement"], "alias": "subsection_problem_engagement", "checksum": {"name": "sha256", "checksum": "e2921cd8b8b5150a9a22e1bedba8c9a0f3682449e1f39a07d5248ba61e16c322"}, "config": {"enabled": true, "alias": null, "schema": "xapi", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "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", "engine": "\n ReplacingMergeTree()", "order_by": "(org, course_key, subsection_block_id, actor_id)", "primary_key": "(org, course_key)"}, "tags": [], "description": "A record per course per subsection per learner with their engagement level", "columns": {"org": {"name": "org", "description": "The organization that the course belongs to", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_key": {"name": "course_key", "description": "The course key for the course", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "actor_id": {"name": "actor_id", "description": "The xAPI actor identifier", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "subsection_block_id": {"name": "subsection_block_id", "description": "The unique identifier for the subsection block", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "engagement_level": {"name": "engagement_level", "description": "The engagement level of the learner with the subsection", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "aspects://models/problems/schema.yml", "build_path": null, "unrendered_config": {"materialized": "materialized_view", "schema": "xapi", "engine": "\n ReplacingMergeTree()", "primary_key": "(org, course_key)", "order_by": "(org, course_key, subsection_block_id, actor_id)"}, "created_at": 1723756272.4011583, "relation_name": "`xapi`.`subsection_problem_engagement`", "raw_code": "{{\n config(\n materialized=\"materialized_view\",\n schema=env_var(\"ASPECTS_XAPI_DATABASE\", \"xapi\"),\n engine=get_engine(\"ReplacingMergeTree()\"),\n primary_key=\"(org, course_key)\",\n order_by=\"(org, course_key, subsection_block_id, actor_id)\",\n )\n}}\n\nwith\n responses as (\n select\n emission_time,\n org,\n course_key,\n object_id,\n problem_id,\n actor_id,\n responses,\n success,\n attempts,\n interaction_type\n from {{ ref(\"problem_events\") }}\n where verb_id = 'https://w3id.org/xapi/acrossx/verbs/evaluated'\n ),\n fact_problem_responses as (\n select\n responses.emission_time as emission_time,\n responses.org as org,\n responses.course_key as course_key,\n blocks.course_name as course_name,\n responses.problem_id as problem_id,\n blocks.block_name as problem_name,\n blocks.display_name_with_location as problem_name_with_location,\n {{ a_tag(\"responses.object_id\", \"blocks.block_name\") }} as problem_link,\n blocks.graded as graded,\n course_order as course_order,\n responses.actor_id as actor_id,\n responses.responses as responses,\n responses.success as success,\n responses.attempts as attempts,\n responses.interaction_type as interaction_type\n from responses\n join\n {{ ref(\"dim_course_blocks\") }} blocks\n on (\n responses.course_key = blocks.course_key\n and responses.problem_id = blocks.block_id\n )\n group by\n -- multi-part questions include an extra record for the response to the\n -- first\n -- part of the question. this group by clause eliminates the duplicate\n -- record\n emission_time,\n org,\n course_key,\n course_name,\n problem_id,\n problem_name,\n problem_name_with_location,\n problem_link,\n actor_id,\n responses,\n success,\n attempts,\n course_order,\n graded,\n interaction_type\n ),\n attempted_subsection_problems as (\n select distinct\n date(emission_time) as attempted_on,\n org,\n course_key,\n {{ section_from_display(\"problem_name_with_location\") }} as section_number,\n {{ subsection_from_display(\"problem_name_with_location\") }}\n as subsection_number,\n course_order as course_order,\n graded,\n actor_id,\n problem_id\n from fact_problem_responses\n ),\n fact_problem_engagement_per_subsection as (\n select\n attempts.org as org,\n attempts.course_key as course_key,\n problems.section_with_name as section_with_name,\n problems.subsection_with_name as subsection_with_name,\n problems.item_count as item_count,\n attempts.actor_id as actor_id,\n attempts.problem_id as problem_id,\n problems.subsection_block_id as subsection_block_id\n from attempted_subsection_problems attempts\n join\n {{ ref(\"int_problems_per_subsection\") }} problems\n on (\n attempts.org = problems.org\n and attempts.course_key = problems.course_key\n and attempts.section_number = problems.section_number\n and attempts.subsection_number = problems.subsection_number\n )\n ),\n subsection_counts as (\n select\n org,\n course_key,\n section_with_name,\n subsection_with_name,\n actor_id,\n item_count,\n count(distinct problem_id) as problems_attempted,\n case\n when problems_attempted = 0\n then 'No problems attempted yet'\n when problems_attempted = item_count\n then 'All problems attempted'\n else 'At least one problem attempted'\n end as engagement_level,\n subsection_block_id\n from fact_problem_engagement_per_subsection\n group by\n org,\n course_key,\n section_with_name,\n subsection_with_name,\n actor_id,\n item_count,\n subsection_block_id\n )\n\nselect org, course_key, actor_id, subsection_block_id, engagement_level\nfrom subsection_counts", "language": "sql", "refs": [{"name": "problem_events", "package": null, "version": null}, {"name": "dim_course_blocks", "package": null, "version": null}, {"name": "int_problems_per_subsection", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.aspects.get_engine", "macro.aspects.a_tag", "macro.aspects.section_from_display", "macro.aspects.subsection_from_display"], "nodes": ["model.aspects.problem_events", "model.aspects.dim_course_blocks", "model.aspects.int_problems_per_subsection"]}, "compiled_path": "target/compiled/aspects/models/problems/subsection_problem_engagement.sql", "compiled": true, "compiled_code": "\n\nwith\n responses as (\n select\n emission_time,\n org,\n course_key,\n object_id,\n problem_id,\n actor_id,\n responses,\n success,\n attempts,\n interaction_type\n from `xapi`.`problem_events`\n where verb_id = 'https://w3id.org/xapi/acrossx/verbs/evaluated'\n ),\n fact_problem_responses as (\n select\n responses.emission_time as emission_time,\n responses.org as org,\n responses.course_key as course_key,\n blocks.course_name as course_name,\n responses.problem_id as problem_id,\n blocks.block_name as problem_name,\n blocks.display_name_with_location as problem_name_with_location,\n \n concat(\n '', blocks.block_name, ''\n )\n as problem_link,\n blocks.graded as graded,\n course_order as course_order,\n responses.actor_id as actor_id,\n responses.responses as responses,\n responses.success as success,\n responses.attempts as attempts,\n responses.interaction_type as interaction_type\n from responses\n join\n `xapi`.`dim_course_blocks` blocks\n on (\n responses.course_key = blocks.course_key\n and responses.problem_id = blocks.block_id\n )\n group by\n -- multi-part questions include an extra record for the response to the\n -- first\n -- part of the question. this group by clause eliminates the duplicate\n -- record\n emission_time,\n org,\n course_key,\n course_name,\n problem_id,\n problem_name,\n problem_name_with_location,\n problem_link,\n actor_id,\n responses,\n success,\n attempts,\n course_order,\n graded,\n interaction_type\n ),\n attempted_subsection_problems as (\n select distinct\n date(emission_time) as attempted_on,\n org,\n course_key,\n \n concat(\n splitByString(\n ':', splitByString(' - ', problem_name_with_location)[1], 1\n )[1],\n ':0:0'\n )\n as section_number,\n \n concat(\n arrayStringConcat(\n splitByString(\n ':', splitByString(' - ', problem_name_with_location)[1], 2\n ),\n ':'\n ),\n ':0'\n )\n\n as subsection_number,\n course_order as course_order,\n graded,\n actor_id,\n problem_id\n from fact_problem_responses\n ),\n fact_problem_engagement_per_subsection as (\n select\n attempts.org as org,\n attempts.course_key as course_key,\n problems.section_with_name as section_with_name,\n problems.subsection_with_name as subsection_with_name,\n problems.item_count as item_count,\n attempts.actor_id as actor_id,\n attempts.problem_id as problem_id,\n problems.subsection_block_id as subsection_block_id\n from attempted_subsection_problems attempts\n join\n `xapi`.`int_problems_per_subsection` problems\n on (\n attempts.org = problems.org\n and attempts.course_key = problems.course_key\n and attempts.section_number = problems.section_number\n and attempts.subsection_number = problems.subsection_number\n )\n ),\n subsection_counts as (\n select\n org,\n course_key,\n section_with_name,\n subsection_with_name,\n actor_id,\n item_count,\n count(distinct problem_id) as problems_attempted,\n case\n when problems_attempted = 0\n then 'No problems attempted yet'\n when problems_attempted = item_count\n then 'All problems attempted'\n else 'At least one problem attempted'\n end as engagement_level,\n subsection_block_id\n from fact_problem_engagement_per_subsection\n group by\n org,\n course_key,\n section_with_name,\n subsection_with_name,\n actor_id,\n item_count,\n subsection_block_id\n )\n\nselect org, course_key, actor_id, subsection_block_id, engagement_level\nfrom subsection_counts", "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.aspects.section_problem_engagement": {"database": "", "schema": "xapi", "name": "section_problem_engagement", "resource_type": "model", "package_name": "aspects", "path": "problems/section_problem_engagement.sql", "original_file_path": "models/problems/section_problem_engagement.sql", "unique_id": "model.aspects.section_problem_engagement", "fqn": ["aspects", "problems", "section_problem_engagement"], "alias": "section_problem_engagement", "checksum": {"name": "sha256", "checksum": "524c2a33f7ce8786133b9cb05fe6ac139625a4acf4efe26a0173d4217096e0b8"}, "config": {"enabled": true, "alias": null, "schema": "xapi", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "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", "engine": "\n ReplacingMergeTree()", "order_by": "(org, course_key, section_block_id, actor_id)", "primary_key": "(org, course_key)"}, "tags": [], "description": "A record per course per section per learner with their engagement level", "columns": {"org": {"name": "org", "description": "The organization that the course belongs to", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_key": {"name": "course_key", "description": "The course key for the course", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "actor_id": {"name": "actor_id", "description": "The xAPI actor identifier", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "section_block_id": {"name": "section_block_id", "description": "The unique identifier for the section block", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "engagement_level": {"name": "engagement_level", "description": "The engagement level of the learner with the section", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "aspects://models/problems/schema.yml", "build_path": null, "unrendered_config": {"materialized": "materialized_view", "schema": "xapi", "engine": "\n ReplacingMergeTree()", "primary_key": "(org, course_key)", "order_by": "(org, course_key, section_block_id, actor_id)"}, "created_at": 1723756272.4004452, "relation_name": "`xapi`.`section_problem_engagement`", "raw_code": "{{\n config(\n materialized=\"materialized_view\",\n schema=env_var(\"ASPECTS_XAPI_DATABASE\", \"xapi\"),\n engine=get_engine(\"ReplacingMergeTree()\"),\n primary_key=\"(org, course_key)\",\n order_by=\"(org, course_key, section_block_id, actor_id)\",\n )\n}}\n\nwith\n responses as (\n select\n emission_time,\n org,\n course_key,\n object_id,\n problem_id,\n actor_id,\n responses,\n success,\n attempts,\n interaction_type\n from {{ ref(\"problem_events\") }}\n where verb_id = 'https://w3id.org/xapi/acrossx/verbs/evaluated'\n ),\n fact_problem_responses as (\n select\n responses.emission_time as emission_time,\n responses.org as org,\n responses.course_key as course_key,\n blocks.course_name as course_name,\n responses.problem_id as problem_id,\n blocks.block_name as problem_name,\n blocks.display_name_with_location as problem_name_with_location,\n {{ a_tag(\"responses.object_id\", \"blocks.block_name\") }} as problem_link,\n blocks.graded as graded,\n course_order as course_order,\n responses.actor_id as actor_id,\n responses.responses as responses,\n responses.success as success,\n responses.attempts as attempts,\n responses.interaction_type as interaction_type\n from responses\n join\n {{ ref(\"dim_course_blocks\") }} blocks\n on (\n responses.course_key = blocks.course_key\n and responses.problem_id = blocks.block_id\n )\n group by\n -- multi-part questions include an extra record for the response to the\n -- first\n -- part of the question. this group by clause eliminates the duplicate\n -- record\n emission_time,\n org,\n course_key,\n course_name,\n problem_id,\n problem_name,\n problem_name_with_location,\n problem_link,\n actor_id,\n responses,\n success,\n attempts,\n course_order,\n graded,\n interaction_type\n ),\n attempted_subsection_problems as (\n select distinct\n date(emission_time) as attempted_on,\n org,\n course_key,\n {{ section_from_display(\"problem_name_with_location\") }} as section_number,\n {{ subsection_from_display(\"problem_name_with_location\") }}\n as subsection_number,\n course_order as course_order,\n graded,\n actor_id,\n problem_id\n from fact_problem_responses\n ),\n fact_problem_engagement_per_subsection as (\n select\n attempts.org as org,\n attempts.course_key as course_key,\n problems.section_with_name as section_with_name,\n problems.subsection_with_name as subsection_with_name,\n problems.item_count as item_count,\n attempts.actor_id as actor_id,\n attempts.problem_id as problem_id,\n problems.section_block_id as section_block_id\n from attempted_subsection_problems attempts\n join\n {{ ref(\"int_problems_per_subsection\") }} problems\n on (\n attempts.org = problems.org\n and attempts.course_key = problems.course_key\n and attempts.section_number = problems.section_number\n and attempts.subsection_number = problems.subsection_number\n )\n ),\n subsection_counts as (\n select\n org,\n course_key,\n section_with_name,\n subsection_with_name,\n actor_id,\n item_count,\n count(distinct problem_id) as problems_attempted,\n case\n when problems_attempted = 0\n then 'No problems attempted yet'\n when problems_attempted = item_count\n then 'All problems attempted'\n else 'At least one problem attempted'\n end as engagement_level,\n section_block_id\n from fact_problem_engagement_per_subsection\n group by\n org,\n course_key,\n section_with_name,\n subsection_with_name,\n actor_id,\n item_count,\n section_block_id\n ),\n section_counts as (\n select\n org,\n course_key,\n actor_id,\n sum(item_count) as item_count,\n sum(problems_attempted) as problems_attempted,\n case\n when problems_attempted = 0\n then 'No problems attempted yet'\n when problems_attempted = item_count\n then 'All problems attempted'\n else 'At least one problem attempted'\n end as engagement_level,\n section_block_id\n from subsection_counts\n group by org, course_key, section_block_id, actor_id\n )\n\nselect org, course_key, actor_id, section_block_id, engagement_level\nfrom section_counts", "language": "sql", "refs": [{"name": "problem_events", "package": null, "version": null}, {"name": "dim_course_blocks", "package": null, "version": null}, {"name": "int_problems_per_subsection", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.aspects.get_engine", "macro.aspects.a_tag", "macro.aspects.section_from_display", "macro.aspects.subsection_from_display"], "nodes": ["model.aspects.problem_events", "model.aspects.dim_course_blocks", "model.aspects.int_problems_per_subsection"]}, "compiled_path": "target/compiled/aspects/models/problems/section_problem_engagement.sql", "compiled": true, "compiled_code": "\n\nwith\n responses as (\n select\n emission_time,\n org,\n course_key,\n object_id,\n problem_id,\n actor_id,\n responses,\n success,\n attempts,\n interaction_type\n from `xapi`.`problem_events`\n where verb_id = 'https://w3id.org/xapi/acrossx/verbs/evaluated'\n ),\n fact_problem_responses as (\n select\n responses.emission_time as emission_time,\n responses.org as org,\n responses.course_key as course_key,\n blocks.course_name as course_name,\n responses.problem_id as problem_id,\n blocks.block_name as problem_name,\n blocks.display_name_with_location as problem_name_with_location,\n \n concat(\n '', blocks.block_name, ''\n )\n as problem_link,\n blocks.graded as graded,\n course_order as course_order,\n responses.actor_id as actor_id,\n responses.responses as responses,\n responses.success as success,\n responses.attempts as attempts,\n responses.interaction_type as interaction_type\n from responses\n join\n `xapi`.`dim_course_blocks` blocks\n on (\n responses.course_key = blocks.course_key\n and responses.problem_id = blocks.block_id\n )\n group by\n -- multi-part questions include an extra record for the response to the\n -- first\n -- part of the question. this group by clause eliminates the duplicate\n -- record\n emission_time,\n org,\n course_key,\n course_name,\n problem_id,\n problem_name,\n problem_name_with_location,\n problem_link,\n actor_id,\n responses,\n success,\n attempts,\n course_order,\n graded,\n interaction_type\n ),\n attempted_subsection_problems as (\n select distinct\n date(emission_time) as attempted_on,\n org,\n course_key,\n \n concat(\n splitByString(\n ':', splitByString(' - ', problem_name_with_location)[1], 1\n )[1],\n ':0:0'\n )\n as section_number,\n \n concat(\n arrayStringConcat(\n splitByString(\n ':', splitByString(' - ', problem_name_with_location)[1], 2\n ),\n ':'\n ),\n ':0'\n )\n\n as subsection_number,\n course_order as course_order,\n graded,\n actor_id,\n problem_id\n from fact_problem_responses\n ),\n fact_problem_engagement_per_subsection as (\n select\n attempts.org as org,\n attempts.course_key as course_key,\n problems.section_with_name as section_with_name,\n problems.subsection_with_name as subsection_with_name,\n problems.item_count as item_count,\n attempts.actor_id as actor_id,\n attempts.problem_id as problem_id,\n problems.section_block_id as section_block_id\n from attempted_subsection_problems attempts\n join\n `xapi`.`int_problems_per_subsection` problems\n on (\n attempts.org = problems.org\n and attempts.course_key = problems.course_key\n and attempts.section_number = problems.section_number\n and attempts.subsection_number = problems.subsection_number\n )\n ),\n subsection_counts as (\n select\n org,\n course_key,\n section_with_name,\n subsection_with_name,\n actor_id,\n item_count,\n count(distinct problem_id) as problems_attempted,\n case\n when problems_attempted = 0\n then 'No problems attempted yet'\n when problems_attempted = item_count\n then 'All problems attempted'\n else 'At least one problem attempted'\n end as engagement_level,\n section_block_id\n from fact_problem_engagement_per_subsection\n group by\n org,\n course_key,\n section_with_name,\n subsection_with_name,\n actor_id,\n item_count,\n section_block_id\n ),\n section_counts as (\n select\n org,\n course_key,\n actor_id,\n sum(item_count) as item_count,\n sum(problems_attempted) as problems_attempted,\n case\n when problems_attempted = 0\n then 'No problems attempted yet'\n when problems_attempted = item_count\n then 'All problems attempted'\n else 'At least one problem attempted'\n end as engagement_level,\n section_block_id\n from subsection_counts\n group by org, course_key, section_block_id, actor_id\n )\n\nselect org, course_key, actor_id, section_block_id, engagement_level\nfrom section_counts", "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.aspects.responses": {"database": "", "schema": "xapi", "name": "responses", "resource_type": "model", "package_name": "aspects", "path": "problems/responses.sql", "original_file_path": "models/problems/responses.sql", "unique_id": "model.aspects.responses", "fqn": ["aspects", "problems", "responses"], "alias": "responses", "checksum": {"name": "sha256", "checksum": "740ef52e23ba2baf158991a2637f2f6636cc82690de11ed734f8cbd536a411f3"}, "config": {"enabled": true, "alias": null, "schema": "xapi", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "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", "engine": "\n ReplacingMergeTree()", "order_by": "(org, course_key, problem_id, actor_id)", "partition_by": "toYYYYMM(emission_time)", "ttl": "", "primary_key": "(org, course_key, problem_id)"}, "tags": [], "description": "A record per course per problem per learner with their last attempt and first success", "columns": {"org": {"name": "org", "description": "The organization that the course belongs to", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_key": {"name": "course_key", "description": "The course key for the course", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "problem_id": {"name": "problem_id", "description": "The problem's unique identifier", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "actor_id": {"name": "actor_id", "description": "The xAPI actor identifier", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "first_success_at": {"name": "first_success_at", "description": "The timestamp of the first successful attempt", "meta": {}, "data_type": "Nullable(DateTime)", "constraints": [], "quote": null, "tags": []}, "last_attempt_at": {"name": "last_attempt_at", "description": "The timestamp of the last attempt", "meta": {}, "data_type": "DateTime", "constraints": [], "quote": null, "tags": []}, "emission_time": {"name": "emission_time", "description": "The timestamp of the last attempt or the first successful attempt", "meta": {}, "data_type": "DateTime", "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "aspects://models/problems/schema.yml", "build_path": null, "unrendered_config": {"materialized": "materialized_view", "schema": "xapi", "engine": "\n ReplacingMergeTree()", "primary_key": "(org, course_key, problem_id)", "order_by": "(org, course_key, problem_id, actor_id)", "partition_by": "toYYYYMM(emission_time)", "ttl": ""}, "created_at": 1723756272.3995385, "relation_name": "`xapi`.`responses`", "raw_code": "-- select one record per (learner, problem, course, org) tuple\n-- contains either the first successful attempt\n-- or the most recent unsuccessful attempt\n-- find the timestamp of the earliest successful response\n-- this will be used to pick the xAPI event corresponding to that submission\n{{\n config(\n materialized=\"materialized_view\",\n schema=env_var(\"ASPECTS_XAPI_DATABASE\", \"xapi\"),\n engine=get_engine(\"ReplacingMergeTree()\"),\n primary_key=\"(org, course_key, problem_id)\",\n order_by=\"(org, course_key, problem_id, actor_id)\",\n partition_by=\"toYYYYMM(emission_time)\",\n ttl=env_var(\"ASPECTS_DATA_TTL_EXPRESSION\", \"\"),\n )\n}}\n\nwith\n responses as (\n select emission_time, org, course_key, object_id, problem_id, actor_id, success\n from {{ ref(\"problem_events\") }}\n where verb_id = 'https://w3id.org/xapi/acrossx/verbs/evaluated'\n ),\n response_status as (\n select\n org,\n course_key,\n problem_id,\n actor_id,\n MIN(case when success then emission_time else NULL end) as first_success_at,\n MAX(emission_time) as last_attempt_at\n from responses\n group by org, course_key, problem_id, actor_id\n )\nselect\n org,\n course_key,\n problem_id,\n actor_id,\n first_success_at,\n last_attempt_at,\n coalesce(first_success_at, last_attempt_at) as emission_time\nfrom response_status", "language": "sql", "refs": [{"name": "problem_events", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.aspects.get_engine"], "nodes": ["model.aspects.problem_events"]}, "compiled_path": "target/compiled/aspects/models/problems/responses.sql", "compiled": true, "compiled_code": "-- select one record per (learner, problem, course, org) tuple\n-- contains either the first successful attempt\n-- or the most recent unsuccessful attempt\n-- find the timestamp of the earliest successful response\n-- this will be used to pick the xAPI event corresponding to that submission\n\n\nwith\n responses as (\n select emission_time, org, course_key, object_id, problem_id, actor_id, success\n from `xapi`.`problem_events`\n where verb_id = 'https://w3id.org/xapi/acrossx/verbs/evaluated'\n ),\n response_status as (\n select\n org,\n course_key,\n problem_id,\n actor_id,\n MIN(case when success then emission_time else NULL end) as first_success_at,\n MAX(emission_time) as last_attempt_at\n from responses\n group by org, course_key, problem_id, actor_id\n )\nselect\n org,\n course_key,\n problem_id,\n actor_id,\n first_success_at,\n last_attempt_at,\n coalesce(first_success_at, last_attempt_at) as emission_time\nfrom response_status", "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.aspects.problem_events": {"database": "", "schema": "xapi", "name": "problem_events", "resource_type": "model", "package_name": "aspects", "path": "problems/problem_events.sql", "original_file_path": "models/problems/problem_events.sql", "unique_id": "model.aspects.problem_events", "fqn": ["aspects", "problems", "problem_events"], "alias": "problem_events", "checksum": {"name": "sha256", "checksum": "8ae3c62c7630e40ba807a70bfcea0d1a95a14cd83d1add4e2603ac7bffb805e9"}, "config": {"enabled": true, "alias": null, "schema": "xapi", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "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", "engine": "\n ReplacingMergeTree()", "order_by": "(org, course_key, verb_id, emission_time, actor_id, object_id, responses, success, event_id)", "partition_by": "(toYYYYMM(emission_time))", "ttl": "", "primary_key": "(org, course_key, verb_id)"}, "tags": [], "description": "Problem events", "columns": {"event_id": {"name": "event_id", "description": "The unique identifier for the event", "meta": {}, "data_type": "UUID", "constraints": [], "quote": null, "tags": []}, "emission_time": {"name": "emission_time", "description": "The time the event was emitted", "meta": {}, "data_type": "DateTime", "constraints": [], "quote": null, "tags": []}, "actor_id": {"name": "actor_id", "description": "The xAPI actor identifier", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "object_id": {"name": "object_id", "description": "The xAPI object identifier", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_key": {"name": "course_key", "description": "The course identifier", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "org": {"name": "org", "description": "The organization that the course belongs to", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "verb_id": {"name": "verb_id", "description": "The xAPI verb identifier", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "responses": {"name": "responses", "description": "The responses for this submission. If a problem has multiple parts, values for all parts will be in this field", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "scaled_score": {"name": "scaled_score", "description": "A ratio between 0 and 1, inclusive, of the learner's grade", "meta": {}, "data_type": "Float32", "constraints": [], "quote": null, "tags": []}, "success": {"name": "success", "description": "Boolean indicating whether the responses were correct", "meta": {}, "data_type": "Boolean", "constraints": [], "quote": null, "tags": []}, "interaction_type": {"name": "interaction_type", "description": "The type of interaction", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "attempts": {"name": "attempts", "description": "Number indicating which attempt this was", "meta": {}, "data_type": "Int16", "constraints": [], "quote": null, "tags": []}, "problem_id": {"name": "problem_id", "description": "The problem's unique identifier", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "aspects://models/problems/schema.yml", "build_path": null, "unrendered_config": {"materialized": "materialized_view", "schema": "xapi", "engine": "\n ReplacingMergeTree()", "primary_key": "(org, course_key, verb_id)", "order_by": "(org, course_key, verb_id, emission_time, actor_id, object_id, responses, success, event_id)", "partition_by": "(toYYYYMM(emission_time))", "ttl": ""}, "created_at": 1723756272.3952844, "relation_name": "`xapi`.`problem_events`", "raw_code": "{{\n config(\n materialized=\"materialized_view\",\n schema=env_var(\"ASPECTS_XAPI_DATABASE\", \"xapi\"),\n engine=get_engine(\"ReplacingMergeTree()\"),\n primary_key=\"(org, course_key, verb_id)\",\n order_by=\"(org, course_key, verb_id, emission_time, actor_id, object_id, responses, success, event_id)\",\n partition_by=\"(toYYYYMM(emission_time))\",\n ttl=env_var(\"ASPECTS_DATA_TTL_EXPRESSION\", \"\"),\n )\n}}\n\nselect\n event_id,\n cast(emission_time as DateTime) as emission_time,\n actor_id,\n object_id,\n course_key,\n org,\n verb_id,\n JSON_VALUE(event, '$.result.response') as responses,\n JSONExtractFloat(event, 'result', 'score', 'scaled') as scaled_score,\n if(\n verb_id = 'https://w3id.org/xapi/acrossx/verbs/evaluated',\n cast(JSON_VALUE(event, '$.result.success') as Bool),\n false\n ) as success,\n toLowCardinality(\n JSON_VALUE(event, '$.object.definition.interactionType')\n ) as interaction_type,\n if(\n verb_id = 'https://w3id.org/xapi/acrossx/verbs/evaluated',\n cast(\n JSON_VALUE(\n event,\n '$.object.definition.extensions.\"http://id.tincanapi.com/extension/attempt-id\"'\n ) as Int16\n ),\n 0\n ) as attempts,\n {{ get_problem_id(\"object_id\") }} as problem_id\nfrom {{ ref(\"xapi_events_all_parsed\") }}\nwhere\n verb_id in (\n 'https://w3id.org/xapi/acrossx/verbs/evaluated',\n 'http://adlnet.gov/expapi/verbs/passed',\n 'http://adlnet.gov/expapi/verbs/asked'\n )", "language": "sql", "refs": [{"name": "xapi_events_all_parsed", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.aspects.get_engine", "macro.aspects.get_problem_id"], "nodes": ["model.aspects.xapi_events_all_parsed"]}, "compiled_path": "target/compiled/aspects/models/problems/problem_events.sql", "compiled": true, "compiled_code": "\n\nselect\n event_id,\n cast(emission_time as DateTime) as emission_time,\n actor_id,\n object_id,\n course_key,\n org,\n verb_id,\n JSON_VALUE(event, '$.result.response') as responses,\n JSONExtractFloat(event, 'result', 'score', 'scaled') as scaled_score,\n if(\n verb_id = 'https://w3id.org/xapi/acrossx/verbs/evaluated',\n cast(JSON_VALUE(event, '$.result.success') as Bool),\n false\n ) as success,\n toLowCardinality(\n JSON_VALUE(event, '$.object.definition.interactionType')\n ) as interaction_type,\n if(\n verb_id = 'https://w3id.org/xapi/acrossx/verbs/evaluated',\n cast(\n JSON_VALUE(\n event,\n '$.object.definition.extensions.\"http://id.tincanapi.com/extension/attempt-id\"'\n ) as Int16\n ),\n 0\n ) as attempts,\n \n regexpExtract(\n object_id, 'xblock/([\\w\\d-\\+:@]*@problem\\+block@[\\w\\d][^_\\/]*)(_\\d_\\d)?', 1\n )\n as problem_id\nfrom `xapi`.`xapi_events_all_parsed`\nwhere\n verb_id in (\n 'https://w3id.org/xapi/acrossx/verbs/evaluated',\n 'http://adlnet.gov/expapi/verbs/passed',\n 'http://adlnet.gov/expapi/verbs/asked'\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.aspects.int_problem_results": {"database": "", "schema": "xapi", "name": "int_problem_results", "resource_type": "model", "package_name": "aspects", "path": "problems/int_problem_results.sql", "original_file_path": "models/problems/int_problem_results.sql", "unique_id": "model.aspects.int_problem_results", "fqn": ["aspects", "problems", "int_problem_results"], "alias": "int_problem_results", "checksum": {"name": "sha256", "checksum": "77b3a3ce55db9521350c6f946389c62076d558b6dfbc55a05dcc398067391772"}, "config": {"enabled": true, "alias": null, "schema": null, "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": "Internal table for problem results", "columns": {"emission_time": {"name": "emission_time", "description": "Timestamp, to the second, of when this event was emitted", "meta": {}, "data_type": "DateTime", "constraints": [], "quote": null, "tags": []}, "org": {"name": "org", "description": "The organization that the course belongs to", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_key": {"name": "course_key", "description": "The course key for the course", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_name": {"name": "course_name", "description": "The name of the course", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_run": {"name": "course_run", "description": "The course run for the course", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "problem_id": {"name": "problem_id", "description": "The problem's unique identifier", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "problem_name": {"name": "problem_name", "description": "The problem's name", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "problem_name_with_location": {"name": "problem_name_with_location", "description": "The problem's display name with section, subsection, and unit prepended to the name. This provides additional context when looking at problem names and can help data consumers understand which problem they are analyzing", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "problem_link": {"name": "problem_link", "description": "An anchor tag with a link to the problem", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "actor_id": {"name": "actor_id", "description": "The xAPI actor identifier", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "responses": {"name": "responses", "description": "The responses for this submission. If a problem has multiple parts, values for all parts will be in this field", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "success": {"name": "success", "description": "Boolean indicating whether the responses were correct", "meta": {}, "data_type": "bool", "constraints": [], "quote": null, "tags": []}, "attempts": {"name": "attempts", "description": "Number indicating which attempt this was", "meta": {}, "data_type": "Int16", "constraints": [], "quote": null, "tags": []}, "graded": {"name": "graded", "description": "Boolean indicating this block is graded", "meta": {}, "data_type": "bool", "constraints": [], "quote": null, "tags": []}, "interaction_type": {"name": "interaction_type", "description": "The type of interaction - e.g. multiple choice", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_order": {"name": "course_order", "description": "The sort order of this block in the course across all course blocks", "meta": {}, "data_type": "Int32", "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "aspects://models/problems/schema.yml", "build_path": null, "unrendered_config": {}, "created_at": 1723756272.3937, "relation_name": "`xapi`.`int_problem_results`", "raw_code": "-- select one record per (learner, problem, course, org) tuple\n-- contains either the first successful attempt\n-- or the most recent unsuccessful attempt\n-- find the timestamp of the earliest successful response\n-- this will be used to pick the xAPI event corresponding to that submission\nwith\n full_responses as (\n select\n events.emission_time as emission_time,\n events.org as org,\n events.course_key as course_key,\n events.problem_id as problem_id,\n events.object_id as object_id,\n events.actor_id as actor_id,\n events.responses as responses,\n events.success as success,\n events.attempts as attempts,\n events.interaction_type as interaction_type\n from {{ ref(\"problem_events\") }} events\n join\n {{ ref(\"responses\") }} using (\n org, course_key, problem_id, actor_id, emission_time\n )\n )\n\nselect\n full_responses.emission_time as emission_time,\n full_responses.org as org,\n full_responses.course_key as course_key,\n blocks.course_name as course_name,\n blocks.course_run as course_run,\n full_responses.problem_id as problem_id,\n blocks.block_name as problem_name,\n blocks.display_name_with_location as problem_name_with_location,\n blocks.course_order as course_order,\n {{ a_tag(\"full_responses.object_id\", \"blocks.block_name\") }} as problem_link,\n full_responses.actor_id as actor_id,\n full_responses.responses as responses,\n full_responses.success as success,\n full_responses.attempts as attempts,\n full_responses.interaction_type as interaction_type,\n blocks.graded\nfrom full_responses\njoin\n {{ ref(\"dim_course_blocks\") }} blocks\n on (\n full_responses.course_key = blocks.course_key\n and full_responses.problem_id = blocks.block_id\n )", "language": "sql", "refs": [{"name": "problem_events", "package": null, "version": null}, {"name": "responses", "package": null, "version": null}, {"name": "dim_course_blocks", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.aspects.a_tag"], "nodes": ["model.aspects.problem_events", "model.aspects.responses", "model.aspects.dim_course_blocks"]}, "compiled_path": "target/compiled/aspects/models/problems/int_problem_results.sql", "compiled": true, "compiled_code": "-- select one record per (learner, problem, course, org) tuple\n-- contains either the first successful attempt\n-- or the most recent unsuccessful attempt\n-- find the timestamp of the earliest successful response\n-- this will be used to pick the xAPI event corresponding to that submission\nwith\n full_responses as (\n select\n events.emission_time as emission_time,\n events.org as org,\n events.course_key as course_key,\n events.problem_id as problem_id,\n events.object_id as object_id,\n events.actor_id as actor_id,\n events.responses as responses,\n events.success as success,\n events.attempts as attempts,\n events.interaction_type as interaction_type\n from `xapi`.`problem_events` events\n join\n `xapi`.`responses` using (\n org, course_key, problem_id, actor_id, emission_time\n )\n )\n\nselect\n full_responses.emission_time as emission_time,\n full_responses.org as org,\n full_responses.course_key as course_key,\n blocks.course_name as course_name,\n blocks.course_run as course_run,\n full_responses.problem_id as problem_id,\n blocks.block_name as problem_name,\n blocks.display_name_with_location as problem_name_with_location,\n blocks.course_order as course_order,\n \n concat(\n '', blocks.block_name, ''\n )\n as problem_link,\n full_responses.actor_id as actor_id,\n full_responses.responses as responses,\n full_responses.success as success,\n full_responses.attempts as attempts,\n full_responses.interaction_type as interaction_type,\n blocks.graded\nfrom full_responses\njoin\n `xapi`.`dim_course_blocks` blocks\n on (\n full_responses.course_key = blocks.course_key\n and full_responses.problem_id = blocks.block_id\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.aspects.xapi_events_all_parsed": {"database": "", "schema": "xapi", "name": "xapi_events_all_parsed", "resource_type": "model", "package_name": "aspects", "path": "base/xapi_events_all_parsed.sql", "original_file_path": "models/base/xapi_events_all_parsed.sql", "unique_id": "model.aspects.xapi_events_all_parsed", "fqn": ["aspects", "base", "xapi_events_all_parsed"], "alias": "xapi_events_all_parsed", "checksum": {"name": "sha256", "checksum": "424b48a5e299cf1bc431b66c79dfcec02800dea174a774717b5ad5782a91216a"}, "config": {"enabled": true, "alias": null, "schema": "xapi", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "materialized_view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "OPTIMIZE TABLE {{ this }} {{ on_cluster() }} FINAL", "transaction": true, "index": null}], "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", "engine": "\n ReplacingMergeTree()", "order_by": "(org, course_id, verb_id, actor_id, emission_time, event_id)", "partition_by": "(toYYYYMM(emission_time))", "ttl": "", "primary_key": "(org, course_id, verb_id, actor_id, emission_time, event_id)"}, "tags": [], "description": "A materialized view for xAPI events", "columns": {"event_id": {"name": "event_id", "description": "The unique identifier for the event", "meta": {}, "data_type": "UUID", "constraints": [], "quote": null, "tags": []}, "verb_id": {"name": "verb_id", "description": "The xAPI verb identifier", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "actor_id": {"name": "actor_id", "description": "The xAPI actor identifier", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "object_id": {"name": "object_id", "description": "The xAPI object identifier", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_id": {"name": "course_id", "description": "The fully-qualified course identifier URL", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_key": {"name": "course_key", "description": "The course key for the course", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "org": {"name": "org", "description": "The organization that the course belongs to", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "emission_time": {"name": "emission_time", "description": "The time the event was emitted", "meta": {}, "data_type": "DateTime64(6)", "constraints": [], "quote": null, "tags": []}, "event": {"name": "event", "description": "The xAPI event as a String", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "aspects://models/base/schema.yml", "build_path": null, "unrendered_config": {"materialized": "materialized_view", "schema": "xapi", "engine": "\n ReplacingMergeTree()", "primary_key": "(org, course_id, verb_id, actor_id, emission_time, event_id)", "order_by": "(org, course_id, verb_id, actor_id, emission_time, event_id)", "partition_by": "(toYYYYMM(emission_time))", "ttl": "", "post-hook": ["OPTIMIZE TABLE {{ this }} {{ on_cluster() }} FINAL"]}, "created_at": 1723756272.4129872, "relation_name": "`xapi`.`xapi_events_all_parsed`", "raw_code": "{{\n config(\n materialized=\"materialized_view\",\n schema=env_var(\"ASPECTS_XAPI_DATABASE\", \"xapi\"),\n engine=get_engine(\"ReplacingMergeTree()\"),\n primary_key=\"(org, course_id, verb_id, actor_id, emission_time, event_id)\",\n order_by=\"(org, course_id, verb_id, actor_id, emission_time, event_id)\",\n partition_by=\"(toYYYYMM(emission_time))\",\n ttl=env_var(\"ASPECTS_DATA_TTL_EXPRESSION\", \"\"),\n post_hook=\"OPTIMIZE TABLE {{ this }} {{ on_cluster() }} FINAL\",\n )\n}}\n\nselect\n event_id as event_id,\n toLowCardinality(JSON_VALUE(event::String, '$.verb.id')) as verb_id,\n COALESCE(\n NULLIF(JSON_VALUE(event::String, '$.actor.account.name'), ''),\n NULLIF(JSON_VALUE(event::String, '$.actor.mbox'), ''),\n JSON_VALUE(event::String, '$.actor.mbox_sha1sum')\n ) as actor_id,\n JSON_VALUE(event::String, '$.object.id') as object_id,\n -- If the contextActivities parent is a course, use that. It can be a \"course\"\n -- type, or a \"cmi.interaction\" type for multiple question problem submissions.\n -- Otherwise use the object id for the course id.\n toLowCardinality(\n multiIf(\n -- If the contextActivities parent is a course, use that\n JSON_VALUE(\n event::String, '$.context.contextActivities.parent[0].definition.type'\n )\n = 'http://adlnet.gov/expapi/activities/course',\n JSON_VALUE(event::String, '$.context.contextActivities.parent[0].id'),\n -- Else if the contextActivities parent is a GroupActivity, it's a multi\n -- question problem and we use the grouping id\n JSON_VALUE(\n event::String, '$.context.contextActivities.parent[0].objectType'\n )\n in ('Activity', 'GroupActivity'),\n JSON_VALUE(event::String, '$.context.contextActivities.grouping[0].id'),\n -- Otherwise use the object id\n JSON_VALUE(event::String, '$.object.id')\n )\n ) as course_id,\n toLowCardinality(splitByString('/', course_id)[-1]) as course_key,\n toLowCardinality(\n coalesce(\n get_org_from_course_url(course_id),\n get_org_from_ccx_course_url(course_id),\n ''\n )\n ) as org,\n emission_time as emission_time,\n event::String as event\nfrom {{ source(\"xapi\", \"xapi_events_all\") }}", "language": "sql", "refs": [], "sources": [["xapi", "xapi_events_all"]], "metrics": [], "depends_on": {"macros": ["macro.aspects.get_engine", "macro.aspects.on_cluster"], "nodes": ["source.aspects.xapi.xapi_events_all"]}, "compiled_path": "target/compiled/aspects/models/base/xapi_events_all_parsed.sql", "compiled": true, "compiled_code": "\n\nselect\n event_id as event_id,\n toLowCardinality(JSON_VALUE(event::String, '$.verb.id')) as verb_id,\n COALESCE(\n NULLIF(JSON_VALUE(event::String, '$.actor.account.name'), ''),\n NULLIF(JSON_VALUE(event::String, '$.actor.mbox'), ''),\n JSON_VALUE(event::String, '$.actor.mbox_sha1sum')\n ) as actor_id,\n JSON_VALUE(event::String, '$.object.id') as object_id,\n -- If the contextActivities parent is a course, use that. It can be a \"course\"\n -- type, or a \"cmi.interaction\" type for multiple question problem submissions.\n -- Otherwise use the object id for the course id.\n toLowCardinality(\n multiIf(\n -- If the contextActivities parent is a course, use that\n JSON_VALUE(\n event::String, '$.context.contextActivities.parent[0].definition.type'\n )\n = 'http://adlnet.gov/expapi/activities/course',\n JSON_VALUE(event::String, '$.context.contextActivities.parent[0].id'),\n -- Else if the contextActivities parent is a GroupActivity, it's a multi\n -- question problem and we use the grouping id\n JSON_VALUE(\n event::String, '$.context.contextActivities.parent[0].objectType'\n )\n in ('Activity', 'GroupActivity'),\n JSON_VALUE(event::String, '$.context.contextActivities.grouping[0].id'),\n -- Otherwise use the object id\n JSON_VALUE(event::String, '$.object.id')\n )\n ) as course_id,\n toLowCardinality(splitByString('/', course_id)[-1]) as course_key,\n toLowCardinality(\n coalesce(\n get_org_from_course_url(course_id),\n get_org_from_ccx_course_url(course_id),\n ''\n )\n ) as org,\n emission_time as emission_time,\n event::String as event\nfrom `xapi`.`xapi_events_all`", "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.aspects.int_pages_per_subsection": {"database": "", "schema": "xapi", "name": "int_pages_per_subsection", "resource_type": "model", "package_name": "aspects", "path": "navigation/int_pages_per_subsection.sql", "original_file_path": "models/navigation/int_pages_per_subsection.sql", "unique_id": "model.aspects.int_pages_per_subsection", "fqn": ["aspects", "navigation", "int_pages_per_subsection"], "alias": "int_pages_per_subsection", "checksum": {"name": "sha256", "checksum": "157337fb72683a82aa1c9dc95d1885038ba643c3bc17224fed8736f1d7044bc3"}, "config": {"enabled": true, "alias": null, "schema": null, "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": "A view for analyzing the number of pages in each subsection", "columns": {"org": {"name": "org", "description": "The organization that the course belongs to", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_key": {"name": "course_key", "description": "The course identifier", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "section_number": {"name": "section_number", "description": "The section number", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "section_with_name": {"name": "section_with_name", "description": "The section number and name", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "subsection_number": {"name": "subsection_number", "description": "The subsection number", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "subsection_with_name": {"name": "subsection_with_name", "description": "The subsection number and name", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_order": {"name": "course_order", "description": "The sort order of this block in the course across all course blocks", "meta": {}, "data_type": "Int32", "constraints": [], "quote": null, "tags": []}, "graded": {"name": "graded", "description": "Whether the unit is graded", "meta": {}, "data_type": "Boolean", "constraints": [], "quote": null, "tags": []}, "item_count": {"name": "item_count", "description": "The number of pages in the associated subsection", "meta": {}, "data_type": "UInt64", "constraints": [], "quote": null, "tags": []}, "subsection_block_id": {"name": "subsection_block_id", "description": "The unique identifier for the subsection block", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "section_block_id": {"name": "section_block_id", "description": "The unique identifier for the section block", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "aspects://models/navigation/schema.yml", "build_path": null, "unrendered_config": {}, "created_at": 1723756272.4204118, "relation_name": "`xapi`.`int_pages_per_subsection`", "raw_code": "select * from ({{ items_per_subsection(\"%@vertical+block@%\") }})", "language": "sql", "refs": [{"name": "dim_course_blocks", "package": null, "version": null}, {"name": "dim_course_blocks", "package": null, "version": null}, {"name": "dim_course_blocks", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.aspects.items_per_subsection"], "nodes": ["model.aspects.dim_course_blocks"]}, "compiled_path": "target/compiled/aspects/models/navigation/int_pages_per_subsection.sql", "compiled": true, "compiled_code": "select * from (\n with\n items_per_subsection as (\n select\n org,\n course_key,\n section_number,\n subsection_number,\n course_order,\n graded,\n count(*) as item_count\n from `xapi`.`dim_course_blocks`\n where block_id like '%@vertical+block@%'\n group by\n org, course_key, section_number, subsection_number, course_order, graded\n )\n\n select\n ips.org as org,\n ips.course_key as course_key,\n ips.section_number as section_number,\n section_blocks.display_name_with_location as section_with_name,\n ips.subsection_number as subsection_number,\n subsection_blocks.display_name_with_location as subsection_with_name,\n ips.course_order as course_order,\n ips.graded as graded,\n ips.item_count as item_count,\n subsection_blocks.block_id as subsection_block_id,\n section_blocks.block_id as section_block_id\n from items_per_subsection ips\n left join\n `xapi`.`dim_course_blocks` section_blocks\n on (\n ips.section_number = section_blocks.hierarchy_location\n and ips.org = section_blocks.org\n and ips.course_key = section_blocks.course_key\n and section_blocks.block_id like '%@chapter+block@%'\n )\n left join\n `xapi`.`dim_course_blocks` subsection_blocks\n on (\n ips.subsection_number = subsection_blocks.hierarchy_location\n and ips.org = subsection_blocks.org\n and ips.course_key = subsection_blocks.course_key\n and subsection_blocks.block_id like '%@sequential+block@%'\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.aspects.fact_learner_last_course_visit": {"database": "", "schema": "xapi", "name": "fact_learner_last_course_visit", "resource_type": "model", "package_name": "aspects", "path": "navigation/fact_learner_last_course_visit.sql", "original_file_path": "models/navigation/fact_learner_last_course_visit.sql", "unique_id": "model.aspects.fact_learner_last_course_visit", "fqn": ["aspects", "navigation", "fact_learner_last_course_visit"], "alias": "fact_learner_last_course_visit", "checksum": {"name": "sha256", "checksum": "1742158805f568d348f81e63dc240faa230563f6da0943f11a22d5113c64f20b"}, "config": {"enabled": true, "alias": null, "schema": "xapi", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "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", "engine": "\n ReplacingMergeTree()", "order_by": "(org, course_key, actor_id)", "partition_by": "(toYYYYMM(emission_time))", "ttl": "", "primary_key": "(org, course_key, actor_id)"}, "tags": [], "description": "A materialized view that stores a learners last navigation event timestamp for a course", "columns": {"org": {"name": "org", "description": "The organization that the course belongs to", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_key": {"name": "course_key", "description": "The course identifier", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "actor_id": {"name": "actor_id", "description": "The xAPI actor identifier", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "emission_time": {"name": "emission_time", "description": "Timestamp, to the second, of when this event was emitted", "meta": {}, "data_type": "DateTime", "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "aspects://models/navigation/schema.yml", "build_path": null, "unrendered_config": {"materialized": "materialized_view", "schema": "xapi", "engine": "\n ReplacingMergeTree()", "primary_key": "(org, course_key, actor_id)", "order_by": "(org, course_key, actor_id)", "partition_by": "(toYYYYMM(emission_time))", "ttl": ""}, "created_at": 1723756272.4228902, "relation_name": "`xapi`.`fact_learner_last_course_visit`", "raw_code": "{{\n config(\n materialized=\"materialized_view\",\n schema=env_var(\"ASPECTS_XAPI_DATABASE\", \"xapi\"),\n engine=get_engine(\"ReplacingMergeTree()\"),\n primary_key=\"(org, course_key, actor_id)\",\n order_by=\"(org, course_key, actor_id)\",\n partition_by=\"(toYYYYMM(emission_time))\",\n ttl=env_var(\"ASPECTS_DATA_TTL_EXPRESSION\", \"\"),\n )\n}}\n\nselect org, course_key, actor_id, max(emission_time) as emission_time\nfrom {{ ref(\"navigation_events\") }}\ngroup by org, course_key, actor_id", "language": "sql", "refs": [{"name": "navigation_events", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.aspects.get_engine"], "nodes": ["model.aspects.navigation_events"]}, "compiled_path": "target/compiled/aspects/models/navigation/fact_learner_last_course_visit.sql", "compiled": true, "compiled_code": "\n\nselect org, course_key, actor_id, max(emission_time) as emission_time\nfrom `xapi`.`navigation_events`\ngroup by org, course_key, actor_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.aspects.subsection_page_engagement": {"database": "", "schema": "xapi", "name": "subsection_page_engagement", "resource_type": "model", "package_name": "aspects", "path": "navigation/subsection_page_engagement.sql", "original_file_path": "models/navigation/subsection_page_engagement.sql", "unique_id": "model.aspects.subsection_page_engagement", "fqn": ["aspects", "navigation", "subsection_page_engagement"], "alias": "subsection_page_engagement", "checksum": {"name": "sha256", "checksum": "7c18a0d825e3f7fd80735a3e57f2cb636faf829f8b2a93f299c57f59f01b03ca"}, "config": {"enabled": true, "alias": null, "schema": "xapi", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "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", "engine": "\n ReplacingMergeTree()", "order_by": "(org, course_key, subsection_block_id, actor_id)", "primary_key": "(org, course_key)"}, "tags": [], "description": "A record per course per subsection per learner with their engagement level", "columns": {"org": {"name": "org", "description": "The organization that the course belongs to", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_key": {"name": "course_key", "description": "The course key for the course", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "actor_id": {"name": "actor_id", "description": "The xAPI actor identifier", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "subsection_block_id": {"name": "subsection_block_id", "description": "The unique identifier for the subsection block", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "engagement_level": {"name": "engagement_level", "description": "The engagement level of the learner with the subsection", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "aspects://models/navigation/schema.yml", "build_path": null, "unrendered_config": {"materialized": "materialized_view", "schema": "xapi", "engine": "\n ReplacingMergeTree()", "primary_key": "(org, course_key)", "order_by": "(org, course_key, subsection_block_id, actor_id)"}, "created_at": 1723756272.424212, "relation_name": "`xapi`.`subsection_page_engagement`", "raw_code": "{{\n config(\n materialized=\"materialized_view\",\n schema=env_var(\"ASPECTS_XAPI_DATABASE\", \"xapi\"),\n engine=get_engine(\"ReplacingMergeTree()\"),\n primary_key=\"(org, course_key)\",\n order_by=\"(org, course_key, subsection_block_id, actor_id)\",\n )\n}}\n\nwith\n fact_navigation as (\n select\n navigation.emission_time as emission_time,\n navigation.org as org,\n navigation.course_key as course_key,\n navigation.actor_id as actor_id,\n navigation.block_id as block_id,\n blocks.display_name_with_location as block_name_with_location\n from {{ ref(\"navigation_events\") }} navigation\n join\n {{ ref(\"dim_course_blocks\") }} blocks\n on (\n navigation.course_key = blocks.course_key\n and navigation.block_id = blocks.block_id\n )\n ),\n visited_subsection_pages as (\n select distinct\n date(emission_time) as visited_on,\n org,\n course_key,\n {{ section_from_display(\"block_name_with_location\") }} as section_number,\n {{ subsection_from_display(\"block_name_with_location\") }}\n as subsection_number,\n actor_id,\n block_id\n from fact_navigation\n ),\n fact_navigation_completion as (\n select\n visits.visited_on as visited_on,\n visits.org as org,\n visits.course_key as course_key,\n pages.section_with_name as section_with_name,\n pages.subsection_with_name as subsection_with_name,\n pages.item_count as item_count,\n visits.actor_id as actor_id,\n visits.block_id as block_id,\n pages.subsection_block_id as subsection_block_id\n from visited_subsection_pages visits\n join\n {{ ref(\"int_pages_per_subsection\") }} pages\n on (\n visits.org = pages.org\n and visits.course_key = pages.course_key\n and visits.section_number = pages.section_number\n and visits.subsection_number = pages.subsection_number\n )\n ),\n subsection_counts as (\n select\n org,\n course_key,\n section_with_name,\n subsection_with_name,\n actor_id,\n item_count,\n count(distinct block_id) as pages_visited,\n case\n when pages_visited = 0\n then 'No pages viewed yet'\n when pages_visited = item_count\n then 'All pages viewed'\n else 'At least one page viewed'\n end as engagement_level,\n subsection_block_id\n from fact_navigation_completion\n group by\n org,\n course_key,\n section_with_name,\n subsection_with_name,\n actor_id,\n item_count,\n subsection_block_id\n )\n\nselect org, course_key, actor_id, subsection_block_id, engagement_level\nfrom subsection_counts", "language": "sql", "refs": [{"name": "navigation_events", "package": null, "version": null}, {"name": "dim_course_blocks", "package": null, "version": null}, {"name": "int_pages_per_subsection", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.aspects.get_engine", "macro.aspects.section_from_display", "macro.aspects.subsection_from_display"], "nodes": ["model.aspects.navigation_events", "model.aspects.dim_course_blocks", "model.aspects.int_pages_per_subsection"]}, "compiled_path": "target/compiled/aspects/models/navigation/subsection_page_engagement.sql", "compiled": true, "compiled_code": "\n\nwith\n fact_navigation as (\n select\n navigation.emission_time as emission_time,\n navigation.org as org,\n navigation.course_key as course_key,\n navigation.actor_id as actor_id,\n navigation.block_id as block_id,\n blocks.display_name_with_location as block_name_with_location\n from `xapi`.`navigation_events` navigation\n join\n `xapi`.`dim_course_blocks` blocks\n on (\n navigation.course_key = blocks.course_key\n and navigation.block_id = blocks.block_id\n )\n ),\n visited_subsection_pages as (\n select distinct\n date(emission_time) as visited_on,\n org,\n course_key,\n \n concat(\n splitByString(\n ':', splitByString(' - ', block_name_with_location)[1], 1\n )[1],\n ':0:0'\n )\n as section_number,\n \n concat(\n arrayStringConcat(\n splitByString(\n ':', splitByString(' - ', block_name_with_location)[1], 2\n ),\n ':'\n ),\n ':0'\n )\n\n as subsection_number,\n actor_id,\n block_id\n from fact_navigation\n ),\n fact_navigation_completion as (\n select\n visits.visited_on as visited_on,\n visits.org as org,\n visits.course_key as course_key,\n pages.section_with_name as section_with_name,\n pages.subsection_with_name as subsection_with_name,\n pages.item_count as item_count,\n visits.actor_id as actor_id,\n visits.block_id as block_id,\n pages.subsection_block_id as subsection_block_id\n from visited_subsection_pages visits\n join\n `xapi`.`int_pages_per_subsection` pages\n on (\n visits.org = pages.org\n and visits.course_key = pages.course_key\n and visits.section_number = pages.section_number\n and visits.subsection_number = pages.subsection_number\n )\n ),\n subsection_counts as (\n select\n org,\n course_key,\n section_with_name,\n subsection_with_name,\n actor_id,\n item_count,\n count(distinct block_id) as pages_visited,\n case\n when pages_visited = 0\n then 'No pages viewed yet'\n when pages_visited = item_count\n then 'All pages viewed'\n else 'At least one page viewed'\n end as engagement_level,\n subsection_block_id\n from fact_navigation_completion\n group by\n org,\n course_key,\n section_with_name,\n subsection_with_name,\n actor_id,\n item_count,\n subsection_block_id\n )\n\nselect org, course_key, actor_id, subsection_block_id, engagement_level\nfrom subsection_counts", "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.aspects.fact_pageview_engagement": {"database": "", "schema": "xapi", "name": "fact_pageview_engagement", "resource_type": "model", "package_name": "aspects", "path": "navigation/fact_pageview_engagement.sql", "original_file_path": "models/navigation/fact_pageview_engagement.sql", "unique_id": "model.aspects.fact_pageview_engagement", "fqn": ["aspects", "navigation", "fact_pageview_engagement"], "alias": "fact_pageview_engagement", "checksum": {"name": "sha256", "checksum": "af19d40d074e7f785aab0477ac6293a637601d043a48c4fef983b13f0aeacf26"}, "config": {"enabled": true, "alias": null, "schema": null, "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": "A view for analyzing the number of page views per learner per section and subsection", "columns": {"org": {"name": "org", "description": "The organization that the course belongs to", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_key": {"name": "course_key", "description": "The course identifier", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_run": {"name": "course_run", "description": "The course run for the course", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "section_with_name": {"name": "section_with_name", "description": "The name of the section", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "subsection_with_name": {"name": "subsection_with_name", "description": "The name of the subsection", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "section_subsection_name": {"name": "section_subsection_name", "description": "The name of the section or subsection", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "content_level": {"name": "content_level", "description": "The level at which page views are counted", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "actor_id": {"name": "actor_id", "description": "The xAPI actor identifier", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "section_subsection_page_engagement": {"name": "section_subsection_page_engagement", "description": "The total number of times a learner viewed pages in this section or subsection", "meta": {}, "data_type": "UInt64", "constraints": [], "quote": null, "tags": []}, "username": {"name": "username", "description": "The username of the learner", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "name": {"name": "name", "description": "The full name of the learner", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "email": {"name": "email", "description": "The email address of the learner", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "aspects://models/navigation/schema.yml", "build_path": null, "unrendered_config": {}, "created_at": 1723756272.4223113, "relation_name": "`xapi`.`fact_pageview_engagement`", "raw_code": "with\n subsection_engagement as (\n select\n org,\n course_key,\n 'subsection' as content_level,\n actor_id,\n subsection_block_id as block_id,\n engagement_level as section_subsection_page_engagement\n from {{ ref(\"subsection_page_engagement\") }}\n ),\n section_engagement as (\n select\n org,\n course_key,\n 'section' as content_level,\n actor_id,\n section_block_id as block_id,\n engagement_level as section_subsection_page_engagement\n from {{ ref(\"section_page_engagement\") }}\n ),\n page_engagement as (\n select *\n from subsection_engagement\n union all\n select *\n from section_engagement\n )\n\nselect\n pv.org as org,\n pv.course_key as course_key,\n course_blocks.course_run as course_run,\n course_blocks.display_name_with_location as section_subsection_name,\n pv.content_level as content_level,\n pv.actor_id as actor_id,\n pv.section_subsection_page_engagement as section_subsection_page_engagement,\n users.username as username,\n users.name as name,\n users.email as email\nfrom page_engagement pv\njoin\n {{ ref(\"dim_course_blocks\") }} course_blocks\n on (\n pv.org = course_blocks.org\n and pv.course_key = course_blocks.course_key\n and pv.block_id = course_blocks.block_id\n )\nleft outer join\n {{ ref(\"dim_user_pii\") }} users on toUUID(pv.actor_id) = users.external_user_id", "language": "sql", "refs": [{"name": "subsection_page_engagement", "package": null, "version": null}, {"name": "section_page_engagement", "package": null, "version": null}, {"name": "dim_course_blocks", "package": null, "version": null}, {"name": "dim_user_pii", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.aspects.subsection_page_engagement", "model.aspects.section_page_engagement", "model.aspects.dim_course_blocks", "model.aspects.dim_user_pii"]}, "compiled_path": "target/compiled/aspects/models/navigation/fact_pageview_engagement.sql", "compiled": true, "compiled_code": "with\n subsection_engagement as (\n select\n org,\n course_key,\n 'subsection' as content_level,\n actor_id,\n subsection_block_id as block_id,\n engagement_level as section_subsection_page_engagement\n from `xapi`.`subsection_page_engagement`\n ),\n section_engagement as (\n select\n org,\n course_key,\n 'section' as content_level,\n actor_id,\n section_block_id as block_id,\n engagement_level as section_subsection_page_engagement\n from `xapi`.`section_page_engagement`\n ),\n page_engagement as (\n select *\n from subsection_engagement\n union all\n select *\n from section_engagement\n )\n\nselect\n pv.org as org,\n pv.course_key as course_key,\n course_blocks.course_run as course_run,\n course_blocks.display_name_with_location as section_subsection_name,\n pv.content_level as content_level,\n pv.actor_id as actor_id,\n pv.section_subsection_page_engagement as section_subsection_page_engagement,\n users.username as username,\n users.name as name,\n users.email as email\nfrom page_engagement pv\njoin\n `xapi`.`dim_course_blocks` course_blocks\n on (\n pv.org = course_blocks.org\n and pv.course_key = course_blocks.course_key\n and pv.block_id = course_blocks.block_id\n )\nleft outer join\n `xapi`.`dim_user_pii` users on toUUID(pv.actor_id) = users.external_user_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.aspects.fact_navigation": {"database": "", "schema": "xapi", "name": "fact_navigation", "resource_type": "model", "package_name": "aspects", "path": "navigation/fact_navigation.sql", "original_file_path": "models/navigation/fact_navigation.sql", "unique_id": "model.aspects.fact_navigation", "fqn": ["aspects", "navigation", "fact_navigation"], "alias": "fact_navigation", "checksum": {"name": "sha256", "checksum": "fedcdf93920cee5d71d2a1d279ba3a6df2d2ffbdeab7d91e09bd165dc3921abe"}, "config": {"enabled": true, "alias": null, "schema": null, "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": "A view of navigation_events enriched with course and block metadata", "columns": {"emission_time": {"name": "emission_time", "description": "Timestamp, to the second, of when this event was emitted", "meta": {}, "data_type": "DateTime", "constraints": [], "quote": null, "tags": []}, "org": {"name": "org", "description": "The organization that the course belongs to", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_key": {"name": "course_key", "description": "The course identifier", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_name": {"name": "course_name", "description": "The name of the course", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_run": {"name": "course_run", "description": "The course run for the course", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "actor_id": {"name": "actor_id", "description": "The xAPI actor identifier", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "block_id": {"name": "block_id", "description": "The LMS object identifier", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "block_name": {"name": "block_name", "description": "The block's name", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "block_name_with_location": {"name": "block_name_with_location", "description": "The block's display name with section, subsection, and unit prepended to the name. This provides additional context when looking at block names and can help data consumers understand which block they are analyzing", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "object_type": {"name": "object_type", "description": "The type of object that the learner interacted with", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "starting_position": {"name": "starting_position", "description": "The tab in the unit navigation bar that the learner was viewing before clicking a link", "meta": {}, "data_type": "Int64", "constraints": [], "quote": null, "tags": []}, "ending_point": {"name": "ending_point", "description": "The tab in the unit navigation bar that the learner selected to navigate to", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "username": {"name": "username", "description": "The username of the learner", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "name": {"name": "name", "description": "The full name of the learner", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "email": {"name": "email", "description": "The email address of the learner", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_order": {"name": "course_order", "description": "The sort order of this block in the course across all course blocks", "meta": {}, "data_type": "Int32", "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "aspects://models/navigation/schema.yml", "build_path": null, "unrendered_config": {}, "created_at": 1723756272.4177737, "relation_name": "`xapi`.`fact_navigation`", "raw_code": "select\n navigation.emission_time as emission_time,\n navigation.org as org,\n navigation.course_key as course_key,\n blocks.course_name as course_name,\n blocks.course_run as course_run,\n navigation.actor_id as actor_id,\n navigation.block_id as block_id,\n blocks.block_name as block_name,\n blocks.display_name_with_location as block_name_with_location,\n blocks.course_order as course_order,\n navigation.object_type as object_type,\n navigation.starting_position as starting_position,\n navigation.ending_point as ending_point,\n users.username as username,\n users.name as name,\n users.email as email\nfrom {{ ref(\"navigation_events\") }} navigation\njoin\n {{ ref(\"dim_course_blocks\") }} blocks\n on (\n navigation.course_key = blocks.course_key\n and navigation.block_id = blocks.block_id\n )\nleft outer join\n {{ ref(\"dim_user_pii\") }} users on toUUID(actor_id) = users.external_user_id", "language": "sql", "refs": [{"name": "navigation_events", "package": null, "version": null}, {"name": "dim_course_blocks", "package": null, "version": null}, {"name": "dim_user_pii", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.aspects.navigation_events", "model.aspects.dim_course_blocks", "model.aspects.dim_user_pii"]}, "compiled_path": "target/compiled/aspects/models/navigation/fact_navigation.sql", "compiled": true, "compiled_code": "select\n navigation.emission_time as emission_time,\n navigation.org as org,\n navigation.course_key as course_key,\n blocks.course_name as course_name,\n blocks.course_run as course_run,\n navigation.actor_id as actor_id,\n navigation.block_id as block_id,\n blocks.block_name as block_name,\n blocks.display_name_with_location as block_name_with_location,\n blocks.course_order as course_order,\n navigation.object_type as object_type,\n navigation.starting_position as starting_position,\n navigation.ending_point as ending_point,\n users.username as username,\n users.name as name,\n users.email as email\nfrom `xapi`.`navigation_events` navigation\njoin\n `xapi`.`dim_course_blocks` blocks\n on (\n navigation.course_key = blocks.course_key\n and navigation.block_id = blocks.block_id\n )\nleft outer join\n `xapi`.`dim_user_pii` users on toUUID(actor_id) = users.external_user_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.aspects.fact_navigation_completion": {"database": "", "schema": "xapi", "name": "fact_navigation_completion", "resource_type": "model", "package_name": "aspects", "path": "navigation/fact_navigation_completion.sql", "original_file_path": "models/navigation/fact_navigation_completion.sql", "unique_id": "model.aspects.fact_navigation_completion", "fqn": ["aspects", "navigation", "fact_navigation_completion"], "alias": "fact_navigation_completion", "checksum": {"name": "sha256", "checksum": "0306927e93c1f866131888d6bd818aa473682c3bc72256e38a658c266fef6c96"}, "config": {"enabled": true, "alias": null, "schema": null, "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": "A view for analyzing how many pages a learner has visited in a section or subsection", "columns": {"visited_on": {"name": "visited_on", "description": "The Date the page was visited", "meta": {}, "data_type": "Date", "constraints": [], "quote": null, "tags": []}, "org": {"name": "org", "description": "The organization that the course belongs to", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_key": {"name": "course_key", "description": "The course identifier", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_name": {"name": "course_name", "description": "The course name", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_run": {"name": "course_run", "description": "The course run for the course", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "section_with_name": {"name": "section_with_name", "description": "The name of the section", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "subsection_with_name": {"name": "subsection_with_name", "description": "The name of the subsection", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "page_count": {"name": "page_count", "description": "The number of pages in the associated subsection", "meta": {}, "data_type": "UInt64", "constraints": [], "quote": null, "tags": []}, "actor_id": {"name": "actor_id", "description": "The xAPI actor identifier", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "block_id": {"name": "block_id", "description": "The ID of the specific page visited", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "username": {"name": "username", "description": "The username of the learner", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "name": {"name": "name", "description": "The full name of the learner", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "email": {"name": "email", "description": "The email address of the learner", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_order": {"name": "course_order", "description": "The sort order of this block in the course across all course blocks", "meta": {}, "data_type": "Int32", "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "aspects://models/navigation/schema.yml", "build_path": null, "unrendered_config": {}, "created_at": 1723756272.4195416, "relation_name": "`xapi`.`fact_navigation_completion`", "raw_code": "-- number of learners who've viewed all pages in a section/subsection\nwith\n visited_subsection_pages as (\n select distinct\n date(emission_time) as visited_on,\n org,\n course_key,\n course_name,\n course_run,\n {{ section_from_display(\"block_name_with_location\") }} as section_number,\n {{ subsection_from_display(\"block_name_with_location\") }}\n as subsection_number,\n actor_id,\n block_id,\n username,\n name,\n email\n from {{ ref(\"fact_navigation\") }}\n )\n\nselect\n visits.visited_on as visited_on,\n visits.org as org,\n visits.course_key as course_key,\n visits.course_name as course_name,\n visits.course_run as course_run,\n pages.section_with_name as section_with_name,\n pages.subsection_with_name as subsection_with_name,\n pages.course_order as course_order,\n pages.item_count as page_count,\n visits.actor_id as actor_id,\n visits.block_id as block_id,\n visits.username as username,\n visits.name as name,\n visits.email as email\nfrom visited_subsection_pages visits\njoin\n {{ ref(\"int_pages_per_subsection\") }} pages\n on (\n visits.org = pages.org\n and visits.course_key = pages.course_key\n and visits.section_number = pages.section_number\n and visits.subsection_number = pages.subsection_number\n )", "language": "sql", "refs": [{"name": "fact_navigation", "package": null, "version": null}, {"name": "int_pages_per_subsection", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.aspects.section_from_display", "macro.aspects.subsection_from_display"], "nodes": ["model.aspects.fact_navigation", "model.aspects.int_pages_per_subsection"]}, "compiled_path": "target/compiled/aspects/models/navigation/fact_navigation_completion.sql", "compiled": true, "compiled_code": "-- number of learners who've viewed all pages in a section/subsection\nwith\n visited_subsection_pages as (\n select distinct\n date(emission_time) as visited_on,\n org,\n course_key,\n course_name,\n course_run,\n \n concat(\n splitByString(\n ':', splitByString(' - ', block_name_with_location)[1], 1\n )[1],\n ':0:0'\n )\n as section_number,\n \n concat(\n arrayStringConcat(\n splitByString(\n ':', splitByString(' - ', block_name_with_location)[1], 2\n ),\n ':'\n ),\n ':0'\n )\n\n as subsection_number,\n actor_id,\n block_id,\n username,\n name,\n email\n from `xapi`.`fact_navigation`\n )\n\nselect\n visits.visited_on as visited_on,\n visits.org as org,\n visits.course_key as course_key,\n visits.course_name as course_name,\n visits.course_run as course_run,\n pages.section_with_name as section_with_name,\n pages.subsection_with_name as subsection_with_name,\n pages.course_order as course_order,\n pages.item_count as page_count,\n visits.actor_id as actor_id,\n visits.block_id as block_id,\n visits.username as username,\n visits.name as name,\n visits.email as email\nfrom visited_subsection_pages visits\njoin\n `xapi`.`int_pages_per_subsection` pages\n on (\n visits.org = pages.org\n and visits.course_key = pages.course_key\n and visits.section_number = pages.section_number\n and visits.subsection_number = pages.subsection_number\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.aspects.navigation_events": {"database": "", "schema": "xapi", "name": "navigation_events", "resource_type": "model", "package_name": "aspects", "path": "navigation/navigation_events.sql", "original_file_path": "models/navigation/navigation_events.sql", "unique_id": "model.aspects.navigation_events", "fqn": ["aspects", "navigation", "navigation_events"], "alias": "navigation_events", "checksum": {"name": "sha256", "checksum": "62c4af9d418c53e355ab215c806528e3171c33d28a71cddcc2cfc88f7899ebd6"}, "config": {"enabled": true, "alias": null, "schema": "xapi", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "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", "engine": "\n ReplacingMergeTree()", "order_by": "(org, course_key, object_type, emission_time, actor_id, starting_position, event_id)", "partition_by": "(toYYYYMM(emission_time))", "ttl": "", "primary_key": "(org, course_key, object_type)"}, "tags": [], "description": "A materialized view for xAPI events related to course navigation", "columns": {"event_id": {"name": "event_id", "description": "The unique identifier for the event", "meta": {}, "data_type": "UUID", "constraints": [], "quote": null, "tags": []}, "emission_time": {"name": "emission_time", "description": "Timestamp, to the second, of when this event was emitted", "meta": {}, "data_type": "DateTime", "constraints": [], "quote": null, "tags": []}, "actor_id": {"name": "actor_id", "description": "The xAPI actor identifier", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "block_id": {"name": "block_id", "description": "The LMS object identifier", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_key": {"name": "course_key", "description": "The course identifier", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "org": {"name": "org", "description": "The organization that the course belongs to", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "verb_id": {"name": "verb_id", "description": "The xAPI verb identifier", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "object_type": {"name": "object_type", "description": "The type of object that the learner interacted with", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "starting_position": {"name": "starting_position", "description": "The tab in the unit navigation bar that the learner was viewing before clicking a link", "meta": {}, "data_type": "Int64", "constraints": [], "quote": null, "tags": []}, "ending_point": {"name": "ending_point", "description": "The tab in the unit navigation bar that the learner selected to navigate to", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "aspects://models/navigation/schema.yml", "build_path": null, "unrendered_config": {"materialized": "materialized_view", "schema": "xapi", "engine": "\n ReplacingMergeTree()", "primary_key": "(org, course_key, object_type)", "order_by": "(org, course_key, object_type, emission_time, actor_id, starting_position, event_id)", "partition_by": "(toYYYYMM(emission_time))", "ttl": ""}, "created_at": 1723756272.4153447, "relation_name": "`xapi`.`navigation_events`", "raw_code": "{{\n config(\n materialized=\"materialized_view\",\n schema=env_var(\"ASPECTS_XAPI_DATABASE\", \"xapi\"),\n engine=get_engine(\"ReplacingMergeTree()\"),\n primary_key=\"(org, course_key, object_type)\",\n order_by=\"(org, course_key, object_type, emission_time, actor_id, starting_position, event_id)\",\n partition_by=\"(toYYYYMM(emission_time))\",\n ttl=env_var(\"ASPECTS_DATA_TTL_EXPRESSION\", \"\"),\n )\n}}\n\nselect\n event_id,\n cast(emission_time as DateTime) as emission_time,\n actor_id,\n splitByString('/xblock/', object_id)[-1] as block_id,\n course_key,\n org,\n verb_id,\n JSONExtractString(event, 'object', 'definition', 'type') as object_type,\n -- clicking a link and selecting a module outline have no starting-position field\n if(\n object_type in (\n 'http://adlnet.gov/expapi/activities/link',\n 'http://adlnet.gov/expapi/activities/module'\n ),\n 0,\n JSONExtractInt(\n event,\n 'context',\n 'extensions',\n 'http://id.tincanapi.com/extension/starting-position'\n )\n ) as starting_position,\n JSONExtractString(\n event, 'context', 'extensions', 'http://id.tincanapi.com/extension/ending-point'\n ) as ending_point\nfrom {{ ref(\"xapi_events_all_parsed\") }}\nwhere verb_id in ('https://w3id.org/xapi/dod-isd/verbs/navigated')", "language": "sql", "refs": [{"name": "xapi_events_all_parsed", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.aspects.get_engine"], "nodes": ["model.aspects.xapi_events_all_parsed"]}, "compiled_path": "target/compiled/aspects/models/navigation/navigation_events.sql", "compiled": true, "compiled_code": "\n\nselect\n event_id,\n cast(emission_time as DateTime) as emission_time,\n actor_id,\n splitByString('/xblock/', object_id)[-1] as block_id,\n course_key,\n org,\n verb_id,\n JSONExtractString(event, 'object', 'definition', 'type') as object_type,\n -- clicking a link and selecting a module outline have no starting-position field\n if(\n object_type in (\n 'http://adlnet.gov/expapi/activities/link',\n 'http://adlnet.gov/expapi/activities/module'\n ),\n 0,\n JSONExtractInt(\n event,\n 'context',\n 'extensions',\n 'http://id.tincanapi.com/extension/starting-position'\n )\n ) as starting_position,\n JSONExtractString(\n event, 'context', 'extensions', 'http://id.tincanapi.com/extension/ending-point'\n ) as ending_point\nfrom `xapi`.`xapi_events_all_parsed`\nwhere verb_id in ('https://w3id.org/xapi/dod-isd/verbs/navigated')", "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.aspects.section_page_engagement": {"database": "", "schema": "xapi", "name": "section_page_engagement", "resource_type": "model", "package_name": "aspects", "path": "navigation/section_page_engagement.sql", "original_file_path": "models/navigation/section_page_engagement.sql", "unique_id": "model.aspects.section_page_engagement", "fqn": ["aspects", "navigation", "section_page_engagement"], "alias": "section_page_engagement", "checksum": {"name": "sha256", "checksum": "801300c920e1857ff7a0c48b7a58b45073b5380238faf615b574b649322313af"}, "config": {"enabled": true, "alias": null, "schema": "xapi", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "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", "engine": "\n ReplacingMergeTree()", "order_by": "(org, course_key, section_block_id, actor_id)", "primary_key": "(org, course_key)"}, "tags": [], "description": "A record per course per section per learner with their engagement level", "columns": {"org": {"name": "org", "description": "The organization that the course belongs to", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_key": {"name": "course_key", "description": "The course key for the course", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "actor_id": {"name": "actor_id", "description": "The xAPI actor identifier", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "section_block_id": {"name": "section_block_id", "description": "The unique identifier for the section block", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "engagement_level": {"name": "engagement_level", "description": "The engagement level of the learner with the section", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "aspects://models/navigation/schema.yml", "build_path": null, "unrendered_config": {"materialized": "materialized_view", "schema": "xapi", "engine": "\n ReplacingMergeTree()", "primary_key": "(org, course_key)", "order_by": "(org, course_key, section_block_id, actor_id)"}, "created_at": 1723756272.4235318, "relation_name": "`xapi`.`section_page_engagement`", "raw_code": "{{\n config(\n materialized=\"materialized_view\",\n schema=env_var(\"ASPECTS_XAPI_DATABASE\", \"xapi\"),\n engine=get_engine(\"ReplacingMergeTree()\"),\n primary_key=\"(org, course_key)\",\n order_by=\"(org, course_key, section_block_id, actor_id)\",\n )\n}}\n\nwith\n fact_navigation as (\n select\n navigation.emission_time as emission_time,\n navigation.org as org,\n navigation.course_key as course_key,\n navigation.actor_id as actor_id,\n navigation.block_id as block_id,\n blocks.display_name_with_location as block_name_with_location\n from {{ ref(\"navigation_events\") }} navigation\n join\n {{ ref(\"dim_course_blocks\") }} blocks\n on (\n navigation.course_key = blocks.course_key\n and navigation.block_id = blocks.block_id\n )\n ),\n visited_subsection_pages as (\n select distinct\n date(emission_time) as visited_on,\n org,\n course_key,\n {{ section_from_display(\"block_name_with_location\") }} as section_number,\n {{ subsection_from_display(\"block_name_with_location\") }}\n as subsection_number,\n actor_id,\n block_id\n from fact_navigation\n ),\n fact_navigation_completion as (\n select\n visits.visited_on as visited_on,\n visits.org as org,\n visits.course_key as course_key,\n pages.section_with_name as section_with_name,\n pages.subsection_with_name as subsection_with_name,\n pages.item_count as item_count,\n visits.actor_id as actor_id,\n visits.block_id as block_id,\n pages.section_block_id as section_block_id\n from visited_subsection_pages visits\n join\n {{ ref(\"int_pages_per_subsection\") }} pages\n on (\n visits.org = pages.org\n and visits.course_key = pages.course_key\n and visits.section_number = pages.section_number\n and visits.subsection_number = pages.subsection_number\n )\n ),\n subsection_counts as (\n select\n org,\n course_key,\n section_with_name,\n subsection_with_name,\n actor_id,\n item_count,\n count(distinct block_id) as pages_visited,\n case\n when pages_visited = 0\n then 'No pages viewed yet'\n when pages_visited = item_count\n then 'All pages viewed'\n else 'At least one page viewed'\n end as engagement_level,\n section_block_id\n from fact_navigation_completion\n group by\n org,\n course_key,\n section_with_name,\n subsection_with_name,\n actor_id,\n item_count,\n section_block_id\n ),\n section_counts as (\n select\n org,\n course_key,\n actor_id,\n sum(item_count) as item_count,\n sum(pages_visited) as pages_visited,\n case\n when pages_visited = 0\n then 'No pages viewed yet'\n when pages_visited = item_count\n then 'All pages viewed'\n else 'At least one page viewed'\n end as engagement_level,\n section_block_id\n from subsection_counts\n group by org, course_key, section_block_id, actor_id\n )\n\nselect org, course_key, actor_id, section_block_id, engagement_level\nfrom section_counts", "language": "sql", "refs": [{"name": "navigation_events", "package": null, "version": null}, {"name": "dim_course_blocks", "package": null, "version": null}, {"name": "int_pages_per_subsection", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.aspects.get_engine", "macro.aspects.section_from_display", "macro.aspects.subsection_from_display"], "nodes": ["model.aspects.navigation_events", "model.aspects.dim_course_blocks", "model.aspects.int_pages_per_subsection"]}, "compiled_path": "target/compiled/aspects/models/navigation/section_page_engagement.sql", "compiled": true, "compiled_code": "\n\nwith\n fact_navigation as (\n select\n navigation.emission_time as emission_time,\n navigation.org as org,\n navigation.course_key as course_key,\n navigation.actor_id as actor_id,\n navigation.block_id as block_id,\n blocks.display_name_with_location as block_name_with_location\n from `xapi`.`navigation_events` navigation\n join\n `xapi`.`dim_course_blocks` blocks\n on (\n navigation.course_key = blocks.course_key\n and navigation.block_id = blocks.block_id\n )\n ),\n visited_subsection_pages as (\n select distinct\n date(emission_time) as visited_on,\n org,\n course_key,\n \n concat(\n splitByString(\n ':', splitByString(' - ', block_name_with_location)[1], 1\n )[1],\n ':0:0'\n )\n as section_number,\n \n concat(\n arrayStringConcat(\n splitByString(\n ':', splitByString(' - ', block_name_with_location)[1], 2\n ),\n ':'\n ),\n ':0'\n )\n\n as subsection_number,\n actor_id,\n block_id\n from fact_navigation\n ),\n fact_navigation_completion as (\n select\n visits.visited_on as visited_on,\n visits.org as org,\n visits.course_key as course_key,\n pages.section_with_name as section_with_name,\n pages.subsection_with_name as subsection_with_name,\n pages.item_count as item_count,\n visits.actor_id as actor_id,\n visits.block_id as block_id,\n pages.section_block_id as section_block_id\n from visited_subsection_pages visits\n join\n `xapi`.`int_pages_per_subsection` pages\n on (\n visits.org = pages.org\n and visits.course_key = pages.course_key\n and visits.section_number = pages.section_number\n and visits.subsection_number = pages.subsection_number\n )\n ),\n subsection_counts as (\n select\n org,\n course_key,\n section_with_name,\n subsection_with_name,\n actor_id,\n item_count,\n count(distinct block_id) as pages_visited,\n case\n when pages_visited = 0\n then 'No pages viewed yet'\n when pages_visited = item_count\n then 'All pages viewed'\n else 'At least one page viewed'\n end as engagement_level,\n section_block_id\n from fact_navigation_completion\n group by\n org,\n course_key,\n section_with_name,\n subsection_with_name,\n actor_id,\n item_count,\n section_block_id\n ),\n section_counts as (\n select\n org,\n course_key,\n actor_id,\n sum(item_count) as item_count,\n sum(pages_visited) as pages_visited,\n case\n when pages_visited = 0\n then 'No pages viewed yet'\n when pages_visited = item_count\n then 'All pages viewed'\n else 'At least one page viewed'\n end as engagement_level,\n section_block_id\n from subsection_counts\n group by org, course_key, section_block_id, actor_id\n )\n\nselect org, course_key, actor_id, section_block_id, engagement_level\nfrom section_counts", "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.aspects.most_recent_course_blocks": {"database": "", "schema": "xapi", "name": "most_recent_course_blocks", "resource_type": "model", "package_name": "aspects", "path": "courses/most_recent_course_blocks.sql", "original_file_path": "models/courses/most_recent_course_blocks.sql", "unique_id": "model.aspects.most_recent_course_blocks", "fqn": ["aspects", "courses", "most_recent_course_blocks"], "alias": "most_recent_course_blocks", "checksum": {"name": "sha256", "checksum": "0f8320ce8fbe084846c2d4cf90c5632ed5ab812cc738cf1191734572b8861cdf"}, "config": {"enabled": true, "alias": null, "schema": "event_sink", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "materialized_view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [{"sql": "OPTIMIZE TABLE {{ this }} {{ on_cluster() }} FINAL", "transaction": true, "index": null}], "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", "engine": "\n ReplacingMergeTree()", "order_by": "(location)"}, "tags": [], "description": "A materialized view of course blocks with their display names and additional metadata. Only stores the most recent row per block location.", "columns": {"location": {"name": "location", "description": "The location of the block", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "block_name": {"name": "block_name", "description": "The name of the block", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_key": {"name": "course_key", "description": "The course which the block belongs to", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "graded": {"name": "graded", "description": "Whether the block is graded", "meta": {}, "data_type": "Boolean", "constraints": [], "quote": null, "tags": []}, "display_name_with_location": {"name": "display_name_with_location", "description": "The block's display name with section, subsection, and unit prepended to the name. This provides additional context when looking at block names and can help data consumers understand which block they are analyzing", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_order": {"name": "course_order", "description": "The sort order of this block in the course across all course blocks", "meta": {}, "data_type": "Int32", "constraints": [], "quote": null, "tags": []}, "section": {"name": "section", "description": "The section number that this block falls under in the course. Starts at 1.", "meta": {}, "data_type": "Int32", "constraints": [], "quote": null, "tags": []}, "subsection": {"name": "subsection", "description": "The subsection number that this block falls under in the section. Starts at 1.", "meta": {}, "data_type": "Int32", "constraints": [], "quote": null, "tags": []}, "unit": {"name": "unit", "description": "The unit number that this block falls under in the subsection. Starts at 1.", "meta": {}, "data_type": "Int32", "constraints": [], "quote": null, "tags": []}, "dump_id": {"name": "dump_id", "description": "The UUID of the event sink run that published this block to ClickHouse. When a course is published all blocks inside it are sent with the same dump_id.", "meta": {}, "data_type": "UUID", "constraints": [], "quote": null, "tags": []}, "time_last_dumped": {"name": "time_last_dumped", "description": "The datetime of the event sink run that published this block to ClickHouse. When a course is published all blocks inside it are sent with the same time_last_dumped.", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "aspects://models/courses/schema.yml", "build_path": null, "unrendered_config": {"materialized": "materialized_view", "schema": "event_sink", "engine": "\n ReplacingMergeTree()", "order_by": "(location)", "post-hook": ["OPTIMIZE TABLE {{ this }} {{ on_cluster() }} FINAL"]}, "created_at": 1723756272.4504673, "relation_name": "`xapi`.`most_recent_course_blocks`", "raw_code": "{{\n config(\n materialized=\"materialized_view\",\n schema=env_var(\"ASPECTS_EVENT_SINK_DATABASE\", \"event_sink\"),\n engine=get_engine(\"ReplacingMergeTree()\"),\n order_by=\"(location)\",\n post_hook=\"OPTIMIZE TABLE {{ this }} {{ on_cluster() }} FINAL\",\n )\n}}\n\nselect\n location,\n display_name as block_name,\n toString(section)\n || ':'\n || toString(subsection)\n || ':'\n || toString(unit)\n || ' - '\n || display_name as display_name_with_location,\n JSONExtractInt(xblock_data_json, 'section') as section,\n JSONExtractInt(xblock_data_json, 'subsection') as subsection,\n JSONExtractInt(xblock_data_json, 'unit') as unit,\n JSONExtractBool(xblock_data_json, 'graded') as graded,\n order as course_order,\n course_key,\n dump_id,\n time_last_dumped\nfrom {{ source(\"event_sink\", \"course_blocks\") }} course_blocks\njoin\n (\n select location, max(time_last_dumped) as max_time_last_dumped\n from {{ source(\"event_sink\", \"course_blocks\") }}\n group by location\n ) latest_course_blocks\n on course_blocks.location = latest_course_blocks.location\n and course_blocks.time_last_dumped = latest_course_blocks.max_time_last_dumped", "language": "sql", "refs": [], "sources": [["event_sink", "course_blocks"], ["event_sink", "course_blocks"]], "metrics": [], "depends_on": {"macros": ["macro.aspects.get_engine", "macro.aspects.on_cluster"], "nodes": ["source.aspects.event_sink.course_blocks"]}, "compiled_path": "target/compiled/aspects/models/courses/most_recent_course_blocks.sql", "compiled": true, "compiled_code": "\n\nselect\n location,\n display_name as block_name,\n toString(section)\n || ':'\n || toString(subsection)\n || ':'\n || toString(unit)\n || ' - '\n || display_name as display_name_with_location,\n JSONExtractInt(xblock_data_json, 'section') as section,\n JSONExtractInt(xblock_data_json, 'subsection') as subsection,\n JSONExtractInt(xblock_data_json, 'unit') as unit,\n JSONExtractBool(xblock_data_json, 'graded') as graded,\n order as course_order,\n course_key,\n dump_id,\n time_last_dumped\nfrom `event_sink`.`course_blocks` course_blocks\njoin\n (\n select location, max(time_last_dumped) as max_time_last_dumped\n from `event_sink`.`course_blocks`\n group by location\n ) latest_course_blocks\n on course_blocks.location = latest_course_blocks.location\n and course_blocks.time_last_dumped = latest_course_blocks.max_time_last_dumped", "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.aspects.course_block_names": {"database": "", "schema": "xapi", "name": "course_block_names", "resource_type": "model", "package_name": "aspects", "path": "courses/course_block_names.sql", "original_file_path": "models/courses/course_block_names.sql", "unique_id": "model.aspects.course_block_names", "fqn": ["aspects", "courses", "course_block_names"], "alias": "course_block_names", "checksum": {"name": "sha256", "checksum": "6933b776c5701841fe7562c97c03f8ba7bf23757546de725573de7fd414800f0"}, "config": {"enabled": true, "alias": null, "schema": "event_sink", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "dictionary", "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", "fields": [["location", "String"], ["block_name", "String"], ["course_key", "String"], ["graded", "Bool"], ["course_order", "Int32"], ["display_name_with_location", "String"]], "primary_key": "location", "layout": "COMPLEX_KEY_SPARSE_HASHED()", "lifetime": "120", "source_type": "clickhouse", "connection_overrides": {"host": "localhost"}}, "tags": [], "description": "An in-memory dictionary of course blocks with their display names and additional metadata. Only stores the most recent row per block location.", "columns": {"location": {"name": "location", "description": "The location of the block", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "block_name": {"name": "block_name", "description": "The name of the block", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_key": {"name": "course_key", "description": "The course which the block belongs to", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "graded": {"name": "graded", "description": "Whether the block is graded", "meta": {}, "data_type": "Boolean", "constraints": [], "quote": null, "tags": []}, "display_name_with_location": {"name": "display_name_with_location", "description": "The block's display name with section, subsection, and unit prepended to the name. This provides additional context when looking at block names and can help data consumers understand which block they are analyzing", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_order": {"name": "course_order", "description": "The sort order of this block in the course across all course blocks", "meta": {}, "data_type": "Int32", "constraints": [], "quote": null, "tags": []}, "section": {"name": "section", "description": "The section number that this block falls under in the course. Starts at 1.", "meta": {}, "data_type": "Int32", "constraints": [], "quote": null, "tags": []}, "subsection": {"name": "subsection", "description": "The subsection number that this block falls under in the section. Starts at 1.", "meta": {}, "data_type": "Int32", "constraints": [], "quote": null, "tags": []}, "unit": {"name": "unit", "description": "The unit number that this block falls under in the subsection. Starts at 1.", "meta": {}, "data_type": "Int32", "constraints": [], "quote": null, "tags": []}, "dump_id": {"name": "dump_id", "description": "The UUID of the event sink run that published this block to ClickHouse. When a course is published all blocks inside it are sent with the same dump_id.", "meta": {}, "data_type": "UUID", "constraints": [], "quote": null, "tags": []}, "time_last_dumped": {"name": "time_last_dumped", "description": "The Datetime of the event sink run that published this block to ClickHouse. When a course is published all blocks inside it are sent with the same time_last_dumped.", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "aspects://models/courses/schema.yml", "build_path": null, "unrendered_config": {"materialized": "dictionary", "schema": "event_sink", "fields": [["location", "String"], ["block_name", "String"], ["course_key", "String"], ["graded", "Bool"], ["course_order", "Int32"], ["display_name_with_location", "String"]], "primary_key": "location", "layout": "COMPLEX_KEY_SPARSE_HASHED()", "lifetime": "120", "source_type": "clickhouse", "connection_overrides": {"host": "localhost"}}, "created_at": 1723756272.4492447, "relation_name": "`xapi`.`course_block_names`", "raw_code": "{{\n config(\n materialized=\"dictionary\",\n schema=env_var(\"ASPECTS_EVENT_SINK_DATABASE\", \"event_sink\"),\n fields=[\n (\"location\", \"String\"),\n (\"block_name\", \"String\"),\n (\"course_key\", \"String\"),\n (\"graded\", \"Bool\"),\n (\"course_order\", \"Int32\"),\n (\"display_name_with_location\", \"String\"),\n ],\n primary_key=\"location\",\n layout=\"COMPLEX_KEY_SPARSE_HASHED()\",\n lifetime=env_var(\"ASPECTS_BLOCK_NAME_CACHE_LIFETIME\", \"120\"),\n source_type=\"clickhouse\",\n connection_overrides={\n \"host\": \"localhost\",\n },\n )\n}}\nselect\n location, block_name, course_key, graded, course_order, display_name_with_location\nfrom {{ ref(\"most_recent_course_blocks\") }}", "language": "sql", "refs": [{"name": "most_recent_course_blocks", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.aspects.most_recent_course_blocks"]}, "compiled_path": "target/compiled/aspects/models/courses/course_block_names.sql", "compiled": true, "compiled_code": "\nselect\n location, block_name, course_key, graded, course_order, display_name_with_location\nfrom `xapi`.`most_recent_course_blocks`", "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.aspects.dim_course_blocks": {"database": "", "schema": "xapi", "name": "dim_course_blocks", "resource_type": "model", "package_name": "aspects", "path": "courses/dim_course_blocks.sql", "original_file_path": "models/courses/dim_course_blocks.sql", "unique_id": "model.aspects.dim_course_blocks", "fqn": ["aspects", "courses", "dim_course_blocks"], "alias": "dim_course_blocks", "checksum": {"name": "sha256", "checksum": "89cb965d3c845f1bd52e529617f3cdb65527ab39200559b2ea529dac72fbde00"}, "config": {"enabled": true, "alias": null, "schema": null, "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": "A denormalized table of course block information. This should be preferred over dim_course_blocks_extended when section and subsection names are not necessary to include in a model", "columns": {"org": {"name": "org", "description": "The organization that the course belongs to", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_key": {"name": "course_key", "description": "The course key for the course", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_name": {"name": "course_name", "description": "The name of the course", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_run": {"name": "course_run", "description": "The course run for the course", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "block_id": {"name": "block_id", "description": "The block's unique identifier", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "block_name": {"name": "block_name", "description": "The block's name", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "section_number": {"name": "section_number", "description": "The section this block belongs to, formatted as :0:0", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "subsection_number": {"name": "subsection_number", "description": "The subsection this block belongs to, formatted as ::0", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "hierarchy_location": {"name": "hierarchy_location", "description": "The full section:subsection:unit hierarchy in which this block belongs", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "display_name_with_location": {"name": "display_name_with_location", "description": "The block's display name with section, subsection, and unit prepended to the name. This provides additional context when looking at block names and can help data consumers understand which block they are analyzing", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_order": {"name": "course_order", "description": "The sort order of this block in the course across all course blocks", "meta": {}, "data_type": "Int32", "constraints": [], "quote": null, "tags": []}, "graded": {"name": "graded", "description": "Whether the block is graded", "meta": {}, "data_type": "Boolean", "constraints": [], "quote": null, "tags": []}, "block_type": {"name": "block_type", "description": "The type of block. This can be a section, subsection, unit, or the block type", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "aspects://models/courses/schema.yml", "build_path": null, "unrendered_config": {}, "created_at": 1723756272.4479017, "relation_name": "`xapi`.`dim_course_blocks`", "raw_code": "select\n courses.org as org,\n courses.course_key as course_key,\n courses.course_name as course_name,\n courses.course_run as course_run,\n blocks.location as block_id,\n blocks.block_name as block_name,\n {{ section_from_display(\"blocks.display_name_with_location\") }} as section_number,\n {{ subsection_from_display(\"blocks.display_name_with_location\") }}\n as subsection_number,\n splitByString(' - ', blocks.display_name_with_location)[1] as hierarchy_location,\n blocks.display_name_with_location as display_name_with_location,\n course_order,\n graded,\n case\n when block_id like '%@chapter+block@%'\n then 'section'\n when block_id like '%@sequential+block@%'\n then 'subsection'\n when block_id like '%@vertical+block@%'\n then 'unit'\n else regexpExtract(block_id, '@([^+]+)\\+block@', 1)\n end as block_type\nfrom {{ ref(\"course_block_names\") }} blocks\njoin {{ ref(\"course_names\") }} courses on blocks.course_key = courses.course_key", "language": "sql", "refs": [{"name": "course_block_names", "package": null, "version": null}, {"name": "course_names", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.aspects.section_from_display", "macro.aspects.subsection_from_display"], "nodes": ["model.aspects.course_block_names", "model.aspects.course_names"]}, "compiled_path": "target/compiled/aspects/models/courses/dim_course_blocks.sql", "compiled": true, "compiled_code": "select\n courses.org as org,\n courses.course_key as course_key,\n courses.course_name as course_name,\n courses.course_run as course_run,\n blocks.location as block_id,\n blocks.block_name as block_name,\n \n concat(\n splitByString(\n ':', splitByString(' - ', blocks.display_name_with_location)[1], 1\n )[1],\n ':0:0'\n )\n as section_number,\n \n concat(\n arrayStringConcat(\n splitByString(\n ':', splitByString(' - ', blocks.display_name_with_location)[1], 2\n ),\n ':'\n ),\n ':0'\n )\n\n as subsection_number,\n splitByString(' - ', blocks.display_name_with_location)[1] as hierarchy_location,\n blocks.display_name_with_location as display_name_with_location,\n course_order,\n graded,\n case\n when block_id like '%@chapter+block@%'\n then 'section'\n when block_id like '%@sequential+block@%'\n then 'subsection'\n when block_id like '%@vertical+block@%'\n then 'unit'\n else regexpExtract(block_id, '@([^+]+)\\+block@', 1)\n end as block_type\nfrom `xapi`.`course_block_names` blocks\njoin `xapi`.`course_names` courses on blocks.course_key = courses.course_key", "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.aspects.course_names": {"database": "", "schema": "xapi", "name": "course_names", "resource_type": "model", "package_name": "aspects", "path": "courses/course_names.sql", "original_file_path": "models/courses/course_names.sql", "unique_id": "model.aspects.course_names", "fqn": ["aspects", "courses", "course_names"], "alias": "course_names", "checksum": {"name": "sha256", "checksum": "e5d77448bfdc32f7d60d5ab96e1ecc596f16e006119432684c5725007292e205"}, "config": {"enabled": true, "alias": null, "schema": "event_sink", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "dictionary", "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", "fields": [["course_key", "String"], ["course_name", "String"], ["course_run", "String"], ["org", "String"]], "primary_key": "course_key", "layout": "COMPLEX_KEY_HASHED()", "lifetime": "120", "source_type": "clickhouse", "connection_overrides": {"host": "localhost"}}, "tags": [], "description": "A table of courses with their names", "columns": {"course_key": {"name": "course_key", "description": "The course key for the course", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_name": {"name": "course_name", "description": "The name of the course", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_run": {"name": "course_run", "description": "The course run for the course", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "org": {"name": "org", "description": "The organization that the course belongs to", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "aspects://models/courses/schema.yml", "build_path": null, "unrendered_config": {"materialized": "dictionary", "schema": "event_sink", "fields": [["course_key", "String"], ["course_name", "String"], ["course_run", "String"], ["org", "String"]], "primary_key": "course_key", "layout": "COMPLEX_KEY_HASHED()", "lifetime": "120", "source_type": "clickhouse", "connection_overrides": {"host": "localhost"}}, "created_at": 1723756272.4512424, "relation_name": "`xapi`.`course_names`", "raw_code": "{{\n config(\n materialized=\"dictionary\",\n schema=env_var(\"ASPECTS_EVENT_SINK_DATABASE\", \"event_sink\"),\n fields=[\n (\"course_key\", \"String\"),\n (\"course_name\", \"String\"),\n (\"course_run\", \"String\"),\n (\"org\", \"String\"),\n ],\n primary_key=\"course_key\",\n layout=\"COMPLEX_KEY_HASHED()\",\n lifetime=env_var(\"ASPECTS_COURSE_NAME_CACHE_LIFETIME\", \"120\"),\n source_type=\"clickhouse\",\n connection_overrides={\n \"host\": \"localhost\",\n },\n )\n}}\n\nwith\n most_recent_overviews as (\n select org, course_key, max(modified) as last_modified\n from {{ source(\"event_sink\", \"course_overviews\") }}\n group by org, course_key\n )\nselect\n course_key,\n display_name as course_name,\n splitByString('+', course_key)[-1] as course_run,\n org\nfrom {{ source(\"event_sink\", \"course_overviews\") }} co\ninner join\n most_recent_overviews mro\n on co.org = mro.org\n and co.course_key = mro.course_key\n and co.modified = mro.last_modified", "language": "sql", "refs": [], "sources": [["event_sink", "course_overviews"], ["event_sink", "course_overviews"]], "metrics": [], "depends_on": {"macros": [], "nodes": ["source.aspects.event_sink.course_overviews"]}, "compiled_path": "target/compiled/aspects/models/courses/course_names.sql", "compiled": true, "compiled_code": "\n\nwith\n most_recent_overviews as (\n select org, course_key, max(modified) as last_modified\n from `event_sink`.`course_overviews`\n group by org, course_key\n )\nselect\n course_key,\n display_name as course_name,\n splitByString('+', course_key)[-1] as course_run,\n org\nfrom `event_sink`.`course_overviews` co\ninner join\n most_recent_overviews mro\n on co.org = mro.org\n and co.course_key = mro.course_key\n and co.modified = mro.last_modified", "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.aspects.dim_course_blocks_extended": {"database": "", "schema": "xapi", "name": "dim_course_blocks_extended", "resource_type": "model", "package_name": "aspects", "path": "courses/dim_course_blocks_extended.sql", "original_file_path": "models/courses/dim_course_blocks_extended.sql", "unique_id": "model.aspects.dim_course_blocks_extended", "fqn": ["aspects", "courses", "dim_course_blocks_extended"], "alias": "dim_course_blocks_extended", "checksum": {"name": "sha256", "checksum": "40e5bf47d8b788c9ddcddcb67b793fa839c4e217a9b39b7c70a9e902a2928485"}, "config": {"enabled": true, "alias": null, "schema": null, "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": "dim_course_blocks with section and subsection names joined into the data.", "columns": {"org": {"name": "org", "description": "The organization that the course belongs to", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_key": {"name": "course_key", "description": "The course key for the course", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_name": {"name": "course_name", "description": "The name of the course", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_run": {"name": "course_run", "description": "The course run for the course", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "block_id": {"name": "block_id", "description": "The block's unique identifier", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "block_name": {"name": "block_name", "description": "The block's name", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "section_number": {"name": "section_number", "description": "The section this block belongs to, formatted as :0:0", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "subsection_number": {"name": "subsection_number", "description": "The subsection this block belongs to, formatted as ::0", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "hierarchy_location": {"name": "hierarchy_location", "description": "The full section:subsection:unit hierarchy in which this block belongs", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "display_name_with_location": {"name": "display_name_with_location", "description": "The block's display name with section, subsection, and unit prepended to the name. This provides additional context when looking at block names and can help data consumers understand which block they are analyzing", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "graded": {"name": "graded", "description": "Whether the block is graded", "meta": {}, "data_type": "Boolean", "constraints": [], "quote": null, "tags": []}, "block_type": {"name": "block_type", "description": "The type of block. This can be a section, subsection, unit, or the block type", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "section_with_name": {"name": "section_with_name", "description": "The name of the section this block belongs to, with section_number prepended", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "subsection_with_name": {"name": "subsection_with_name", "description": "The name of the section this subsection belongs to, with subsection_number prepended", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_order": {"name": "course_order", "description": "The sort order of this block in the course across all course blocks", "meta": {}, "data_type": "Int32", "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "aspects://models/courses/schema.yml", "build_path": null, "unrendered_config": {}, "created_at": 1723756272.4528213, "relation_name": "`xapi`.`dim_course_blocks_extended`", "raw_code": "select\n blocks.org as org,\n blocks.course_key as course_key,\n blocks.course_name as course_name,\n blocks.course_run as course_run,\n blocks.block_id as block_id,\n blocks.block_name as block_name,\n blocks.section_number as section_number,\n blocks.subsection_number as subsection_number,\n blocks.hierarchy_location as hierarchy_location,\n blocks.display_name_with_location as display_name_with_location,\n blocks.graded as graded,\n blocks.course_order as course_order,\n blocks.block_type as block_type,\n section_blocks.display_name_with_location as section_with_name,\n subsection_blocks.display_name_with_location as subsection_with_name\nfrom {{ ref(\"dim_course_blocks\") }} blocks\nleft join\n {{ ref(\"dim_course_blocks\") }} section_blocks\n on (\n blocks.section_number = section_blocks.hierarchy_location\n and blocks.org = section_blocks.org\n and blocks.course_key = section_blocks.course_key\n and section_blocks.block_id like '%@chapter+block@%'\n )\nleft join\n {{ ref(\"dim_course_blocks\") }} subsection_blocks\n on (\n blocks.subsection_number = subsection_blocks.hierarchy_location\n and blocks.org = subsection_blocks.org\n and blocks.course_key = subsection_blocks.course_key\n and subsection_blocks.block_id like '%@sequential+block@%'\n )", "language": "sql", "refs": [{"name": "dim_course_blocks", "package": null, "version": null}, {"name": "dim_course_blocks", "package": null, "version": null}, {"name": "dim_course_blocks", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.aspects.dim_course_blocks"]}, "compiled_path": "target/compiled/aspects/models/courses/dim_course_blocks_extended.sql", "compiled": true, "compiled_code": "select\n blocks.org as org,\n blocks.course_key as course_key,\n blocks.course_name as course_name,\n blocks.course_run as course_run,\n blocks.block_id as block_id,\n blocks.block_name as block_name,\n blocks.section_number as section_number,\n blocks.subsection_number as subsection_number,\n blocks.hierarchy_location as hierarchy_location,\n blocks.display_name_with_location as display_name_with_location,\n blocks.graded as graded,\n blocks.course_order as course_order,\n blocks.block_type as block_type,\n section_blocks.display_name_with_location as section_with_name,\n subsection_blocks.display_name_with_location as subsection_with_name\nfrom `xapi`.`dim_course_blocks` blocks\nleft join\n `xapi`.`dim_course_blocks` section_blocks\n on (\n blocks.section_number = section_blocks.hierarchy_location\n and blocks.org = section_blocks.org\n and blocks.course_key = section_blocks.course_key\n and section_blocks.block_id like '%@chapter+block@%'\n )\nleft join\n `xapi`.`dim_course_blocks` subsection_blocks\n on (\n blocks.subsection_number = subsection_blocks.hierarchy_location\n and blocks.org = subsection_blocks.org\n and blocks.course_key = subsection_blocks.course_key\n and subsection_blocks.block_id like '%@sequential+block@%'\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.aspects.fact_video_plays": {"database": "", "schema": "xapi", "name": "fact_video_plays", "resource_type": "model", "package_name": "aspects", "path": "video/fact_video_plays.sql", "original_file_path": "models/video/fact_video_plays.sql", "unique_id": "model.aspects.fact_video_plays", "fqn": ["aspects", "video", "fact_video_plays"], "alias": "fact_video_plays", "checksum": {"name": "sha256", "checksum": "318b681ff711047f401c5cef658d3782a098b690c0e36314dcd40c0f4450e197"}, "config": {"enabled": true, "alias": null, "schema": null, "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": "One record for each time a learner played a video", "columns": {"emission_time": {"name": "emission_time", "description": "Timestamp, to the second, of when this event was emitted", "meta": {}, "data_type": "DateTime", "constraints": [], "quote": null, "tags": []}, "org": {"name": "org", "description": "The organization that the course belongs to", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_key": {"name": "course_key", "description": "The course key for the course", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_name": {"name": "course_name", "description": "The name of the course", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "course_run": {"name": "course_run", "description": "The course run for the course", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "video_id": {"name": "video_id", "description": "The xAPI object identifier", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "video_name": {"name": "video_name", "description": "The name of the video", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "video_name_with_location": {"name": "video_name_with_location", "description": "The name of the video with the section and subsection", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "video_link": {"name": "video_link", "description": "An anchor tag with a link to the video", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "graded": {"name": "graded", "description": "Whether the block is graded", "meta": {}, "data_type": "Boolean", "constraints": [], "quote": null, "tags": []}, "actor_id": {"name": "actor_id", "description": "The xAPI actor identifier", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "video_duration": {"name": "video_duration", "description": "The duration of the video in seconds", "meta": {}, "data_type": "Int64", "constraints": [], "quote": null, "tags": []}, "video_position": {"name": "video_position", "description": "The seconds into the video where the play event occurred", "meta": {}, "data_type": "Int64", "constraints": [], "quote": null, "tags": []}, "visualization_bucket": {"name": "visualization_bucket", "description": "The percentile bucket for the video play event", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "username": {"name": "username", "description": "The username of the learner", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "name": {"name": "name", "description": "The full name of the learner", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "email": {"name": "email", "description": "The email address of the learner", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "section_with_name": {"name": "section_with_name", "description": "The name of the section this video belongs to, with section_number prepended", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "subsection_with_name": {"name": "subsection_with_name", "description": "The name of the subsection this video belongs to, with subsection_number prepended", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "course_order": {"name": "course_order", "description": "The sort order of this block in the course across all course blocks", "meta": {}, "data_type": "Int32", "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "aspects://models/video/schema.yml", "build_path": null, "unrendered_config": {}, "created_at": 1723756272.4571183, "relation_name": "`xapi`.`fact_video_plays`", "raw_code": "-- model to support number of watches per video\n-- ref:\n-- https://edx.readthedocs.io/projects/edx-insights/en/latest/Reference.html#engagement-computations\nwith\n plays as (\n select\n emission_time,\n org,\n course_key,\n object_id,\n video_duration,\n video_position,\n splitByString('/xblock/', object_id)[-1] as video_id,\n actor_id\n from {{ ref(\"video_playback_events\") }}\n where verb_id = 'https://w3id.org/xapi/video/verbs/played'\n )\n\nselect\n plays.emission_time as emission_time,\n plays.org as org,\n plays.course_key as course_key,\n blocks.course_name as course_name,\n blocks.course_run as course_run,\n plays.video_id as video_id,\n blocks.block_name as video_name,\n blocks.display_name_with_location as video_name_with_location,\n {{ a_tag(\"plays.object_id\", \"blocks.block_name\") }} as video_link,\n blocks.graded as graded,\n plays.video_position as video_position,\n plays.video_duration as video_duration,\n {{ get_bucket(\"video_position/video_duration\") }} as visualization_bucket,\n plays.actor_id as actor_id,\n users.username as username,\n users.name as name,\n users.email as email,\n blocks.section_with_name as section_with_name,\n blocks.subsection_with_name as subsection_with_name,\n blocks.course_order as course_order\nfrom plays\njoin\n {{ ref(\"dim_course_blocks_extended\") }} blocks\n on (plays.course_key = blocks.course_key and plays.video_id = blocks.block_id)\nleft outer join\n {{ ref(\"dim_user_pii\") }} users on toUUID(actor_id) = users.external_user_id", "language": "sql", "refs": [{"name": "video_playback_events", "package": null, "version": null}, {"name": "dim_course_blocks_extended", "package": null, "version": null}, {"name": "dim_user_pii", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.aspects.a_tag", "macro.aspects.get_bucket"], "nodes": ["model.aspects.video_playback_events", "model.aspects.dim_course_blocks_extended", "model.aspects.dim_user_pii"]}, "compiled_path": "target/compiled/aspects/models/video/fact_video_plays.sql", "compiled": true, "compiled_code": "-- model to support number of watches per video\n-- ref:\n-- https://edx.readthedocs.io/projects/edx-insights/en/latest/Reference.html#engagement-computations\nwith\n plays as (\n select\n emission_time,\n org,\n course_key,\n object_id,\n video_duration,\n video_position,\n splitByString('/xblock/', object_id)[-1] as video_id,\n actor_id\n from `xapi`.`video_playback_events`\n where verb_id = 'https://w3id.org/xapi/video/verbs/played'\n )\n\nselect\n plays.emission_time as emission_time,\n plays.org as org,\n plays.course_key as course_key,\n blocks.course_name as course_name,\n blocks.course_run as course_run,\n plays.video_id as video_id,\n blocks.block_name as video_name,\n blocks.display_name_with_location as video_name_with_location,\n \n concat(\n '', blocks.block_name, ''\n )\n as video_link,\n blocks.graded as graded,\n plays.video_position as video_position,\n plays.video_duration as video_duration,\n case\n when video_position/video_duration >= 0.9\n then '90-100%'\n when video_position/video_duration >= 0.8 and video_position/video_duration < 0.9\n then '80-89%'\n when video_position/video_duration >= 0.7 and video_position/video_duration < 0.8\n then '70-79%'\n when video_position/video_duration >= 0.6 and video_position/video_duration < 0.7\n then '60-69%'\n when video_position/video_duration >= 0.5 and video_position/video_duration < 0.6\n then '50-59%'\n when video_position/video_duration >= 0.4 and video_position/video_duration < 0.5\n then '40-49%'\n when video_position/video_duration >= 0.3 and video_position/video_duration < 0.4\n then '30-39%'\n when video_position/video_duration >= 0.2 and video_position/video_duration < 0.3\n then '20-29%'\n when video_position/video_duration >= 0.1 and video_position/video_duration < 0.2\n then '10-19%'\n else '0-9%'\n end as visualization_bucket,\n plays.actor_id as actor_id,\n users.username as username,\n users.name as name,\n users.email as email,\n blocks.section_with_name as section_with_name,\n blocks.subsection_with_name as subsection_with_name,\n blocks.course_order as course_order\nfrom plays\njoin\n `xapi`.`dim_course_blocks_extended` blocks\n on (plays.course_key = blocks.course_key and plays.video_id = blocks.block_id)\nleft outer join\n `xapi`.`dim_user_pii` users on toUUID(actor_id) = users.external_user_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.aspects.fact_video_engagement": {"database": "", "schema": "xapi", "name": "fact_video_engagement", "resource_type": "model", "package_name": "aspects", "path": "video/fact_video_engagement.sql", "original_file_path": "models/video/fact_video_engagement.sql", "unique_id": "model.aspects.fact_video_engagement", "fqn": ["aspects", "video", "fact_video_engagement"], "alias": "fact_video_engagement", "checksum": {"name": "sha256", "checksum": "8e4f4f8c49b7970ae89b05b8dfccf909507c9c93ced2c4e10a4683f7e54257d0"}, "config": {"enabled": true, "alias": null, "schema": null, "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": "A dataset with one record representing the engagement of a learner with a video", "columns": {"org": {"name": "org", "description": "The organization that the video belongs to", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "course_key": {"name": "course_key", "description": "The course key for the course", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "course_run": {"name": "course_run", "description": "The course run for the course", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "section_with_name": {"name": "section_with_name", "description": "The name of the section this subsection belongs to, with section_number prepended", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "subsection_with_name": {"name": "subsection_with_name", "description": "The name of the subsection, with section_number prepended", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "section_subsection_name": {"name": "section_subsection_name", "description": "The name of the section or the subsection", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "content_level": {"name": "content_level", "description": "The content level of the video", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "actor_id": {"name": "actor_id", "description": "The xAPI actor identifier", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "section_subsection_video_engagement": {"name": "section_subsection_video_engagement", "description": "The engagement level of the learner with the video", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "username": {"name": "username", "description": "The username of the learner", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "name": {"name": "name", "description": "The full name of the learner", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}, "email": {"name": "email", "description": "The email address of the learner", "meta": {}, "data_type": "String", "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "aspects://models/video/schema.yml", "build_path": null, "unrendered_config": {}, "created_at": 1723756272.4615762, "relation_name": "`xapi`.`fact_video_engagement`", "raw_code": "with\n subsection_engagement as (\n select\n org,\n course_key,\n 'subsection' as content_level,\n actor_id,\n subsection_block_id as block_id,\n engagement_level as section_subsection_video_engagement\n from {{ ref(\"subsection_video_engagement\") }}\n ),\n section_engagement as (\n select\n org,\n course_key,\n 'section' as content_level,\n actor_id,\n section_block_id as block_id,\n engagement_level as section_subsection_video_engagement\n from {{ ref(\"section_video_engagement\") }}\n ),\n video_engagement as (\n select *\n from subsection_engagement\n union all\n select *\n from section_engagement\n )\nselect\n ve.org as org,\n ve.course_key as course_key,\n course_blocks.course_run as course_run,\n course_blocks.display_name_with_location as section_subsection_name,\n ve.content_level as content_level,\n ve.actor_id as actor_id,\n ve.section_subsection_video_engagement as section_subsection_video_engagement,\n users.username as username,\n users.name as name,\n users.email as email\nfrom video_engagement ve\njoin\n {{ ref(\"dim_course_blocks\") }} course_blocks\n on (\n ve.org = course_blocks.org\n and ve.course_key = course_blocks.course_key\n and ve.block_id = course_blocks.block_id\n )\nleft outer join\n {{ ref(\"dim_user_pii\") }} users on toUUID(ve.actor_id) = users.external_user_id", "language": "sql", "refs": [{"name": "subsection_video_engagement", "package": null, "version": null}, {"name": "section_video_engagement", "package": null, "version": null}, {"name": "dim_course_blocks", "package": null, "version": null}, {"name": "dim_user_pii", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.aspects.subsection_video_engagement", "model.aspects.section_video_engagement", "model.aspects.dim_course_blocks", "model.aspects.dim_user_pii"]}, "compiled_path": "target/compiled/aspects/models/video/fact_video_engagement.sql", "compiled": true, "compiled_code": "with\n subsection_engagement as (\n select\n org,\n course_key,\n 'subsection' as content_level,\n actor_id,\n subsection_block_id as block_id,\n engagement_level as section_subsection_video_engagement\n from `xapi`.`subsection_video_engagement`\n ),\n section_engagement as (\n select\n org,\n course_key,\n 'section' as content_level,\n actor_id,\n section_block_id as block_id,\n engagement_level as section_subsection_video_engagement\n from `xapi`.`section_video_engagement`\n ),\n video_engagement as (\n select *\n from subsection_engagement\n union all\n select *\n from section_engagement\n )\nselect\n ve.org as org,\n ve.course_key as course_key,\n course_blocks.course_run as course_run,\n course_blocks.display_name_with_location as section_subsection_name,\n ve.content_level as content_level,\n ve.actor_id as actor_id,\n ve.section_subsection_video_engagement as section_subsection_video_engagement,\n users.username as username,\n users.name as name,\n users.email as email\nfrom video_engagement ve\njoin\n `xapi`.`dim_course_blocks` course_blocks\n on (\n ve.org = course_blocks.org\n and ve.course_key = course_blocks.course_key\n and ve.block_id = course_blocks.block_id\n )\nleft outer join\n `xapi`.`dim_user_pii` users on toUUID(ve.actor_id) = users.external_user_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.aspects.section_video_engagement": {"database": "", "schema": "xapi", "name": "section_video_engagement", "resource_type": "model", "package_name": "aspects", "path": "video/section_video_engagement.sql", "original_file_path": "models/video/section_video_engagement.sql", "unique_id": "model.aspects.section_video_engagement", "fqn": ["aspects", "video", "section_video_engagement"], "alias": "section_video_engagement", "checksum": {"name": "sha256", "checksum": "e1faecd8052346a0a55780f549f68d57b386ebdb31c0bcb9a9b98083a3466560"}, "config": {"enabled": true, "alias": null, "schema": "xapi", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "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", "engine": "\n ReplacingMergeTree()", "order_by": "(org, course_key, section_block_id, actor_id)", "primary_key": "(org, course_key)"}, "tags": [], "description": "A record per course per section per learner with their engagement level", "columns": {"org": {"name": "org", "description": "The organization that the course belongs to", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "course_key": {"name": "course_key", "description": "The course key for the course", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "actor_id": {"name": "actor_id", "description": "The xAPI actor identifier", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "section_block_id": {"name": "section_block_id", "description": "The unique identifier for the section block", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "engagement_level": {"name": "engagement_level", "description": "The engagement level of the learner with the section", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "aspects://models/video/schema.yml", "build_path": null, "unrendered_config": {"materialized": "materialized_view", "schema": "xapi", "engine": "\n ReplacingMergeTree()", "primary_key": "(org, course_key)", "order_by": "(org, course_key, section_block_id, actor_id)"}, "created_at": 1723756272.4622848, "relation_name": "`xapi`.`section_video_engagement`", "raw_code": "{{\n config(\n materialized=\"materialized_view\",\n schema=env_var(\"ASPECTS_XAPI_DATABASE\", \"xapi\"),\n engine=get_engine(\"ReplacingMergeTree()\"),\n primary_key=\"(org, course_key)\",\n order_by=\"(org, course_key, section_block_id, actor_id)\",\n )\n}}\n\nwith\n viewed_subsection_videos as (\n select distinct\n date(emission_time) as viewed_on,\n org,\n course_key,\n {{ section_from_display(\"video_name_with_location\") }} as section_number,\n {{ subsection_from_display(\"video_name_with_location\") }}\n as subsection_number,\n actor_id,\n video_id\n from {{ ref(\"fact_video_plays\") }}\n ),\n fact_video_engagement_per_subsection as (\n select\n views.org as org,\n views.course_key as course_key,\n videos.section_with_name as section_with_name,\n videos.subsection_with_name as subsection_with_name,\n videos.item_count as item_count,\n views.actor_id as actor_id,\n views.video_id as video_id,\n videos.section_block_id as section_block_id\n from viewed_subsection_videos views\n join\n {{ ref(\"int_videos_per_subsection\") }} videos\n on (\n views.org = videos.org\n and views.course_key = videos.course_key\n and views.section_number = videos.section_number\n and views.subsection_number = videos.subsection_number\n )\n ),\n subsection_counts as (\n select\n org,\n course_key,\n section_with_name,\n subsection_with_name,\n actor_id,\n item_count,\n count(distinct video_id) as videos_viewed,\n case\n when videos_viewed = 0\n then 'No videos viewed yet'\n when videos_viewed = item_count\n then 'All videos viewed'\n else 'At least one video viewed'\n end as engagement_level,\n section_block_id\n from fact_video_engagement_per_subsection\n group by\n org,\n course_key,\n section_with_name,\n subsection_with_name,\n actor_id,\n item_count,\n section_block_id\n ),\n section_counts as (\n select\n org,\n course_key,\n actor_id,\n sum(item_count) as item_count,\n sum(videos_viewed) as videos_viewed,\n case\n when videos_viewed = 0\n then 'No videos viewed yet'\n when videos_viewed = item_count\n then 'All videos viewed'\n else 'At least one video viewed'\n end as engagement_level,\n section_block_id\n from subsection_counts\n group by org, course_key, section_block_id, actor_id\n )\nselect org, course_key, actor_id, section_block_id, engagement_level\nfrom section_counts", "language": "sql", "refs": [{"name": "fact_video_plays", "package": null, "version": null}, {"name": "int_videos_per_subsection", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.aspects.get_engine", "macro.aspects.section_from_display", "macro.aspects.subsection_from_display"], "nodes": ["model.aspects.fact_video_plays", "model.aspects.int_videos_per_subsection"]}, "compiled_path": "target/compiled/aspects/models/video/section_video_engagement.sql", "compiled": true, "compiled_code": "\n\nwith\n viewed_subsection_videos as (\n select distinct\n date(emission_time) as viewed_on,\n org,\n course_key,\n \n concat(\n splitByString(\n ':', splitByString(' - ', video_name_with_location)[1], 1\n )[1],\n ':0:0'\n )\n as section_number,\n \n concat(\n arrayStringConcat(\n splitByString(\n ':', splitByString(' - ', video_name_with_location)[1], 2\n ),\n ':'\n ),\n ':0'\n )\n\n as subsection_number,\n actor_id,\n video_id\n from `xapi`.`fact_video_plays`\n ),\n fact_video_engagement_per_subsection as (\n select\n views.org as org,\n views.course_key as course_key,\n videos.section_with_name as section_with_name,\n videos.subsection_with_name as subsection_with_name,\n videos.item_count as item_count,\n views.actor_id as actor_id,\n views.video_id as video_id,\n videos.section_block_id as section_block_id\n from viewed_subsection_videos views\n join\n `xapi`.`int_videos_per_subsection` videos\n on (\n views.org = videos.org\n and views.course_key = videos.course_key\n and views.section_number = videos.section_number\n and views.subsection_number = videos.subsection_number\n )\n ),\n subsection_counts as (\n select\n org,\n course_key,\n section_with_name,\n subsection_with_name,\n actor_id,\n item_count,\n count(distinct video_id) as videos_viewed,\n case\n when videos_viewed = 0\n then 'No videos viewed yet'\n when videos_viewed = item_count\n then 'All videos viewed'\n else 'At least one video viewed'\n end as engagement_level,\n section_block_id\n from fact_video_engagement_per_subsection\n group by\n org,\n course_key,\n section_with_name,\n subsection_with_name,\n actor_id,\n item_count,\n section_block_id\n ),\n section_counts as (\n select\n org,\n course_key,\n actor_id,\n sum(item_count) as item_count,\n sum(videos_viewed) as videos_viewed,\n case\n when videos_viewed = 0\n then 'No videos viewed yet'\n when videos_viewed = item_count\n then 'All videos viewed'\n else 'At least one video viewed'\n end as engagement_level,\n section_block_id\n from subsection_counts\n group by org, course_key, section_block_id, actor_id\n )\nselect org, course_key, actor_id, section_block_id, engagement_level\nfrom section_counts", "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.aspects.video_playback_events": {"database": "", "schema": "xapi", "name": "video_playback_events", "resource_type": "model", "package_name": "aspects", "path": "video/video_playback_events.sql", "original_file_path": "models/video/video_playback_events.sql", "unique_id": "model.aspects.video_playback_events", "fqn": ["aspects", "video", "video_playback_events"], "alias": "video_playback_events", "checksum": {"name": "sha256", "checksum": "30efe06d3eb1c3e5d9469c92a3ee4d767b726cff8a8aafc8e129d1cfea410c30"}, "config": {"enabled": true, "alias": null, "schema": "xapi", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "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", "engine": "\n ReplacingMergeTree()", "order_by": "(org, course_key, verb_id, emission_time, actor_id, video_position, event_id)", "partition_by": "(toYYYYMM(emission_time))", "ttl": "", "primary_key": "(org, course_key, verb_id)"}, "tags": [], "description": "Events related to video playback", "columns": {"event_id": {"name": "event_id", "description": "The unique identifier for the event", "meta": {}, "data_type": "uuid", "constraints": [], "quote": null, "tags": []}, "emission_time": {"name": "emission_time", "description": "The time the event was emitted", "meta": {}, "data_type": "datetime", "constraints": [], "quote": null, "tags": []}, "actor_id": {"name": "actor_id", "description": "The xAPI actor identifier", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "object_id": {"name": "object_id", "description": "The xAPI object identifier", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "course_key": {"name": "course_key", "description": "The course identifier", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "org": {"name": "org", "description": "The organization that the course belongs to", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "verb_id": {"name": "verb_id", "description": "The xAPI verb identifier", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "video_position": {"name": "video_position", "description": "The position in the video where the event occurred", "meta": {}, "data_type": "decimal(9, 2)", "constraints": [], "quote": null, "tags": []}, "video_duration": {"name": "video_duration", "description": "The duration of the video in seconds", "meta": {}, "data_type": "int64", "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "aspects://models/video/schema.yml", "build_path": null, "unrendered_config": {"materialized": "materialized_view", "schema": "xapi", "engine": "\n ReplacingMergeTree()", "primary_key": "(org, course_key, verb_id)", "order_by": "(org, course_key, verb_id, emission_time, actor_id, video_position, event_id)", "partition_by": "(toYYYYMM(emission_time))", "ttl": ""}, "created_at": 1723756272.4590778, "relation_name": "`xapi`.`video_playback_events`", "raw_code": "{{\n config(\n materialized=\"materialized_view\",\n schema=env_var(\"ASPECTS_XAPI_DATABASE\", \"xapi\"),\n engine=get_engine(\"ReplacingMergeTree()\"),\n primary_key=\"(org, course_key, verb_id)\",\n order_by=\"(org, course_key, verb_id, emission_time, actor_id, video_position, event_id)\",\n partition_by=\"(toYYYYMM(emission_time))\",\n ttl=env_var(\"ASPECTS_DATA_TTL_EXPRESSION\", \"\"),\n )\n}}\n\nselect\n event_id,\n CAST(emission_time, 'DateTime') as emission_time,\n actor_id,\n object_id,\n course_key,\n org,\n verb_id,\n ceil(\n CAST(\n coalesce(\n nullIf(\n JSON_VALUE(\n event,\n '$.result.extensions.\"https://w3id.org/xapi/video/extensions/time\"'\n ),\n ''\n ),\n nullIf(\n JSON_VALUE(\n event,\n '$.result.extensions.\"https://w3id.org/xapi/video/extensions/time-from\"'\n ),\n ''\n ),\n '0.0'\n ),\n 'Decimal32(2)'\n )\n ) as video_position,\n JSONExtractInt(\n event, 'context', 'extensions', 'https://w3id.org/xapi/video/extensions/length'\n ) as video_duration\nfrom {{ ref(\"xapi_events_all_parsed\") }}\nwhere\n (\n verb_id in (\n 'http://adlnet.gov/expapi/verbs/completed',\n 'http://adlnet.gov/expapi/verbs/initialized',\n 'http://adlnet.gov/expapi/verbs/terminated',\n 'https://w3id.org/xapi/video/verbs/paused',\n 'https://w3id.org/xapi/video/verbs/played',\n 'https://w3id.org/xapi/video/verbs/seeked'\n )\n )\n and (object_id like '%video+block%')", "language": "sql", "refs": [{"name": "xapi_events_all_parsed", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.aspects.get_engine"], "nodes": ["model.aspects.xapi_events_all_parsed"]}, "compiled_path": "target/compiled/aspects/models/video/video_playback_events.sql", "compiled": true, "compiled_code": "\n\nselect\n event_id,\n CAST(emission_time, 'DateTime') as emission_time,\n actor_id,\n object_id,\n course_key,\n org,\n verb_id,\n ceil(\n CAST(\n coalesce(\n nullIf(\n JSON_VALUE(\n event,\n '$.result.extensions.\"https://w3id.org/xapi/video/extensions/time\"'\n ),\n ''\n ),\n nullIf(\n JSON_VALUE(\n event,\n '$.result.extensions.\"https://w3id.org/xapi/video/extensions/time-from\"'\n ),\n ''\n ),\n '0.0'\n ),\n 'Decimal32(2)'\n )\n ) as video_position,\n JSONExtractInt(\n event, 'context', 'extensions', 'https://w3id.org/xapi/video/extensions/length'\n ) as video_duration\nfrom `xapi`.`xapi_events_all_parsed`\nwhere\n (\n verb_id in (\n 'http://adlnet.gov/expapi/verbs/completed',\n 'http://adlnet.gov/expapi/verbs/initialized',\n 'http://adlnet.gov/expapi/verbs/terminated',\n 'https://w3id.org/xapi/video/verbs/paused',\n 'https://w3id.org/xapi/video/verbs/played',\n 'https://w3id.org/xapi/video/verbs/seeked'\n )\n )\n and (object_id like '%video+block%')", "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.aspects.subsection_video_engagement": {"database": "", "schema": "xapi", "name": "subsection_video_engagement", "resource_type": "model", "package_name": "aspects", "path": "video/subsection_video_engagement.sql", "original_file_path": "models/video/subsection_video_engagement.sql", "unique_id": "model.aspects.subsection_video_engagement", "fqn": ["aspects", "video", "subsection_video_engagement"], "alias": "subsection_video_engagement", "checksum": {"name": "sha256", "checksum": "56d4d3a7a7c1511e7a6a371c14f27527714e6befdb8da7e3a5eba0859699a553"}, "config": {"enabled": true, "alias": null, "schema": "xapi", "database": null, "tags": [], "meta": {}, "group": null, "materialized": "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", "engine": "\n ReplacingMergeTree()", "order_by": "(org, course_key, subsection_block_id, actor_id)", "primary_key": "(org, course_key)"}, "tags": [], "description": "A record per course per subsection per learner with their engagement level", "columns": {"org": {"name": "org", "description": "The organization that the course belongs to", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "course_key": {"name": "course_key", "description": "The course key for the course", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "actor_id": {"name": "actor_id", "description": "The xAPI actor identifier", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "subsection_block_id": {"name": "subsection_block_id", "description": "The unique identifier for the subsection block", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "engagement_level": {"name": "engagement_level", "description": "The engagement level of the learner with the subsection", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "aspects://models/video/schema.yml", "build_path": null, "unrendered_config": {"materialized": "materialized_view", "schema": "xapi", "engine": "\n ReplacingMergeTree()", "primary_key": "(org, course_key)", "order_by": "(org, course_key, subsection_block_id, actor_id)"}, "created_at": 1723756272.462945, "relation_name": "`xapi`.`subsection_video_engagement`", "raw_code": "{{\n config(\n materialized=\"materialized_view\",\n schema=env_var(\"ASPECTS_XAPI_DATABASE\", \"xapi\"),\n engine=get_engine(\"ReplacingMergeTree()\"),\n primary_key=\"(org, course_key)\",\n order_by=\"(org, course_key, subsection_block_id, actor_id)\",\n )\n}}\n\nwith\n viewed_subsection_videos as (\n select distinct\n date(emission_time) as viewed_on,\n org,\n course_key,\n {{ section_from_display(\"video_name_with_location\") }} as section_number,\n {{ subsection_from_display(\"video_name_with_location\") }}\n as subsection_number,\n actor_id,\n video_id\n from {{ ref(\"fact_video_plays\") }}\n ),\n fact_video_engagement_per_subsection as (\n select\n views.org as org,\n views.course_key as course_key,\n videos.section_with_name as section_with_name,\n videos.subsection_with_name as subsection_with_name,\n videos.item_count as item_count,\n views.actor_id as actor_id,\n views.video_id as video_id,\n videos.subsection_block_id as subsection_block_id\n from viewed_subsection_videos views\n join\n {{ ref(\"int_videos_per_subsection\") }} videos\n on (\n views.org = videos.org\n and views.course_key = videos.course_key\n and views.section_number = videos.section_number\n and views.subsection_number = videos.subsection_number\n )\n ),\n subsection_counts as (\n select\n org,\n course_key,\n section_with_name,\n subsection_with_name,\n actor_id,\n item_count,\n count(distinct video_id) as videos_viewed,\n case\n when videos_viewed = 0\n then 'No videos viewed yet'\n when videos_viewed = item_count\n then 'All videos viewed'\n else 'At least one video viewed'\n end as engagement_level,\n subsection_block_id\n from fact_video_engagement_per_subsection\n group by\n org,\n course_key,\n section_with_name,\n subsection_with_name,\n actor_id,\n item_count,\n subsection_block_id\n )\nselect distinct org, course_key, actor_id, subsection_block_id, engagement_level\nfrom subsection_counts", "language": "sql", "refs": [{"name": "fact_video_plays", "package": null, "version": null}, {"name": "int_videos_per_subsection", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.aspects.get_engine", "macro.aspects.section_from_display", "macro.aspects.subsection_from_display"], "nodes": ["model.aspects.fact_video_plays", "model.aspects.int_videos_per_subsection"]}, "compiled_path": "target/compiled/aspects/models/video/subsection_video_engagement.sql", "compiled": true, "compiled_code": "\n\nwith\n viewed_subsection_videos as (\n select distinct\n date(emission_time) as viewed_on,\n org,\n course_key,\n \n concat(\n splitByString(\n ':', splitByString(' - ', video_name_with_location)[1], 1\n )[1],\n ':0:0'\n )\n as section_number,\n \n concat(\n arrayStringConcat(\n splitByString(\n ':', splitByString(' - ', video_name_with_location)[1], 2\n ),\n ':'\n ),\n ':0'\n )\n\n as subsection_number,\n actor_id,\n video_id\n from `xapi`.`fact_video_plays`\n ),\n fact_video_engagement_per_subsection as (\n select\n views.org as org,\n views.course_key as course_key,\n videos.section_with_name as section_with_name,\n videos.subsection_with_name as subsection_with_name,\n videos.item_count as item_count,\n views.actor_id as actor_id,\n views.video_id as video_id,\n videos.subsection_block_id as subsection_block_id\n from viewed_subsection_videos views\n join\n `xapi`.`int_videos_per_subsection` videos\n on (\n views.org = videos.org\n and views.course_key = videos.course_key\n and views.section_number = videos.section_number\n and views.subsection_number = videos.subsection_number\n )\n ),\n subsection_counts as (\n select\n org,\n course_key,\n section_with_name,\n subsection_with_name,\n actor_id,\n item_count,\n count(distinct video_id) as videos_viewed,\n case\n when videos_viewed = 0\n then 'No videos viewed yet'\n when videos_viewed = item_count\n then 'All videos viewed'\n else 'At least one video viewed'\n end as engagement_level,\n subsection_block_id\n from fact_video_engagement_per_subsection\n group by\n org,\n course_key,\n section_with_name,\n subsection_with_name,\n actor_id,\n item_count,\n subsection_block_id\n )\nselect distinct org, course_key, actor_id, subsection_block_id, engagement_level\nfrom subsection_counts", "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.aspects.int_videos_per_subsection": {"database": "", "schema": "xapi", "name": "int_videos_per_subsection", "resource_type": "model", "package_name": "aspects", "path": "video/int_videos_per_subsection.sql", "original_file_path": "models/video/int_videos_per_subsection.sql", "unique_id": "model.aspects.int_videos_per_subsection", "fqn": ["aspects", "video", "int_videos_per_subsection"], "alias": "int_videos_per_subsection", "checksum": {"name": "sha256", "checksum": "b95fb8fbe257ae83e6a3dd859730de95ede0685e04ff98bd10c94eba8134807e"}, "config": {"enabled": true, "alias": null, "schema": null, "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": "A dimension table with the number of videos per subsection", "columns": {"org": {"name": "org", "description": "The organization that the course belongs to", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "course_key": {"name": "course_key", "description": "The course key for the course", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "section_number": {"name": "section_number", "description": "The location of this section in the course, represented as section:0:0", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "section_with_name": {"name": "section_with_name", "description": "The name of the section this subsection belongs to, with section_number prepended", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "subsection_number": {"name": "subsection_number", "description": "The location of this subsection in the course, represented as section:subsection:0", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "subsection_with_name": {"name": "subsection_with_name", "description": "The name of the subsection, with section_number prepended", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "graded": {"name": "graded", "description": "Whether the block is graded", "meta": {}, "data_type": "Boolean", "constraints": [], "quote": null, "tags": []}, "item_count": {"name": "item_count", "description": "The number of videos in this subsection", "meta": {}, "data_type": "uint64", "constraints": [], "quote": null, "tags": []}, "course_order": {"name": "course_order", "description": "The sort order of this block in the course across all course blocks", "meta": {}, "data_type": "Int32", "constraints": [], "quote": null, "tags": []}, "subsection_block_id": {"name": "subsection_block_id", "description": "The unique identifier for the subsection block", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}, "section_block_id": {"name": "section_block_id", "description": "The unique identifier for the section block", "meta": {}, "data_type": "string", "constraints": [], "quote": null, "tags": []}}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": "aspects://models/video/schema.yml", "build_path": null, "unrendered_config": {}, "created_at": 1723756272.460247, "relation_name": "`xapi`.`int_videos_per_subsection`", "raw_code": "select * from ({{ items_per_subsection(\"%@video+block@%\") }})", "language": "sql", "refs": [{"name": "dim_course_blocks", "package": null, "version": null}, {"name": "dim_course_blocks", "package": null, "version": null}, {"name": "dim_course_blocks", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.aspects.items_per_subsection"], "nodes": ["model.aspects.dim_course_blocks"]}, "compiled_path": "target/compiled/aspects/models/video/int_videos_per_subsection.sql", "compiled": true, "compiled_code": "select * from (\n with\n items_per_subsection as (\n select\n org,\n course_key,\n section_number,\n subsection_number,\n course_order,\n graded,\n count(*) as item_count\n from `xapi`.`dim_course_blocks`\n where block_id like '%@video+block@%'\n group by\n org, course_key, section_number, subsection_number, course_order, graded\n )\n\n select\n ips.org as org,\n ips.course_key as course_key,\n ips.section_number as section_number,\n section_blocks.display_name_with_location as section_with_name,\n ips.subsection_number as subsection_number,\n subsection_blocks.display_name_with_location as subsection_with_name,\n ips.course_order as course_order,\n ips.graded as graded,\n ips.item_count as item_count,\n subsection_blocks.block_id as subsection_block_id,\n section_blocks.block_id as section_block_id\n from items_per_subsection ips\n left join\n `xapi`.`dim_course_blocks` section_blocks\n on (\n ips.section_number = section_blocks.hierarchy_location\n and ips.org = section_blocks.org\n and ips.course_key = section_blocks.course_key\n and section_blocks.block_id like '%@chapter+block@%'\n )\n left join\n `xapi`.`dim_course_blocks` subsection_blocks\n on (\n ips.subsection_number = subsection_blocks.hierarchy_location\n and ips.org = subsection_blocks.org\n and ips.course_key = subsection_blocks.course_key\n and subsection_blocks.block_id like '%@sequential+block@%'\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}, "test.aspects.get_problem_id_with_ccx": {"database": "", "schema": "xapi", "name": "get_problem_id_with_ccx", "resource_type": "test", "package_name": "aspects", "path": "macros/get_problem_id_with_ccx.sql", "original_file_path": "tests/macros/get_problem_id_with_ccx.sql", "unique_id": "test.aspects.get_problem_id_with_ccx", "fqn": ["aspects", "macros", "get_problem_id_with_ccx"], "alias": "get_problem_id_with_ccx", "checksum": {"name": "sha256", "checksum": "6a34adbf88e71976a4ec23527f8c9d805cacb1da2927f68eb1325bd694703b07"}, "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": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "unrendered_config": {}, "created_at": 1723756272.0811, "relation_name": null, "raw_code": "select\n 'http://local.edly.io:8000/xblock/ccx-block-v1:edunext+demo+demo+ccx@1+type@problem+block@3c1646f7133a4c5fb4557d649e22c251'\n as object_id\nfrom system.one\nwhere\n {{ get_problem_id(\"object_id\") }}\n != 'ccx-block-v1:edunext+demo+demo+ccx@1+type@problem+block@3c1646f7133a4c5fb4557d649e22c251'", "language": "sql", "refs": [], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.aspects.get_problem_id"], "nodes": []}, "compiled_path": "target/compiled/aspects/tests/macros/get_problem_id_with_ccx.sql", "compiled": true, "compiled_code": "select\n 'http://local.edly.io:8000/xblock/ccx-block-v1:edunext+demo+demo+ccx@1+type@problem+block@3c1646f7133a4c5fb4557d649e22c251'\n as object_id\nfrom system.one\nwhere\n \n regexpExtract(\n object_id, 'xblock/([\\w\\d-\\+:@]*@problem\\+block@[\\w\\d][^_\\/]*)(_\\d_\\d)?', 1\n )\n\n != 'ccx-block-v1:edunext+demo+demo+ccx@1+type@problem+block@3c1646f7133a4c5fb4557d649e22c251'", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}}, "test.aspects.get_bucket": {"database": "", "schema": "xapi", "name": "get_bucket", "resource_type": "test", "package_name": "aspects", "path": "macros/get_bucket.sql", "original_file_path": "tests/macros/get_bucket.sql", "unique_id": "test.aspects.get_bucket", "fqn": ["aspects", "macros", "get_bucket"], "alias": "get_bucket", "checksum": {"name": "sha256", "checksum": "c90f76edc031d642c81a001c8f5b23c7269a581884e97a5d88477f99ae0f56a9"}, "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": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "unrendered_config": {}, "created_at": 1723756272.0898118, "relation_name": null, "raw_code": "select 0.95 as field\nfrom system.one\nwhere \n {{ get_bucket('field') }} != '90-100%'\n\nunion all \n\nselect 0.8 as field\nfrom system.one\nwhere \n {{ get_bucket('field') }} != '80-89%'\n\nunion all \n\nselect 0.700009 as field\nfrom system.one\nwhere \n {{ get_bucket('field') }} != '70-79%'\n\nunion all \n\nselect 0.69999 as field\nfrom system.one\nwhere \n {{ get_bucket('field') }} != '60-69%'\n\nunion all \n\nselect 0.5 as field\nfrom system.one\nwhere \n {{ get_bucket('field') }} != '50-59%'\n\nunion all \n\nselect 0.4123 as field\nfrom system.one\nwhere \n {{ get_bucket('field') }} != '40-49%'\n\nunion all \n\nselect 0.3000000000 as field\nfrom system.one\nwhere \n {{ get_bucket('field') }} != '30-39%'\n\nunion all \n\nselect 0.276734 as field\nfrom system.one\nwhere \n {{ get_bucket('field') }} != '20-29%'\n\nunion all \n\nselect 0.11111 as field\nfrom system.one\nwhere \n {{ get_bucket('field') }} != '10-19%'\n\nunion all \n\nselect 0.0342 as field\nfrom system.one\nwhere \n {{ get_bucket('field') }} != '0-9%'\n\nunion all \n\nselect 0.00000005 as field\nfrom system.one\nwhere \n {{ get_bucket('field') }} != '0-9%'\n\nunion all \n\nselect -0.1 as field\nfrom system.one\nwhere \n {{ get_bucket('field') }} != '0-9%'\n\nunion all \n\nselect 123 as field\nfrom system.one\nwhere \n {{ get_bucket('field') }} != '90-100%'", "language": "sql", "refs": [], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.aspects.get_bucket"], "nodes": []}, "compiled_path": "target/compiled/aspects/tests/macros/get_bucket.sql", "compiled": true, "compiled_code": "select 0.95 as field\nfrom system.one\nwhere \n case\n when field >= 0.9\n then '90-100%'\n when field >= 0.8 and field < 0.9\n then '80-89%'\n when field >= 0.7 and field < 0.8\n then '70-79%'\n when field >= 0.6 and field < 0.7\n then '60-69%'\n when field >= 0.5 and field < 0.6\n then '50-59%'\n when field >= 0.4 and field < 0.5\n then '40-49%'\n when field >= 0.3 and field < 0.4\n then '30-39%'\n when field >= 0.2 and field < 0.3\n then '20-29%'\n when field >= 0.1 and field < 0.2\n then '10-19%'\n else '0-9%'\n end != '90-100%'\n\nunion all \n\nselect 0.8 as field\nfrom system.one\nwhere \n case\n when field >= 0.9\n then '90-100%'\n when field >= 0.8 and field < 0.9\n then '80-89%'\n when field >= 0.7 and field < 0.8\n then '70-79%'\n when field >= 0.6 and field < 0.7\n then '60-69%'\n when field >= 0.5 and field < 0.6\n then '50-59%'\n when field >= 0.4 and field < 0.5\n then '40-49%'\n when field >= 0.3 and field < 0.4\n then '30-39%'\n when field >= 0.2 and field < 0.3\n then '20-29%'\n when field >= 0.1 and field < 0.2\n then '10-19%'\n else '0-9%'\n end != '80-89%'\n\nunion all \n\nselect 0.700009 as field\nfrom system.one\nwhere \n case\n when field >= 0.9\n then '90-100%'\n when field >= 0.8 and field < 0.9\n then '80-89%'\n when field >= 0.7 and field < 0.8\n then '70-79%'\n when field >= 0.6 and field < 0.7\n then '60-69%'\n when field >= 0.5 and field < 0.6\n then '50-59%'\n when field >= 0.4 and field < 0.5\n then '40-49%'\n when field >= 0.3 and field < 0.4\n then '30-39%'\n when field >= 0.2 and field < 0.3\n then '20-29%'\n when field >= 0.1 and field < 0.2\n then '10-19%'\n else '0-9%'\n end != '70-79%'\n\nunion all \n\nselect 0.69999 as field\nfrom system.one\nwhere \n case\n when field >= 0.9\n then '90-100%'\n when field >= 0.8 and field < 0.9\n then '80-89%'\n when field >= 0.7 and field < 0.8\n then '70-79%'\n when field >= 0.6 and field < 0.7\n then '60-69%'\n when field >= 0.5 and field < 0.6\n then '50-59%'\n when field >= 0.4 and field < 0.5\n then '40-49%'\n when field >= 0.3 and field < 0.4\n then '30-39%'\n when field >= 0.2 and field < 0.3\n then '20-29%'\n when field >= 0.1 and field < 0.2\n then '10-19%'\n else '0-9%'\n end != '60-69%'\n\nunion all \n\nselect 0.5 as field\nfrom system.one\nwhere \n case\n when field >= 0.9\n then '90-100%'\n when field >= 0.8 and field < 0.9\n then '80-89%'\n when field >= 0.7 and field < 0.8\n then '70-79%'\n when field >= 0.6 and field < 0.7\n then '60-69%'\n when field >= 0.5 and field < 0.6\n then '50-59%'\n when field >= 0.4 and field < 0.5\n then '40-49%'\n when field >= 0.3 and field < 0.4\n then '30-39%'\n when field >= 0.2 and field < 0.3\n then '20-29%'\n when field >= 0.1 and field < 0.2\n then '10-19%'\n else '0-9%'\n end != '50-59%'\n\nunion all \n\nselect 0.4123 as field\nfrom system.one\nwhere \n case\n when field >= 0.9\n then '90-100%'\n when field >= 0.8 and field < 0.9\n then '80-89%'\n when field >= 0.7 and field < 0.8\n then '70-79%'\n when field >= 0.6 and field < 0.7\n then '60-69%'\n when field >= 0.5 and field < 0.6\n then '50-59%'\n when field >= 0.4 and field < 0.5\n then '40-49%'\n when field >= 0.3 and field < 0.4\n then '30-39%'\n when field >= 0.2 and field < 0.3\n then '20-29%'\n when field >= 0.1 and field < 0.2\n then '10-19%'\n else '0-9%'\n end != '40-49%'\n\nunion all \n\nselect 0.3000000000 as field\nfrom system.one\nwhere \n case\n when field >= 0.9\n then '90-100%'\n when field >= 0.8 and field < 0.9\n then '80-89%'\n when field >= 0.7 and field < 0.8\n then '70-79%'\n when field >= 0.6 and field < 0.7\n then '60-69%'\n when field >= 0.5 and field < 0.6\n then '50-59%'\n when field >= 0.4 and field < 0.5\n then '40-49%'\n when field >= 0.3 and field < 0.4\n then '30-39%'\n when field >= 0.2 and field < 0.3\n then '20-29%'\n when field >= 0.1 and field < 0.2\n then '10-19%'\n else '0-9%'\n end != '30-39%'\n\nunion all \n\nselect 0.276734 as field\nfrom system.one\nwhere \n case\n when field >= 0.9\n then '90-100%'\n when field >= 0.8 and field < 0.9\n then '80-89%'\n when field >= 0.7 and field < 0.8\n then '70-79%'\n when field >= 0.6 and field < 0.7\n then '60-69%'\n when field >= 0.5 and field < 0.6\n then '50-59%'\n when field >= 0.4 and field < 0.5\n then '40-49%'\n when field >= 0.3 and field < 0.4\n then '30-39%'\n when field >= 0.2 and field < 0.3\n then '20-29%'\n when field >= 0.1 and field < 0.2\n then '10-19%'\n else '0-9%'\n end != '20-29%'\n\nunion all \n\nselect 0.11111 as field\nfrom system.one\nwhere \n case\n when field >= 0.9\n then '90-100%'\n when field >= 0.8 and field < 0.9\n then '80-89%'\n when field >= 0.7 and field < 0.8\n then '70-79%'\n when field >= 0.6 and field < 0.7\n then '60-69%'\n when field >= 0.5 and field < 0.6\n then '50-59%'\n when field >= 0.4 and field < 0.5\n then '40-49%'\n when field >= 0.3 and field < 0.4\n then '30-39%'\n when field >= 0.2 and field < 0.3\n then '20-29%'\n when field >= 0.1 and field < 0.2\n then '10-19%'\n else '0-9%'\n end != '10-19%'\n\nunion all \n\nselect 0.0342 as field\nfrom system.one\nwhere \n case\n when field >= 0.9\n then '90-100%'\n when field >= 0.8 and field < 0.9\n then '80-89%'\n when field >= 0.7 and field < 0.8\n then '70-79%'\n when field >= 0.6 and field < 0.7\n then '60-69%'\n when field >= 0.5 and field < 0.6\n then '50-59%'\n when field >= 0.4 and field < 0.5\n then '40-49%'\n when field >= 0.3 and field < 0.4\n then '30-39%'\n when field >= 0.2 and field < 0.3\n then '20-29%'\n when field >= 0.1 and field < 0.2\n then '10-19%'\n else '0-9%'\n end != '0-9%'\n\nunion all \n\nselect 0.00000005 as field\nfrom system.one\nwhere \n case\n when field >= 0.9\n then '90-100%'\n when field >= 0.8 and field < 0.9\n then '80-89%'\n when field >= 0.7 and field < 0.8\n then '70-79%'\n when field >= 0.6 and field < 0.7\n then '60-69%'\n when field >= 0.5 and field < 0.6\n then '50-59%'\n when field >= 0.4 and field < 0.5\n then '40-49%'\n when field >= 0.3 and field < 0.4\n then '30-39%'\n when field >= 0.2 and field < 0.3\n then '20-29%'\n when field >= 0.1 and field < 0.2\n then '10-19%'\n else '0-9%'\n end != '0-9%'\n\nunion all \n\nselect -0.1 as field\nfrom system.one\nwhere \n case\n when field >= 0.9\n then '90-100%'\n when field >= 0.8 and field < 0.9\n then '80-89%'\n when field >= 0.7 and field < 0.8\n then '70-79%'\n when field >= 0.6 and field < 0.7\n then '60-69%'\n when field >= 0.5 and field < 0.6\n then '50-59%'\n when field >= 0.4 and field < 0.5\n then '40-49%'\n when field >= 0.3 and field < 0.4\n then '30-39%'\n when field >= 0.2 and field < 0.3\n then '20-29%'\n when field >= 0.1 and field < 0.2\n then '10-19%'\n else '0-9%'\n end != '0-9%'\n\nunion all \n\nselect 123 as field\nfrom system.one\nwhere \n case\n when field >= 0.9\n then '90-100%'\n when field >= 0.8 and field < 0.9\n then '80-89%'\n when field >= 0.7 and field < 0.8\n then '70-79%'\n when field >= 0.6 and field < 0.7\n then '60-69%'\n when field >= 0.5 and field < 0.6\n then '50-59%'\n when field >= 0.4 and field < 0.5\n then '40-49%'\n when field >= 0.3 and field < 0.4\n then '30-39%'\n when field >= 0.2 and field < 0.3\n then '20-29%'\n when field >= 0.1 and field < 0.2\n then '10-19%'\n else '0-9%'\n end != '90-100%'", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}}, "test.aspects.section_from_display": {"database": "", "schema": "xapi", "name": "section_from_display", "resource_type": "test", "package_name": "aspects", "path": "macros/section_from_display.sql", "original_file_path": "tests/macros/section_from_display.sql", "unique_id": "test.aspects.section_from_display", "fqn": ["aspects", "macros", "section_from_display"], "alias": "section_from_display", "checksum": {"name": "sha256", "checksum": "0c6b02ef69d95ab483f8170e5eb9b47dab947ab23a2fa3285bdb8752027fab12"}, "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": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "unrendered_config": {}, "created_at": 1723756272.0949733, "relation_name": null, "raw_code": "select \n '1:2:3 - Course 1a2b3c' as display_name_with_location\nfrom system.one\nwhere \n {{ section_from_display('display_name_with_location') }}\n != '1:0:0'\n\nunion all \n\nselect \n '1:2:33 - Video 12' as display_name_with_location\nfrom system.one\nwhere \n {{ section_from_display('display_name_with_location') }}\n != '1:0:0'\n\nunion all \n\nselect \n '1:22:3 - Vertical 345' as display_name_with_location\nfrom system.one\nwhere \n {{ section_from_display('display_name_with_location') }}\n != '1:0:0'\n\nunion all \n\nselect \n '11:2:3 - Sequential 678' as display_name_with_location\nfrom system.one\nwhere \n {{ section_from_display('display_name_with_location') }}\n != '11:0:0'", "language": "sql", "refs": [], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.aspects.section_from_display"], "nodes": []}, "compiled_path": "target/compiled/aspects/tests/macros/section_from_display.sql", "compiled": true, "compiled_code": "select \n '1:2:3 - Course 1a2b3c' as display_name_with_location\nfrom system.one\nwhere \n \n concat(\n splitByString(\n ':', splitByString(' - ', display_name_with_location)[1], 1\n )[1],\n ':0:0'\n )\n\n != '1:0:0'\n\nunion all \n\nselect \n '1:2:33 - Video 12' as display_name_with_location\nfrom system.one\nwhere \n \n concat(\n splitByString(\n ':', splitByString(' - ', display_name_with_location)[1], 1\n )[1],\n ':0:0'\n )\n\n != '1:0:0'\n\nunion all \n\nselect \n '1:22:3 - Vertical 345' as display_name_with_location\nfrom system.one\nwhere \n \n concat(\n splitByString(\n ':', splitByString(' - ', display_name_with_location)[1], 1\n )[1],\n ':0:0'\n )\n\n != '1:0:0'\n\nunion all \n\nselect \n '11:2:3 - Sequential 678' as display_name_with_location\nfrom system.one\nwhere \n \n concat(\n splitByString(\n ':', splitByString(' - ', display_name_with_location)[1], 1\n )[1],\n ':0:0'\n )\n\n != '11:0:0'", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}}, "test.aspects.subsection_from_display": {"database": "", "schema": "xapi", "name": "subsection_from_display", "resource_type": "test", "package_name": "aspects", "path": "macros/subsection_from_display.sql", "original_file_path": "tests/macros/subsection_from_display.sql", "unique_id": "test.aspects.subsection_from_display", "fqn": ["aspects", "macros", "subsection_from_display"], "alias": "subsection_from_display", "checksum": {"name": "sha256", "checksum": "74c94108e12bc31c8d248a570257eac8c2a7f8bea8412ed1e00c1bf52a95f77a"}, "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": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "unrendered_config": {}, "created_at": 1723756272.098674, "relation_name": null, "raw_code": "select \n '1:2:3 - Chapter 123' as display_name_with_location\nfrom system.one\nwhere \n {{ subsection_from_display('display_name_with_location') }}\n != '1:2:0'\n\nunion all \n\nselect \n '1:2:33 - Problem 456' as display_name_with_location\nfrom system.one\nwhere \n {{ subsection_from_display('display_name_with_location') }}\n != '1:2:0'\n\nunion all \n\nselect \n '1:22:3 - Sequential 789' as display_name_with_location\nfrom system.one\nwhere \n {{ subsection_from_display('display_name_with_location') }}\n != '1:22:0'\n\nunion all \n\nselect \n '11:2:3 - Vertical 123' as display_name_with_location\nfrom system.one\nwhere \n {{ subsection_from_display('display_name_with_location') }}\n != '11:2:0'", "language": "sql", "refs": [], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.aspects.subsection_from_display"], "nodes": []}, "compiled_path": "target/compiled/aspects/tests/macros/subsection_from_display.sql", "compiled": true, "compiled_code": "select \n '1:2:3 - Chapter 123' as display_name_with_location\nfrom system.one\nwhere \n \n concat(\n arrayStringConcat(\n splitByString(\n ':', splitByString(' - ', display_name_with_location)[1], 2\n ),\n ':'\n ),\n ':0'\n )\n\n != '1:2:0'\n\nunion all \n\nselect \n '1:2:33 - Problem 456' as display_name_with_location\nfrom system.one\nwhere \n \n concat(\n arrayStringConcat(\n splitByString(\n ':', splitByString(' - ', display_name_with_location)[1], 2\n ),\n ':'\n ),\n ':0'\n )\n\n != '1:2:0'\n\nunion all \n\nselect \n '1:22:3 - Sequential 789' as display_name_with_location\nfrom system.one\nwhere \n \n concat(\n arrayStringConcat(\n splitByString(\n ':', splitByString(' - ', display_name_with_location)[1], 2\n ),\n ':'\n ),\n ':0'\n )\n\n != '1:22:0'\n\nunion all \n\nselect \n '11:2:3 - Vertical 123' as display_name_with_location\nfrom system.one\nwhere \n \n concat(\n arrayStringConcat(\n splitByString(\n ':', splitByString(' - ', display_name_with_location)[1], 2\n ),\n ':'\n ),\n ':0'\n )\n\n != '11:2:0'", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}}, "test.aspects.get_problem_id": {"database": "", "schema": "xapi", "name": "get_problem_id", "resource_type": "test", "package_name": "aspects", "path": "macros/get_problem_id.sql", "original_file_path": "tests/macros/get_problem_id.sql", "unique_id": "test.aspects.get_problem_id", "fqn": ["aspects", "macros", "get_problem_id"], "alias": "get_problem_id", "checksum": {"name": "sha256", "checksum": "dc6e1c60588cc6325fea3509e87033b3ed3026fe6870f331bf9383d14b035b8a"}, "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": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "unrendered_config": {}, "created_at": 1723756272.1023533, "relation_name": null, "raw_code": "select\n 'http://local.edly.io:8000/xblock/block-v1:edunext+demo+demo+ccx+type@problem+block@3c1646f7133a4c5fb4557d649e22c251'\n as object_id\nfrom system.one\nwhere\n {{ get_problem_id(\"object_id\") }}\n != 'block-v1:edunext+demo+demo+ccx+type@problem+block@3c1646f7133a4c5fb4557d649e22c251'\n\nunion all\n\nselect\n 'http://localhost:18000/course/course-v1:Org1+DemoX+1937e7'\n as object_id\nfrom system.one\nwhere\n {{ get_problem_id(\"object_id\") }}\n != ''\n\nunion all\n\nselect\n 'http://localhost:18000/xblock/block-v1:course-v1:Org0+DemoX+2bc51b+type@problem+block@09b07a8d'\n as object_id\nfrom system.one\nwhere\n {{ get_problem_id(\"object_id\") }}\n != 'block-v1:course-v1:Org0+DemoX+2bc51b+type@problem+block@09b07a8d'\n\nunion all\n\nselect\n 'http://localhost:18000/xblock/block-v1:course-v1:Org0+DemoX+2bc51b+type@problem+block@09b07a8d/answer'\n as object_id\nfrom system.one\nwhere\n {{ get_problem_id(\"object_id\") }}\n != 'block-v1:course-v1:Org0+DemoX+2bc51b+type@problem+block@09b07a8d'\n\nunion all\n\nselect\n 'http://localhost:18000/xblock/block-v1:course-v1:Org0+DemoX+81bba1+type@problem+block@20d3f709/hint/1'\n as object_id\nfrom system.one\nwhere\n {{ get_problem_id(\"object_id\") }}\n != 'block-v1:course-v1:Org0+DemoX+81bba1+type@problem+block@20d3f709'\n\nunion all\n\nselect\n 'http://localhost:18000/xblock/block-v1:course-v1:Org0+DemoX+81bba1+type@problem+block@20d3f709/hint/1'\n as object_id\nfrom system.one\nwhere\n {{ get_problem_id(\"object_id\") }}\n != 'block-v1:course-v1:Org0+DemoX+81bba1+type@problem+block@20d3f709'", "language": "sql", "refs": [], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.aspects.get_problem_id"], "nodes": []}, "compiled_path": "target/compiled/aspects/tests/macros/get_problem_id.sql", "compiled": true, "compiled_code": "select\n 'http://local.edly.io:8000/xblock/block-v1:edunext+demo+demo+ccx+type@problem+block@3c1646f7133a4c5fb4557d649e22c251'\n as object_id\nfrom system.one\nwhere\n \n regexpExtract(\n object_id, 'xblock/([\\w\\d-\\+:@]*@problem\\+block@[\\w\\d][^_\\/]*)(_\\d_\\d)?', 1\n )\n\n != 'block-v1:edunext+demo+demo+ccx+type@problem+block@3c1646f7133a4c5fb4557d649e22c251'\n\nunion all\n\nselect\n 'http://localhost:18000/course/course-v1:Org1+DemoX+1937e7'\n as object_id\nfrom system.one\nwhere\n \n regexpExtract(\n object_id, 'xblock/([\\w\\d-\\+:@]*@problem\\+block@[\\w\\d][^_\\/]*)(_\\d_\\d)?', 1\n )\n\n != ''\n\nunion all\n\nselect\n 'http://localhost:18000/xblock/block-v1:course-v1:Org0+DemoX+2bc51b+type@problem+block@09b07a8d'\n as object_id\nfrom system.one\nwhere\n \n regexpExtract(\n object_id, 'xblock/([\\w\\d-\\+:@]*@problem\\+block@[\\w\\d][^_\\/]*)(_\\d_\\d)?', 1\n )\n\n != 'block-v1:course-v1:Org0+DemoX+2bc51b+type@problem+block@09b07a8d'\n\nunion all\n\nselect\n 'http://localhost:18000/xblock/block-v1:course-v1:Org0+DemoX+2bc51b+type@problem+block@09b07a8d/answer'\n as object_id\nfrom system.one\nwhere\n \n regexpExtract(\n object_id, 'xblock/([\\w\\d-\\+:@]*@problem\\+block@[\\w\\d][^_\\/]*)(_\\d_\\d)?', 1\n )\n\n != 'block-v1:course-v1:Org0+DemoX+2bc51b+type@problem+block@09b07a8d'\n\nunion all\n\nselect\n 'http://localhost:18000/xblock/block-v1:course-v1:Org0+DemoX+81bba1+type@problem+block@20d3f709/hint/1'\n as object_id\nfrom system.one\nwhere\n \n regexpExtract(\n object_id, 'xblock/([\\w\\d-\\+:@]*@problem\\+block@[\\w\\d][^_\\/]*)(_\\d_\\d)?', 1\n )\n\n != 'block-v1:course-v1:Org0+DemoX+81bba1+type@problem+block@20d3f709'\n\nunion all\n\nselect\n 'http://localhost:18000/xblock/block-v1:course-v1:Org0+DemoX+81bba1+type@problem+block@20d3f709/hint/1'\n as object_id\nfrom system.one\nwhere\n \n regexpExtract(\n object_id, 'xblock/([\\w\\d-\\+:@]*@problem\\+block@[\\w\\d][^_\\/]*)(_\\d_\\d)?', 1\n )\n\n != 'block-v1:course-v1:Org0+DemoX+81bba1+type@problem+block@20d3f709'", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}}, "test.aspects.a_tag": {"database": "", "schema": "xapi", "name": "a_tag", "resource_type": "test", "package_name": "aspects", "path": "macros/a_tag.sql", "original_file_path": "tests/macros/a_tag.sql", "unique_id": "test.aspects.a_tag", "fqn": ["aspects", "macros", "a_tag"], "alias": "a_tag", "checksum": {"name": "sha256", "checksum": "0189e37c42a186a7c6b57b43ce3cade68fe400b57580a137c3ce8f927bda1048"}, "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": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "unrendered_config": {}, "created_at": 1723756272.1063902, "relation_name": null, "raw_code": "select\n 'http://local.edly.io/xblock/block-v1:OpenedX+DemoX+DemoCourse+type@video+block@d5a54ce52f464acfa7a83ae155712cc3' as object_id,\n 'The Purpose, Power and Reach of the Open edX\u00ae Platform' as video_name,\n {{ a_tag('object_id', 'video_name') }} as object_a_tag\nfrom\n system.numbers\nwhere object_a_tag != 'The Purpose, Power and Reach of the Open edX\u00ae Platform'", "language": "sql", "refs": [], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.aspects.a_tag"], "nodes": []}, "compiled_path": "target/compiled/aspects/tests/macros/a_tag.sql", "compiled": true, "compiled_code": "select\n 'http://local.edly.io/xblock/block-v1:OpenedX+DemoX+DemoCourse+type@video+block@d5a54ce52f464acfa7a83ae155712cc3' as object_id,\n 'The Purpose, Power and Reach of the Open edX\u00ae Platform' as video_name,\n \n concat(\n '', video_name, ''\n )\n as object_a_tag\nfrom\n system.numbers\nwhere object_a_tag != 'The Purpose, Power and Reach of the Open edX\u00ae Platform'", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}}, "test.aspects.accepted_values_fact_enrollments_enrollment_status__registered__unregistered.f8d10203f4": {"database": "", "schema": "xapi", "name": "accepted_values_fact_enrollments_enrollment_status__registered__unregistered", "resource_type": "test", "package_name": "aspects", "path": "accepted_values_fact_enrollmen_1086f4b5aaa1831a14dfbb256e3845c9.sql", "original_file_path": "models/enrollment/schema.yml", "unique_id": "test.aspects.accepted_values_fact_enrollments_enrollment_status__registered__unregistered.f8d10203f4", "fqn": ["aspects", "enrollment", "accepted_values_fact_enrollments_enrollment_status__registered__unregistered"], "alias": "accepted_values_fact_enrollmen_1086f4b5aaa1831a14dfbb256e3845c9", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "accepted_values_fact_enrollmen_1086f4b5aaa1831a14dfbb256e3845c9", "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": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "unrendered_config": {"alias": "accepted_values_fact_enrollmen_1086f4b5aaa1831a14dfbb256e3845c9"}, "created_at": 1723756272.3434987, "relation_name": null, "raw_code": "{{ test_accepted_values(**_dbt_generic_test_kwargs) }}{{ config(alias=\"accepted_values_fact_enrollmen_1086f4b5aaa1831a14dfbb256e3845c9\") }}", "language": "sql", "refs": [{"name": "fact_enrollments", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_accepted_values", "macro.dbt.get_where_subquery"], "nodes": ["model.aspects.fact_enrollments"]}, "compiled_path": "target/compiled/aspects/models/enrollment/schema.yml/accepted_values_fact_enrollmen_1086f4b5aaa1831a14dfbb256e3845c9.sql", "compiled": true, "compiled_code": "\n \n \n\nwith all_values as (\n\n select\n enrollment_status as value_field,\n count(*) as n_records\n\n from `xapi`.`fact_enrollments`\n group by enrollment_status\n\n)\n\nselect *\nfrom all_values\nwhere value_field not in (\n 'registered','unregistered'\n)\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "enrollment_status", "file_key_name": "models.fact_enrollments", "attached_node": "model.aspects.fact_enrollments", "test_metadata": {"name": "accepted_values", "kwargs": {"values": ["registered", "unregistered"], "column_name": "enrollment_status", "model": "{{ get_where_subquery(ref('fact_enrollments')) }}"}, "namespace": null}}, "test.aspects.accepted_values_fact_enrollment_status_enrollment_status__registered__unregistered.893527c11f": {"database": "", "schema": "xapi", "name": "accepted_values_fact_enrollment_status_enrollment_status__registered__unregistered", "resource_type": "test", "package_name": "aspects", "path": "accepted_values_fact_enrollmen_19e28d0c914e4e943cd678ae73f6a8ec.sql", "original_file_path": "models/enrollment/schema.yml", "unique_id": "test.aspects.accepted_values_fact_enrollment_status_enrollment_status__registered__unregistered.893527c11f", "fqn": ["aspects", "enrollment", "accepted_values_fact_enrollment_status_enrollment_status__registered__unregistered"], "alias": "accepted_values_fact_enrollmen_19e28d0c914e4e943cd678ae73f6a8ec", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "accepted_values_fact_enrollmen_19e28d0c914e4e943cd678ae73f6a8ec", "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": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "unrendered_config": {"alias": "accepted_values_fact_enrollmen_19e28d0c914e4e943cd678ae73f6a8ec"}, "created_at": 1723756272.3604708, "relation_name": null, "raw_code": "{{ test_accepted_values(**_dbt_generic_test_kwargs) }}{{ config(alias=\"accepted_values_fact_enrollmen_19e28d0c914e4e943cd678ae73f6a8ec\") }}", "language": "sql", "refs": [{"name": "fact_enrollment_status", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_accepted_values", "macro.dbt.get_where_subquery"], "nodes": ["model.aspects.fact_enrollment_status"]}, "compiled_path": "target/compiled/aspects/models/enrollment/schema.yml/accepted_values_fact_enrollmen_19e28d0c914e4e943cd678ae73f6a8ec.sql", "compiled": true, "compiled_code": "\n \n \n\nwith all_values as (\n\n select\n enrollment_status as value_field,\n count(*) as n_records\n\n from `xapi`.`fact_enrollment_status`\n group by enrollment_status\n\n)\n\nselect *\nfrom all_values\nwhere value_field not in (\n 'registered','unregistered'\n)\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "enrollment_status", "file_key_name": "models.fact_enrollment_status", "attached_node": "model.aspects.fact_enrollment_status", "test_metadata": {"name": "accepted_values", "kwargs": {"values": ["registered", "unregistered"], "column_name": "enrollment_status", "model": "{{ get_where_subquery(ref('fact_enrollment_status')) }}"}, "namespace": null}}, "test.aspects.accepted_values_xapi_fact_instance_enrollments_enrollment_status__xapi_fact_instance_enrollments__registered__unregistered.744ab867be": {"database": "", "schema": "xapi", "name": "accepted_values_xapi_fact_instance_enrollments_enrollment_status__xapi_fact_instance_enrollments__registered__unregistered", "resource_type": "test", "package_name": "aspects", "path": "accepted_values_xapi_fact_inst_919ea2b7d3586eb457e7b98e6f268476.sql", "original_file_path": "models/instance/schema.yml", "unique_id": "test.aspects.accepted_values_xapi_fact_instance_enrollments_enrollment_status__xapi_fact_instance_enrollments__registered__unregistered.744ab867be", "fqn": ["aspects", "instance", "accepted_values_xapi_fact_instance_enrollments_enrollment_status__xapi_fact_instance_enrollments__registered__unregistered"], "alias": "accepted_values_xapi_fact_inst_919ea2b7d3586eb457e7b98e6f268476", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "accepted_values_xapi_fact_inst_919ea2b7d3586eb457e7b98e6f268476", "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": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "unrendered_config": {"alias": "accepted_values_xapi_fact_inst_919ea2b7d3586eb457e7b98e6f268476"}, "created_at": 1723756272.3688228, "relation_name": null, "raw_code": "{{ test_accepted_values_xapi(**_dbt_generic_test_kwargs) }}{{ config(alias=\"accepted_values_xapi_fact_inst_919ea2b7d3586eb457e7b98e6f268476\") }}", "language": "sql", "refs": [{"name": "fact_instance_enrollments", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.aspects.test_accepted_values_xapi", "macro.dbt.get_where_subquery"], "nodes": ["model.aspects.fact_instance_enrollments"]}, "compiled_path": "target/compiled/aspects/models/instance/schema.yml/accepted_values_xapi_fact_inst_919ea2b7d3586eb457e7b98e6f268476.sql", "compiled": true, "compiled_code": "\n\nwith all_values as (\n\n select distinct\n enrollment_status as value_field\n\n from xapi.fact_instance_enrollments\n\n),\n\nvalidation_errors as (\n\n select\n value_field\n\n from all_values\n where value_field not in (\n 'registered','unregistered'\n )\n\n)\n\nselect *\nfrom validation_errors\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "enrollment_status", "file_key_name": "models.fact_instance_enrollments", "attached_node": "model.aspects.fact_instance_enrollments", "test_metadata": {"name": "accepted_values_xapi", "kwargs": {"values": ["registered", "unregistered"], "table": "xapi.fact_instance_enrollments", "column_name": "enrollment_status", "model": "{{ get_where_subquery(ref('fact_instance_enrollments')) }}"}, "namespace": null}}, "test.aspects.accepted_values_fact_learner_course_status_approving_state__passed__failed.f9c0c1b85f": {"database": "", "schema": "xapi", "name": "accepted_values_fact_learner_course_status_approving_state__passed__failed", "resource_type": "test", "package_name": "aspects", "path": "accepted_values_fact_learner_c_559ec0ad399aaf9694346b1d7ddfb5aa.sql", "original_file_path": "models/grading/schema.yml", "unique_id": "test.aspects.accepted_values_fact_learner_course_status_approving_state__passed__failed.f9c0c1b85f", "fqn": ["aspects", "grading", "accepted_values_fact_learner_course_status_approving_state__passed__failed"], "alias": "accepted_values_fact_learner_c_559ec0ad399aaf9694346b1d7ddfb5aa", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "accepted_values_fact_learner_c_559ec0ad399aaf9694346b1d7ddfb5aa", "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": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "unrendered_config": {"alias": "accepted_values_fact_learner_c_559ec0ad399aaf9694346b1d7ddfb5aa"}, "created_at": 1723756272.3794405, "relation_name": null, "raw_code": "{{ test_accepted_values(**_dbt_generic_test_kwargs) }}{{ config(alias=\"accepted_values_fact_learner_c_559ec0ad399aaf9694346b1d7ddfb5aa\") }}", "language": "sql", "refs": [{"name": "fact_learner_course_status", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_accepted_values", "macro.dbt.get_where_subquery"], "nodes": ["model.aspects.fact_learner_course_status"]}, "compiled_path": "target/compiled/aspects/models/grading/schema.yml/accepted_values_fact_learner_c_559ec0ad399aaf9694346b1d7ddfb5aa.sql", "compiled": true, "compiled_code": "\n \n \n\nwith all_values as (\n\n select\n approving_state as value_field,\n count(*) as n_records\n\n from `xapi`.`fact_learner_course_status`\n group by approving_state\n\n)\n\nselect *\nfrom all_values\nwhere value_field not in (\n 'passed','failed'\n)\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "approving_state", "file_key_name": "models.fact_learner_course_status", "attached_node": "model.aspects.fact_learner_course_status", "test_metadata": {"name": "accepted_values", "kwargs": {"values": ["passed", "failed"], "column_name": "approving_state", "model": "{{ get_where_subquery(ref('fact_learner_course_status')) }}"}, "namespace": null}}, "test.aspects.accepted_values_fact_student_status_enrollment_status__registered__unregistered.53cae8a0f3": {"database": "", "schema": "xapi", "name": "accepted_values_fact_student_status_enrollment_status__registered__unregistered", "resource_type": "test", "package_name": "aspects", "path": "accepted_values_fact_student_s_8a61d4434c0b8a7d4988caa6759e7181.sql", "original_file_path": "models/grading/schema.yml", "unique_id": "test.aspects.accepted_values_fact_student_status_enrollment_status__registered__unregistered.53cae8a0f3", "fqn": ["aspects", "grading", "accepted_values_fact_student_status_enrollment_status__registered__unregistered"], "alias": "accepted_values_fact_student_s_8a61d4434c0b8a7d4988caa6759e7181", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "accepted_values_fact_student_s_8a61d4434c0b8a7d4988caa6759e7181", "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": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "unrendered_config": {"alias": "accepted_values_fact_student_s_8a61d4434c0b8a7d4988caa6759e7181"}, "created_at": 1723756272.383387, "relation_name": null, "raw_code": "{{ test_accepted_values(**_dbt_generic_test_kwargs) }}{{ config(alias=\"accepted_values_fact_student_s_8a61d4434c0b8a7d4988caa6759e7181\") }}", "language": "sql", "refs": [{"name": "fact_student_status", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_accepted_values", "macro.dbt.get_where_subquery"], "nodes": ["model.aspects.fact_student_status"]}, "compiled_path": "target/compiled/aspects/models/grading/schema.yml/accepted_values_fact_student_s_8a61d4434c0b8a7d4988caa6759e7181.sql", "compiled": true, "compiled_code": "\n \n \n\nwith all_values as (\n\n select\n enrollment_status as value_field,\n count(*) as n_records\n\n from `xapi`.`fact_student_status`\n group by enrollment_status\n\n)\n\nselect *\nfrom all_values\nwhere value_field not in (\n 'registered','unregistered'\n)\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "enrollment_status", "file_key_name": "models.fact_student_status", "attached_node": "model.aspects.fact_student_status", "test_metadata": {"name": "accepted_values", "kwargs": {"values": ["registered", "unregistered"], "column_name": "enrollment_status", "model": "{{ get_where_subquery(ref('fact_student_status')) }}"}, "namespace": null}}, "test.aspects.accepted_values_xapi_section_problem_engagement_engagement_level__xapi_section_problem_engagement__No_problems_attempted_yet__All_problems_attempted__At_least_one_problem_attempted.48ca5955e3": {"database": "", "schema": "xapi", "name": "accepted_values_xapi_section_problem_engagement_engagement_level__xapi_section_problem_engagement__No_problems_attempted_yet__All_problems_attempted__At_least_one_problem_attempted", "resource_type": "test", "package_name": "aspects", "path": "accepted_values_xapi_section_p_b967763ff505769e8077838e07629ef4.sql", "original_file_path": "models/problems/schema.yml", "unique_id": "test.aspects.accepted_values_xapi_section_problem_engagement_engagement_level__xapi_section_problem_engagement__No_problems_attempted_yet__All_problems_attempted__At_least_one_problem_attempted.48ca5955e3", "fqn": ["aspects", "problems", "accepted_values_xapi_section_problem_engagement_engagement_level__xapi_section_problem_engagement__No_problems_attempted_yet__All_problems_attempted__At_least_one_problem_attempted"], "alias": "accepted_values_xapi_section_p_b967763ff505769e8077838e07629ef4", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "accepted_values_xapi_section_p_b967763ff505769e8077838e07629ef4", "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": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "unrendered_config": {"alias": "accepted_values_xapi_section_p_b967763ff505769e8077838e07629ef4"}, "created_at": 1723756272.4019613, "relation_name": null, "raw_code": "{{ test_accepted_values_xapi(**_dbt_generic_test_kwargs) }}{{ config(alias=\"accepted_values_xapi_section_p_b967763ff505769e8077838e07629ef4\") }}", "language": "sql", "refs": [{"name": "section_problem_engagement", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.aspects.test_accepted_values_xapi", "macro.dbt.get_where_subquery"], "nodes": ["model.aspects.section_problem_engagement"]}, "compiled_path": "target/compiled/aspects/models/problems/schema.yml/accepted_values_xapi_section_p_b967763ff505769e8077838e07629ef4.sql", "compiled": true, "compiled_code": "\n\nwith all_values as (\n\n select distinct\n engagement_level as value_field\n\n from xapi.section_problem_engagement\n\n),\n\nvalidation_errors as (\n\n select\n value_field\n\n from all_values\n where value_field not in (\n 'No problems attempted yet','All problems attempted','At least one problem attempted'\n )\n\n)\n\nselect *\nfrom validation_errors\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "engagement_level", "file_key_name": "models.section_problem_engagement", "attached_node": "model.aspects.section_problem_engagement", "test_metadata": {"name": "accepted_values_xapi", "kwargs": {"values": ["No problems attempted yet", "All problems attempted", "At least one problem attempted"], "table": "xapi.section_problem_engagement", "column_name": "engagement_level", "model": "{{ get_where_subquery(ref('section_problem_engagement')) }}"}, "namespace": null}}, "test.aspects.accepted_values_xapi_subsection_problem_engagement_engagement_level__xapi_subsection_problem_engagement__No_problems_attempted_yet__All_problems_attempted__At_least_one_problem_attempted.51aa37af55": {"database": "", "schema": "xapi", "name": "accepted_values_xapi_subsection_problem_engagement_engagement_level__xapi_subsection_problem_engagement__No_problems_attempted_yet__All_problems_attempted__At_least_one_problem_attempted", "resource_type": "test", "package_name": "aspects", "path": "accepted_values_xapi_subsectio_4ae05d21f0929163fa94f554b6c70554.sql", "original_file_path": "models/problems/schema.yml", "unique_id": "test.aspects.accepted_values_xapi_subsection_problem_engagement_engagement_level__xapi_subsection_problem_engagement__No_problems_attempted_yet__All_problems_attempted__At_least_one_problem_attempted.51aa37af55", "fqn": ["aspects", "problems", "accepted_values_xapi_subsection_problem_engagement_engagement_level__xapi_subsection_problem_engagement__No_problems_attempted_yet__All_problems_attempted__At_least_one_problem_attempted"], "alias": "accepted_values_xapi_subsectio_4ae05d21f0929163fa94f554b6c70554", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "accepted_values_xapi_subsectio_4ae05d21f0929163fa94f554b6c70554", "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": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "unrendered_config": {"alias": "accepted_values_xapi_subsectio_4ae05d21f0929163fa94f554b6c70554"}, "created_at": 1723756272.4065874, "relation_name": null, "raw_code": "{{ test_accepted_values_xapi(**_dbt_generic_test_kwargs) }}{{ config(alias=\"accepted_values_xapi_subsectio_4ae05d21f0929163fa94f554b6c70554\") }}", "language": "sql", "refs": [{"name": "subsection_problem_engagement", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.aspects.test_accepted_values_xapi", "macro.dbt.get_where_subquery"], "nodes": ["model.aspects.subsection_problem_engagement"]}, "compiled_path": "target/compiled/aspects/models/problems/schema.yml/accepted_values_xapi_subsectio_4ae05d21f0929163fa94f554b6c70554.sql", "compiled": true, "compiled_code": "\n\nwith all_values as (\n\n select distinct\n engagement_level as value_field\n\n from xapi.subsection_problem_engagement\n\n),\n\nvalidation_errors as (\n\n select\n value_field\n\n from all_values\n where value_field not in (\n 'No problems attempted yet','All problems attempted','At least one problem attempted'\n )\n\n)\n\nselect *\nfrom validation_errors\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "engagement_level", "file_key_name": "models.subsection_problem_engagement", "attached_node": "model.aspects.subsection_problem_engagement", "test_metadata": {"name": "accepted_values_xapi", "kwargs": {"values": ["No problems attempted yet", "All problems attempted", "At least one problem attempted"], "table": "xapi.subsection_problem_engagement", "column_name": "engagement_level", "model": "{{ get_where_subquery(ref('subsection_problem_engagement')) }}"}, "namespace": null}}, "test.aspects.accepted_values_fact_pageview_engagement_content_level__section__subsection.dd9e9af3ed": {"database": "", "schema": "xapi", "name": "accepted_values_fact_pageview_engagement_content_level__section__subsection", "resource_type": "test", "package_name": "aspects", "path": "accepted_values_fact_pageview__b1bf1051fb872a03819d7debc3e80b8b.sql", "original_file_path": "models/navigation/schema.yml", "unique_id": "test.aspects.accepted_values_fact_pageview_engagement_content_level__section__subsection.dd9e9af3ed", "fqn": ["aspects", "navigation", "accepted_values_fact_pageview_engagement_content_level__section__subsection"], "alias": "accepted_values_fact_pageview__b1bf1051fb872a03819d7debc3e80b8b", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "accepted_values_fact_pageview__b1bf1051fb872a03819d7debc3e80b8b", "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": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "unrendered_config": {"alias": "accepted_values_fact_pageview__b1bf1051fb872a03819d7debc3e80b8b"}, "created_at": 1723756272.4250872, "relation_name": null, "raw_code": "{{ test_accepted_values(**_dbt_generic_test_kwargs) }}{{ config(alias=\"accepted_values_fact_pageview__b1bf1051fb872a03819d7debc3e80b8b\") }}", "language": "sql", "refs": [{"name": "fact_pageview_engagement", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_accepted_values", "macro.dbt.get_where_subquery"], "nodes": ["model.aspects.fact_pageview_engagement"]}, "compiled_path": "target/compiled/aspects/models/navigation/schema.yml/accepted_values_fact_pageview__b1bf1051fb872a03819d7debc3e80b8b.sql", "compiled": true, "compiled_code": "\n \n \n\nwith all_values as (\n\n select\n content_level as value_field,\n count(*) as n_records\n\n from `xapi`.`fact_pageview_engagement`\n group by content_level\n\n)\n\nselect *\nfrom all_values\nwhere value_field not in (\n 'section','subsection'\n)\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "content_level", "file_key_name": "models.fact_pageview_engagement", "attached_node": "model.aspects.fact_pageview_engagement", "test_metadata": {"name": "accepted_values", "kwargs": {"values": ["section", "subsection"], "column_name": "content_level", "model": "{{ get_where_subquery(ref('fact_pageview_engagement')) }}"}, "namespace": null}}, "test.aspects.accepted_values_xapi_section_page_engagement_engagement_level__xapi_section_page_engagement__No_pages_viewed_yet__All_pages_viewed__At_least_one_page_viewed.f10135df89": {"database": "", "schema": "xapi", "name": "accepted_values_xapi_section_page_engagement_engagement_level__xapi_section_page_engagement__No_pages_viewed_yet__All_pages_viewed__At_least_one_page_viewed", "resource_type": "test", "package_name": "aspects", "path": "accepted_values_xapi_section_p_b5c1b2417b819abf84119480ff120fda.sql", "original_file_path": "models/navigation/schema.yml", "unique_id": "test.aspects.accepted_values_xapi_section_page_engagement_engagement_level__xapi_section_page_engagement__No_pages_viewed_yet__All_pages_viewed__At_least_one_page_viewed.f10135df89", "fqn": ["aspects", "navigation", "accepted_values_xapi_section_page_engagement_engagement_level__xapi_section_page_engagement__No_pages_viewed_yet__All_pages_viewed__At_least_one_page_viewed"], "alias": "accepted_values_xapi_section_p_b5c1b2417b819abf84119480ff120fda", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "accepted_values_xapi_section_p_b5c1b2417b819abf84119480ff120fda", "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": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "unrendered_config": {"alias": "accepted_values_xapi_section_p_b5c1b2417b819abf84119480ff120fda"}, "created_at": 1723756272.4290729, "relation_name": null, "raw_code": "{{ test_accepted_values_xapi(**_dbt_generic_test_kwargs) }}{{ config(alias=\"accepted_values_xapi_section_p_b5c1b2417b819abf84119480ff120fda\") }}", "language": "sql", "refs": [{"name": "section_page_engagement", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.aspects.test_accepted_values_xapi", "macro.dbt.get_where_subquery"], "nodes": ["model.aspects.section_page_engagement"]}, "compiled_path": "target/compiled/aspects/models/navigation/schema.yml/accepted_values_xapi_section_p_b5c1b2417b819abf84119480ff120fda.sql", "compiled": true, "compiled_code": "\n\nwith all_values as (\n\n select distinct\n engagement_level as value_field\n\n from xapi.section_page_engagement\n\n),\n\nvalidation_errors as (\n\n select\n value_field\n\n from all_values\n where value_field not in (\n 'No pages viewed yet','All pages viewed','At least one page viewed'\n )\n\n)\n\nselect *\nfrom validation_errors\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "engagement_level", "file_key_name": "models.section_page_engagement", "attached_node": "model.aspects.section_page_engagement", "test_metadata": {"name": "accepted_values_xapi", "kwargs": {"values": ["No pages viewed yet", "All pages viewed", "At least one page viewed"], "table": "xapi.section_page_engagement", "column_name": "engagement_level", "model": "{{ get_where_subquery(ref('section_page_engagement')) }}"}, "namespace": null}}, "test.aspects.accepted_values_xapi_subsection_page_engagement_engagement_level__xapi_subsection_page_engagement__No_pages_viewed_yet__All_pages_viewed__At_least_one_page_viewed.bcd23fe35f": {"database": "", "schema": "xapi", "name": "accepted_values_xapi_subsection_page_engagement_engagement_level__xapi_subsection_page_engagement__No_pages_viewed_yet__All_pages_viewed__At_least_one_page_viewed", "resource_type": "test", "package_name": "aspects", "path": "accepted_values_xapi_subsectio_6fa349f10ec258c2fc19269de9d5561b.sql", "original_file_path": "models/navigation/schema.yml", "unique_id": "test.aspects.accepted_values_xapi_subsection_page_engagement_engagement_level__xapi_subsection_page_engagement__No_pages_viewed_yet__All_pages_viewed__At_least_one_page_viewed.bcd23fe35f", "fqn": ["aspects", "navigation", "accepted_values_xapi_subsection_page_engagement_engagement_level__xapi_subsection_page_engagement__No_pages_viewed_yet__All_pages_viewed__At_least_one_page_viewed"], "alias": "accepted_values_xapi_subsectio_6fa349f10ec258c2fc19269de9d5561b", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "accepted_values_xapi_subsectio_6fa349f10ec258c2fc19269de9d5561b", "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": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "unrendered_config": {"alias": "accepted_values_xapi_subsectio_6fa349f10ec258c2fc19269de9d5561b"}, "created_at": 1723756272.4344354, "relation_name": null, "raw_code": "{{ test_accepted_values_xapi(**_dbt_generic_test_kwargs) }}{{ config(alias=\"accepted_values_xapi_subsectio_6fa349f10ec258c2fc19269de9d5561b\") }}", "language": "sql", "refs": [{"name": "subsection_page_engagement", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.aspects.test_accepted_values_xapi", "macro.dbt.get_where_subquery"], "nodes": ["model.aspects.subsection_page_engagement"]}, "compiled_path": "target/compiled/aspects/models/navigation/schema.yml/accepted_values_xapi_subsectio_6fa349f10ec258c2fc19269de9d5561b.sql", "compiled": true, "compiled_code": "\n\nwith all_values as (\n\n select distinct\n engagement_level as value_field\n\n from xapi.subsection_page_engagement\n\n),\n\nvalidation_errors as (\n\n select\n value_field\n\n from all_values\n where value_field not in (\n 'No pages viewed yet','All pages viewed','At least one page viewed'\n )\n\n)\n\nselect *\nfrom validation_errors\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "engagement_level", "file_key_name": "models.subsection_page_engagement", "attached_node": "model.aspects.subsection_page_engagement", "test_metadata": {"name": "accepted_values_xapi", "kwargs": {"values": ["No pages viewed yet", "All pages viewed", "At least one page viewed"], "table": "xapi.subsection_page_engagement", "column_name": "engagement_level", "model": "{{ get_where_subquery(ref('subsection_page_engagement')) }}"}, "namespace": null}}, "test.aspects.accepted_values_fact_video_engagement_content_level__section__subsection.636c5e7005": {"database": "", "schema": "xapi", "name": "accepted_values_fact_video_engagement_content_level__section__subsection", "resource_type": "test", "package_name": "aspects", "path": "accepted_values_fact_video_eng_1114368cd7e3e54d8e33e4933a5078fe.sql", "original_file_path": "models/video/schema.yml", "unique_id": "test.aspects.accepted_values_fact_video_engagement_content_level__section__subsection.636c5e7005", "fqn": ["aspects", "video", "accepted_values_fact_video_engagement_content_level__section__subsection"], "alias": "accepted_values_fact_video_eng_1114368cd7e3e54d8e33e4933a5078fe", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "accepted_values_fact_video_eng_1114368cd7e3e54d8e33e4933a5078fe", "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": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "unrendered_config": {"alias": "accepted_values_fact_video_eng_1114368cd7e3e54d8e33e4933a5078fe"}, "created_at": 1723756272.4637218, "relation_name": null, "raw_code": "{{ test_accepted_values(**_dbt_generic_test_kwargs) }}{{ config(alias=\"accepted_values_fact_video_eng_1114368cd7e3e54d8e33e4933a5078fe\") }}", "language": "sql", "refs": [{"name": "fact_video_engagement", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_accepted_values", "macro.dbt.get_where_subquery"], "nodes": ["model.aspects.fact_video_engagement"]}, "compiled_path": "target/compiled/aspects/models/video/schema.yml/accepted_values_fact_video_eng_1114368cd7e3e54d8e33e4933a5078fe.sql", "compiled": true, "compiled_code": "\n \n \n\nwith all_values as (\n\n select\n content_level as value_field,\n count(*) as n_records\n\n from `xapi`.`fact_video_engagement`\n group by content_level\n\n)\n\nselect *\nfrom all_values\nwhere value_field not in (\n 'section','subsection'\n)\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "content_level", "file_key_name": "models.fact_video_engagement", "attached_node": "model.aspects.fact_video_engagement", "test_metadata": {"name": "accepted_values", "kwargs": {"values": ["section", "subsection"], "column_name": "content_level", "model": "{{ get_where_subquery(ref('fact_video_engagement')) }}"}, "namespace": null}}, "test.aspects.accepted_values_fact_video_engagement_section_subsection_video_engagement__No_videos_viewed_yet__At_least_one_video_viewed__All_videos_viewed.91f6ccbf80": {"database": "", "schema": "xapi", "name": "accepted_values_fact_video_engagement_section_subsection_video_engagement__No_videos_viewed_yet__At_least_one_video_viewed__All_videos_viewed", "resource_type": "test", "package_name": "aspects", "path": "accepted_values_fact_video_eng_b5eba4b87ba3d5dc281e045ba5fb35bc.sql", "original_file_path": "models/video/schema.yml", "unique_id": "test.aspects.accepted_values_fact_video_engagement_section_subsection_video_engagement__No_videos_viewed_yet__At_least_one_video_viewed__All_videos_viewed.91f6ccbf80", "fqn": ["aspects", "video", "accepted_values_fact_video_engagement_section_subsection_video_engagement__No_videos_viewed_yet__At_least_one_video_viewed__All_videos_viewed"], "alias": "accepted_values_fact_video_eng_b5eba4b87ba3d5dc281e045ba5fb35bc", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "accepted_values_fact_video_eng_b5eba4b87ba3d5dc281e045ba5fb35bc", "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": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "unrendered_config": {"alias": "accepted_values_fact_video_eng_b5eba4b87ba3d5dc281e045ba5fb35bc"}, "created_at": 1723756272.4671721, "relation_name": null, "raw_code": "{{ test_accepted_values(**_dbt_generic_test_kwargs) }}{{ config(alias=\"accepted_values_fact_video_eng_b5eba4b87ba3d5dc281e045ba5fb35bc\") }}", "language": "sql", "refs": [{"name": "fact_video_engagement", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.dbt.test_accepted_values", "macro.dbt.get_where_subquery"], "nodes": ["model.aspects.fact_video_engagement"]}, "compiled_path": "target/compiled/aspects/models/video/schema.yml/accepted_values_fact_video_eng_b5eba4b87ba3d5dc281e045ba5fb35bc.sql", "compiled": true, "compiled_code": "\n \n \n\nwith all_values as (\n\n select\n section_subsection_video_engagement as value_field,\n count(*) as n_records\n\n from `xapi`.`fact_video_engagement`\n group by section_subsection_video_engagement\n\n)\n\nselect *\nfrom all_values\nwhere value_field not in (\n 'No videos viewed yet','At least one video viewed','All videos viewed'\n)\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "section_subsection_video_engagement", "file_key_name": "models.fact_video_engagement", "attached_node": "model.aspects.fact_video_engagement", "test_metadata": {"name": "accepted_values", "kwargs": {"values": ["No videos viewed yet", "At least one video viewed", "All videos viewed"], "column_name": "section_subsection_video_engagement", "model": "{{ get_where_subquery(ref('fact_video_engagement')) }}"}, "namespace": null}}, "test.aspects.accepted_values_xapi_section_video_engagement_engagement_level__xapi_section_video_engagement__No_videos_viewed_yet__All_videos_viewed__At_least_one_video_viewed.597c4fb289": {"database": "", "schema": "xapi", "name": "accepted_values_xapi_section_video_engagement_engagement_level__xapi_section_video_engagement__No_videos_viewed_yet__All_videos_viewed__At_least_one_video_viewed", "resource_type": "test", "package_name": "aspects", "path": "accepted_values_xapi_section_v_b5f2914f10014237c993abbc74075a03.sql", "original_file_path": "models/video/schema.yml", "unique_id": "test.aspects.accepted_values_xapi_section_video_engagement_engagement_level__xapi_section_video_engagement__No_videos_viewed_yet__All_videos_viewed__At_least_one_video_viewed.597c4fb289", "fqn": ["aspects", "video", "accepted_values_xapi_section_video_engagement_engagement_level__xapi_section_video_engagement__No_videos_viewed_yet__All_videos_viewed__At_least_one_video_viewed"], "alias": "accepted_values_xapi_section_v_b5f2914f10014237c993abbc74075a03", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "accepted_values_xapi_section_v_b5f2914f10014237c993abbc74075a03", "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": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "unrendered_config": {"alias": "accepted_values_xapi_section_v_b5f2914f10014237c993abbc74075a03"}, "created_at": 1723756272.4715543, "relation_name": null, "raw_code": "{{ test_accepted_values_xapi(**_dbt_generic_test_kwargs) }}{{ config(alias=\"accepted_values_xapi_section_v_b5f2914f10014237c993abbc74075a03\") }}", "language": "sql", "refs": [{"name": "section_video_engagement", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.aspects.test_accepted_values_xapi", "macro.dbt.get_where_subquery"], "nodes": ["model.aspects.section_video_engagement"]}, "compiled_path": "target/compiled/aspects/models/video/schema.yml/accepted_values_xapi_section_v_b5f2914f10014237c993abbc74075a03.sql", "compiled": true, "compiled_code": "\n\nwith all_values as (\n\n select distinct\n engagement_level as value_field\n\n from xapi.section_video_engagement\n\n),\n\nvalidation_errors as (\n\n select\n value_field\n\n from all_values\n where value_field not in (\n 'No videos viewed yet','All videos viewed','At least one video viewed'\n )\n\n)\n\nselect *\nfrom validation_errors\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "engagement_level", "file_key_name": "models.section_video_engagement", "attached_node": "model.aspects.section_video_engagement", "test_metadata": {"name": "accepted_values_xapi", "kwargs": {"values": ["No videos viewed yet", "All videos viewed", "At least one video viewed"], "table": "xapi.section_video_engagement", "column_name": "engagement_level", "model": "{{ get_where_subquery(ref('section_video_engagement')) }}"}, "namespace": null}}, "test.aspects.accepted_values_xapi_subsection_video_engagement_engagement_level__xapi_subsection_video_engagement__No_videos_viewed_yet__All_videos_viewed__At_least_one_video_viewed.c9b49600d3": {"database": "", "schema": "xapi", "name": "accepted_values_xapi_subsection_video_engagement_engagement_level__xapi_subsection_video_engagement__No_videos_viewed_yet__All_videos_viewed__At_least_one_video_viewed", "resource_type": "test", "package_name": "aspects", "path": "accepted_values_xapi_subsectio_02ffe7720b136f9bdf72d6b72e181c99.sql", "original_file_path": "models/video/schema.yml", "unique_id": "test.aspects.accepted_values_xapi_subsection_video_engagement_engagement_level__xapi_subsection_video_engagement__No_videos_viewed_yet__All_videos_viewed__At_least_one_video_viewed.c9b49600d3", "fqn": ["aspects", "video", "accepted_values_xapi_subsection_video_engagement_engagement_level__xapi_subsection_video_engagement__No_videos_viewed_yet__All_videos_viewed__At_least_one_video_viewed"], "alias": "accepted_values_xapi_subsectio_02ffe7720b136f9bdf72d6b72e181c99", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "alias": "accepted_values_xapi_subsectio_02ffe7720b136f9bdf72d6b72e181c99", "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": [], "description": "", "columns": {}, "meta": {}, "group": null, "docs": {"show": true, "node_color": null}, "patch_path": null, "build_path": null, "unrendered_config": {"alias": "accepted_values_xapi_subsectio_02ffe7720b136f9bdf72d6b72e181c99"}, "created_at": 1723756272.475126, "relation_name": null, "raw_code": "{{ test_accepted_values_xapi(**_dbt_generic_test_kwargs) }}{{ config(alias=\"accepted_values_xapi_subsectio_02ffe7720b136f9bdf72d6b72e181c99\") }}", "language": "sql", "refs": [{"name": "subsection_video_engagement", "package": null, "version": null}], "sources": [], "metrics": [], "depends_on": {"macros": ["macro.aspects.test_accepted_values_xapi", "macro.dbt.get_where_subquery"], "nodes": ["model.aspects.subsection_video_engagement"]}, "compiled_path": "target/compiled/aspects/models/video/schema.yml/accepted_values_xapi_subsectio_02ffe7720b136f9bdf72d6b72e181c99.sql", "compiled": true, "compiled_code": "\n\nwith all_values as (\n\n select distinct\n engagement_level as value_field\n\n from xapi.subsection_video_engagement\n\n),\n\nvalidation_errors as (\n\n select\n value_field\n\n from all_values\n where value_field not in (\n 'No videos viewed yet','All videos viewed','At least one video viewed'\n )\n\n)\n\nselect *\nfrom validation_errors\n\n", "extra_ctes_injected": true, "extra_ctes": [], "contract": {"enforced": false, "alias_types": true, "checksum": null}, "column_name": "engagement_level", "file_key_name": "models.subsection_video_engagement", "attached_node": "model.aspects.subsection_video_engagement", "test_metadata": {"name": "accepted_values_xapi", "kwargs": {"values": ["No videos viewed yet", "All videos viewed", "At least one video viewed"], "table": "xapi.subsection_video_engagement", "column_name": "engagement_level", "model": "{{ get_where_subquery(ref('subsection_video_engagement')) }}"}, "namespace": null}}}, "sources": {"source.aspects.event_sink.user_profile": {"database": "event_sink", "schema": "event_sink", "name": "user_profile", "resource_type": "source", "package_name": "aspects", "path": "models/users/sources.yml", "original_file_path": "models/users/sources.yml", "unique_id": "source.aspects.event_sink.user_profile", "fqn": ["aspects", "users", "event_sink", "user_profile"], "source_name": "event_sink", "source_description": "", "loader": "", "identifier": "user_profile", "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": {"id": {"name": "id", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "user_id": {"name": "user_id", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "name": {"name": "name", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "email": {"name": "email", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "meta": {"name": "meta", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "courseware": {"name": "courseware", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "language": {"name": "language", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "location": {"name": "location", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "year_of_birth": {"name": "year_of_birth", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "gender": {"name": "gender", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "level_of_education": {"name": "level_of_education", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "mailing_address": {"name": "mailing_address", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "city": {"name": "city", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "country": {"name": "country", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "state": {"name": "state", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "goals": {"name": "goals", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "bio": {"name": "bio", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "profile_image_uploaded_at": {"name": "profile_image_uploaded_at", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "phone_number": {"name": "phone_number", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dump_id": {"name": "dump_id", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "time_last_dumped": {"name": "time_last_dumped", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "`event_sink`.`user_profile`", "created_at": 1723756272.5576746}, "source.aspects.event_sink.external_id": {"database": "event_sink", "schema": "event_sink", "name": "external_id", "resource_type": "source", "package_name": "aspects", "path": "models/users/sources.yml", "original_file_path": "models/users/sources.yml", "unique_id": "source.aspects.event_sink.external_id", "fqn": ["aspects", "users", "event_sink", "external_id"], "source_name": "event_sink", "source_description": "", "loader": "", "identifier": "external_id", "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": {"external_user_id": {"name": "external_user_id", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "external_id_type": {"name": "external_id_type", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "username": {"name": "username", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "user_id": {"name": "user_id", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dump_id": {"name": "dump_id", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "time_last_dumped": {"name": "time_last_dumped", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "`event_sink`.`external_id`", "created_at": 1723756272.558784}, "source.aspects.xapi.xapi_events_all": {"database": "xapi", "schema": "xapi", "name": "xapi_events_all", "resource_type": "source", "package_name": "aspects", "path": "models/base/sources.yml", "original_file_path": "models/base/sources.yml", "unique_id": "source.aspects.xapi.xapi_events_all", "fqn": ["aspects", "base", "xapi", "xapi_events_all"], "source_name": "xapi", "source_description": "the xapi database in clickhouse", "loader": "", "identifier": "xapi_events_all", "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": "Base table for raw xAPI events", "columns": {"event_id": {"name": "event_id", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "emission_time": {"name": "emission_time", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "event": {"name": "event", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "`xapi`.`xapi_events_all`", "created_at": 1723756272.5589535}, "source.aspects.event_sink.course_blocks": {"database": "event_sink", "schema": "event_sink", "name": "course_blocks", "resource_type": "source", "package_name": "aspects", "path": "models/courses/sources.yml", "original_file_path": "models/courses/sources.yml", "unique_id": "source.aspects.event_sink.course_blocks", "fqn": ["aspects", "courses", "event_sink", "course_blocks"], "source_name": "event_sink", "source_description": "", "loader": "", "identifier": "course_blocks", "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": {"org": {"name": "org", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "course_key": {"name": "course_key", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "location": {"name": "location", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "display_name": {"name": "display_name", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "xblock_data_json": {"name": "xblock_data_json", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "order": {"name": "order", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "edited_on": {"name": "edited_on", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dump_id": {"name": "dump_id", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "time_last_dumped": {"name": "time_last_dumped", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "`event_sink`.`course_blocks`", "created_at": 1723756272.5591161}, "source.aspects.event_sink.course_overviews": {"database": "event_sink", "schema": "event_sink", "name": "course_overviews", "resource_type": "source", "package_name": "aspects", "path": "models/courses/sources.yml", "original_file_path": "models/courses/sources.yml", "unique_id": "source.aspects.event_sink.course_overviews", "fqn": ["aspects", "courses", "event_sink", "course_overviews"], "source_name": "event_sink", "source_description": "", "loader": "", "identifier": "course_overviews", "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": {"org": {"name": "org", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "course_key": {"name": "course_key", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "display_name": {"name": "display_name", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "course_start": {"name": "course_start", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "course_end": {"name": "course_end", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "enrollment_start": {"name": "enrollment_start", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "enrollment_end": {"name": "enrollment_end", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "self_paced": {"name": "self_paced", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "course_data_json": {"name": "course_data_json", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "created": {"name": "created", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "modified": {"name": "modified", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "dump_id": {"name": "dump_id", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}, "time_last_dumped": {"name": "time_last_dumped", "description": "", "meta": {}, "data_type": null, "constraints": [], "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "`event_sink`.`course_overviews`", "created_at": 1723756272.559272}}, "macros": {"macro.aspects.on_cluster": {"name": "on_cluster", "resource_type": "macro", "package_name": "aspects", "path": "macros/cluster_macros.sql", "original_file_path": "macros/cluster_macros.sql", "unique_id": "macro.aspects.on_cluster", "macro_sql": "{% macro on_cluster() -%}\n {%- if env_var(\"CLICKHOUSE_CLUSTER_NAME\", \"\") != \"\" -%}\n ON CLUSTER \"{{ env_var(\"CLICKHOUSE_CLUSTER_NAME\") }}\"\n {%- endif -%}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.5351577, "supported_languages": null}, "macro.aspects.get_engine": {"name": "get_engine", "resource_type": "macro", "package_name": "aspects", "path": "macros/cluster_macros.sql", "original_file_path": "macros/cluster_macros.sql", "unique_id": "macro.aspects.get_engine", "macro_sql": "{% macro get_engine(engine) -%}\n {%- if env_var(\"CLICKHOUSE_CLUSTER_NAME\", \"\") != \"\" -%}\n {{ \"Replicated\" + engine }}\n {% else %}\n {{ engine }}\n {%- endif -%}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.5356185, "supported_languages": null}, "macro.aspects.subsection_from_display": {"name": "subsection_from_display", "resource_type": "macro", "package_name": "aspects", "path": "macros/parse_section_codes.sql", "original_file_path": "macros/parse_section_codes.sql", "unique_id": "macro.aspects.subsection_from_display", "macro_sql": "{% macro subsection_from_display(display_name_with_location) %}\n concat(\n arrayStringConcat(\n splitByString(\n ':', splitByString(' - ', {{ display_name_with_location }})[1], 2\n ),\n ':'\n ),\n ':0'\n )\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.53601, "supported_languages": null}, "macro.aspects.section_from_display": {"name": "section_from_display", "resource_type": "macro", "package_name": "aspects", "path": "macros/parse_section_codes.sql", "original_file_path": "macros/parse_section_codes.sql", "unique_id": "macro.aspects.section_from_display", "macro_sql": "{% macro section_from_display(display_name_with_location) %}\n concat(\n splitByString(\n ':', splitByString(' - ', {{ display_name_with_location }})[1], 1\n )[1],\n ':0:0'\n )\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.5362148, "supported_languages": null}, "macro.aspects.get_bucket": {"name": "get_bucket", "resource_type": "macro", "package_name": "aspects", "path": "macros/get_bucket.sql", "original_file_path": "macros/get_bucket.sql", "unique_id": "macro.aspects.get_bucket", "macro_sql": "{% macro get_bucket(field) -%}\n case\n when {{ field }} >= 0.9\n then '90-100%'\n when {{ field }} >= 0.8 and {{ field }} < 0.9\n then '80-89%'\n when {{ field }} >= 0.7 and {{ field }} < 0.8\n then '70-79%'\n when {{ field }} >= 0.6 and {{ field }} < 0.7\n then '60-69%'\n when {{ field }} >= 0.5 and {{ field }} < 0.6\n then '50-59%'\n when {{ field }} >= 0.4 and {{ field }} < 0.5\n then '40-49%'\n when {{ field }} >= 0.3 and {{ field }} < 0.4\n then '30-39%'\n when {{ field }} >= 0.2 and {{ field }} < 0.3\n then '20-29%'\n when {{ field }} >= 0.1 and {{ field }} < 0.2\n then '10-19%'\n else '0-9%'\n end\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.5375454, "supported_languages": null}, "macro.aspects.do_drop": {"name": "do_drop", "resource_type": "macro", "package_name": "aspects", "path": "macros/remove_deprecated_models.sql", "original_file_path": "macros/remove_deprecated_models.sql", "unique_id": "macro.aspects.do_drop", "macro_sql": "{% macro do_drop(type, schema, relation) %}\n -- Drop a relation, types are \"view\", \"table\", or \"mv\".\n -- \"mv\" will drop both the expected view and destination table.\n {% if type == \"mv\" %}\n {% do do_drop(\"view\", schema, relation ~ \"_mv\") %}\n {% do do_drop(\"table\", schema, relation) %}\n {% else %}\n {% set cmd = \"drop \" ~ type ~ \" if exists \" ~ schema ~ \".\" ~ relation ~ \";\" %}\n {% print(cmd) %}\n {% do run_query(cmd) %}\n {% endif %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.5398238, "supported_languages": null}, "macro.aspects.remove_deprecated_models": {"name": "remove_deprecated_models", "resource_type": "macro", "package_name": "aspects", "path": "macros/remove_deprecated_models.sql", "original_file_path": "macros/remove_deprecated_models.sql", "unique_id": "macro.aspects.remove_deprecated_models", "macro_sql": "{% macro remove_deprecated_models() %}\n {% set xapi = env_var(\"ASPECTS_XAPI_DATABASE\", \"xapi\") %}\n {% set reporting = env_var(\"DBT_PROFILE_TARGET_DATABASE\", \"reporting\") %}\n {% set event_sink = env_var(\"ASPECTS_EVENT_SINK_DATABASE\", \"event_sink\") %}\n\n {{\n print(\n \"Running remove_deprecated_models on \"\n ~ xapi\n ~ \", \"\n ~ reporting\n ~ \", \"\n ~ event_sink\n ~ \".\"\n )\n }}\n\n -- https://github.com/openedx/aspects-dbt/pull/111/\n {% do do_drop(\"mv\", xapi, \"completion_events\") %}\n {% do do_drop(\"view\", reporting, \"fact_completions\") %}\n {% do do_drop(\"view\", xapi, \"fact_forum_interactions\") %}\n {% do do_drop(\"mv\", xapi, \"forum_events\") %}\n {% do do_drop(\"view\", reporting, \"fact_grades\") %}\n {% do do_drop(\"view\", reporting, \"learner_summary\") %}\n {% do do_drop(\"view\", reporting, \"fact_navigation_dropoff\") %}\n {% do do_drop(\"view\", reporting, \"fact_learner_problem_summary\") %}\n {% do do_drop(\"view\", reporting, \"fact_problem_engagement\") %}\n {% do do_drop(\"view\", reporting, \"fact_problem_engagement_per_subsection\") %}\n {% do do_drop(\"view\", reporting, \"fact_problem_responses_extended\") %}\n {% do do_drop(\"view\", reporting, \"dim_at_risk_learners\") %}\n {% do do_drop(\"view\", reporting, \"fact_transcript_usage\") %}\n {% do do_drop(\"view\", reporting, \"fact_watched_video_segments\") %}\n {% do do_drop(\"mv\", reporting, \"video_transcript_events\") %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.aspects.do_drop"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.5421557, "supported_languages": null}, "macro.aspects.items_per_subsection": {"name": "items_per_subsection", "resource_type": "macro", "package_name": "aspects", "path": "macros/items_per_subsection.sql", "original_file_path": "macros/items_per_subsection.sql", "unique_id": "macro.aspects.items_per_subsection", "macro_sql": "{% macro items_per_subsection(block_pattern) %}\n with\n items_per_subsection as (\n select\n org,\n course_key,\n section_number,\n subsection_number,\n course_order,\n graded,\n count(*) as item_count\n from {{ ref(\"dim_course_blocks\") }}\n where block_id like '{{ block_pattern }}'\n group by\n org, course_key, section_number, subsection_number, course_order, graded\n )\n\n select\n ips.org as org,\n ips.course_key as course_key,\n ips.section_number as section_number,\n section_blocks.display_name_with_location as section_with_name,\n ips.subsection_number as subsection_number,\n subsection_blocks.display_name_with_location as subsection_with_name,\n ips.course_order as course_order,\n ips.graded as graded,\n ips.item_count as item_count,\n subsection_blocks.block_id as subsection_block_id,\n section_blocks.block_id as section_block_id\n from items_per_subsection ips\n left join\n {{ ref(\"dim_course_blocks\") }} section_blocks\n on (\n ips.section_number = section_blocks.hierarchy_location\n and ips.org = section_blocks.org\n and ips.course_key = section_blocks.course_key\n and section_blocks.block_id like '%@chapter+block@%'\n )\n left join\n {{ ref(\"dim_course_blocks\") }} subsection_blocks\n on (\n ips.subsection_number = subsection_blocks.hierarchy_location\n and ips.org = subsection_blocks.org\n and ips.course_key = subsection_blocks.course_key\n and subsection_blocks.block_id like '%@sequential+block@%'\n )\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.5432427, "supported_languages": null}, "macro.aspects.generate_schema_name": {"name": "generate_schema_name", "resource_type": "macro", "package_name": "aspects", "path": "macros/get_custom_schema.sql", "original_file_path": "macros/get_custom_schema.sql", "unique_id": "macro.aspects.generate_schema_name", "macro_sql": "{% macro generate_schema_name(custom_schema_name, node) -%}\n\n {%- set default_schema = target.schema -%}\n {%- if (\n target.name == \"prod\" or node.resource_type == \"seed\"\n ) and custom_schema_name is not none -%}\n\n {{ custom_schema_name | trim }}\n\n {%- else -%} {{ 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": 1723756270.543919, "supported_languages": null}, "macro.aspects.get_problem_id": {"name": "get_problem_id", "resource_type": "macro", "package_name": "aspects", "path": "macros/get_problem_id.sql", "original_file_path": "macros/get_problem_id.sql", "unique_id": "macro.aspects.get_problem_id", "macro_sql": "{% macro get_problem_id(object_id) %}\n regexpExtract(\n object_id, 'xblock/([\\w\\d-\\+:@]*@problem\\+block@[\\w\\d][^_\\/]*)(_\\d_\\d)?', 1\n )\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.544144, "supported_languages": null}, "macro.aspects.a_tag": {"name": "a_tag", "resource_type": "macro", "package_name": "aspects", "path": "macros/a_tag.sql", "original_file_path": "macros/a_tag.sql", "unique_id": "macro.aspects.a_tag", "macro_sql": "{% macro a_tag(object_id, object_name) %}\n concat(\n '', {{ object_name }}, ''\n )\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.5444336, "supported_languages": null}, "macro.aspects.test_accepted_values_xapi": {"name": "test_accepted_values_xapi", "resource_type": "macro", "package_name": "aspects", "path": "tests/generic/test_accepted_values_xapi.sql", "original_file_path": "tests/generic/test_accepted_values_xapi.sql", "unique_id": "macro.aspects.test_accepted_values_xapi", "macro_sql": "{% test accepted_values_xapi(model, column_name, values, table, quote=True) %}\n\nwith all_values as (\n\n select distinct\n {{ column_name }} as value_field\n\n from {{ table }}\n\n),\n\nvalidation_errors as (\n\n select\n value_field\n\n from all_values\n where value_field not in (\n {% for value in values -%}\n {% if quote -%}\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{% endtest %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.545413, "supported_languages": null}, "macro.dbt_clickhouse.clickhouse__list_schemas": {"name": "clickhouse__list_schemas", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_clickhouse.clickhouse__list_schemas", "macro_sql": "{% macro clickhouse__list_schemas(database) %}\n {% call statement('list_schemas', fetch_result=True, auto_begin=False) %}\n select name from system.databases\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": 1723756270.5503738, "supported_languages": null}, "macro.dbt_clickhouse.clickhouse__create_schema": {"name": "clickhouse__create_schema", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_clickhouse.clickhouse__create_schema", "macro_sql": "{% macro clickhouse__create_schema(relation) -%}\n {%- call statement('create_schema') -%}\n create database if not exists {{ relation.without_identifier().include(database=False) }}\n {{ on_cluster_clause(relation)}}\n {{ adapter.clickhouse_db_engine_clause() }}\n {% endcall %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt_clickhouse.on_cluster_clause"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.5508287, "supported_languages": null}, "macro.dbt_clickhouse.clickhouse__drop_schema": {"name": "clickhouse__drop_schema", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_clickhouse.clickhouse__drop_schema", "macro_sql": "{% macro clickhouse__drop_schema(relation) -%}\n {%- call statement('drop_schema') -%}\n drop database if exists {{ relation.without_identifier().include(database=False) }} {{ on_cluster_clause(relation)}}\n {%- endcall -%}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt_clickhouse.on_cluster_clause"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.5512102, "supported_languages": null}, "macro.dbt_clickhouse.clickhouse__list_relations_without_caching": {"name": "clickhouse__list_relations_without_caching", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_clickhouse.clickhouse__list_relations_without_caching", "macro_sql": "{% macro clickhouse__list_relations_without_caching(schema_relation) %}\n {% call statement('list_relations_without_caching', fetch_result=True) -%}\n select\n t.name as name,\n t.database as schema,\n multiIf(\n engine in ('MaterializedView', 'View'), 'view',\n engine = 'Dictionary', 'dictionary',\n 'table'\n ) as type,\n db.engine as db_engine,\n {%- if adapter.get_clickhouse_cluster_name() -%}\n count(distinct _shard_num) > 1 as is_on_cluster\n from clusterAllReplicas({{ adapter.get_clickhouse_cluster_name() }}, system.tables) as t\n join system.databases as db on t.database = db.name\n where schema = '{{ schema_relation.schema }}'\n group by name, schema, type, db_engine\n {%- else -%}\n 0 as is_on_cluster\n from system.tables as t join system.databases as db on t.database = db.name\n where schema = '{{ schema_relation.schema }}'\n {% endif %}\n\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": 1723756270.5519254, "supported_languages": null}, "macro.dbt_clickhouse.clickhouse__get_columns_in_relation": {"name": "clickhouse__get_columns_in_relation", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_clickhouse.clickhouse__get_columns_in_relation", "macro_sql": "{% macro clickhouse__get_columns_in_relation(relation) -%}\n {% call statement('get_columns', fetch_result=True) %}\n select name, type from system.columns where table = '{{ relation.identifier }}'\n {% if relation.schema %}\n and database = '{{ relation.schema }}'\n {% endif %}\n order by position\n {% endcall %}\n {{ return(sql_convert_columns_in_relation(load_result('get_columns').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": 1723756270.5525033, "supported_languages": null}, "macro.dbt_clickhouse.clickhouse__drop_relation": {"name": "clickhouse__drop_relation", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_clickhouse.clickhouse__drop_relation", "macro_sql": "{% macro clickhouse__drop_relation(relation, obj_type='table') -%}\n {% call statement('drop_relation', auto_begin=False) -%}\n {# drop relation on cluster by default if cluster is set #}\n drop {{ obj_type }} if exists {{ relation }} {{ on_cluster_clause(relation.without_identifier(), True)}}\n {%- endcall %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt_clickhouse.on_cluster_clause"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.5529792, "supported_languages": null}, "macro.dbt_clickhouse.clickhouse__rename_relation": {"name": "clickhouse__rename_relation", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_clickhouse.clickhouse__rename_relation", "macro_sql": "{% macro clickhouse__rename_relation(from_relation, to_relation, obj_type='table') -%}\n {% call statement('drop_relation') %}\n drop {{ obj_type }} if exists {{ to_relation }} {{ on_cluster_clause(to_relation.without_identifier())}}\n {% endcall %}\n {% call statement('rename_relation') %}\n rename {{ obj_type }} {{ from_relation }} to {{ to_relation }} {{ on_cluster_clause(from_relation)}}\n {% endcall %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt_clickhouse.on_cluster_clause"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.5536158, "supported_languages": null}, "macro.dbt_clickhouse.clickhouse__truncate_relation": {"name": "clickhouse__truncate_relation", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_clickhouse.clickhouse__truncate_relation", "macro_sql": "{% macro clickhouse__truncate_relation(relation) -%}\n {% call statement('truncate_relation') -%}\n truncate table {{ relation }} {{ on_cluster_clause(relation)}}\n {%- endcall %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt_clickhouse.on_cluster_clause"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.553917, "supported_languages": null}, "macro.dbt_clickhouse.clickhouse__make_temp_relation": {"name": "clickhouse__make_temp_relation", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_clickhouse.clickhouse__make_temp_relation", "macro_sql": "{% macro clickhouse__make_temp_relation(base_relation, suffix) %}\n {% set tmp_identifier = base_relation.identifier ~ suffix %}\n {% set tmp_relation = base_relation.incorporate(\n path={\"identifier\": tmp_identifier, \"schema\": None}) -%}\n {% do return(tmp_relation) %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.554448, "supported_languages": null}, "macro.dbt_clickhouse.clickhouse__generate_database_name": {"name": "clickhouse__generate_database_name", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_clickhouse.clickhouse__generate_database_name", "macro_sql": "{% macro clickhouse__generate_database_name(custom_database_name=none, node=none) -%}\n {% do return('') %}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.554804, "supported_languages": null}, "macro.dbt_clickhouse.clickhouse__get_columns_in_query": {"name": "clickhouse__get_columns_in_query", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_clickhouse.clickhouse__get_columns_in_query", "macro_sql": "{% macro clickhouse__get_columns_in_query(select_sql) %}\n {% call statement('get_columns_in_query', fetch_result=True, auto_begin=False) -%}\n select * from (\n {{ select_sql }}\n ) as __dbt_sbq\n limit 0\n {% endcall %}\n\n {{ return(load_result('get_columns_in_query').table.columns | map(attribute='name') | list) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.555304, "supported_languages": null}, "macro.dbt_clickhouse.clickhouse__alter_column_type": {"name": "clickhouse__alter_column_type", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_clickhouse.clickhouse__alter_column_type", "macro_sql": "{% macro clickhouse__alter_column_type(relation, column_name, new_column_type) -%}\n {% call statement('alter_column_type') %}\n alter table {{ relation }} {{ on_cluster_clause(relation)}} modify column {{ adapter.quote(column_name) }} {{ new_column_type }}\n {% endcall %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt_clickhouse.on_cluster_clause"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.555732, "supported_languages": null}, "macro.dbt_clickhouse.exchange_tables_atomic": {"name": "exchange_tables_atomic", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "unique_id": "macro.dbt_clickhouse.exchange_tables_atomic", "macro_sql": "{% macro exchange_tables_atomic(old_relation, target_relation, obj_types='TABLES') %}\n\n {%- if adapter.get_clickhouse_cluster_name() is not none and obj_types == 'TABLES' and 'Replicated' in engine_clause() %}\n {%- call statement('exchange_table_sync_replica') -%}\n SYSTEM SYNC REPLICA {{ on_cluster_clause(target_relation) }} {{ target_relation.schema }}.{{ target_relation.identifier }}\n {% endcall %}\n {%- endif %}\n {%- call statement('exchange_tables_atomic') -%}\n EXCHANGE {{ obj_types }} {{ old_relation }} AND {{ target_relation }} {{ on_cluster_clause(target_relation)}}\n {% endcall %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_clickhouse.engine_clause", "macro.dbt.statement", "macro.dbt_clickhouse.on_cluster_clause"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.5565758, "supported_languages": null}, "macro.dbt_clickhouse.clickhouse__get_catalog": {"name": "clickhouse__get_catalog", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/catalog.sql", "original_file_path": "macros/catalog.sql", "unique_id": "macro.dbt_clickhouse.clickhouse__get_catalog", "macro_sql": "{% macro clickhouse__get_catalog(information_schema, schemas) -%}\n {%- call statement('catalog', fetch_result=True) -%}\n select\n '' as table_database,\n columns.database as table_schema,\n columns.table as table_name,\n if(tables.engine not in ('MaterializedView', 'View'), 'table', 'view') as table_type,\n nullIf(tables.comment, '') as table_comment,\n columns.name as column_name,\n columns.position as column_index,\n columns.type as column_type,\n nullIf(columns.comment, '') as column_comment,\n null as table_owner\n from system.columns as columns\n join system.tables as tables on tables.database = columns.database and tables.name = columns.table\n where database != 'system' and\n (\n {%- for schema in schemas -%}\n columns.database = '{{ schema }}'\n {%- if not loop.last %} or {% endif -%}\n {%- endfor -%}\n )\n order by columns.database, columns.table, columns.position\n {%- endcall -%}\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": 1723756270.5574841, "supported_languages": null}, "macro.dbt_clickhouse.clickhouse__get_assert_columns_equivalent": {"name": "clickhouse__get_assert_columns_equivalent", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/column_spec_ddl.sql", "original_file_path": "macros/column_spec_ddl.sql", "unique_id": "macro.dbt_clickhouse.clickhouse__get_assert_columns_equivalent", "macro_sql": "{% macro clickhouse__get_assert_columns_equivalent(sql) -%}\n {%- set user_defined_columns = model['columns'] -%}\n\n {%- if not user_defined_columns -%}\n {{ exceptions.raise_contract_error([], []) }}\n {%- endif -%}\n\n {%- set yaml_columns = user_defined_columns.values() -%}\n\n {%- set sql_file_provided_columns = adapter.get_column_schema_from_query(sql) -%}\n {%- set sql_columns = adapter.format_columns(sql_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 {%- 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['data_type'] != yaml_col[0]['data_type'] -%}\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": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.5600433, "supported_languages": null}, "macro.dbt_clickhouse.one_alter_relation": {"name": "one_alter_relation", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/persist_docs.sql", "original_file_path": "macros/persist_docs.sql", "unique_id": "macro.dbt_clickhouse.one_alter_relation", "macro_sql": "{% macro one_alter_relation(relation, alter_comments) %}\n alter table {{ relation }} {{ on_cluster_clause(relation) }} {{ alter_comments }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_clickhouse.on_cluster_clause"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.5618887, "supported_languages": null}, "macro.dbt_clickhouse.one_alter_column_comment": {"name": "one_alter_column_comment", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/persist_docs.sql", "original_file_path": "macros/persist_docs.sql", "unique_id": "macro.dbt_clickhouse.one_alter_column_comment", "macro_sql": "{% macro one_alter_column_comment(relation, column_name, comment) %}\n alter table {{ relation }} {{ on_cluster_clause(relation) }} comment column {{ column_name }} '{{ comment }}'\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_clickhouse.on_cluster_clause"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.5621932, "supported_languages": null}, "macro.dbt_clickhouse.clickhouse__alter_relation_comment": {"name": "clickhouse__alter_relation_comment", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/persist_docs.sql", "original_file_path": "macros/persist_docs.sql", "unique_id": "macro.dbt_clickhouse.clickhouse__alter_relation_comment", "macro_sql": "{% macro clickhouse__alter_relation_comment(relation, comment) %}\n alter table {{ relation }} {{ on_cluster_clause(relation) }} modify comment '{{ comment }}'\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_clickhouse.on_cluster_clause"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.5624535, "supported_languages": null}, "macro.dbt_clickhouse.clickhouse__persist_docs": {"name": "clickhouse__persist_docs", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/persist_docs.sql", "original_file_path": "macros/persist_docs.sql", "unique_id": "macro.dbt_clickhouse.clickhouse__persist_docs", "macro_sql": "{% macro clickhouse__persist_docs(relation, model, for_relation, for_columns) %}\n {%- set alter_comments = [] %}\n\n {%- if for_relation and config.persist_relation_docs() and model.description -%}\n {% set escaped_comment = clickhouse_escape_comment(model.description) %}\n {% do alter_comments.append(\"modify comment {comment}\".format(comment=escaped_comment)) %}\n {%- endif -%}\n\n {%- if for_columns and config.persist_column_docs() and model.columns -%}\n {% set existing_columns = adapter.get_columns_in_relation(relation) | map(attribute=\"name\") | list %}\n {% for column_name in model.columns if (column_name in existing_columns) %}\n {%- set comment = model.columns[column_name]['description'] -%}\n {%- if comment %}\n {% set escaped_comment = clickhouse_escape_comment(comment) %}\n {% do alter_comments.append(\"comment column {column_name} {comment}\".format(column_name=column_name, comment=escaped_comment)) %}\n {%- endif %}\n {%- endfor -%}\n {%- endif -%}\n\n {%- if alter_comments | length > 0 -%}\n {% do run_query(one_alter_relation(relation, alter_comments|join(', '))) %}\n {%- endif -%}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_clickhouse.clickhouse_escape_comment", "macro.dbt.run_query", "macro.dbt_clickhouse.one_alter_relation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.5641613, "supported_languages": null}, "macro.dbt_clickhouse.clickhouse_escape_comment": {"name": "clickhouse_escape_comment", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/persist_docs.sql", "original_file_path": "macros/persist_docs.sql", "unique_id": "macro.dbt_clickhouse.clickhouse_escape_comment", "macro_sql": "{% macro clickhouse_escape_comment(comment) -%}\n {% if adapter.is_before_version('21.9.2.17') %}\n {% do exceptions.raise_compiler_error('Unsupported ClickHouse version for using heredoc syntax') %}\n {% endif %}\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": 1723756270.565049, "supported_languages": null}, "macro.dbt_clickhouse.clickhouse__get_test_sql": {"name": "clickhouse__get_test_sql", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/utils/utils.sql", "original_file_path": "macros/utils/utils.sql", "unique_id": "macro.dbt_clickhouse.clickhouse__get_test_sql", "macro_sql": "{% macro clickhouse__get_test_sql(main_sql, fail_calc, warn_if, error_if, limit) -%}\n {% set main_sql_formatted = clickhouse__place_limit(main_sql, limit) if limit !=None else main_sql%}\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_formatted }}\n ) dbt_internal_test\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_clickhouse.clickhouse__place_limit"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.5693307, "supported_languages": null}, "macro.dbt_clickhouse.clickhouse__place_limit": {"name": "clickhouse__place_limit", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/utils/utils.sql", "original_file_path": "macros/utils/utils.sql", "unique_id": "macro.dbt_clickhouse.clickhouse__place_limit", "macro_sql": "{% macro clickhouse__place_limit(query, limit) -%}\n {% if 'settings' in query.lower()%}\n {% if '-- end_of_sql' not in query.lower()%}\n {{exceptions.raise_compiler_error(\"-- end_of_sql must be set when using ClickHouse settings\")}}\n {% endif %}\n {% set split_by_settings_sections = query.split(\"-- end_of_sql\")%}\n {% set split_by_settings_sections_with_limit = split_by_settings_sections[-2] + \"\\n LIMIT \" + limit|string + \"\\n\" %}\n {% set query_with_limit = \"-- end_of_sql\".join(split_by_settings_sections[:-2] + [split_by_settings_sections_with_limit, split_by_settings_sections[-1]])%}\n {{query_with_limit}}\n {% else %}\n {{query}}\n {{\"limit \" ~ limit}}\n {% endif %}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.5704207, "supported_languages": null}, "macro.dbt_clickhouse.clickhouse__any_value": {"name": "clickhouse__any_value", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/utils/utils.sql", "original_file_path": "macros/utils/utils.sql", "unique_id": "macro.dbt_clickhouse.clickhouse__any_value", "macro_sql": "{% macro clickhouse__any_value(expression) -%}\n any({{ expression }})\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.5705955, "supported_languages": null}, "macro.dbt_clickhouse.clickhouse__bool_or": {"name": "clickhouse__bool_or", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/utils/utils.sql", "original_file_path": "macros/utils/utils.sql", "unique_id": "macro.dbt_clickhouse.clickhouse__bool_or", "macro_sql": "{% macro clickhouse__bool_or(expression) -%}\n max({{ expression }}) > 0\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.5707576, "supported_languages": null}, "macro.dbt_clickhouse.clickhouse__cast_bool_to_text": {"name": "clickhouse__cast_bool_to_text", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/utils/utils.sql", "original_file_path": "macros/utils/utils.sql", "unique_id": "macro.dbt_clickhouse.clickhouse__cast_bool_to_text", "macro_sql": "{% macro clickhouse__cast_bool_to_text(field) %}\n multiIf({{ field }} > 0, 'true', {{ field }} = 0, 'false', NULL)\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.5709453, "supported_languages": null}, "macro.dbt_clickhouse.clickhouse__hash": {"name": "clickhouse__hash", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/utils/utils.sql", "original_file_path": "macros/utils/utils.sql", "unique_id": "macro.dbt_clickhouse.clickhouse__hash", "macro_sql": "{% macro clickhouse__hash(field) -%}\n lower(hex(MD5(toString({{ field }} ))))\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.5711043, "supported_languages": null}, "macro.dbt_clickhouse.clickhouse__last_day": {"name": "clickhouse__last_day", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/utils/utils.sql", "original_file_path": "macros/utils/utils.sql", "unique_id": "macro.dbt_clickhouse.clickhouse__last_day", "macro_sql": "\n\n\n{%- macro clickhouse__last_day(date, datepart) -%}\n {{ dbt.dateadd('day', '-1', dbt.dateadd(datepart, '1', dbt.date_trunc(datepart, date)))}}\n{%- endmacro -%}\n\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": 1723756270.5714948, "supported_languages": null}, "macro.dbt_clickhouse.clickhouse__split_part": {"name": "clickhouse__split_part", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/utils/utils.sql", "original_file_path": "macros/utils/utils.sql", "unique_id": "macro.dbt_clickhouse.clickhouse__split_part", "macro_sql": "{% macro clickhouse__split_part(string_text, delimiter_text, part_number) %}\n splitByChar('{{delimiter_text}}', {{ string_text }})[{{ part_number }}]\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.571766, "supported_languages": null}, "macro.dbt_clickhouse.clickhouse__replace": {"name": "clickhouse__replace", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/utils/utils.sql", "original_file_path": "macros/utils/utils.sql", "unique_id": "macro.dbt_clickhouse.clickhouse__replace", "macro_sql": "{% macro clickhouse__replace(field, old_chars, new_chars) %}\n replaceAll({{ field }},'{{ old_chars }}','{{ new_chars }}')\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.572007, "supported_languages": null}, "macro.dbt_clickhouse.clickhouse__listagg": {"name": "clickhouse__listagg", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/utils/utils.sql", "original_file_path": "macros/utils/utils.sql", "unique_id": "macro.dbt_clickhouse.clickhouse__listagg", "macro_sql": "{% macro clickhouse__listagg(measure, delimiter_text, order_by_clause, limit_num) -%}\n {% if order_by_clause -%}\n {% set arr = \"arrayMap(x -> x.1, arraySort(x -> x.2, arrayZip(array_agg({}), array_agg({}))))\".format(measure, order_by_clause) %}\n {% else -%}\n {% set arr = \"array_agg({})\".format(measure) %}\n {%- endif %}\n\n {% if limit_num -%}\n arrayStringConcat(arraySlice({{ arr }}, 1, {{ limit_num }}), {{delimiter_text}})\n {% else -%}\n arrayStringConcat({{ arr }}, {{delimiter_text}})\n {%- endif %}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.572729, "supported_languages": null}, "macro.dbt_clickhouse.clickhouse__array_construct": {"name": "clickhouse__array_construct", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/utils/utils.sql", "original_file_path": "macros/utils/utils.sql", "unique_id": "macro.dbt_clickhouse.clickhouse__array_construct", "macro_sql": "{% macro clickhouse__array_construct(inputs, data_type) -%}\n {% if inputs|length > 0 %}\n [ {{ inputs|join(' , ') }} ]\n {% else %}\n emptyArray{{data_type}}()\n {% endif %}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.5731242, "supported_languages": null}, "macro.dbt_clickhouse.clickhouse__array_append": {"name": "clickhouse__array_append", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/utils/utils.sql", "original_file_path": "macros/utils/utils.sql", "unique_id": "macro.dbt_clickhouse.clickhouse__array_append", "macro_sql": "{% macro clickhouse__array_append(array, new_element) -%}\n arrayPushBack({{ array }}, {{ new_element }})\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.5733325, "supported_languages": null}, "macro.dbt_clickhouse.clickhouse__array_concat": {"name": "clickhouse__array_concat", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/utils/utils.sql", "original_file_path": "macros/utils/utils.sql", "unique_id": "macro.dbt_clickhouse.clickhouse__array_concat", "macro_sql": "{% macro clickhouse__array_concat(array_1, array_2) -%}\n arrayConcat({{ array_1 }}, {{ array_2 }})\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.5735328, "supported_languages": null}, "macro.dbt_clickhouse.clickhouse__current_timestamp": {"name": "clickhouse__current_timestamp", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/utils/timestamps.sql", "original_file_path": "macros/utils/timestamps.sql", "unique_id": "macro.dbt_clickhouse.clickhouse__current_timestamp", "macro_sql": "{% macro clickhouse__current_timestamp() -%}\n now()\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.5737586, "supported_languages": null}, "macro.dbt_clickhouse.clickhouse__snapshot_string_as_time": {"name": "clickhouse__snapshot_string_as_time", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/utils/timestamps.sql", "original_file_path": "macros/utils/timestamps.sql", "unique_id": "macro.dbt_clickhouse.clickhouse__snapshot_string_as_time", "macro_sql": "{% macro clickhouse__snapshot_string_as_time(timestamp) -%}\n {%- set result = \"toDateTime('\" ~ timestamp ~ \"')\" -%}\n {{ return(result) }}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.574038, "supported_languages": null}, "macro.dbt_clickhouse.clickhouse_s3source": {"name": "clickhouse_s3source", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/materializations/s3.sql", "original_file_path": "macros/materializations/s3.sql", "unique_id": "macro.dbt_clickhouse.clickhouse_s3source", "macro_sql": "{% macro clickhouse_s3source(config_name='', bucket='', path='', fmt='', structure='',\n aws_access_key_id='', aws_secret_access_key='', compression='') %}\n {% if config_name and not config_name.lower().endswith('s3') %}\n {{ exceptions.raise_compiler_error(\"S3 configuration should end with 's3'\") }}\n {% endif %}\n {% set s3config = config.get(config_name, {}) %}\n {{ adapter.s3source_clause(\n config_name=config_name,\n s3_model_config=s3config,\n bucket=bucket,\n path=path,\n fmt=fmt,\n structure=structure,\n aws_access_key_id=aws_access_key_id,\n aws_secret_access_key=aws_secret_access_key,\n compression=compression) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.575414, "supported_languages": null}, "macro.dbt_clickhouse.materialization_view_clickhouse": {"name": "materialization_view_clickhouse", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/materializations/view.sql", "original_file_path": "macros/materializations/view.sql", "unique_id": "macro.dbt_clickhouse.materialization_view_clickhouse", "macro_sql": "{%- materialization view, adapter='clickhouse' -%}\n\n {%- set existing_relation = load_cached_relation(this) -%}\n {%- set target_relation = this.incorporate(type='view') -%}\n {%- set backup_relation = none -%}\n {%- set preexisting_backup_relation = none -%}\n {%- set preexisting_intermediate_relation = none -%}\n\n {% if existing_relation is not none %}\n {%- set backup_relation_type = existing_relation.type -%}\n {%- set backup_relation = make_backup_relation(target_relation, backup_relation_type) -%}\n {%- set preexisting_backup_relation = load_cached_relation(backup_relation) -%}\n {% if not existing_relation.can_exchange %}\n {%- set intermediate_relation = make_intermediate_relation(target_relation) -%}\n {%- set preexisting_intermediate_relation = load_cached_relation(intermediate_relation) -%}\n {% endif %}\n {% endif %}\n\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 {% if backup_relation is none %}\n {{ log('Creating new relation ' + target_relation.name )}}\n -- There is not existing relation, so we can just create\n {% call statement('main') -%}\n {{ get_create_view_as_sql(target_relation, sql) }}\n {%- endcall %}\n {% elif existing_relation.can_exchange %}\n -- We can do an atomic exchange, so no need for an intermediate\n {% call statement('main') -%}\n {{ get_create_view_as_sql(backup_relation, sql) }}\n {%- endcall %}\n {% do exchange_tables_atomic(backup_relation, existing_relation) %}\n {% else %}\n -- We have to use an intermediate and rename accordingly\n {% call statement('main') -%}\n {{ get_create_view_as_sql(intermediate_relation, sql) }}\n {%- endcall %}\n {{ adapter.rename_relation(existing_relation, backup_relation) }}\n {{ adapter.rename_relation(intermediate_relation, target_relation) }}\n {% endif %}\n\n -- cleanup\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 -%}\n\n\n", "depends_on": {"macros": ["macro.dbt.load_cached_relation", "macro.dbt.make_backup_relation", "macro.dbt.make_intermediate_relation", "macro.dbt.run_hooks", "macro.dbt.drop_relation_if_exists", "macro.dbt.statement", "macro.dbt.get_create_view_as_sql", "macro.dbt_clickhouse.exchange_tables_atomic", "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": 1723756270.5817943, "supported_languages": ["sql"]}, "macro.dbt_clickhouse.clickhouse__create_view_as": {"name": "clickhouse__create_view_as", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/materializations/view.sql", "original_file_path": "macros/materializations/view.sql", "unique_id": "macro.dbt_clickhouse.clickhouse__create_view_as", "macro_sql": "{% macro clickhouse__create_view_as(relation, sql) -%}\n {%- set sql_header = config.get('sql_header', none) -%}\n {{ sql_header if sql_header is not none }}\n\n create view {{ relation.include(database=False) }} {{ on_cluster_clause(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 {% if model.get('config').get('materialized') == 'view' %}\n {{ adapter.get_model_settings(model) }}\n {%- endif %}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_clickhouse.on_cluster_clause", "macro.dbt.get_assert_columns_equivalent"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.582834, "supported_languages": null}, "macro.dbt_clickhouse.materialization_table_clickhouse": {"name": "materialization_table_clickhouse", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/materializations/table.sql", "original_file_path": "macros/materializations/table.sql", "unique_id": "macro.dbt_clickhouse.materialization_table_clickhouse", "macro_sql": "{% materialization table, adapter='clickhouse' %}\n\n {%- set existing_relation = load_cached_relation(this) -%}\n {%- set target_relation = this.incorporate(type='table') -%}\n {%- set backup_relation = none -%}\n {%- set preexisting_backup_relation = none -%}\n {%- set preexisting_intermediate_relation = none -%}\n\n {% if existing_relation is not none %}\n {%- set backup_relation_type = existing_relation.type -%}\n {%- set backup_relation = make_backup_relation(target_relation, backup_relation_type) -%}\n {%- set preexisting_backup_relation = load_cached_relation(backup_relation) -%}\n {% if not existing_relation.can_exchange %}\n {%- set intermediate_relation = make_intermediate_relation(target_relation) -%}\n {%- set preexisting_intermediate_relation = load_cached_relation(intermediate_relation) -%}\n {% endif %}\n {% endif %}\n\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 {% if backup_relation is none %}\n {{ log('Creating new relation ' + target_relation.name )}}\n -- There is not existing relation, so we can just create\n {% call statement('main') -%}\n {{ get_create_table_as_sql(False, target_relation, sql) }}\n {%- endcall %}\n {% elif existing_relation.can_exchange %}\n -- We can do an atomic exchange, so no need for an intermediate\n {% call statement('main') -%}\n {{ get_create_table_as_sql(False, backup_relation, sql) }}\n {%- endcall %}\n {% do exchange_tables_atomic(backup_relation, existing_relation) %}\n {% else %}\n -- We have to use an intermediate and rename accordingly\n {% call statement('main') -%}\n {{ get_create_table_as_sql(False, intermediate_relation, sql) }}\n {%- endcall %}\n {{ adapter.rename_relation(existing_relation, backup_relation) }}\n {{ adapter.rename_relation(intermediate_relation, target_relation) }}\n {% endif %}\n\n -- cleanup\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_backup_relation", "macro.dbt.make_intermediate_relation", "macro.dbt.run_hooks", "macro.dbt.drop_relation_if_exists", "macro.dbt.statement", "macro.dbt.get_create_table_as_sql", "macro.dbt_clickhouse.exchange_tables_atomic", "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": 1723756270.595061, "supported_languages": ["sql"]}, "macro.dbt_clickhouse.engine_clause": {"name": "engine_clause", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/materializations/table.sql", "original_file_path": "macros/materializations/table.sql", "unique_id": "macro.dbt_clickhouse.engine_clause", "macro_sql": "{% macro engine_clause() %}\n engine = {{ config.get('engine', default='MergeTree()') }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.59532, "supported_languages": null}, "macro.dbt_clickhouse.partition_cols": {"name": "partition_cols", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/materializations/table.sql", "original_file_path": "macros/materializations/table.sql", "unique_id": "macro.dbt_clickhouse.partition_cols", "macro_sql": "{% macro partition_cols(label) %}\n {%- set cols = config.get('partition_by', validator=validation.any[list, basestring]) -%}\n {%- if cols is not none %}\n {%- if cols is string -%}\n {%- set cols = [cols] -%}\n {%- endif -%}\n {{ label }} (\n {%- for item in cols -%}\n {{ item }}\n {%- if not loop.last -%},{%- endif -%}\n {%- endfor -%}\n )\n {%- endif %}\n{%- endmacro -%}\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.596085, "supported_languages": null}, "macro.dbt_clickhouse.primary_key_clause": {"name": "primary_key_clause", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/materializations/table.sql", "original_file_path": "macros/materializations/table.sql", "unique_id": "macro.dbt_clickhouse.primary_key_clause", "macro_sql": "{% macro primary_key_clause(label) %}\n {%- set primary_key = config.get('primary_key', validator=validation.any[basestring]) -%}\n\n {%- if primary_key is not none %}\n {{ label }} {{ primary_key }}\n {%- endif %}\n{%- endmacro -%}\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.5965111, "supported_languages": null}, "macro.dbt_clickhouse.order_cols": {"name": "order_cols", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/materializations/table.sql", "original_file_path": "macros/materializations/table.sql", "unique_id": "macro.dbt_clickhouse.order_cols", "macro_sql": "{% macro order_cols(label) %}\n {%- set cols = config.get('order_by', validator=validation.any[list, basestring]) -%}\n {%- set engine = config.get('engine', default='MergeTree()') -%}\n {%- set supported = [\n 'HDFS',\n 'MaterializedPostgreSQL',\n 'S3',\n 'EmbeddedRocksDB',\n 'Hive'\n ] -%}\n\n {%- if 'MergeTree' in engine or engine in supported %}\n {%- if cols is not none %}\n {%- if cols is string -%}\n {%- set cols = [cols] -%}\n {%- endif -%}\n {{ label }} (\n {%- for item in cols -%}\n {{ item }}\n {%- if not loop.last -%},{%- endif -%}\n {%- endfor -%}\n )\n {%- else %}\n {{ label }} (tuple())\n {%- endif %}\n {%- endif %}\n{%- endmacro -%}\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.5977128, "supported_languages": null}, "macro.dbt_clickhouse.ttl_config": {"name": "ttl_config", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/materializations/table.sql", "original_file_path": "macros/materializations/table.sql", "unique_id": "macro.dbt_clickhouse.ttl_config", "macro_sql": "{% macro ttl_config(label) %}\n {%- if config.get(\"ttl\")%}\n {{ label }} {{ config.get(\"ttl\") }}\n {%- endif %}\n{%- endmacro -%}\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.5980403, "supported_languages": null}, "macro.dbt_clickhouse.on_cluster_clause": {"name": "on_cluster_clause", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/materializations/table.sql", "original_file_path": "macros/materializations/table.sql", "unique_id": "macro.dbt_clickhouse.on_cluster_clause", "macro_sql": "{% macro on_cluster_clause(relation, force_sync) %}\n {% set active_cluster = adapter.get_clickhouse_cluster_name() %}\n {%- if active_cluster is not none and relation.should_on_cluster %}\n {# Add trailing whitespace to avoid problems when this clause is not last #}\n ON CLUSTER {{ active_cluster + ' ' }}\n {%- if force_sync %}\n SYNC\n {%- endif %}\n {%- endif %}\n{%- endmacro -%}\n\n", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.5985045, "supported_languages": null}, "macro.dbt_clickhouse.clickhouse__create_table_as": {"name": "clickhouse__create_table_as", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/materializations/table.sql", "original_file_path": "macros/materializations/table.sql", "unique_id": "macro.dbt_clickhouse.clickhouse__create_table_as", "macro_sql": "{% macro clickhouse__create_table_as(temporary, relation, sql) -%}\n {% set has_contract = config.get('contract').enforced %}\n {% set create_table = create_table_or_empty(temporary, relation, sql, has_contract) %}\n {% if adapter.is_before_version('22.7.1.2484') or temporary -%}\n {{ create_table }}\n {%- else %}\n {% call statement('create_table_empty') %}\n {{ create_table }}\n {% endcall %}\n {{ clickhouse__insert_into(relation, sql, has_contract) }}\n {%- endif %}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_clickhouse.create_table_or_empty", "macro.dbt.statement", "macro.dbt_clickhouse.clickhouse__insert_into"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.5993323, "supported_languages": null}, "macro.dbt_clickhouse.create_table_or_empty": {"name": "create_table_or_empty", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/materializations/table.sql", "original_file_path": "macros/materializations/table.sql", "unique_id": "macro.dbt_clickhouse.create_table_or_empty", "macro_sql": "{% macro create_table_or_empty(temporary, relation, sql, has_contract) -%}\n {%- set sql_header = config.get('sql_header', none) -%}\n\n {{ sql_header if sql_header is not none }}\n\n {% if temporary -%}\n create temporary table {{ relation }}\n engine Memory\n {{ adapter.get_model_settings(model) }}\n as (\n {{ sql }}\n )\n {%- else %}\n create table {{ relation }}\n {{ on_cluster_clause(relation)}}\n {%- if has_contract%}\n {{ get_assert_columns_equivalent(sql) }}\n {{ get_table_columns_and_constraints() }}\n {%- endif %}\n {{ engine_clause() }}\n {{ order_cols(label=\"order by\") }}\n {{ primary_key_clause(label=\"primary key\") }}\n {{ partition_cols(label=\"partition by\") }}\n {{ ttl_config(label=\"ttl\")}}\n {{ adapter.get_model_settings(model) }}\n\n {%- if not has_contract %}\n {%- if not adapter.is_before_version('22.7.1.2484') %}\n empty\n {%- endif %}\n as (\n {{ sql }}\n )\n {%- endif %}\n {%- endif %}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_clickhouse.on_cluster_clause", "macro.dbt.get_assert_columns_equivalent", "macro.dbt.get_table_columns_and_constraints", "macro.dbt_clickhouse.engine_clause", "macro.dbt_clickhouse.order_cols", "macro.dbt_clickhouse.primary_key_clause", "macro.dbt_clickhouse.partition_cols", "macro.dbt_clickhouse.ttl_config"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.600757, "supported_languages": null}, "macro.dbt_clickhouse.clickhouse__insert_into": {"name": "clickhouse__insert_into", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/materializations/table.sql", "original_file_path": "macros/materializations/table.sql", "unique_id": "macro.dbt_clickhouse.clickhouse__insert_into", "macro_sql": "{% macro clickhouse__insert_into(target_relation, sql, has_contract) %}\n {%- set dest_columns = adapter.get_columns_in_relation(target_relation) -%}\n {%- set dest_cols_csv = dest_columns | map(attribute='quoted') | join(', ') -%}\n\n insert into {{ target_relation }}\n ({{ dest_cols_csv }})\n {%- if has_contract -%}\n -- Use a subquery to get columns in the right order\n SELECT {{ dest_cols_csv }} FROM ( {{ sql }} )\n {%- else -%}\n {{ sql }}\n {%- endif -%}\n {{ adapter.get_model_query_settings(model) }}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.601474, "supported_languages": null}, "macro.dbt_clickhouse.clickhouse__load_csv_rows": {"name": "clickhouse__load_csv_rows", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/materializations/seed.sql", "original_file_path": "macros/materializations/seed.sql", "unique_id": "macro.dbt_clickhouse.clickhouse__load_csv_rows", "macro_sql": "{% macro clickhouse__load_csv_rows(model, agate_table) %}\n {% set cols_sql = get_seed_column_quoted_csv(model, agate_table.column_names) %}\n {% set data_sql = adapter.get_csv_data(agate_table) %}\n\n {% set sql -%}\n insert into {{ this.render() }} ({{ cols_sql }})\n {{ adapter.get_model_query_settings(model) }}\n format CSV\n {{ data_sql }}\n {%- endset %}\n\n {% do adapter.add_query(sql, bindings=agate_table, abridge_sql_log=True) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.get_seed_column_quoted_csv"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.603271, "supported_languages": null}, "macro.dbt_clickhouse.clickhouse__create_csv_table": {"name": "clickhouse__create_csv_table", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/materializations/seed.sql", "original_file_path": "macros/materializations/seed.sql", "unique_id": "macro.dbt_clickhouse.clickhouse__create_csv_table", "macro_sql": "{% macro clickhouse__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() }} {{ on_cluster_clause(this) }} (\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 {{ engine_clause() }}\n {{ order_cols(label='order by') }}\n {{ partition_cols(label='partition by') }}\n {% endset %}\n\n {% call statement('_') -%}\n {{ sql }}\n {%- endcall %}\n\n {{ return(sql) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_clickhouse.on_cluster_clause", "macro.dbt_clickhouse.engine_clause", "macro.dbt_clickhouse.order_cols", "macro.dbt_clickhouse.partition_cols", "macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.6048553, "supported_languages": null}, "macro.dbt_clickhouse.clickhouse__snapshot_hash_arguments": {"name": "clickhouse__snapshot_hash_arguments", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/materializations/snapshot.sql", "original_file_path": "macros/materializations/snapshot.sql", "unique_id": "macro.dbt_clickhouse.clickhouse__snapshot_hash_arguments", "macro_sql": "{% macro clickhouse__snapshot_hash_arguments(args) -%}\n halfMD5({%- 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": 1723756270.6091998, "supported_languages": null}, "macro.dbt_clickhouse.clickhouse__post_snapshot": {"name": "clickhouse__post_snapshot", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/materializations/snapshot.sql", "original_file_path": "macros/materializations/snapshot.sql", "unique_id": "macro.dbt_clickhouse.clickhouse__post_snapshot", "macro_sql": "{% macro clickhouse__post_snapshot(staging_relation) %}\n {{ drop_relation_if_exists(staging_relation) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.drop_relation_if_exists"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.6094012, "supported_languages": null}, "macro.dbt_clickhouse.build_snapshot_staging_table": {"name": "build_snapshot_staging_table", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/materializations/snapshot.sql", "original_file_path": "macros/materializations/snapshot.sql", "unique_id": "macro.dbt_clickhouse.build_snapshot_staging_table", "macro_sql": "{% macro build_snapshot_staging_table(strategy, sql, target_relation) %}\n {% set tmp_relation = make_temp_relation(target_relation) %}\n\n {% set select = snapshot_staging_table(strategy, sql, target_relation) %}\n\n {% call statement('build_snapshot_staging_relation') %}\n {{ create_table_as(False, tmp_relation, select) }}\n {% endcall %}\n\n {% do return(tmp_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": 1723756270.6100273, "supported_languages": null}, "macro.dbt_clickhouse.clickhouse__snapshot_merge_sql": {"name": "clickhouse__snapshot_merge_sql", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/materializations/snapshot.sql", "original_file_path": "macros/materializations/snapshot.sql", "unique_id": "macro.dbt_clickhouse.clickhouse__snapshot_merge_sql", "macro_sql": "{% macro clickhouse__snapshot_merge_sql(target, source, insert_cols) -%}\n {%- set insert_cols_csv = insert_cols | join(', ') -%}\n {%- set valid_to_col = adapter.quote('dbt_valid_to') -%}\n\n {%- set upsert = target.derivative('__snapshot_upsert') -%}\n {% call statement('create_upsert_relation') %}\n create table if not exists {{ upsert }} as {{ target }}\n {% endcall %}\n\n {% call statement('insert_unchanged_data') %}\n insert into {{ upsert }} ({{ insert_cols_csv }})\n select {% for column in insert_cols -%}\n {{ column }} {%- if not loop.last %}, {%- endif %}\n {%- endfor %}\n from {{ target }}\n where dbt_scd_id not in (\n select {{ source }}.dbt_scd_id from {{ source }} \n )\n {% endcall %}\n\n {% call statement('insert_updated_and_deleted') %}\n insert into {{ upsert }} ({{ insert_cols_csv }})\n with updates_and_deletes as (\n select\n dbt_scd_id,\n dbt_valid_to\n from {{ source }}\n where dbt_change_type IN ('update', 'delete')\n )\n select {% for column in insert_cols %}\n {%- if column == valid_to_col -%}\n updates_and_deletes.dbt_valid_to as dbt_valid_to\n {%- else -%}\n target.{{ column }} as {{ column }}\n {%- endif %} {%- if not loop.last %}, {%- endif %}\n {%- endfor %}\n from {{ target }} target\n join updates_and_deletes on target.dbt_scd_id = updates_and_deletes.dbt_scd_id;\n {% endcall %}\n\n {% call statement('insert_new') %}\n insert into {{ upsert }} ({{ insert_cols_csv }})\n select {% for column in insert_cols -%}\n {{ column }} {%- if not loop.last %}, {%- endif %}\n {%- endfor %}\n from {{ source }}\n where {{ source }}.dbt_change_type IN ('insert');\n {% endcall %}\n\n {% if target.can_exchange %}\n {% do exchange_tables_atomic(upsert, target) %}\n {% call statement('drop_exchanged_relation') %}\n drop table if exists {{ upsert }};\n {% endcall %}\n {% else %}\n {% call statement('drop_target_relation') %}\n drop table if exists {{ target }};\n {% endcall %}\n {% call statement('rename_upsert_relation') %}\n rename table {{ upsert }} to {{ target }};\n {% endcall %}\n {% endif %}\n\n {% do return ('select 1') %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt_clickhouse.exchange_tables_atomic"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.6128042, "supported_languages": null}, "macro.dbt_clickhouse.materialization_materialized_view_clickhouse": {"name": "materialization_materialized_view_clickhouse", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/materializations/materialized_view.sql", "original_file_path": "macros/materializations/materialized_view.sql", "unique_id": "macro.dbt_clickhouse.materialization_materialized_view_clickhouse", "macro_sql": "\n{%- materialization materialized_view, adapter='clickhouse' -%}\n\n {%- set target_relation = this.incorporate(type='table') -%}\n {%- set mv_relation = target_relation.derivative('_mv', 'materialized_view') -%}\n {%- set cluster_clause = on_cluster_clause(target_relation) -%}\n\n {# look for an existing relation for the target table and create backup relations if necessary #}\n {%- set existing_relation = load_cached_relation(this) -%}\n {%- set backup_relation = none -%}\n {%- set preexisting_backup_relation = none -%}\n {%- set preexisting_intermediate_relation = none -%}\n {% if existing_relation is not none %}\n {%- set backup_relation_type = existing_relation.type -%}\n {%- set backup_relation = make_backup_relation(target_relation, backup_relation_type) -%}\n {%- set preexisting_backup_relation = load_cached_relation(backup_relation) -%}\n {% if not existing_relation.can_exchange %}\n {%- set intermediate_relation = make_intermediate_relation(target_relation) -%}\n {%- set preexisting_intermediate_relation = load_cached_relation(intermediate_relation) -%}\n {% endif %}\n {% endif %}\n\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 {% if backup_relation is none %}\n {{ log('Creating new materialized view ' + target_relation.name )}}\n {% call statement('main') -%}\n {{ clickhouse__get_create_materialized_view_as_sql(target_relation, sql) }}\n {%- endcall %}\n {% elif existing_relation.can_exchange %}\n {{ log('Replacing existing materialized view ' + target_relation.name) }}\n {% call statement('drop existing materialized view') %}\n drop view if exists {{ mv_relation }} {{ cluster_clause }}\n {% endcall %}\n {% if should_full_refresh() %}\n {% call statement('main') -%}\n {{ get_create_table_as_sql(False, backup_relation, sql) }}\n {%- endcall %}\n {% do exchange_tables_atomic(backup_relation, existing_relation) %}\n {% else %}\n -- we need to have a 'main' statement\n {% call statement('main') -%}\n select 1\n {%- endcall %}\n {% endif %}\n {% call statement('create new materialized view') %}\n {{ clickhouse__create_mv_sql(mv_relation, existing_relation, cluster_clause, sql) }}\n {% endcall %}\n {% else %}\n {{ log('Replacing existing materialized view ' + target_relation.name) }}\n {{ clickhouse__replace_mv(target_relation, existing_relation, intermediate_relation, backup_relation, sql) }}\n {% endif %}\n\n -- cleanup\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, mv_relation]}) }}\n\n{%- endmaterialization -%}\n\n\n", "depends_on": {"macros": ["macro.dbt_clickhouse.on_cluster_clause", "macro.dbt.load_cached_relation", "macro.dbt.make_backup_relation", "macro.dbt.make_intermediate_relation", "macro.dbt.run_hooks", "macro.dbt.drop_relation_if_exists", "macro.dbt.statement", "macro.dbt_clickhouse.clickhouse__get_create_materialized_view_as_sql", "macro.dbt.should_full_refresh", "macro.dbt.get_create_table_as_sql", "macro.dbt_clickhouse.exchange_tables_atomic", "macro.dbt_clickhouse.clickhouse__create_mv_sql", "macro.dbt_clickhouse.clickhouse__replace_mv", "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": 1723756270.620101, "supported_languages": ["sql"]}, "macro.dbt_clickhouse.clickhouse__get_create_materialized_view_as_sql": {"name": "clickhouse__get_create_materialized_view_as_sql", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/materializations/materialized_view.sql", "original_file_path": "macros/materializations/materialized_view.sql", "unique_id": "macro.dbt_clickhouse.clickhouse__get_create_materialized_view_as_sql", "macro_sql": "{% macro clickhouse__get_create_materialized_view_as_sql(relation, sql) -%}\n {% call statement('create_target_table') %}\n {{ get_create_table_as_sql(False, relation, sql) }}\n {% endcall %}\n {%- set cluster_clause = on_cluster_clause(relation) -%}\n {%- set mv_relation = relation.derivative('_mv', 'materialized_view') -%}\n {{ clickhouse__create_mv_sql(mv_relation, relation, cluster_clause, sql) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt.get_create_table_as_sql", "macro.dbt_clickhouse.on_cluster_clause", "macro.dbt_clickhouse.clickhouse__create_mv_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.6207652, "supported_languages": null}, "macro.dbt_clickhouse.clickhouse__create_mv_sql": {"name": "clickhouse__create_mv_sql", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/materializations/materialized_view.sql", "original_file_path": "macros/materializations/materialized_view.sql", "unique_id": "macro.dbt_clickhouse.clickhouse__create_mv_sql", "macro_sql": "{% macro clickhouse__create_mv_sql(mv_relation, target_table, cluster_clause, sql) -%}\n create materialized view if not exists {{ mv_relation }} {{ cluster_clause }}\n to {{ target_table }}\n as {{ sql }}\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.621084, "supported_languages": null}, "macro.dbt_clickhouse.clickhouse__replace_mv": {"name": "clickhouse__replace_mv", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/materializations/materialized_view.sql", "original_file_path": "macros/materializations/materialized_view.sql", "unique_id": "macro.dbt_clickhouse.clickhouse__replace_mv", "macro_sql": "{% macro clickhouse__replace_mv(target_relation, existing_relation, intermediate_relation, backup_relation, sql) %}\n {# drop existing materialized view while we recreate the target table #}\n {%- set cluster_clause = on_cluster_clause(target_relation) -%}\n {%- set mv_relation = target_relation.derivative('_mv', 'materialized_view') -%}\n {% call statement('drop existing mv') -%}\n drop view if exists {{ mv_relation }} {{ cluster_clause }}\n {%- endcall %}\n\n {# recreate the target table #}\n {% call statement('main') -%}\n {{ get_create_table_as_sql(False, intermediate_relation, sql) }}\n {%- endcall %}\n {{ adapter.rename_relation(existing_relation, backup_relation) }}\n {{ adapter.rename_relation(intermediate_relation, target_relation) }}\n\n {# now that the target table is recreated, we can finally create our new view #}\n {{ clickhouse__create_mv_sql(mv_relation, target_relation, cluster_clause, sql) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_clickhouse.on_cluster_clause", "macro.dbt.statement", "macro.dbt.get_create_table_as_sql", "macro.dbt_clickhouse.clickhouse__create_mv_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.6221406, "supported_languages": null}, "macro.dbt_clickhouse.materialization_dictionary_clickhouse": {"name": "materialization_dictionary_clickhouse", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/materializations/dictionary.sql", "original_file_path": "macros/materializations/dictionary.sql", "unique_id": "macro.dbt_clickhouse.materialization_dictionary_clickhouse", "macro_sql": "{%- materialization dictionary, adapter='clickhouse' -%}\n\n {%- set existing_relation = load_cached_relation(this) -%}\n {%- set target_relation = this.incorporate(type='dictionary') -%}\n {%- set intermediate_relation = make_intermediate_relation(target_relation) -%}\n {%- set existing_intermediate_relation = load_cached_relation(intermediate_relation) -%}\n {%- set backup_relation_type = 'dictionary' if existing_relation is none else existing_relation.type -%}\n {%- set backup_relation = make_backup_relation(target_relation, backup_relation_type) -%}\n {%- set existing_backup_relation = load_cached_relation(backup_relation) -%}\n {%- set cluster_clause = on_cluster_clause(target_relation) -%}\n\n {%- set grant_config = config.get('grants') -%}\n\n {{ run_hooks(pre_hooks, inside_transaction=False) }}\n\n {{ drop_dictionary_if_exists(existing_backup_relation, cluster_clause) }}\n {{ drop_dictionary_if_exists(existing_intermediate_relation, cluster_clause) }}\n\n\n {{ run_hooks(pre_hooks, inside_transaction=True) }}\n\n {# create our new dictionary #}\n {% call statement('main') -%}\n {{ clickhouse__get_create_dictionary_as_sql(intermediate_relation, cluster_clause, sql) }}\n {%- endcall %}\n\n {# cleanup #}\n {% if existing_relation is not none %}\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_dictionary_if_exists(backup_relation) }}\n\n {{ run_hooks(post_hooks, inside_transaction=False) }}\n\n {{ return({'relations': [target_relation]}) }}\n\n{%- endmaterialization -%}\n\n\n", "depends_on": {"macros": ["macro.dbt.load_cached_relation", "macro.dbt.make_intermediate_relation", "macro.dbt.make_backup_relation", "macro.dbt_clickhouse.on_cluster_clause", "macro.dbt.run_hooks", "macro.dbt_clickhouse.drop_dictionary_if_exists", "macro.dbt.statement", "macro.dbt_clickhouse.clickhouse__get_create_dictionary_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": 1723756270.6282473, "supported_languages": ["sql"]}, "macro.dbt_clickhouse.clickhouse__get_create_dictionary_as_sql": {"name": "clickhouse__get_create_dictionary_as_sql", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/materializations/dictionary.sql", "original_file_path": "macros/materializations/dictionary.sql", "unique_id": "macro.dbt_clickhouse.clickhouse__get_create_dictionary_as_sql", "macro_sql": "{% macro clickhouse__get_create_dictionary_as_sql(relation, cluster_clause, sql) %}\n {%- set fields = config.get('fields') -%}\n {%- set source_type = config.get('source_type') -%}\n\n CREATE DICTIONARY {{ relation }} {{ cluster_clause }}\n (\n {%- for (name, data_type) in fields -%}\n {{ name }} {{ data_type }}{%- if not loop.last -%},{%- endif -%}\n {%- endfor -%}\n )\n {{ primary_key_clause(label=\"primary key\") }}\n SOURCE(\n {%- if source_type == 'http' %}\n {{ http_source() }}\n {% else %}\n {{ clickhouse_source(sql) }}\n {% endif -%}\n )\n LAYOUT({{ config.get('layout') }})\n LIFETIME({{ config.get('lifetime') }})\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_clickhouse.primary_key_clause", "macro.dbt_clickhouse.http_source", "macro.dbt_clickhouse.clickhouse_source"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.6294372, "supported_languages": null}, "macro.dbt_clickhouse.http_source": {"name": "http_source", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/materializations/dictionary.sql", "original_file_path": "macros/materializations/dictionary.sql", "unique_id": "macro.dbt_clickhouse.http_source", "macro_sql": "{% macro http_source() %}\n HTTP(URL '{{ config.get(\"url\") }}' FORMAT '{{ config.get(\"format\") }}')\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.6297054, "supported_languages": null}, "macro.dbt_clickhouse.clickhouse_source": {"name": "clickhouse_source", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/materializations/dictionary.sql", "original_file_path": "macros/materializations/dictionary.sql", "unique_id": "macro.dbt_clickhouse.clickhouse_source", "macro_sql": "{% macro clickhouse_source(sql) %}\n {%- set credentials = adapter.get_credentials(config.get(\"connection_overrides\", {})) -%}\n {%- set table = config.get('table') -%}\n CLICKHOUSE(\n {% if credentials.get(\"user\") -%}\n user '{{ credentials.get(\"user\") }}'\n {%- endif %}\n {% if credentials.get(\"password\") -%}\n password '{{ credentials.get(\"password\") }}'\n {%- endif %}\n {% if credentials.get(\"database\") -%}\n db '{{ credentials.get(\"database\") }}'\n {%- endif %}\n {%- if table is not none %}\n table '{{ table }}'\n {% else %}\n query \"{{ sql }}\"\n {% endif -%}\n )\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.6307664, "supported_languages": null}, "macro.dbt_clickhouse.drop_dictionary_if_exists": {"name": "drop_dictionary_if_exists", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/materializations/dictionary.sql", "original_file_path": "macros/materializations/dictionary.sql", "unique_id": "macro.dbt_clickhouse.drop_dictionary_if_exists", "macro_sql": "{% macro drop_dictionary_if_exists(relation, cluster_clause) %}\n {% if relation.type != 'dictionary' %}\n {{ log(relation ~ ' is not a dictionary; defaulting to drop_relation_if_exists') }}\n {{ drop_relation_if_exists(relation) }}\n {% else %}\n {% call statement('drop_dictionary_if_exists') %}\n drop dictionary if exists {{ relation }} {{ cluster_clause }}\n {% endcall %}\n {% endif %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.drop_relation_if_exists", "macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.631328, "supported_languages": null}, "macro.dbt_clickhouse.materialization_distributed_table_clickhouse": {"name": "materialization_distributed_table_clickhouse", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/materializations/distributed_table.sql", "original_file_path": "macros/materializations/distributed_table.sql", "unique_id": "macro.dbt_clickhouse.materialization_distributed_table_clickhouse", "macro_sql": "{% materialization distributed_table, adapter='clickhouse' %}\n {% set insert_distributed_sync = run_query(\"SELECT value FROM system.settings WHERE name = 'insert_distributed_sync'\")[0][0] %}\n {% if insert_distributed_sync != '1' %}\n {% do exceptions.raise_compiler_error('To use distributed materialization setting insert_distributed_sync should be set to 1') %}\n {% endif %}\n\n {%- set local_suffix = adapter.get_clickhouse_local_suffix() -%}\n {%- set local_db_prefix = adapter.get_clickhouse_local_db_prefix() -%}\n\n {%- set existing_relation = load_cached_relation(this) -%}\n {%- set target_relation = this.incorporate(type='table') -%}\n\n {% set on_cluster = on_cluster_clause(target_relation) %}\n {% if on_cluster.strip() == '' %}\n {% do exceptions.raise_compiler_error('To use distributed materialization cluster setting in dbt profile must be set') %}\n {% endif %}\n\n {% set existing_relation_local = existing_relation.incorporate(path={\"identifier\": this.identifier + local_suffix, \"schema\": local_db_prefix + this.schema}) if existing_relation is not none else none %}\n {% set target_relation_local = target_relation.incorporate(path={\"identifier\": this.identifier + local_suffix, \"schema\": local_db_prefix + this.schema}) if target_relation is not none else none %}\n\n {%- set backup_relation = none -%}\n {%- set preexisting_backup_relation = none -%}\n {%- set preexisting_intermediate_relation = none -%}\n\n {% if existing_relation_local is not none %}\n {%- set backup_relation_type = existing_relation_local.type -%}\n {%- set backup_relation = make_backup_relation(target_relation_local, backup_relation_type) -%}\n {%- set preexisting_backup_relation = load_cached_relation(backup_relation) -%}\n {% if not existing_relation.can_exchange %}\n {%- set intermediate_relation = make_intermediate_relation(target_relation_local) -%}\n {%- set preexisting_intermediate_relation = load_cached_relation(intermediate_relation) -%}\n {% endif %}\n {% endif %}\n {% set view_relation = default__make_temp_relation(target_relation, '__dbt_tmp') %}\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 {{ drop_relation_if_exists(view_relation) }}\n\n {% set grant_config = config.get('grants') %}\n\n {{ run_hooks(pre_hooks, inside_transaction=False) }}\n\n {% call statement('main') %}\n {{ create_view_as(view_relation, sql) }}\n {% endcall %}\n\n {{ run_hooks(pre_hooks, inside_transaction=True) }}\n\n {% if backup_relation is none %}\n {{ create_distributed_local_table(target_relation, target_relation_local, view_relation) }}\n {% elif existing_relation.can_exchange %}\n -- We can do an atomic exchange, so no need for an intermediate\n {% call statement('main') -%}\n {{ create_empty_table_from_relation(backup_relation, view_relation) }}\n {%- endcall %}\n {% do exchange_tables_atomic(backup_relation, existing_relation_local) %}\n {% else %}\n {% do run_query(create_empty_table_from_relation(intermediate_relation, view_relation)) or '' %}\n {{ adapter.rename_relation(existing_relation_local, backup_relation) }}\n {{ adapter.rename_relation(intermediate_relation, target_relation_local) }}\n {% endif %} \n {% do run_query(create_distributed_table(target_relation, target_relation_local)) or '' %}\n {% do run_query(clickhouse__insert_into(target_relation, sql)) or '' %}\n {{ drop_relation_if_exists(view_relation) }}\n -- cleanup\n {% set should_revoke = should_revoke(existing_relation, full_refresh_mode=True) %}\n {% do apply_grants(target_relation_local, grant_config, should_revoke=should_revoke) %}\n {% do apply_grants(target_relation, grant_config, should_revoke=should_revoke) %}\n\n {% do persist_docs(target_relation, model) %}\n {{ run_hooks(post_hooks, inside_transaction=True) }}\n {{ adapter.commit() }}\n {{ drop_relation_if_exists(backup_relation) }}\n {{ run_hooks(post_hooks, inside_transaction=False) }}\n {{ return({'relations': [target_relation]}) }}\n\n{% endmaterialization %}", "depends_on": {"macros": ["macro.dbt.run_query", "macro.dbt.load_cached_relation", "macro.dbt_clickhouse.on_cluster_clause", "macro.dbt.make_backup_relation", "macro.dbt.make_intermediate_relation", "macro.dbt.default__make_temp_relation", "macro.dbt.drop_relation_if_exists", "macro.dbt.run_hooks", "macro.dbt.statement", "macro.dbt.create_view_as", "macro.dbt_clickhouse.create_distributed_local_table", "macro.dbt_clickhouse.create_empty_table_from_relation", "macro.dbt_clickhouse.exchange_tables_atomic", "macro.dbt_clickhouse.create_distributed_table", "macro.dbt_clickhouse.clickhouse__insert_into", "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": 1723756270.6459095, "supported_languages": ["sql"]}, "macro.dbt_clickhouse.create_distributed_table": {"name": "create_distributed_table", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/materializations/distributed_table.sql", "original_file_path": "macros/materializations/distributed_table.sql", "unique_id": "macro.dbt_clickhouse.create_distributed_table", "macro_sql": "{% macro create_distributed_table(relation, local_relation) %}\n {%- set cluster = adapter.get_clickhouse_cluster_name() -%}\n {% if cluster is none %}\n {% do exceptions.raise_compiler_error('Cluster name should be defined for using distributed materializations, current is None') %}\n {% endif %}\n\n {%- set cluster = cluster[1:-1] -%}\n {%- set sharding = config.get('sharding_key') -%}\n\n create or replace table {{ relation }} {{ on_cluster_clause(relation) }} as {{ local_relation }}\n ENGINE = Distributed('{{ cluster}}', '{{ local_relation.schema }}', '{{ local_relation.name }}'\n {%- if sharding is not none and sharding.strip() != '' -%}\n , {{ sharding }}\n {%- else %}\n , rand()\n {% endif -%}\n )\n {% endmacro %}", "depends_on": {"macros": ["macro.dbt_clickhouse.on_cluster_clause"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.6469808, "supported_languages": null}, "macro.dbt_clickhouse.create_empty_table_from_relation": {"name": "create_empty_table_from_relation", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/materializations/distributed_table.sql", "original_file_path": "macros/materializations/distributed_table.sql", "unique_id": "macro.dbt_clickhouse.create_empty_table_from_relation", "macro_sql": "{% macro create_empty_table_from_relation(relation, source_relation) -%}\n {%- set sql_header = config.get('sql_header', none) -%}\n {%- set columns = adapter.get_columns_in_relation(source_relation) | list -%}\n \n\n {%- set col_list = [] -%}\n {% for col in columns %}\n {{col_list.append(col.name + ' ' + col.data_type) or '' }}\n {% endfor %}\n {{ sql_header if sql_header is not none }}\n\n create table {{ relation.include(database=False) }}\n {{ on_cluster_clause(relation) }} (\n {{col_list | join(', ')}}\n )\n \n {{ engine_clause() }}\n {{ order_cols(label=\"order by\") }}\n {{ primary_key_clause(label=\"primary key\") }}\n {{ partition_cols(label=\"partition by\") }}\n {{ adapter.get_model_settings(model) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_clickhouse.on_cluster_clause", "macro.dbt_clickhouse.engine_clause", "macro.dbt_clickhouse.order_cols", "macro.dbt_clickhouse.primary_key_clause", "macro.dbt_clickhouse.partition_cols"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.6482022, "supported_languages": null}, "macro.dbt_clickhouse.create_distributed_local_table": {"name": "create_distributed_local_table", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/materializations/distributed_table.sql", "original_file_path": "macros/materializations/distributed_table.sql", "unique_id": "macro.dbt_clickhouse.create_distributed_local_table", "macro_sql": "{% macro create_distributed_local_table(distributed_relation, shard_relation, structure_relation, sql_query=none) -%}\n {{ drop_relation_if_exists(shard_relation) }}\n {{ drop_relation_if_exists(distributed_relation) }}\n {{ create_schema(shard_relation) }}\n {% do run_query(create_empty_table_from_relation(shard_relation, structure_relation)) or '' %}\n {% do run_query(create_distributed_table(distributed_relation, shard_relation)) or '' %}\n {% if sql_query is not none %}\n {% do run_query(clickhouse__insert_into(distributed_relation, sql_query)) or '' %}\n {% endif %}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.drop_relation_if_exists", "macro.dbt.create_schema", "macro.dbt.run_query", "macro.dbt_clickhouse.create_empty_table_from_relation", "macro.dbt_clickhouse.create_distributed_table", "macro.dbt_clickhouse.clickhouse__insert_into"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.649046, "supported_languages": null}, "macro.dbt_clickhouse.materialization_incremental_clickhouse": {"name": "materialization_incremental_clickhouse", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/materializations/incremental/incremental.sql", "original_file_path": "macros/materializations/incremental/incremental.sql", "unique_id": "macro.dbt_clickhouse.materialization_incremental_clickhouse", "macro_sql": "{% materialization incremental, adapter='clickhouse' %}\n\n {%- set existing_relation = load_cached_relation(this) -%}\n {%- set target_relation = this.incorporate(type='table') -%}\n\n {%- set unique_key = config.get('unique_key') -%}\n {% if unique_key is not none and unique_key|length == 0 %}\n {% set unique_key = none %}\n {% endif %}\n {% if unique_key is iterable and (unique_key is not string and unique_key is not mapping) %}\n {% set unique_key = unique_key|join(', ') %}\n {% endif %}\n {%- set inserts_only = config.get('inserts_only') -%}\n {%- set grant_config = config.get('grants') -%}\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 {%- 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 {%- set preexisting_intermediate_relation = load_cached_relation(intermediate_relation)-%}\n {%- set preexisting_backup_relation = load_cached_relation(backup_relation) -%}\n\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 {{ run_hooks(pre_hooks, inside_transaction=True) }}\n {% set to_drop = [] %}\n\n {% if existing_relation is none %}\n -- No existing table, simply create a new one\n {% call statement('main') %}\n {{ get_create_table_as_sql(False, target_relation, sql) }}\n {% endcall %}\n\n {% elif full_refresh_mode %}\n -- Completely replacing the old table, so create a temporary table and then swap it\n {% call statement('main') %}\n {{ get_create_table_as_sql(False, intermediate_relation, sql) }}\n {% endcall %}\n {% set need_swap = true %}\n\n {% elif inserts_only or unique_key is none -%}\n -- There are no updates/deletes or duplicate keys are allowed. Simply add all of the new rows to the existing\n -- table. It is the user's responsibility to avoid duplicates. Note that \"inserts_only\" is a ClickHouse adapter\n -- specific configurable that is used to avoid creating an expensive intermediate table.\n {% call statement('main') %}\n {{ clickhouse__insert_into(target_relation, sql) }}\n {% endcall %}\n\n {% else %}\n {% set column_changes = none %}\n {% set incremental_strategy = adapter.calculate_incremental_strategy(config.get('incremental_strategy')) %}\n {% set incremental_predicates = config.get('predicates', none) or config.get('incremental_predicates', none) %}\n {%- if on_schema_change != 'ignore' %}\n {%- set column_changes = adapter.check_incremental_schema_changes(on_schema_change, existing_relation, sql) -%}\n {%- if column_changes %}\n {%- if incremental_strategy in ('append', 'delete_insert') %}\n {% set incremental_strategy = 'legacy' %}\n {{ log('Schema changes detected, switching to legacy incremental strategy') }}\n {%- endif %}\n {% endif %}\n {% endif %}\n {% if incremental_strategy != 'delete_insert' and incremental_predicates %}\n {% do exceptions.raise_compiler_error('Cannot apply incremental predicates with ' + incremental_strategy + ' strategy.') %}\n {% endif %}\n {% if incremental_strategy == 'legacy' %}\n {% do clickhouse__incremental_legacy(existing_relation, intermediate_relation, column_changes, unique_key) %}\n {% set need_swap = true %}\n {% elif incremental_strategy == 'delete_insert' %}\n {% do clickhouse__incremental_delete_insert(existing_relation, unique_key, incremental_predicates) %}\n {% elif incremental_strategy == 'append' %}\n {% call statement('main') %}\n {{ clickhouse__insert_into(target_relation, sql) }}\n {% endcall %}\n {% endif %}\n {% endif %}\n\n {% if need_swap %}\n {% if existing_relation.can_exchange %}\n {% do adapter.rename_relation(intermediate_relation, backup_relation) %}\n {% do exchange_tables_atomic(backup_relation, target_relation) %}\n {% else %}\n {% do adapter.rename_relation(target_relation, backup_relation) %}\n {% do adapter.rename_relation(intermediate_relation, target_relation) %}\n {% endif %}\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 {% 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.should_full_refresh", "macro.dbt.incremental_validate_on_schema_change", "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_clickhouse.clickhouse__insert_into", "macro.dbt_clickhouse.clickhouse__incremental_legacy", "macro.dbt_clickhouse.clickhouse__incremental_delete_insert", "macro.dbt_clickhouse.exchange_tables_atomic", "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": 1723756270.690187, "supported_languages": ["sql"]}, "macro.dbt_clickhouse.clickhouse__incremental_legacy": {"name": "clickhouse__incremental_legacy", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/materializations/incremental/incremental.sql", "original_file_path": "macros/materializations/incremental/incremental.sql", "unique_id": "macro.dbt_clickhouse.clickhouse__incremental_legacy", "macro_sql": "{% macro clickhouse__incremental_legacy(existing_relation, intermediate_relation, column_changes, unique_key, is_distributed=False) %}\n {% set new_data_relation = existing_relation.incorporate(path={\"identifier\": existing_relation.identifier + '__dbt_new_data'}) %}\n {{ drop_relation_if_exists(new_data_relation) }}\n\n {%- set inserted_relation = intermediate_relation -%}\n {%- set inserting_relation = new_data_relation -%}\n\n -- First create a temporary table for all of the new data\n {% if is_distributed %}\n {% if column_changes %}\n {% do exceptions.raise_compiler_error('Schema changes not supported with Distributed tables ') %}\n {% endif %}\n -- Need to use distributed table to have data on all shards\n {%- set distributed_new_data_relation = existing_relation.incorporate(path={\"identifier\": existing_relation.identifier + '__dbt_distributed_new_data'}) -%}\n {%- set inserting_relation = distributed_new_data_relation -%}\n {{ create_distributed_local_table(distributed_new_data_relation, new_data_relation, existing_relation, sql) }}\n {% elif column_changes %}\n {% call statement('create_new_data_temp') %}\n {{ get_create_table_as_sql(False, new_data_relation, sql) }}\n {% endcall %}\n {% else %}\n {% call statement('create_new_data_temp') %}\n {{ get_create_table_as_sql(False, new_data_relation, sql) }}\n {% endcall %}\n {% endif %}\n\n -- Next create another temporary table that will eventually be used to replace the existing table. We can't\n -- use the table just created in the previous step because we don't want to override any updated rows with\n -- old rows when we insert the old data\n {% if is_distributed %}\n {%- set distributed_intermediate_relation = make_intermediate_relation(existing_relation) -%}\n {%- set inserted_relation = distributed_intermediate_relation -%}\n {{ create_distributed_local_table(distributed_intermediate_relation, intermediate_relation, existing_relation) }}\n {% else %}\n {% call statement('main') %}\n create table {{ intermediate_relation }} {{ on_cluster_clause(existing_relation) }} as {{ new_data_relation }}\n {% endcall %}\n {% endif %}\n\n -- Insert all the existing rows into the new temporary table, ignoring any rows that have keys in the \"new data\"\n -- table.\n {%- set source_columns = adapter.get_columns_in_relation(existing_relation) -%}\n {%- set source_columns_csv = source_columns | map(attribute='quoted') | join(', ') -%}\n {% call statement('insert_existing_data') %}\n insert into {{ inserted_relation }} ({{ source_columns_csv }})\n select {{ source_columns_csv }}\n from {{ existing_relation }}\n where ({{ unique_key }}) not in (\n select {{ unique_key }}\n from {{ inserting_relation }}\n )\n {{ adapter.get_model_query_settings(model) }}\n {% endcall %}\n\n -- Insert all of the new data into the temporary table\n {% if column_changes %}\n {%- set dest_columns = adapter.get_columns_in_relation(new_data_relation) -%}\n {%- set dest_columns_csv = dest_columns | map(attribute='quoted') | join(', ') -%}\n {% else %}\n {%- set dest_columns_csv = source_columns_csv %}\n {% endif %}\n {% call statement('insert_new_data') %}\n insert into {{ inserted_relation }} ({{ dest_columns_csv }})\n select {{ dest_columns_csv }}\n from {{ inserting_relation }}\n {{ adapter.get_model_query_settings(model) }}\n {% endcall %}\n\n {% do adapter.drop_relation(new_data_relation) %}\n {% if is_distributed %}\n {{ drop_relation_if_exists(distributed_new_data_relation) }}\n {{ drop_relation_if_exists(distributed_intermediate_relation) }}\n {% endif %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.drop_relation_if_exists", "macro.dbt_clickhouse.create_distributed_local_table", "macro.dbt.statement", "macro.dbt.get_create_table_as_sql", "macro.dbt.make_intermediate_relation", "macro.dbt_clickhouse.on_cluster_clause"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.6939714, "supported_languages": null}, "macro.dbt_clickhouse.clickhouse__incremental_delete_insert": {"name": "clickhouse__incremental_delete_insert", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/materializations/incremental/incremental.sql", "original_file_path": "macros/materializations/incremental/incremental.sql", "unique_id": "macro.dbt_clickhouse.clickhouse__incremental_delete_insert", "macro_sql": "{% macro clickhouse__incremental_delete_insert(existing_relation, unique_key, incremental_predicates, is_distributed=False) %}\n {% set new_data_relation = existing_relation.incorporate(path={\"identifier\": existing_relation.identifier\n + '__dbt_new_data_' + invocation_id.replace('-', '_')}) %}\n {{ drop_relation_if_exists(new_data_relation) }}\n {%- set distributed_new_data_relation = existing_relation.incorporate(path={\"identifier\": existing_relation.identifier + '__dbt_distributed_new_data'}) -%}\n\n {%- set inserting_relation = new_data_relation -%}\n\n {%- set local_suffix = adapter.get_clickhouse_local_suffix() -%}\n {%- set local_db_prefix = adapter.get_clickhouse_local_db_prefix() -%}\n\n {% if is_distributed %}\n -- Need to use distributed table to have data on all shards\n {%- set inserting_relation = distributed_new_data_relation -%}\n {{ create_distributed_local_table(distributed_new_data_relation, new_data_relation, existing_relation, sql) }}\n {% else %}\n {% call statement('main') %}\n {{ get_create_table_as_sql(False, new_data_relation, sql) }}\n {% endcall %}\n {% endif %}\n\n {% call statement('delete_existing_data') %}\n {% if is_distributed %}\n {% set existing_local = existing_relation.incorporate(path={\"identifier\": this.identifier + local_suffix, \"schema\": local_db_prefix + this.schema}) if existing_relation is not none else none %}\n delete from {{ existing_local }} {{ on_cluster_clause(existing_relation) }} where ({{ unique_key }}) in (select {{ unique_key }}\n from {{ inserting_relation }})\n {% else %}\n delete from {{ existing_relation }} where ({{ unique_key }}) in (select {{ unique_key }}\n from {{ inserting_relation }})\n {% endif %}\n {%- if incremental_predicates %}\n {% for predicate in incremental_predicates %}\n and {{ predicate }}\n {% endfor %}\n {%- endif -%}\n {{ adapter.get_model_query_settings(model) }}\n {% endcall %}\n\n {%- set dest_columns = adapter.get_columns_in_relation(existing_relation) -%}\n {%- set dest_cols_csv = dest_columns | map(attribute='quoted') | join(', ') -%}\n {% call statement('insert_new_data') %}\n insert into {{ existing_relation }} select {{ dest_cols_csv }} from {{ inserting_relation }} {{ adapter.get_model_query_settings(model) }}\n {% endcall %}\n {% do adapter.drop_relation(new_data_relation) %}\n {{ drop_relation_if_exists(distributed_new_data_relation) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.replace", "macro.dbt.drop_relation_if_exists", "macro.dbt_clickhouse.create_distributed_local_table", "macro.dbt.statement", "macro.dbt.get_create_table_as_sql", "macro.dbt_clickhouse.on_cluster_clause"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.6969464, "supported_languages": null}, "macro.dbt_clickhouse.is_incremental": {"name": "is_incremental", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/materializations/incremental/is_incremental.sql", "original_file_path": "macros/materializations/incremental/is_incremental.sql", "unique_id": "macro.dbt_clickhouse.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' or model.config.materialized == 'distributed_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": 1723756270.6979597, "supported_languages": null}, "macro.dbt_clickhouse.materialization_distributed_incremental_clickhouse": {"name": "materialization_distributed_incremental_clickhouse", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/materializations/incremental/distributed_incremental.sql", "original_file_path": "macros/materializations/incremental/distributed_incremental.sql", "unique_id": "macro.dbt_clickhouse.materialization_distributed_incremental_clickhouse", "macro_sql": "{% materialization distributed_incremental, adapter='clickhouse' %}\n {% set insert_distributed_sync = run_query(\"SELECT value FROM system.settings WHERE name = 'insert_distributed_sync'\")[0][0] %}\n {% if insert_distributed_sync != '1' %}\n {% do exceptions.raise_compiler_error('To use distributed materialization setting insert_distributed_sync should be set to 1') %}\n {% endif %}\n\n {%- set local_suffix = adapter.get_clickhouse_local_suffix() -%}\n {%- set local_db_prefix = adapter.get_clickhouse_local_db_prefix() -%}\n\n {%- set existing_relation = load_cached_relation(this) -%}\n {%- set target_relation = this.incorporate(type='table') -%}\n\n {% set on_cluster = on_cluster_clause(target_relation) %}\n {% if on_cluster.strip() == '' %}\n {% do exceptions.raise_compiler_error('To use distributed materializations cluster setting in dbt profile must be set') %}\n {% endif %}\n\n {% set existing_relation_local = existing_relation.incorporate(path={\"identifier\": this.identifier + local_suffix, \"schema\": local_db_prefix + this.schema}) if existing_relation is not none else none %}\n {% set target_relation_local = target_relation.incorporate(path={\"identifier\": this.identifier + local_suffix, \"schema\": local_db_prefix + this.schema}) if target_relation is not none else none %}\n\n {%- set unique_key = config.get('unique_key') -%}\n {% if unique_key is not none and unique_key|length == 0 %}\n {% set unique_key = none %}\n {% endif %}\n {% if unique_key is iterable and (unique_key is not string and unique_key is not mapping) %}\n {% set unique_key = unique_key|join(', ') %}\n {% endif %}\n {%- set inserts_only = config.get('inserts_only') -%}\n {%- set grant_config = config.get('grants') -%}\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\n {{ create_schema(target_relation_local) }}\n {%- set intermediate_relation = make_intermediate_relation(target_relation_local)-%}\n {%- set distributed_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_local, backup_relation_type) -%}\n {%- set distributed_backup_relation = make_backup_relation(target_relation, backup_relation_type) -%}\n {%- set preexisting_intermediate_relation = load_cached_relation(intermediate_relation)-%}\n {%- set preexisting_backup_relation = load_cached_relation(backup_relation) -%}\n {%- set view_relation = default__make_temp_relation(target_relation, '__dbt_view_tmp') -%}\n\n {{ drop_relation_if_exists(preexisting_intermediate_relation) }}\n {{ drop_relation_if_exists(preexisting_backup_relation) }}\n {{ drop_relation_if_exists(view_relation) }}\n {{ drop_relation_if_exists(distributed_intermediate_relation) }}\n\n {{ run_hooks(pre_hooks, inside_transaction=False) }}\n {{ run_hooks(pre_hooks, inside_transaction=True) }}\n {% set to_drop = [] %}\n {% set schema_changes = none %}\n\n {% call statement('main') %}\n {{ create_view_as(view_relation, sql) }}\n {% endcall %}\n\n {% if existing_relation is none %}\n -- No existing table, simply create a new one\n {{ create_distributed_local_table(target_relation, target_relation_local, view_relation, sql) }}\n\n {% elif full_refresh_mode %}\n -- Completely replacing the old table, so create a temporary table and then swap it\n {{ create_distributed_local_table(distributed_intermediate_relation, intermediate_relation, view_relation, sql) }}\n {% do adapter.drop_relation(distributed_intermediate_relation) or '' %}\n {% set need_swap = true %}\n\n {% elif inserts_only or unique_key is none -%}\n -- There are no updates/deletes or duplicate keys are allowed. Simply add all of the new rows to the existing\n -- table. It is the user's responsibility to avoid duplicates. Note that \"inserts_only\" is a ClickHouse adapter\n -- specific configurable that is used to avoid creating an expensive intermediate table.\n {% call statement('main') %}\n {{ clickhouse__insert_into(target_relation, sql) }}\n {% endcall %}\n\n {% else %}\n {% set incremental_strategy = adapter.calculate_incremental_strategy(config.get('incremental_strategy')) %}\n {% set incremental_predicates = config.get('predicates', none) or config.get('incremental_predicates', none) %}\n {% if on_schema_change != 'ignore' %}\n {%- set schema_changes = check_for_schema_changes(existing_relation, target_relation) -%}\n {% if schema_changes['schema_changed'] and incremental_strategy in ('append', 'delete_insert') %}\n {% set incremental_strategy = 'legacy' %}\n {% do log('Schema changes detected, switching to legacy incremental strategy') %}\n {% endif %}\n {% endif %}\n {% if incremental_strategy != 'delete_insert' and incremental_predicates %}\n {% do exceptions.raise_compiler_error('Cannot apply incremental predicates with ' + incremental_strategy + ' strategy.') %}\n {% endif %}\n {% if incremental_strategy == 'legacy' %}\n {% do clickhouse__incremental_legacy(existing_relation, intermediate_relation, schema_changes, unique_key, True) %}\n {% set need_swap = true %}\n {% elif incremental_strategy == 'delete_insert' %}\n {% do clickhouse__incremental_delete_insert(existing_relation, unique_key, incremental_predicates, True) %}\n {% elif incremental_strategy == 'append' %}\n {% call statement('main') %}\n {{ clickhouse__insert_into(target_relation, sql) }}\n {% endcall %}\n {% endif %}\n {% endif %}\n\n {% if need_swap %}\n {% if False %}\n {% do adapter.rename_relation(intermediate_relation, backup_relation) %}\n {% do exchange_tables_atomic(backup_relation, target_relation_local) %}\n {% else %}\n {% do adapter.rename_relation(target_relation_local, backup_relation) %}\n {% do adapter.rename_relation(intermediate_relation, target_relation_local) %}\n {% endif %}\n\n -- Structure could have changed, need to update distributed table from replaced local table\n {% set target_relation_new = target_relation.incorporate(path={\"identifier\": target_relation.identifier + '_temp'}) %}\n {{ drop_relation_if_exists(target_relation_new) }}\n {% do run_query(create_distributed_table(target_relation_new, target_relation_local)) %}\n\n {% if False %}\n {% do adapter.rename_relation(target_relation_new, distributed_backup_relation) %}\n {% do exchange_tables_atomic(distributed_backup_relation, target_relation) %}\n {% else %}\n {% do adapter.rename_relation(target_relation, distributed_backup_relation) %}\n {% do adapter.rename_relation(target_relation_new, target_relation) %}\n {% endif %}\n\n {% do to_drop.append(backup_relation) %}\n {% do to_drop.append(distributed_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 {% do apply_grants(target_relation_local, 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 {% 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.run_query", "macro.dbt.load_cached_relation", "macro.dbt_clickhouse.on_cluster_clause", "macro.dbt.should_full_refresh", "macro.dbt.incremental_validate_on_schema_change", "macro.dbt.create_schema", "macro.dbt.make_intermediate_relation", "macro.dbt.make_backup_relation", "macro.dbt.default__make_temp_relation", "macro.dbt.drop_relation_if_exists", "macro.dbt.run_hooks", "macro.dbt.statement", "macro.dbt.create_view_as", "macro.dbt_clickhouse.create_distributed_local_table", "macro.dbt_clickhouse.clickhouse__insert_into", "macro.dbt.check_for_schema_changes", "macro.dbt_clickhouse.clickhouse__incremental_legacy", "macro.dbt_clickhouse.clickhouse__incremental_delete_insert", "macro.dbt_clickhouse.exchange_tables_atomic", "macro.dbt_clickhouse.create_distributed_table", "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": 1723756270.7202861, "supported_languages": ["sql"]}, "macro.dbt_clickhouse.clickhouse__test_relationships": {"name": "clickhouse__test_relationships", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/schema_tests/relationships.sql", "original_file_path": "macros/schema_tests/relationships.sql", "unique_id": "macro.dbt_clickhouse.clickhouse__test_relationships", "macro_sql": "{% macro clickhouse__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-- end_of_sql\nsettings join_use_nulls = 1\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.7209053, "supported_languages": null}, "macro.dbt_clickhouse.clickhouse__get_show_grant_sql": {"name": "clickhouse__get_show_grant_sql", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt_clickhouse.clickhouse__get_show_grant_sql", "macro_sql": "{% macro clickhouse__get_show_grant_sql(relation) %}\n SELECT access_type as privilege_type, COALESCE(user_name, role_name) as grantee from system.grants where table = '{{ relation.name }}'\n AND database = '{{ relation.schema }}'\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.7215965, "supported_languages": null}, "macro.dbt_clickhouse.clickhouse__call_dcl_statements": {"name": "clickhouse__call_dcl_statements", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt_clickhouse.clickhouse__call_dcl_statements", "macro_sql": "{% macro clickhouse__call_dcl_statements(dcl_statement_list) %}\n {% for dcl_statement in dcl_statement_list %}\n {% call statement('dcl') %}\n {{ dcl_statement }};\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": 1723756270.721951, "supported_languages": null}, "macro.dbt_clickhouse.clickhouse__get_grant_sql": {"name": "clickhouse__get_grant_sql", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt_clickhouse.clickhouse__get_grant_sql", "macro_sql": "\n\n\n{%- macro clickhouse__get_grant_sql(relation, privilege, grantees) -%}\n grant {{ on_cluster_clause(relation)}} {{ privilege }} on {{ relation }} to {{ grantees | join(', ') }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt_clickhouse.on_cluster_clause"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.7222862, "supported_languages": null}, "macro.dbt_clickhouse.clickhouse__get_revoke_sql": {"name": "clickhouse__get_revoke_sql", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/adapters/apply_grants.sql", "original_file_path": "macros/adapters/apply_grants.sql", "unique_id": "macro.dbt_clickhouse.clickhouse__get_revoke_sql", "macro_sql": "{%- macro clickhouse__get_revoke_sql(relation, privilege, grantees) -%}\n revoke {{ on_cluster_clause(relation)}} {{ privilege }} on {{ relation }} from {{ grantees | join(', ') }}\n{%- endmacro -%}", "depends_on": {"macros": ["macro.dbt_clickhouse.on_cluster_clause"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.72265, "supported_languages": null}, "macro.dbt_clickhouse.clickhouse__get_or_create_relation": {"name": "clickhouse__get_or_create_relation", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "unique_id": "macro.dbt_clickhouse.clickhouse__get_or_create_relation", "macro_sql": "{% macro clickhouse__get_or_create_relation(database, schema, identifier, type) %}\n {%- set target_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) %}\n {% if target_relation %}\n {% do return([true, target_relation]) %}\n {% endif %}\n\n {%- set can_exchange = adapter.can_exchange(schema, type) %}\n {%- set should_on_cluster = adapter.should_on_cluster(config.get('materialized'), engine_clause()) %}\n {%- set new_relation = api.Relation.create(\n database=None,\n schema=schema,\n identifier=identifier,\n type=type,\n can_exchange=can_exchange,\n can_on_cluster=should_on_cluster\n ) -%}\n {% do return([false, new_relation]) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_clickhouse.engine_clause"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.7241726, "supported_languages": null}, "macro.dbt_clickhouse.clickhouse__get_database": {"name": "clickhouse__get_database", "resource_type": "macro", "package_name": "dbt_clickhouse", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "unique_id": "macro.dbt_clickhouse.clickhouse__get_database", "macro_sql": "{% macro clickhouse__get_database(database) %}\n {% call statement('get_database', fetch_result=True) %}\n select name, engine, comment\n from system.databases\n where name = '{{ database }}'\n {% endcall %}\n {% do return(load_result('get_database').table) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.7245822, "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": 1723756270.7249684, "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": 1723756270.7254214, "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": 1723756270.7259123, "supported_languages": null}, "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": 1723756270.7267213, "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": 1723756270.727825, "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": 1723756270.7295609, "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": 1723756270.7301, "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": 1723756270.730489, "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": 1723756270.7314715, "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": 1723756270.7320912, "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_clickhouse.clickhouse__rename_relation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.7323833, "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.render() }} 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": 1723756270.7328558, "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": 1723756270.7335434, "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": 1723756270.734211, "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": 1723756270.7346911, "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": 1723756270.7349908, "supported_languages": null}, "macro.dbt.drop_schema_named": {"name": "drop_schema_named", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/schema.sql", "original_file_path": "macros/relations/schema.sql", "unique_id": "macro.dbt.drop_schema_named", "macro_sql": "{% macro drop_schema_named(schema_name) %}\n {{ return(adapter.dispatch('drop_schema_named', 'dbt') (schema_name)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__drop_schema_named"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.735419, "supported_languages": null}, "macro.dbt.default__drop_schema_named": {"name": "default__drop_schema_named", "resource_type": "macro", "package_name": "dbt", "path": "macros/relations/schema.sql", "original_file_path": "macros/relations/schema.sql", "unique_id": "macro.dbt.default__drop_schema_named", "macro_sql": "{% macro default__drop_schema_named(schema_name) %}\n {% set schema_relation = api.Relation.create(schema=schema_name) %}\n {{ adapter.drop_schema(schema_relation) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.735865, "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": 1723756270.736401, "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": 1723756270.7367702, "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": 1723756270.7378147, "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.render() }} 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": 1723756270.738389, "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_clickhouse.clickhouse__drop_relation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.7386575, "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": 1723756270.7389524, "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": 1723756270.7392373, "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": 1723756270.7396922, "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": 1723756270.740018, "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.default__get_replace_table_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.740407, "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": 1723756270.7406244, "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.default__get_rename_table_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.7410302, "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": 1723756270.7412508, "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": 1723756270.742449, "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": 1723756270.7427533, "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_clickhouse.clickhouse__create_table_as"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.7433825, "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": 1723756270.7444031, "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": 1723756270.745116, "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": 1723756270.7454147, "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": 1723756270.7457027, "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 {{- adapter.dispatch('drop_table', 'dbt')(relation) -}}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__drop_table"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.7460663, "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.render() }} cascade\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.7462528, "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.default__get_replace_view_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.7474582, "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": 1723756270.7476797, "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": 1723756270.7493968, "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": 1723756270.7496846, "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.render() ~ \" 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": 1723756270.7500587, "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.default__get_rename_view_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.7504525, "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": 1723756270.750671, "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": 1723756270.751255, "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": 1723756270.7514877, "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_clickhouse.clickhouse__create_view_as"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.7517493, "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.render() }}\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": 1723756270.752377, "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 {{- adapter.dispatch('drop_view', 'dbt')(relation) -}}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__drop_view"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.7527516, "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.render() }} cascade\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.7529762, "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": 1723756270.7543874, "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": 1723756270.7545693, "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": 1723756270.755337, "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_clickhouse.clickhouse__get_assert_columns_equivalent"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.755615, "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": 1723756270.7558217, "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": 1723756270.7576776, "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.codegen.format_column", "macro.dbt.default__format_column"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.7582328, "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": 1723756270.758719, "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": 1723756270.759122, "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": 1723756270.7593398, "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.default__get_rename_materialized_view_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.7597299, "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": 1723756270.7599514, "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_clickhouse.clickhouse__get_create_materialized_view_as_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.7603793, "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": 1723756270.7606034, "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.default__refresh_materialized_view"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.7610657, "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": 1723756270.7612746, "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.default__get_alter_materialized_view_as_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.7622476, "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": 1723756270.7625272, "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.default__get_materialized_view_configuration_changes"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.762989, "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": 1723756270.7632213, "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 {{- adapter.dispatch('drop_materialized_view', 'dbt')(relation) -}}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__drop_materialized_view"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.7635813, "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.render() }} cascade\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.7637663, "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_clickhouse.clickhouse__replace"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.7642539, "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": 1723756270.7645006, "supported_languages": null}, "macro.dbt.cast": {"name": "cast", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/cast.sql", "original_file_path": "macros/utils/cast.sql", "unique_id": "macro.dbt.cast", "macro_sql": "{% macro cast(field, type) %}\n {{ return(adapter.dispatch('cast', 'dbt') (field, type)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__cast"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.7649083, "supported_languages": null}, "macro.dbt.default__cast": {"name": "default__cast", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/cast.sql", "original_file_path": "macros/utils/cast.sql", "unique_id": "macro.dbt.default__cast", "macro_sql": "{% macro default__cast(field, type) %}\n cast({{field}} as {{type}})\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.765104, "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_clickhouse.clickhouse__array_concat"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.7654939, "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": 1723756270.7657096, "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.default__dateadd"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.7661889, "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": 1723756270.7664394, "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": 1723756270.766845, "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": 1723756270.7670555, "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_clickhouse.clickhouse__last_day"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.7675354, "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": 1723756270.767915, "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": 1723756270.7681353, "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": 1723756270.7685363, "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": 1723756270.7687328, "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": 1723756270.7690873, "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": 1723756270.7692096, "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": 1723756270.769568, "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": 1723756270.769735, "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_clickhouse.clickhouse__any_value"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.7701225, "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": 1723756270.7702847, "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": 1723756270.770775, "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": 1723756270.7711074, "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": 1723756270.7722595, "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": 1723756270.772918, "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": 1723756270.7732158, "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": 1723756270.7740023, "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": 1723756270.7744408, "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": 1723756270.7746468, "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": 1723756270.7749949, "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": 1723756270.7751532, "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_clickhouse.clickhouse__split_part"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.7759054, "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": 1723756270.7761533, "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": 1723756270.7764852, "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_clickhouse.clickhouse__array_append"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.7769103, "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": 1723756270.7771153, "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_clickhouse.clickhouse__bool_or"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.7774668, "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": 1723756270.7776244, "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": 1723756270.7780075, "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": 1723756270.7782154, "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": 1723756270.7785614, "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": 1723756270.7787573, "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": 1723756270.7790756, "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": 1723756270.7791958, "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_clickhouse.clickhouse__listagg"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.780059, "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": 1723756270.7807052, "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.default__datediff"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.7811983, "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": 1723756270.7814436, "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_clickhouse.clickhouse__array_construct"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.7819636, "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": 1723756270.7824373, "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": 1723756270.783473, "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": 1723756270.784368, "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": 1723756270.7847009, "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": 1723756270.785241, "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_clickhouse.clickhouse__hash"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.7856574, "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": 1723756270.7860653, "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": 1723756270.7878597, "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": 1723756270.7881033, "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": 1723756270.7883558, "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": 1723756270.788586, "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": 1723756270.7888274, "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": 1723756270.7890763, "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": 1723756270.7893186, "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": 1723756270.7895823, "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": 1723756270.789823, "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": 1723756270.790053, "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": 1723756270.7903235, "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": 1723756270.7905529, "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": 1723756270.7907999, "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": 1723756270.791021, "supported_languages": null}, "macro.dbt.date": {"name": "date", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/date.sql", "original_file_path": "macros/utils/date.sql", "unique_id": "macro.dbt.date", "macro_sql": "{% macro date(year, month, day) %}\n {{ return(adapter.dispatch('date', 'dbt') (year, month, day)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__date"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.7915192, "supported_languages": null}, "macro.dbt.default__date": {"name": "default__date", "resource_type": "macro", "package_name": "dbt", "path": "macros/utils/date.sql", "original_file_path": "macros/utils/date.sql", "unique_id": "macro.dbt.default__date", "macro_sql": "{% macro default__date(year, month, day) -%}\n {%- set dt = modules.datetime.date(year, month, day) -%}\n {%- set iso_8601_formatted_date = dt.strftime('%Y-%m-%d') -%}\n to_date('{{ iso_8601_formatted_date }}', 'YYYY-MM-DD')\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.7919488, "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_clickhouse.clickhouse__cast_bool_to_text"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.7923129, "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": 1723756270.7925584, "supported_languages": null}, "macro.dbt.get_fixture_sql": {"name": "get_fixture_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/unit_test_sql/get_fixture_sql.sql", "original_file_path": "macros/unit_test_sql/get_fixture_sql.sql", "unique_id": "macro.dbt.get_fixture_sql", "macro_sql": "{% macro get_fixture_sql(rows, column_name_to_data_types) %}\n-- Fixture for {{ model.name }}\n{% set default_row = {} %}\n\n{%- if not column_name_to_data_types -%}\n{#-- Use defer_relation IFF it is available in the manifest and 'this' is missing from the database --#}\n{%- set this_or_defer_relation = defer_relation if (defer_relation and not load_relation(this)) else this -%}\n{%- set columns_in_relation = adapter.get_columns_in_relation(this_or_defer_relation) -%}\n\n{%- set column_name_to_data_types = {} -%}\n{%- for column in columns_in_relation -%}\n{#-- This needs to be a case-insensitive comparison --#}\n{%- do column_name_to_data_types.update({column.name|lower: column.data_type}) -%}\n{%- endfor -%}\n{%- endif -%}\n\n{%- if not column_name_to_data_types -%}\n {{ exceptions.raise_compiler_error(\"Not able to get columns for unit test '\" ~ model.name ~ \"' from relation \" ~ this ~ \" because the relation doesn't exist\") }}\n{%- endif -%}\n\n{%- for column_name, column_type in column_name_to_data_types.items() -%}\n {%- do default_row.update({column_name: (safe_cast(\"null\", column_type) | trim )}) -%}\n{%- endfor -%}\n\n{{ validate_fixture_rows(rows, row_number) }}\n\n{%- for row in rows -%}\n{%- set formatted_row = format_row(row, column_name_to_data_types) -%}\n{%- set default_row_copy = default_row.copy() -%}\n{%- do default_row_copy.update(formatted_row) -%}\nselect\n{%- for column_name, column_value in default_row_copy.items() %} {{ column_value }} as {{ column_name }}{% if not loop.last -%}, {%- endif %}\n{%- endfor %}\n{%- if not loop.last %}\nunion all\n{% endif %}\n{%- endfor -%}\n\n{%- if (rows | length) == 0 -%}\n select\n {%- for column_name, column_value in default_row.items() %} {{ column_value }} as {{ column_name }}{% if not loop.last -%},{%- endif %}\n {%- endfor %}\n limit 0\n{%- endif -%}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.load_relation", "macro.dbt.safe_cast", "macro.dbt.validate_fixture_rows", "macro.dbt.format_row"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.7977283, "supported_languages": null}, "macro.dbt.get_expected_sql": {"name": "get_expected_sql", "resource_type": "macro", "package_name": "dbt", "path": "macros/unit_test_sql/get_fixture_sql.sql", "original_file_path": "macros/unit_test_sql/get_fixture_sql.sql", "unique_id": "macro.dbt.get_expected_sql", "macro_sql": "{% macro get_expected_sql(rows, column_name_to_data_types) %}\n\n{%- if (rows | length) == 0 -%}\n select * from dbt_internal_unit_test_actual\n limit 0\n{%- else -%}\n{%- for row in rows -%}\n{%- set formatted_row = format_row(row, column_name_to_data_types) -%}\nselect\n{%- for column_name, column_value in formatted_row.items() %} {{ column_value }} as {{ column_name }}{% if not loop.last -%}, {%- endif %}\n{%- endfor %}\n{%- if not loop.last %}\nunion all\n{% endif %}\n{%- endfor -%}\n{%- endif -%}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.format_row"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.798574, "supported_languages": null}, "macro.dbt.format_row": {"name": "format_row", "resource_type": "macro", "package_name": "dbt", "path": "macros/unit_test_sql/get_fixture_sql.sql", "original_file_path": "macros/unit_test_sql/get_fixture_sql.sql", "unique_id": "macro.dbt.format_row", "macro_sql": "\n\n{%- macro format_row(row, column_name_to_data_types) -%}\n {#-- generate case-insensitive formatted row --#}\n {% set formatted_row = {} %}\n {%- for column_name, column_value in row.items() -%}\n {% set column_name = column_name|lower %}\n\n {%- if column_name not in column_name_to_data_types %}\n {#-- if user-provided row contains column name that relation does not contain, raise an error --#}\n {% set fixture_name = \"expected output\" if model.resource_type == 'unit_test' else (\"'\" ~ model.name ~ \"'\") %}\n {{ exceptions.raise_compiler_error(\n \"Invalid column name: '\" ~ column_name ~ \"' in unit test fixture for \" ~ fixture_name ~ \".\"\n \"\\nAccepted columns for \" ~ fixture_name ~ \" are: \" ~ (column_name_to_data_types.keys()|list)\n ) }}\n {%- endif -%}\n\n {%- set column_type = column_name_to_data_types[column_name] %}\n\n {#-- sanitize column_value: wrap yaml strings in quotes, apply cast --#}\n {%- set column_value_clean = column_value -%}\n {%- if column_value is string -%}\n {%- set column_value_clean = dbt.string_literal(dbt.escape_single_quotes(column_value)) -%}\n {%- elif column_value is none -%}\n {%- set column_value_clean = 'null' -%}\n {%- endif -%}\n\n {%- set row_update = {column_name: safe_cast(column_value_clean, column_type) } -%}\n {%- do formatted_row.update(row_update) -%}\n {%- endfor -%}\n {{ return(formatted_row) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt.string_literal", "macro.dbt.escape_single_quotes", "macro.dbt.safe_cast"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.8002055, "supported_languages": null}, "macro.dbt.validate_fixture_rows": {"name": "validate_fixture_rows", "resource_type": "macro", "package_name": "dbt", "path": "macros/unit_test_sql/get_fixture_sql.sql", "original_file_path": "macros/unit_test_sql/get_fixture_sql.sql", "unique_id": "macro.dbt.validate_fixture_rows", "macro_sql": "{%- macro validate_fixture_rows(rows, row_number) -%}\n {{ return(adapter.dispatch('validate_fixture_rows', 'dbt')(rows, row_number)) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt.default__validate_fixture_rows"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.8005402, "supported_languages": null}, "macro.dbt.default__validate_fixture_rows": {"name": "default__validate_fixture_rows", "resource_type": "macro", "package_name": "dbt", "path": "macros/unit_test_sql/get_fixture_sql.sql", "original_file_path": "macros/unit_test_sql/get_fixture_sql.sql", "unique_id": "macro.dbt.default__validate_fixture_rows", "macro_sql": "{%- macro default__validate_fixture_rows(rows, row_number) -%}\n {# This is an abstract method for adapter overrides as needed #}\n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.8006897, "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": 1723756270.8014722, "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": 1723756270.8018818, "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": 1723756270.80231, "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": 1723756270.8029008, "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": 1723756270.8034942, "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_clickhouse.clickhouse__generate_database_name"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.8040514, "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": 1723756270.8044577, "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": 1723756270.8050158, "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": 1723756270.8054612, "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": 1723756270.805924, "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": 1723756270.8076189, "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": 1723756270.807997, "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": 1723756270.8082716, "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": 1723756270.8085587, "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": 1723756270.8088646, "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": 1723756270.8095233, "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": 1723756270.810206, "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": 1723756270.814789, "supported_languages": ["sql"]}, "macro.dbt.materialization_unit_default": {"name": "materialization_unit_default", "resource_type": "macro", "package_name": "dbt", "path": "macros/materializations/tests/unit.sql", "original_file_path": "macros/materializations/tests/unit.sql", "unique_id": "macro.dbt.materialization_unit_default", "macro_sql": "{%- materialization unit, default -%}\n\n {% set relations = [] %}\n\n {% set expected_rows = config.get('expected_rows') %}\n {% set expected_sql = config.get('expected_sql') %}\n {% set tested_expected_column_names = expected_rows[0].keys() if (expected_rows | length ) > 0 else get_columns_in_query(sql) %} %}\n\n {%- set target_relation = this.incorporate(type='table') -%}\n {%- set temp_relation = make_temp_relation(target_relation)-%}\n {% do run_query(get_create_table_as_sql(True, temp_relation, get_empty_subquery_sql(sql))) %}\n {%- set columns_in_relation = adapter.get_columns_in_relation(temp_relation) -%}\n {%- set column_name_to_data_types = {} -%}\n {%- for column in columns_in_relation -%}\n {%- do column_name_to_data_types.update({column.name|lower: column.data_type}) -%}\n {%- endfor -%}\n\n {% if not expected_sql %}\n {% set expected_sql = get_expected_sql(expected_rows, column_name_to_data_types) %}\n {% endif %}\n {% set unit_test_sql = get_unit_test_sql(sql, expected_sql, tested_expected_column_names) %}\n\n {% call statement('main', fetch_result=True) -%}\n\n {{ unit_test_sql }}\n\n {%- endcall %}\n\n {% do adapter.drop_relation(temp_relation) %}\n\n {{ return({'relations': relations}) }}\n\n{%- endmaterialization -%}", "depends_on": {"macros": ["macro.dbt.get_columns_in_query", "macro.dbt.make_temp_relation", "macro.dbt.run_query", "macro.dbt.get_create_table_as_sql", "macro.dbt.get_empty_subquery_sql", "macro.dbt.get_expected_sql", "macro.dbt.get_unit_test_sql", "macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.8176148, "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_clickhouse.clickhouse__get_test_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.8192055, "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": 1723756270.8196507, "supported_languages": null}, "macro.dbt.get_unit_test_sql": {"name": "get_unit_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_unit_test_sql", "macro_sql": "{% macro get_unit_test_sql(main_sql, expected_fixture_sql, expected_column_names) -%}\n {{ adapter.dispatch('get_unit_test_sql', 'dbt')(main_sql, expected_fixture_sql, expected_column_names) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_unit_test_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.819947, "supported_languages": null}, "macro.dbt.default__get_unit_test_sql": {"name": "default__get_unit_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_unit_test_sql", "macro_sql": "{% macro default__get_unit_test_sql(main_sql, expected_fixture_sql, expected_column_names) -%}\n-- Build actual result given inputs\nwith dbt_internal_unit_test_actual as (\n select\n {% for expected_column_name in expected_column_names %}{{expected_column_name}}{% if not loop.last -%},{% endif %}{%- endfor -%}, {{ dbt.string_literal(\"actual\") }} as {{ adapter.quote(\"actual_or_expected\") }}\n from (\n {{ main_sql }}\n ) _dbt_internal_unit_test_actual\n),\n-- Build expected result\ndbt_internal_unit_test_expected as (\n select\n {% for expected_column_name in expected_column_names %}{{expected_column_name}}{% if not loop.last -%}, {% endif %}{%- endfor -%}, {{ dbt.string_literal(\"expected\") }} as {{ adapter.quote(\"actual_or_expected\") }}\n from (\n {{ expected_fixture_sql }}\n ) _dbt_internal_unit_test_expected\n)\n-- Union actual and expected results\nselect * from dbt_internal_unit_test_actual\nunion all\nselect * from dbt_internal_unit_test_expected\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt.string_literal"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.8208928, "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": 1723756270.829347, "supported_languages": ["sql"]}, "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": 1723756270.834827, "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.render() }} 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": 1723756270.835287, "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_clickhouse.clickhouse__post_snapshot"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.8355367, "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": 1723756270.8356793, "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": 1723756270.835896, "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": 1723756270.8360739, "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": 1723756270.836373, "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": 1723756270.8377352, "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": 1723756270.8380177, "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": 1723756270.8383982, "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": 1723756270.8390207, "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_clickhouse.clickhouse__snapshot_merge_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.8396475, "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.render() }} 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": 1723756270.8400788, "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": 1723756270.8451183, "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_clickhouse.clickhouse__snapshot_hash_arguments"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.845396, "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": 1723756270.8457372, "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": 1723756270.8468826, "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_clickhouse.clickhouse__snapshot_string_as_time"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.8471289, "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": 1723756270.847386, "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": 1723756270.8494787, "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": 1723756270.8514004, "supported_languages": null}, "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": 1723756270.855589, "supported_languages": ["sql"]}, "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": 1723756270.8596952, "supported_languages": ["sql"]}, "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": 1723756270.866642, "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": 1723756270.867212, "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": 1723756270.86758, "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.render() ~ \"`\") }}\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.render() ~ \"`\") }}\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": 1723756270.869517, "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": 1723756270.869858, "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": 1723756270.8708277, "supported_languages": null}, "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": 1723756270.8711846, "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": 1723756270.871363, "supported_languages": null}, "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": 1723756270.871827, "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.render() }} clone {{ defer_relation.render() }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.8720887, "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.render() ~ \" 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.render()) }}\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": 1723756270.8772438, "supported_languages": ["sql"]}, "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 {% set contract_config = config.get('contract') %}\n {% if not contract_config or not contract_config.enforced %}\n {% do adapter.expand_target_column_types(\n from_relation=temp_relation,\n to_relation=target_relation) %}\n {% endif %}\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": 1723756270.8848863, "supported_languages": ["sql"]}, "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": 1723756270.8872058, "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": 1723756270.8880186, "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": 1723756270.8890212, "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": 1723756270.8893685, "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": 1723756270.89044, "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": 1723756270.898062, "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": 1723756270.899823, "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": 1723756270.9016986, "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": 1723756270.9029422, "supported_languages": null}, "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": 1723756270.903883, "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": 1723756270.9120073, "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": 1723756270.9143636, "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": 1723756270.914738, "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": 1723756270.9162128, "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": 1723756270.916591, "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": 1723756270.9175358, "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": 1723756270.9188101, "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": 1723756270.9191391, "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": 1723756270.9194107, "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": 1723756270.91983, "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": 1723756270.9201033, "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": 1723756270.9205086, "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": 1723756270.9207757, "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": 1723756270.9212022, "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.default__get_incremental_default_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.9214692, "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": 1723756270.921969, "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": 1723756270.9223797, "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.render())) }}\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": 1723756270.9270642, "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_clickhouse.clickhouse__create_csv_table"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.9346242, "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": 1723756270.936249, "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": 1723756270.9365976, "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.render() %}\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": 1723756270.9373612, "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": 1723756270.9376426, "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": 1723756270.937845, "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": 1723756270.9380534, "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": 1723756270.938226, "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": 1723756270.9384596, "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": 1723756270.9386387, "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": 1723756270.939338, "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_clickhouse.clickhouse__load_csv_rows"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.939612, "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": 1723756270.9414847, "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": 1723756270.9438574, "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": 1723756270.944121, "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": 1723756270.94534, "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": 1723756270.9459577, "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": 1723756270.9468048, "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": 1723756270.9474878, "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": 1723756270.9476027, "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.default__copy_grants"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.9500108, "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": 1723756270.9501889, "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": 1723756270.9504352, "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": 1723756270.9507294, "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": 1723756270.9512691, "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_clickhouse.clickhouse__get_show_grant_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.9515576, "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.render() }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.9517422, "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_clickhouse.clickhouse__get_grant_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.9520645, "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.render() }} 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": 1723756270.9523726, "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_clickhouse.clickhouse__get_revoke_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.9527023, "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.render() }} 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": 1723756270.9530427, "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": 1723756270.9533746, "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": 1723756270.9543993, "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_clickhouse.clickhouse__call_dcl_statements"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.9546742, "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": 1723756270.9550424, "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": 1723756270.9553664, "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.render() ~': 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": 1723756270.9570544, "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.default__get_catalog_relations"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.9618974, "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": 1723756270.9622843, "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_clickhouse.clickhouse__get_catalog"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.962579, "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": 1723756270.9629629, "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.default__information_schema_name"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.963235, "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": 1723756270.9634762, "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_clickhouse.clickhouse__list_schemas"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.963733, "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": 1723756270.964129, "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.default__check_schema_exists"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.9644442, "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": 1723756270.9649012, "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_clickhouse.clickhouse__list_relations_without_caching"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.965174, "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": 1723756270.9654138, "supported_languages": null}, "macro.dbt.get_catalog_for_single_relation": {"name": "get_catalog_for_single_relation", "resource_type": "macro", "package_name": "dbt", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "unique_id": "macro.dbt.get_catalog_for_single_relation", "macro_sql": "{% macro get_catalog_for_single_relation(relation) %}\n {{ return(adapter.dispatch('get_catalog_for_single_relation', 'dbt')(relation)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.default__get_catalog_for_single_relation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.9658084, "supported_languages": null}, "macro.dbt.default__get_catalog_for_single_relation": {"name": "default__get_catalog_for_single_relation", "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_for_single_relation", "macro_sql": "{% macro default__get_catalog_for_single_relation(relation) %}\n {{ exceptions.raise_not_implemented(\n 'get_catalog_for_single_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": 1723756270.9660466, "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.default__get_relations"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.9662874, "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": 1723756270.9665124, "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": 1723756270.9668078, "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": 1723756270.9670608, "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.default__alter_column_comment"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.9680443, "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": 1723756270.9682953, "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_clickhouse.clickhouse__alter_relation_comment"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.9685893, "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": 1723756270.9688344, "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_clickhouse.clickhouse__persist_docs"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.9692395, "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": 1723756270.9699223, "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": 1723756270.9703314, "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": 1723756270.9706576, "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 is not none -%}\n {{ sql_header }}\n {%- endif %}\n {{ get_limit_subquery_sql(compiled_code, limit) }}\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": 1723756270.971227, "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": "\n{%- macro get_limit_subquery_sql(sql, limit) -%}\n {{ adapter.dispatch('get_limit_sql', 'dbt')(sql, limit) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt.default__get_limit_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.971524, "supported_languages": null}, "macro.dbt.default__get_limit_sql": {"name": "default__get_limit_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_sql", "macro_sql": "{% macro default__get_limit_sql(sql, limit) %}\n {{ compiled_code }}\n {% if limit is not none %}\n limit {{ limit }}\n {%- endif -%}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.971812, "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_clickhouse.clickhouse__create_schema"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.972354, "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": 1723756270.9726243, "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_clickhouse.clickhouse__drop_schema"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.9728665, "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": 1723756270.9731617, "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_clickhouse.clickhouse__get_columns_in_relation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.9762652, "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": 1723756270.9765136, "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": 1723756270.976984, "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": 1723756270.9773037, "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": 1723756270.9776049, "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": 1723756270.977863, "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', 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": ["macro.dbt.cast"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.9796708, "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": 1723756270.980165, "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_clickhouse.clickhouse__get_columns_in_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.980464, "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": 1723756270.980984, "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_clickhouse.clickhouse__alter_column_type"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.9813085, "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.render() }} add column {{ adapter.quote(tmp_column) }} {{ new_column_type }};\n update {{ relation.render() }} set {{ adapter.quote(tmp_column) }} = {{ adapter.quote(column_name) }};\n alter table {{ relation.render() }} drop column {{ adapter.quote(column_name) }} cascade;\n alter table {{ relation.render() }} 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": 1723756270.9822712, "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": 1723756270.982636, "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.render() }}\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": 1723756270.9837918, "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.default__get_create_index_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.9850607, "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": 1723756270.9852722, "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": 1723756270.9855094, "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": 1723756270.986092, "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.default__get_drop_index_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.986363, "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": 1723756270.9865694, "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.default__get_show_indexes_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.986802, "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": 1723756270.9869988, "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.default__make_intermediate_relation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.9898, "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": 1723756270.9900508, "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_clickhouse.clickhouse__make_temp_relation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.9903672, "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": 1723756270.9908197, "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.default__make_backup_relation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.9911768, "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": 1723756270.9916651, "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_clickhouse.clickhouse__truncate_relation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.9919295, "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.render() }}\n {%- endcall %}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.992194, "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_clickhouse.clickhouse__get_or_create_relation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.9925425, "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": 1723756270.9933872, "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": 1723756270.9938488, "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": 1723756270.9940612, "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_clickhouse.clickhouse__current_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.9948046, "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": 1723756270.995033, "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.default__snapshot_get_time"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.9952471, "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": 1723756270.9954064, "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.default__current_timestamp_backcompat"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.9956467, "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": 1723756270.9957647, "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.default__current_timestamp_in_utc_backcompat"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.9960065, "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.default__current_timestamp_backcompat"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756270.996246, "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": 1723756270.9968362, "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": 1723756270.9974513, "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": 1723756270.9996045, "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": 1723756271.0004673, "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": 1723756271.0009255, "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": 1723756271.0035467, "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": 1723756271.0053282, "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": 1723756271.00642, "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": 1723756271.0067525, "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": 1723756271.0075278, "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": 1723756271.0078948, "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": 1723756271.008345, "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_clickhouse.clickhouse__test_relationships"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756271.0087774, "supported_languages": null}, "macro.dbt_utils.degrees_to_radians": {"name": "degrees_to_radians", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/haversine_distance.sql", "original_file_path": "macros/sql/haversine_distance.sql", "unique_id": "macro.dbt_utils.degrees_to_radians", "macro_sql": "{% macro degrees_to_radians(degrees) -%}\n acos(-1) * {{degrees}} / 180\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756271.0103831, "supported_languages": null}, "macro.dbt_utils.haversine_distance": {"name": "haversine_distance", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/haversine_distance.sql", "original_file_path": "macros/sql/haversine_distance.sql", "unique_id": "macro.dbt_utils.haversine_distance", "macro_sql": "{% macro haversine_distance(lat1, lon1, lat2, lon2, unit='mi') -%}\n {{ return(adapter.dispatch('haversine_distance', 'dbt_utils')(lat1,lon1,lat2,lon2,unit)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__haversine_distance"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756271.0107906, "supported_languages": null}, "macro.dbt_utils.default__haversine_distance": {"name": "default__haversine_distance", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/haversine_distance.sql", "original_file_path": "macros/sql/haversine_distance.sql", "unique_id": "macro.dbt_utils.default__haversine_distance", "macro_sql": "{% macro default__haversine_distance(lat1, lon1, lat2, lon2, unit='mi') -%}\n{%- if unit == 'mi' %}\n {% set conversion_rate = 1 %}\n{% elif unit == 'km' %}\n {% set conversion_rate = 1.60934 %}\n{% else %}\n {{ exceptions.raise_compiler_error(\"unit input must be one of 'mi' or 'km'. Got \" ~ unit) }}\n{% endif %}\n\n 2 * 3961 * asin(sqrt(power((sin(radians(({{ lat2 }} - {{ lat1 }}) / 2))), 2) +\n cos(radians({{lat1}})) * cos(radians({{lat2}})) *\n power((sin(radians(({{ lon2 }} - {{ lon1 }}) / 2))), 2))) * {{ conversion_rate }}\n\n{%- endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756271.0117714, "supported_languages": null}, "macro.dbt_utils.bigquery__haversine_distance": {"name": "bigquery__haversine_distance", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/haversine_distance.sql", "original_file_path": "macros/sql/haversine_distance.sql", "unique_id": "macro.dbt_utils.bigquery__haversine_distance", "macro_sql": "{% macro bigquery__haversine_distance(lat1, lon1, lat2, lon2, unit='mi') -%}\n{% set radians_lat1 = dbt_utils.degrees_to_radians(lat1) %}\n{% set radians_lat2 = dbt_utils.degrees_to_radians(lat2) %}\n{% set radians_lon1 = dbt_utils.degrees_to_radians(lon1) %}\n{% set radians_lon2 = dbt_utils.degrees_to_radians(lon2) %}\n{%- if unit == 'mi' %}\n {% set conversion_rate = 1 %}\n{% elif unit == 'km' %}\n {% set conversion_rate = 1.60934 %}\n{% else %}\n {{ exceptions.raise_compiler_error(\"unit input must be one of 'mi' or 'km'. Got \" ~ unit) }}\n{% endif %}\n 2 * 3961 * asin(sqrt(power(sin(({{ radians_lat2 }} - {{ radians_lat1 }}) / 2), 2) +\n cos({{ radians_lat1 }}) * cos({{ radians_lat2 }}) *\n power(sin(({{ radians_lon2 }} - {{ radians_lon1 }}) / 2), 2))) * {{ conversion_rate }}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.degrees_to_radians"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756271.0129752, "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": 1723756271.0135624, "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": 1723756271.0139763, "supported_languages": null}, "macro.dbt_utils.safe_divide": {"name": "safe_divide", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/safe_divide.sql", "original_file_path": "macros/sql/safe_divide.sql", "unique_id": "macro.dbt_utils.safe_divide", "macro_sql": "{% macro safe_divide(numerator, denominator) -%}\n {{ return(adapter.dispatch('safe_divide', 'dbt_utils')(numerator, denominator)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__safe_divide"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756271.01442, "supported_languages": null}, "macro.dbt_utils.default__safe_divide": {"name": "default__safe_divide", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/safe_divide.sql", "original_file_path": "macros/sql/safe_divide.sql", "unique_id": "macro.dbt_utils.default__safe_divide", "macro_sql": "{% macro default__safe_divide(numerator, denominator) %}\n ( {{ numerator }} ) / nullif( ( {{ denominator }} ), 0)\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756271.0146298, "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": 1723756271.0153813, "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": 1723756271.0164585, "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": 1723756271.017065, "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": 1723756271.017421, "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": 1723756271.0179691, "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": 1723756271.0187597, "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": 1723756271.0204656, "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": 1723756271.022607, "supported_languages": null}, "macro.dbt_utils.get_query_results_as_dict": {"name": "get_query_results_as_dict", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_query_results_as_dict.sql", "original_file_path": "macros/sql/get_query_results_as_dict.sql", "unique_id": "macro.dbt_utils.get_query_results_as_dict", "macro_sql": "{% macro get_query_results_as_dict(query) %}\n {{ return(adapter.dispatch('get_query_results_as_dict', 'dbt_utils')(query)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__get_query_results_as_dict"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756271.0231845, "supported_languages": null}, "macro.dbt_utils.default__get_query_results_as_dict": {"name": "default__get_query_results_as_dict", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_query_results_as_dict.sql", "original_file_path": "macros/sql/get_query_results_as_dict.sql", "unique_id": "macro.dbt_utils.default__get_query_results_as_dict", "macro_sql": "{% macro default__get_query_results_as_dict(query) %}\n\n{# This macro returns a dictionary of the form {column_name: (tuple_of_results)} #}\n\n {%- call statement('get_query_results', fetch_result=True,auto_begin=false) -%}\n\n {{ query }}\n\n {%- endcall -%}\n\n {% set sql_results={} %}\n\n {%- if execute -%}\n {% set sql_results_table = load_result('get_query_results').table.columns %}\n {% for column_name, column in sql_results_table.items() %}\n {% do sql_results.update({column_name: column.values()}) %}\n {% endfor %}\n {%- endif -%}\n\n {{ return(sql_results) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756271.0240514, "supported_languages": null}, "macro.dbt_utils.group_by": {"name": "group_by", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/groupby.sql", "original_file_path": "macros/sql/groupby.sql", "unique_id": "macro.dbt_utils.group_by", "macro_sql": "{%- macro group_by(n) -%}\n {{ return(adapter.dispatch('group_by', 'dbt_utils')(n)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__group_by"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756271.024494, "supported_languages": null}, "macro.dbt_utils.default__group_by": {"name": "default__group_by", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/groupby.sql", "original_file_path": "macros/sql/groupby.sql", "unique_id": "macro.dbt_utils.default__group_by", "macro_sql": "\n\n{%- macro default__group_by(n) -%}\n\n group by {% for i in range(1, n + 1) -%}\n {{ i }}{{ ',' if not loop.last }} \n {%- endfor -%}\n\n{%- endmacro -%}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756271.0248992, "supported_languages": null}, "macro.dbt_utils.union_relations": {"name": "union_relations", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/union.sql", "original_file_path": "macros/sql/union.sql", "unique_id": "macro.dbt_utils.union_relations", "macro_sql": "{%- macro union_relations(relations, column_override=none, include=[], exclude=[], source_column_name='_dbt_source_relation', where=none) -%}\n {{ return(adapter.dispatch('union_relations', 'dbt_utils')(relations, column_override, include, exclude, source_column_name, where)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__union_relations"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756271.0293958, "supported_languages": null}, "macro.dbt_utils.default__union_relations": {"name": "default__union_relations", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/union.sql", "original_file_path": "macros/sql/union.sql", "unique_id": "macro.dbt_utils.default__union_relations", "macro_sql": "\n\n{%- macro default__union_relations(relations, column_override=none, include=[], exclude=[], source_column_name='_dbt_source_relation', where=none) -%}\n\n {%- if exclude and include -%}\n {{ exceptions.raise_compiler_error(\"Both an exclude and include list were provided to the `union` macro. Only one is allowed\") }}\n {%- endif -%}\n\n {#-- Prevent querying of db in parsing mode. This works because this macro does not create any new refs. -#}\n {%- if not execute %}\n {{ return('') }}\n {% endif -%}\n\n {%- set column_override = column_override if column_override is not none else {} -%}\n\n {%- set relation_columns = {} -%}\n {%- set column_superset = {} -%}\n {%- set all_excludes = [] -%}\n {%- set all_includes = [] -%}\n\n {%- if exclude -%}\n {%- for exc in exclude -%}\n {%- do all_excludes.append(exc | lower) -%}\n {%- endfor -%}\n {%- endif -%}\n\n {%- if include -%}\n {%- for inc in include -%}\n {%- do all_includes.append(inc | lower) -%}\n {%- endfor -%}\n {%- endif -%}\n\n {%- for relation in relations -%}\n\n {%- do relation_columns.update({relation: []}) -%}\n\n {%- do dbt_utils._is_relation(relation, 'union_relations') -%}\n {%- do dbt_utils._is_ephemeral(relation, 'union_relations') -%}\n {%- set cols = adapter.get_columns_in_relation(relation) -%}\n {%- for col in cols -%}\n\n {#- If an exclude list was provided and the column is in the list, do nothing -#}\n {%- if exclude and col.column | lower in all_excludes -%}\n\n {#- If an include list was provided and the column is not in the list, do nothing -#}\n {%- elif include and col.column | lower not in all_includes -%}\n\n {#- Otherwise add the column to the column superset -#}\n {%- else -%}\n\n {#- update the list of columns in this relation -#}\n {%- do relation_columns[relation].append(col.column) -%}\n\n {%- if col.column in column_superset -%}\n\n {%- set stored = column_superset[col.column] -%}\n {%- if col.is_string() and stored.is_string() and col.string_size() > stored.string_size() -%}\n\n {%- do column_superset.update({col.column: col}) -%}\n\n {%- endif %}\n\n {%- else -%}\n\n {%- do column_superset.update({col.column: col}) -%}\n\n {%- endif -%}\n\n {%- endif -%}\n\n {%- endfor -%}\n {%- endfor -%}\n\n {%- set ordered_column_names = column_superset.keys() -%}\n {%- 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": 1723756271.0347016, "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": 1723756271.036551, "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": 1723756271.0389132, "supported_languages": null}, "macro.dbt_utils.get_table_types_sql": {"name": "get_table_types_sql", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_table_types_sql.sql", "original_file_path": "macros/sql/get_table_types_sql.sql", "unique_id": "macro.dbt_utils.get_table_types_sql", "macro_sql": "{%- macro get_table_types_sql() -%}\n {{ return(adapter.dispatch('get_table_types_sql', 'dbt_utils')()) }}\n{%- endmacro -%}\n\n", "depends_on": {"macros": ["macro.dbt_utils.default__get_table_types_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756271.0396488, "supported_languages": null}, "macro.dbt_utils.default__get_table_types_sql": {"name": "default__get_table_types_sql", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_table_types_sql.sql", "original_file_path": "macros/sql/get_table_types_sql.sql", "unique_id": "macro.dbt_utils.default__get_table_types_sql", "macro_sql": "{% macro default__get_table_types_sql() %}\n case table_type\n when 'BASE TABLE' then 'table'\n when 'EXTERNAL TABLE' then 'external'\n when 'MATERIALIZED VIEW' then 'materializedview'\n else lower(table_type)\n end as {{ adapter.quote('table_type') }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756271.039866, "supported_languages": null}, "macro.dbt_utils.postgres__get_table_types_sql": {"name": "postgres__get_table_types_sql", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_table_types_sql.sql", "original_file_path": "macros/sql/get_table_types_sql.sql", "unique_id": "macro.dbt_utils.postgres__get_table_types_sql", "macro_sql": "{% macro postgres__get_table_types_sql() %}\n case table_type\n when 'BASE TABLE' then 'table'\n when 'FOREIGN' then 'external'\n when 'MATERIALIZED VIEW' then 'materializedview'\n else lower(table_type)\n end as {{ adapter.quote('table_type') }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756271.0400743, "supported_languages": null}, "macro.dbt_utils.databricks__get_table_types_sql": {"name": "databricks__get_table_types_sql", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_table_types_sql.sql", "original_file_path": "macros/sql/get_table_types_sql.sql", "unique_id": "macro.dbt_utils.databricks__get_table_types_sql", "macro_sql": "{% macro databricks__get_table_types_sql() %}\n case table_type\n when 'MANAGED' then 'table'\n when 'BASE TABLE' then 'table'\n when 'MATERIALIZED VIEW' then 'materializedview'\n else lower(table_type)\n end as {{ adapter.quote('table_type') }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756271.040281, "supported_languages": null}, "macro.dbt_utils.get_powers_of_two": {"name": "get_powers_of_two", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/generate_series.sql", "original_file_path": "macros/sql/generate_series.sql", "unique_id": "macro.dbt_utils.get_powers_of_two", "macro_sql": "{% macro get_powers_of_two(upper_bound) %}\n {{ return(adapter.dispatch('get_powers_of_two', 'dbt_utils')(upper_bound)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__get_powers_of_two"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756271.0415146, "supported_languages": null}, "macro.dbt_utils.default__get_powers_of_two": {"name": "default__get_powers_of_two", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/generate_series.sql", "original_file_path": "macros/sql/generate_series.sql", "unique_id": "macro.dbt_utils.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": 1723756271.0421715, "supported_languages": null}, "macro.dbt_utils.generate_series": {"name": "generate_series", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/generate_series.sql", "original_file_path": "macros/sql/generate_series.sql", "unique_id": "macro.dbt_utils.generate_series", "macro_sql": "{% macro generate_series(upper_bound) %}\n {{ return(adapter.dispatch('generate_series', 'dbt_utils')(upper_bound)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__generate_series"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756271.0424526, "supported_languages": null}, "macro.dbt_utils.default__generate_series": {"name": "default__generate_series", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/generate_series.sql", "original_file_path": "macros/sql/generate_series.sql", "unique_id": "macro.dbt_utils.default__generate_series", "macro_sql": "{% macro default__generate_series(upper_bound) %}\n\n {% set n = dbt_utils.get_powers_of_two(upper_bound) %}\n\n with p as (\n select 0 as generated_number union all select 1\n ), unioned as (\n\n select\n\n {% for i in range(n) %}\n p{{i}}.generated_number * 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_utils.get_powers_of_two"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756271.043228, "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": 1723756271.0441794, "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": 1723756271.0454836, "supported_languages": null}, "macro.dbt_utils.get_tables_by_pattern_sql": {"name": "get_tables_by_pattern_sql", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_tables_by_pattern_sql.sql", "original_file_path": "macros/sql/get_tables_by_pattern_sql.sql", "unique_id": "macro.dbt_utils.get_tables_by_pattern_sql", "macro_sql": "{% macro get_tables_by_pattern_sql(schema_pattern, table_pattern, exclude='', database=target.database) %}\n {{ return(adapter.dispatch('get_tables_by_pattern_sql', 'dbt_utils')\n (schema_pattern, table_pattern, exclude, database)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__get_tables_by_pattern_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756271.0477586, "supported_languages": null}, "macro.dbt_utils.default__get_tables_by_pattern_sql": {"name": "default__get_tables_by_pattern_sql", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_tables_by_pattern_sql.sql", "original_file_path": "macros/sql/get_tables_by_pattern_sql.sql", "unique_id": "macro.dbt_utils.default__get_tables_by_pattern_sql", "macro_sql": "{% macro default__get_tables_by_pattern_sql(schema_pattern, table_pattern, exclude='', database=target.database) %}\n\n select distinct\n table_schema as {{ adapter.quote('table_schema') }},\n table_name as {{ adapter.quote('table_name') }},\n {{ dbt_utils.get_table_types_sql() }}\n from {{ database }}.information_schema.tables\n where table_schema ilike '{{ schema_pattern }}'\n and table_name ilike '{{ table_pattern }}'\n and table_name not ilike '{{ exclude }}'\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.get_table_types_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756271.0482938, "supported_languages": null}, "macro.dbt_utils.bigquery__get_tables_by_pattern_sql": {"name": "bigquery__get_tables_by_pattern_sql", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_tables_by_pattern_sql.sql", "original_file_path": "macros/sql/get_tables_by_pattern_sql.sql", "unique_id": "macro.dbt_utils.bigquery__get_tables_by_pattern_sql", "macro_sql": "{% macro bigquery__get_tables_by_pattern_sql(schema_pattern, table_pattern, exclude='', database=target.database) %}\n\n {% if '%' in schema_pattern %}\n {% set schemata=dbt_utils._bigquery__get_matching_schemata(schema_pattern, database) %}\n {% else %}\n {% set schemata=[schema_pattern] %}\n {% endif %}\n\n {% set sql %}\n {% for schema in schemata %}\n select distinct\n table_schema,\n table_name,\n {{ dbt_utils.get_table_types_sql() }}\n\n from {{ adapter.quote(database) }}.{{ schema }}.INFORMATION_SCHEMA.TABLES\n where lower(table_name) like lower ('{{ table_pattern }}')\n and lower(table_name) not like lower ('{{ exclude }}')\n\n {% if not loop.last %} union all {% endif %}\n\n {% endfor %}\n {% endset %}\n\n {{ return(sql) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils._bigquery__get_matching_schemata", "macro.dbt_utils.get_table_types_sql"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756271.0493796, "supported_languages": null}, "macro.dbt_utils._bigquery__get_matching_schemata": {"name": "_bigquery__get_matching_schemata", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_tables_by_pattern_sql.sql", "original_file_path": "macros/sql/get_tables_by_pattern_sql.sql", "unique_id": "macro.dbt_utils._bigquery__get_matching_schemata", "macro_sql": "{% macro _bigquery__get_matching_schemata(schema_pattern, database) %}\n {% if execute %}\n\n {% set sql %}\n select schema_name from {{ adapter.quote(database) }}.INFORMATION_SCHEMA.SCHEMATA\n where lower(schema_name) like lower('{{ schema_pattern }}')\n {% endset %}\n\n {% set results=run_query(sql) %}\n\n {% set schemata=results.columns['schema_name'].values() %}\n\n {{ return(schemata) }}\n\n {% else %}\n\n {{ return([]) }}\n\n {% endif %}\n\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756271.0502038, "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": 1723756271.0511541, "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": 1723756271.052413, "supported_languages": null}, "macro.dbt_utils.get_column_values": {"name": "get_column_values", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_column_values.sql", "original_file_path": "macros/sql/get_column_values.sql", "unique_id": "macro.dbt_utils.get_column_values", "macro_sql": "{% macro get_column_values(table, column, order_by='count(*) desc', max_records=none, default=none, where=none) -%}\n {{ return(adapter.dispatch('get_column_values', 'dbt_utils')(table, column, order_by, max_records, default, where)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__get_column_values"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756271.0540044, "supported_languages": null}, "macro.dbt_utils.default__get_column_values": {"name": "default__get_column_values", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_column_values.sql", "original_file_path": "macros/sql/get_column_values.sql", "unique_id": "macro.dbt_utils.default__get_column_values", "macro_sql": "{% macro default__get_column_values(table, column, order_by='count(*) desc', max_records=none, default=none, where=none) -%}\n {#-- Prevent querying of db in parsing mode. This works because this macro does not create any new refs. #}\n {%- if not execute -%}\n {% set default = [] if not default %}\n {{ return(default) }}\n {% endif %}\n\n {%- do dbt_utils._is_ephemeral(table, 'get_column_values') -%}\n\n {# Not all relations are tables. Renaming for internal clarity without breaking functionality for anyone using named arguments #}\n {# TODO: Change the method signature in a future 0.x.0 release #}\n {%- set target_relation = table -%}\n\n {# adapter.load_relation is a convenience wrapper to avoid building a Relation when we already have one #}\n {% set relation_exists = (load_relation(target_relation)) is not none %}\n\n {%- call statement('get_column_values', fetch_result=true) %}\n\n {%- if not relation_exists and default is none -%}\n\n {{ exceptions.raise_compiler_error(\"In get_column_values(): relation \" ~ target_relation ~ \" does not exist and no default value was provided.\") }}\n\n {%- elif not relation_exists and default is not none -%}\n\n {{ log(\"Relation \" ~ target_relation ~ \" does not exist. Returning the default value: \" ~ default) }}\n\n {{ return(default) }}\n\n {%- else -%}\n\n\n select\n {{ column }} as value\n\n from {{ target_relation }}\n\n {% if where is not none %}\n where {{ where }}\n {% endif %}\n\n group by {{ column }}\n order by {{ order_by }}\n\n {% if max_records is not none %}\n limit {{ max_records }}\n {% endif %}\n\n {% endif %}\n\n {%- endcall -%}\n\n {%- set value_list = load_result('get_column_values') -%}\n\n {%- if value_list and value_list['data'] -%}\n {%- set values = value_list['data'] | map(attribute=0) | list %}\n {{ return(values) }}\n {%- else -%}\n {{ return(default) }}\n {%- endif -%}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_utils._is_ephemeral", "macro.dbt.load_relation", "macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756271.0563397, "supported_languages": null}, "macro.dbt_utils.safe_add": {"name": "safe_add", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/safe_add.sql", "original_file_path": "macros/sql/safe_add.sql", "unique_id": "macro.dbt_utils.safe_add", "macro_sql": "{%- macro safe_add(field_list) -%}\n {{ return(adapter.dispatch('safe_add', 'dbt_utils')(field_list)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__safe_add"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756271.0569391, "supported_languages": null}, "macro.dbt_utils.default__safe_add": {"name": "default__safe_add", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/safe_add.sql", "original_file_path": "macros/sql/safe_add.sql", "unique_id": "macro.dbt_utils.default__safe_add", "macro_sql": "\n\n{%- macro default__safe_add(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_add` macro now 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.warn(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": 1723756271.0577557, "supported_languages": null}, "macro.dbt_utils.get_filtered_columns_in_relation": {"name": "get_filtered_columns_in_relation", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_filtered_columns_in_relation.sql", "original_file_path": "macros/sql/get_filtered_columns_in_relation.sql", "unique_id": "macro.dbt_utils.get_filtered_columns_in_relation", "macro_sql": "{% macro get_filtered_columns_in_relation(from, except=[]) -%}\n {{ return(adapter.dispatch('get_filtered_columns_in_relation', 'dbt_utils')(from, except)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__get_filtered_columns_in_relation"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756271.0584288, "supported_languages": null}, "macro.dbt_utils.default__get_filtered_columns_in_relation": {"name": "default__get_filtered_columns_in_relation", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/get_filtered_columns_in_relation.sql", "original_file_path": "macros/sql/get_filtered_columns_in_relation.sql", "unique_id": "macro.dbt_utils.default__get_filtered_columns_in_relation", "macro_sql": "{% macro default__get_filtered_columns_in_relation(from, except=[]) -%}\n {%- do dbt_utils._is_relation(from, 'get_filtered_columns_in_relation') -%}\n {%- do dbt_utils._is_ephemeral(from, 'get_filtered_columns_in_relation') -%}\n\n {# -- Prevent querying of db in parsing mode. This works because this macro does not create any new refs. #}\n {%- if not execute -%}\n {{ return('') }}\n {% endif %}\n\n {%- set include_cols = [] %}\n {%- set cols = adapter.get_columns_in_relation(from) -%}\n {%- set except = except | map(\"lower\") | list %}\n {%- for col in cols -%}\n {%- if col.column|lower not in except -%}\n {% do include_cols.append(col.column) %}\n {%- endif %}\n {%- endfor %}\n\n {{ return(include_cols) }}\n\n{%- endmacro %}", "depends_on": {"macros": ["macro.dbt_utils._is_relation", "macro.dbt_utils._is_ephemeral"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756271.0595033, "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": 1723756271.060569, "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": 1723756271.0612886, "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": 1723756271.0615814, "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": 1723756271.0622602, "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": 1723756271.0632124, "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": 1723756271.063699, "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": 1723756271.0642028, "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.default__deduplicate"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756271.0653093, "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": 1723756271.0656347, "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": 1723756271.0659246, "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": 1723756271.0662084, "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": 1723756271.0664642, "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": 1723756271.0667248, "supported_languages": null}, "macro.dbt_utils.nullcheck_table": {"name": "nullcheck_table", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/nullcheck_table.sql", "original_file_path": "macros/sql/nullcheck_table.sql", "unique_id": "macro.dbt_utils.nullcheck_table", "macro_sql": "{% macro nullcheck_table(relation) %}\n {{ return(adapter.dispatch('nullcheck_table', 'dbt_utils')(relation)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.default__nullcheck_table"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756271.0671659, "supported_languages": null}, "macro.dbt_utils.default__nullcheck_table": {"name": "default__nullcheck_table", "resource_type": "macro", "package_name": "dbt_utils", "path": "macros/sql/nullcheck_table.sql", "original_file_path": "macros/sql/nullcheck_table.sql", "unique_id": "macro.dbt_utils.default__nullcheck_table", "macro_sql": "{% macro default__nullcheck_table(relation) %}\n\n {%- do dbt_utils._is_relation(relation, 'nullcheck_table') -%}\n {%- do dbt_utils._is_ephemeral(relation, 'nullcheck_table') -%}\n {% set cols = adapter.get_columns_in_relation(relation) %}\n\n select {{ dbt_utils.nullcheck(cols) }}\n from {{relation}}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils._is_relation", "macro.dbt_utils._is_ephemeral", "macro.dbt_utils.nullcheck"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756271.0676525, "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": 1723756271.0686073, "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": 1723756271.0694973, "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": 1723756271.0698338, "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": 1723756271.0703526, "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": 1723756271.071857, "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": 1723756271.0732691, "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": 1723756271.0737767, "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": 1723756271.0746102, "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": 1723756271.075309, "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": 1723756271.0762463, "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": 1723756271.0767012, "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": 1723756271.0772145, "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": 1723756271.0775898, "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": 1723756271.0778399, "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": 1723756271.0784647, "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": 1723756271.0788553, "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": 1723756271.0791352, "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": 1723756271.0800176, "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": 1723756271.0814564, "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": 1723756271.0818508, "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": 1723756271.0821073, "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": 1723756271.0830407, "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": 1723756271.084235, "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": 1723756271.0849254, "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": 1723756271.085615, "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": 1723756271.090265, "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": 1723756271.0926902, "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": 1723756271.0934436, "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": 1723756271.0938997, "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": 1723756271.0947669, "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": 1723756271.0954936, "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": 1723756271.0960736, "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": 1723756271.0966012, "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": 1723756271.0975227, "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": 1723756271.0986784, "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": 1723756271.0995739, "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": 1723756271.1000683, "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": 1723756271.1007986, "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": 1723756271.1013114, "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": 1723756271.102057, "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": 1723756271.1026556, "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": 1723756271.1035273, "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": 1723756271.1044831, "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": 1723756271.1060262, "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": 1723756271.1076233, "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": 1723756271.108656, "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": 1723756271.1098902, "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": 1723756271.1109087, "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": 1723756271.1122324, "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": 1723756271.1135356, "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": 1723756271.1150231, "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": 1723756271.1162012, "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": 1723756271.117801, "supported_languages": null}, "macro.codegen.create_base_models": {"name": "create_base_models", "resource_type": "macro", "package_name": "codegen", "path": "macros/create_base_models.sql", "original_file_path": "macros/create_base_models.sql", "unique_id": "macro.codegen.create_base_models", "macro_sql": "{% macro create_base_models(source_name, tables) %}\n {{ return(adapter.dispatch('create_base_models', 'codegen')(source_name, tables)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.codegen.default__create_base_models"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756271.1184044, "supported_languages": null}, "macro.codegen.default__create_base_models": {"name": "default__create_base_models", "resource_type": "macro", "package_name": "codegen", "path": "macros/create_base_models.sql", "original_file_path": "macros/create_base_models.sql", "unique_id": "macro.codegen.default__create_base_models", "macro_sql": "{% macro default__create_base_models(source_name, tables) %}\n\n{% set source_name = \"\"~ source_name ~\"\" %}\n\n{% set zsh_command_models = \"source dbt_packages/codegen/bash_scripts/base_model_creation.sh \"\"\"~ source_name ~\"\"\" \" %}\n\n{%- set models_array = [] -%}\n\n{% for t in tables %}\n {% set help_command = zsh_command_models + t %}\n {{ models_array.append(help_command) }}\n{% endfor %}\n\n{{ log(\"Run these commands in your shell to generate the models:\\n\" ~ models_array|join(' && \\n'), info=True) }}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756271.1191955, "supported_languages": null}, "macro.codegen.generate_column_yaml": {"name": "generate_column_yaml", "resource_type": "macro", "package_name": "codegen", "path": "macros/generate_model_yaml.sql", "original_file_path": "macros/generate_model_yaml.sql", "unique_id": "macro.codegen.generate_column_yaml", "macro_sql": "{% macro generate_column_yaml(column, model_yaml, column_desc_dict, include_data_types, parent_column_name=\"\") %}\n {{ return(adapter.dispatch('generate_column_yaml', 'codegen')(column, model_yaml, column_desc_dict, include_data_types, parent_column_name)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.codegen.default__generate_column_yaml"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756271.1221933, "supported_languages": null}, "macro.codegen.default__generate_column_yaml": {"name": "default__generate_column_yaml", "resource_type": "macro", "package_name": "codegen", "path": "macros/generate_model_yaml.sql", "original_file_path": "macros/generate_model_yaml.sql", "unique_id": "macro.codegen.default__generate_column_yaml", "macro_sql": "{% macro default__generate_column_yaml(column, model_yaml, column_desc_dict, include_data_types, parent_column_name) %}\n {% if parent_column_name %}\n {% set column_name = parent_column_name ~ \".\" ~ column.name %}\n {% else %}\n {% set column_name = column.name %}\n {% endif %}\n\n {% do model_yaml.append(' - name: ' ~ column_name | lower ) %}\n {% if include_data_types %}\n {% do model_yaml.append(' data_type: ' ~ codegen.data_type_format_model(column)) %}\n {% endif %}\n {% do model_yaml.append(' description: \"' ~ column_desc_dict.get(column.name | lower,'') ~ '\"') %}\n {% do model_yaml.append('') %}\n\n {% if column.fields|length > 0 %}\n {% for child_column in column.fields %}\n {% set model_yaml = codegen.generate_column_yaml(child_column, model_yaml, column_desc_dict, include_data_types, parent_column_name=column_name) %}\n {% endfor %}\n {% endif %}\n {% do return(model_yaml) %}\n{% endmacro %}", "depends_on": {"macros": ["macro.codegen.data_type_format_model", "macro.codegen.generate_column_yaml"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756271.1237268, "supported_languages": null}, "macro.codegen.generate_model_yaml": {"name": "generate_model_yaml", "resource_type": "macro", "package_name": "codegen", "path": "macros/generate_model_yaml.sql", "original_file_path": "macros/generate_model_yaml.sql", "unique_id": "macro.codegen.generate_model_yaml", "macro_sql": "{% macro generate_model_yaml(model_names=[], upstream_descriptions=False, include_data_types=True) -%}\n {{ return(adapter.dispatch('generate_model_yaml', 'codegen')(model_names, upstream_descriptions, include_data_types)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.codegen.default__generate_model_yaml"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756271.1241198, "supported_languages": null}, "macro.codegen.default__generate_model_yaml": {"name": "default__generate_model_yaml", "resource_type": "macro", "package_name": "codegen", "path": "macros/generate_model_yaml.sql", "original_file_path": "macros/generate_model_yaml.sql", "unique_id": "macro.codegen.default__generate_model_yaml", "macro_sql": "{% macro default__generate_model_yaml(model_names, upstream_descriptions, include_data_types) %}\n\n {% set model_yaml=[] %}\n\n {% do model_yaml.append('version: 2') %}\n {% do model_yaml.append('') %}\n {% do model_yaml.append('models:') %}\n\n {% if model_names is string %}\n {{ exceptions.raise_compiler_error(\"The `model_names` argument must always be a list, even if there is only one model.\") }}\n {% else %}\n {% for model in model_names %}\n {% do model_yaml.append(' - name: ' ~ model | lower) %}\n {% do model_yaml.append(' description: \"\"') %}\n {% do model_yaml.append(' columns:') %}\n\n {% set relation=ref(model) %}\n {%- set columns = adapter.get_columns_in_relation(relation) -%}\n {% set column_desc_dict = codegen.build_dict_column_descriptions(model) if upstream_descriptions else {} %}\n\n {% for column in columns %}\n {% set model_yaml = codegen.generate_column_yaml(column, model_yaml, column_desc_dict, include_data_types) %}\n {% endfor %}\n {% endfor %}\n {% endif %}\n\n{% if execute %}\n\n {% set joined = model_yaml | join ('\\n') %}\n {{ print(joined) }}\n {% do return(joined) %}\n\n{% endif %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.codegen.build_dict_column_descriptions", "macro.codegen.generate_column_yaml"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756271.126029, "supported_languages": null}, "macro.codegen.generate_model_import_ctes": {"name": "generate_model_import_ctes", "resource_type": "macro", "package_name": "codegen", "path": "macros/generate_model_import_ctes.sql", "original_file_path": "macros/generate_model_import_ctes.sql", "unique_id": "macro.codegen.generate_model_import_ctes", "macro_sql": "{% macro generate_model_import_ctes(model_name, leading_commas = False) %}\n {{ return(adapter.dispatch('generate_model_import_ctes', 'codegen')(model_name, leading_commas)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.codegen.default__generate_model_import_ctes"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756271.1350482, "supported_languages": null}, "macro.codegen.default__generate_model_import_ctes": {"name": "default__generate_model_import_ctes", "resource_type": "macro", "package_name": "codegen", "path": "macros/generate_model_import_ctes.sql", "original_file_path": "macros/generate_model_import_ctes.sql", "unique_id": "macro.codegen.default__generate_model_import_ctes", "macro_sql": "{% macro default__generate_model_import_ctes(model_name, leading_commas) %}\n\n {%- if execute -%}\n {%- set nodes = graph.nodes.values() -%}\n\n {%- set model = (nodes\n | selectattr('name', 'equalto', model_name) \n | selectattr('resource_type', 'equalto', 'model')\n | list).pop() -%}\n\n {%- set model_raw_sql = model.raw_sql or model.raw_code -%}\n {%- else -%}\n {%- set model_raw_sql = '' -%}\n {%- endif -%}\n\n {#-\n\n REGEX Explanations\n\n # with_regex\n - matches (start of file followed by anything then whitespace\n or whitespace\n or a comma) followed by the word with then a space \n\n # from_ref \n - matches (from or join) followed by some spaces and then {{ref()}}\n\n # from_source \n - matches (from or join) followed by some spaces and then {{source(,)}}\n\n # from_var_1\n - matches (from or join) followed by some spaces and then {{var()}}\n\n # from_var_2\n - matches (from or join) followed by some spaces and then {{var(,)}}\n\n # from_table_1\n - matches (from or join) followed by some spaces and then .\n where each is enclosed by (` or [ or \" or ' or nothing)\n\n # from_table_2\n - matches (from or join) followed by some spaces and then ..\n where each is enclosed by (` or [ or \" or ' or nothing)\n\n # from_table_3\n - matches (from or join) followed by some spaces and then \n where is enclosed by (` or [ or \" or ')\n\n # config block\n - matches the start of the file followed by anything and then {{config()}}\n\n -#}\n\n {%- set re = modules.re -%}\n\n {%- set with_regex = '(?i)(?s)(^.*\\s*|\\s+|,)with\\s' -%}\n {%- set does_raw_sql_contain_cte = re.search(with_regex, model_raw_sql) -%}\n\n {%- set from_regexes = {\n 'from_ref':\n '(?ix)\n\n # first matching group\n # from or join followed by at least 1 whitespace character\n (from|join)\\s+\n\n # second matching group\n # opening {{, 0 or more whitespace character(s), ref, 0 or more whitespace character(s), an opening parenthesis, 0 or more whitespace character(s), 1 or 0 quotation mark\n ({{\\s*ref\\s*\\(\\s*[\\'\\\"]?)\n \n # third matching group\n # at least 1 of anything except a parenthesis or quotation mark\n ([^)\\'\\\"]+)\n \n # fourth matching group\n # 1 or 0 quotation mark, 0 or more whitespace character(s)\n ([\\'\\\"]?\\s*)\n\n # fifth matching group\n # a closing parenthesis, 0 or more whitespace character(s), closing }}\n (\\)\\s*}})\n \n ',\n 'from_source':\n '(?ix)\n\n # first matching group\n # from or join followed by at least 1 whitespace character\n (from|join)\\s+\n\n # second matching group\n # opening {{, 0 or more whitespace character(s), source, 0 or more whitespace character(s), an opening parenthesis, 0 or more whitespace character(s), 1 or 0 quotation mark\n ({{\\s*source\\s*\\(\\s*[\\'\\\"]?)\n\n # third matching group\n # at least 1 of anything except a parenthesis or quotation mark\n ([^)\\'\\\"]+)\n\n # fourth matching group\n # 1 or 0 quotation mark, 0 or more whitespace character(s)\n ([\\'\\\"]?\\s*)\n\n # fifth matching group\n # a comma\n (,)\n\n # sixth matching group\n # 0 or more whitespace character(s), 1 or 0 quotation mark\n (\\s*[\\'\\\"]?)\n\n # seventh matching group\n # at least 1 of anything except a parenthesis or quotation mark\n ([^)\\'\\\"]+)\n\n # eighth matching group\n # 1 or 0 quotation mark, 0 or more whitespace character(s)\n ([\\'\\\"]?\\s*)\n\n # ninth matching group\n # a closing parenthesis, 0 or more whitespace character(s), closing }}\n (\\)\\s*}})\n\n ',\n 'from_var_1':\n '(?ix)\n\n # first matching group\n # from or join followed by at least 1 whitespace character\n (from|join)\\s+\n\n # second matching group\n # opening {{, 0 or more whitespace character(s), var, 0 or more whitespace character(s), an opening parenthesis, 0 or more whitespace character(s), 1 or 0 quotation mark\n ({{\\s*var\\s*\\(\\s*[\\'\\\"]?)\n\n # third matching group\n # at least 1 of anything except a parenthesis or quotation mark\n ([^)\\'\\\"]+)\n\n # fourth matching group\n # 1 or 0 quotation mark, 0 or more whitespace character(s)\n ([\\'\\\"]?\\s*)\n\n # fifth matching group\n # a closing parenthesis, 0 or more whitespace character(s), closing }}\n (\\)\\s*}})\n \n ',\n 'from_var_2':\n '(?ix)\n\n # first matching group\n # from or join followed by at least 1 whitespace character\n (from|join)\\s+\n \n # second matching group\n # opening {{, 0 or more whitespace character(s), var, 0 or more whitespace character(s), an opening parenthesis, 0 or more whitespace character(s), 1 or 0 quotation mark\n ({{\\s*var\\s*\\(\\s*[\\'\\\"]?)\n\n # third matching group\n # at least 1 of anything except a parenthesis or quotation mark \n ([^)\\'\\\"]+)\n \n # fourth matching group\n # 1 or 0 quotation mark, 0 or more whitespace character(s)\n ([\\'\\\"]?\\s*)\n\n # fifth matching group\n # a comma\n (,)\n\n # sixth matching group\n # 0 or more whitespace character(s), 1 or 0 quotation mark \n (\\s*[\\'\\\"]?)\n\n # seventh matching group\n # at least 1 of anything except a parenthesis or quotation mark \n ([^)\\'\\\"]+)\n\n # eighth matching group\n # 1 or 0 quotation mark, 0 or more whitespace character(s) \n ([\\'\\\"]?\\s*)\n\n # ninth matching group\n # a closing parenthesis, 0 or more whitespace character(s), closing }} \n (\\)\\s*}})\n \n ',\n 'from_table_1':\n '(?ix)\n \n # first matching group\n # from or join followed by at least 1 whitespace character \n (from|join)\\s+\n \n # second matching group\n # 1 or 0 of (opening bracket, backtick, or quotation mark)\n ([\\[`\\\"\\']?)\n \n # third matching group\n # at least 1 word character\n (\\w+)\n \n # fouth matching group\n # 1 or 0 of (closing bracket, backtick, or quotation mark)\n ([\\]`\\\"\\']?)\n \n # fifth matching group\n # a period\n (\\.)\n \n # sixth matching group\n # 1 or 0 of (opening bracket, backtick, or quotation mark)\n ([\\[`\\\"\\']?)\n \n # seventh matching group\n # at least 1 word character\n (\\w+)\n \n # eighth matching group\n # 1 or 0 of (closing bracket, backtick, or quotation mark) folowed by a whitespace character or end of string\n ([\\]`\\\"\\']?)(?=\\s|$)\n \n ',\n 'from_table_2':\n '(?ix)\n\n # first matching group\n # from or join followed by at least 1 whitespace character \n (from|join)\\s+\n \n # second matching group\n # 1 or 0 of (opening bracket, backtick, or quotation mark) \n ([\\[`\\\"\\']?)\n \n # third matching group\n # at least 1 word character\n (\\w+)\n\n # fouth matching group\n # 1 or 0 of (closing bracket, backtick, or quotation mark) \n ([\\]`\\\"\\']?)\n \n # fifth matching group\n # a period \n (\\.)\n \n # sixth matching group\n # 1 or 0 of (opening bracket, backtick, or quotation mark)\n ([\\[`\\\"\\']?)\n\n # seventh matching group\n # at least 1 word character \n (\\w+)\n \n # eighth matching group\n # 1 or 0 of (closing bracket, backtick, or quotation mark) \n ([\\]`\\\"\\']?)\n \n # ninth matching group\n # a period \n (\\.)\n \n # tenth matching group\n # 1 or 0 of (closing bracket, backtick, or quotation mark) \n ([\\[`\\\"\\']?)\n \n # eleventh matching group\n # at least 1 word character \n (\\w+)\n\n # twelfth matching group\n # 1 or 0 of (closing bracket, backtick, or quotation mark) folowed by a whitespace character or end of string\n ([\\]`\\\"\\']?)(?=\\s|$)\n \n ',\n 'from_table_3':\n '(?ix)\n\n # first matching group\n # from or join followed by at least 1 whitespace character \n (from|join)\\s+\n \n # second matching group\n # 1 or 0 of (opening bracket, backtick, or quotation mark) \n ([\\[`\\\"\\'])\n \n # third matching group\n # at least 1 word character or space \n ([\\w ]+)\n\n # fourth matching group\n # 1 or 0 of (closing bracket, backtick, or quotation mark) folowed by a whitespace character or end of string\n ([\\]`\\\"\\'])(?=\\s|$)\n \n ',\n 'config_block':'(?i)(?s)^.*{{\\s*config\\s*\\([^)]+\\)\\s*}}'\n } -%}\n\n {%- set from_list = [] -%}\n {%- set config_list = [] -%}\n {%- set ns = namespace(model_sql = model_raw_sql) -%}\n\n {%- for regex_name, regex_pattern in from_regexes.items() -%}\n\n {%- set all_regex_matches = re.findall(regex_pattern, model_raw_sql) -%}\n\n {%- for match in all_regex_matches -%}\n\n {%- if regex_name == 'config_block' -%}\n {%- set match_tuple = (match|trim, regex_name) -%}\n {%- do config_list.append(match_tuple) -%}\n {%- elif regex_name == 'from_source' -%} \n {%- set full_from_clause = match[1:]|join|trim -%}\n {%- set cte_name = 'source_' + match[6]|lower -%}\n {%- set match_tuple = (cte_name, full_from_clause, regex_name) -%}\n {%- do from_list.append(match_tuple) -%} \n {%- elif regex_name == 'from_table_1' -%}\n {%- set full_from_clause = match[1:]|join()|trim -%}\n {%- set cte_name = match[2]|lower + '_' + match[6]|lower -%}\n {%- set match_tuple = (cte_name, full_from_clause, regex_name) -%}\n {%- do from_list.append(match_tuple) -%} \n {%- elif regex_name == 'from_table_2' -%}\n {%- set full_from_clause = match[1:]|join()|trim -%}\n {%- set cte_name = match[2]|lower + '_' + match[6]|lower + '_' + match[10]|lower -%}\n {%- set match_tuple = (cte_name, full_from_clause, regex_name) -%}\n {%- do from_list.append(match_tuple) -%} \n {%- else -%}\n {%- set full_from_clause = match[1:]|join|trim -%}\n {%- set cte_name = match[2]|trim|lower -%}\n {%- set match_tuple = (cte_name, full_from_clause, regex_name) -%}\n {%- do from_list.append(match_tuple) -%}\n {%- endif -%}\n\n {%- endfor -%}\n\n {%- if regex_name == 'config_block' -%}\n {%- elif regex_name == 'from_source' -%}\n {%- set ns.model_sql = re.sub(regex_pattern, '\\g<1> source_\\g<7>', ns.model_sql) -%} \n {%- elif regex_name == 'from_table_1' -%}\n {%- set ns.model_sql = re.sub(regex_pattern, '\\g<1> \\g<3>_\\g<7>', ns.model_sql) -%} \n {%- elif regex_name == 'from_table_2' -%}\n {%- set ns.model_sql = re.sub(regex_pattern, '\\g<1> \\g<3>_\\g<7>_\\g<11>', ns.model_sql) -%} \n {%- else -%} \n {%- set ns.model_sql = re.sub(regex_pattern, '\\g<1> \\g<3>', ns.model_sql) -%} \n {% endif %}\n\n {%- endfor -%}\n\n{%- if from_list|length > 0 -%}\n\n{%- set model_import_ctes -%}\n\n {%- for config_obj in config_list -%}\n\n {%- set ns.model_sql = ns.model_sql|replace(config_obj[0], '') -%}\n\n{{ config_obj[0] }}\n\n{% endfor -%}\n\n {%- for from_obj in from_list|unique|sort -%}\n\n{%- if loop.first -%}with {% else -%}{%- if leading_commas -%},{%- endif -%}{%- endif -%}{{ from_obj[0] }} as (\n\n select * from {{ from_obj[1] }}\n {%- if from_obj[2] == 'from_source' and from_list|length > 1 %} \n -- CAUTION: It's best practice to create staging layer for raw sources\n {%- elif from_obj[2] == 'from_table_1' or from_obj[2] == 'from_table_2' or from_obj[2] == 'from_table_3' %}\n -- CAUTION: It's best practice to use the ref or source function instead of a direct reference\n {%- elif from_obj[2] == 'from_var_1' or from_obj[2] == 'from_var_2' %}\n -- CAUTION: It's best practice to use the ref or source function instead of a var\n {%- endif %}\n \n){%- if ((loop.last and does_raw_sql_contain_cte) or (not loop.last)) and not leading_commas -%},{%- endif %}\n\n{% endfor -%}\n\n{%- if does_raw_sql_contain_cte -%}\n {%- if leading_commas -%}\n {%- set replace_with = '\\g<1>,' -%}\n {%- else -%}\n {%- set replace_with = '\\g<1>' -%}\n {%- endif -%}\n{{ re.sub(with_regex, replace_with, ns.model_sql, 1)|trim }}\n{%- else -%}\n{{ ns.model_sql|trim }}\n{%- endif -%}\n\n{%- endset -%}\n\n{%- else -%}\n\n{% set model_import_ctes = model_raw_sql %}\n\n{%- endif -%}\n\n{%- if execute -%}\n\n{{ print(model_import_ctes) }}\n{% do return(model_import_ctes) %}\n\n{% endif %}\n\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756271.1430418, "supported_languages": null}, "macro.codegen.generate_base_model": {"name": "generate_base_model", "resource_type": "macro", "package_name": "codegen", "path": "macros/generate_base_model.sql", "original_file_path": "macros/generate_base_model.sql", "unique_id": "macro.codegen.generate_base_model", "macro_sql": "{% macro generate_base_model(source_name, table_name, leading_commas=False, case_sensitive_cols=False, materialized=None) %}\n {{ return(adapter.dispatch('generate_base_model', 'codegen')(source_name, table_name, leading_commas, case_sensitive_cols, materialized)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.codegen.default__generate_base_model"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756271.144754, "supported_languages": null}, "macro.codegen.default__generate_base_model": {"name": "default__generate_base_model", "resource_type": "macro", "package_name": "codegen", "path": "macros/generate_base_model.sql", "original_file_path": "macros/generate_base_model.sql", "unique_id": "macro.codegen.default__generate_base_model", "macro_sql": "{% macro default__generate_base_model(source_name, table_name, leading_commas, case_sensitive_cols, materialized) %}\n\n{%- set source_relation = source(source_name, table_name) -%}\n\n{%- set columns = adapter.get_columns_in_relation(source_relation) -%}\n{% set column_names=columns | map(attribute='name') %}\n{% set base_model_sql %}\n\n{%- if materialized is not none -%}\n {{ \"{{ config(materialized='\" ~ materialized ~ \"') }}\" }}\n{%- endif %}\n\nwith source as (\n\n select * from {% raw %}{{ source({% endraw %}'{{ source_name }}', '{{ table_name }}'{% raw %}) }}{% endraw %}\n\n),\n\nrenamed as (\n\n select\n {%- if leading_commas -%}\n {%- for column in column_names %}\n {{\", \" if not loop.first}}{% if not case_sensitive_cols %}{{ column | lower }}{% elif target.type == \"bigquery\" %}{{ column }}{% else %}{{ \"\\\"\" ~ column ~ \"\\\"\" }}{% endif %}\n {%- endfor %}\n {%- else -%}\n {%- for column in column_names %}\n {% if not case_sensitive_cols %}{{ column | lower }}{% elif target.type == \"bigquery\" %}{{ column }}{% else %}{{ \"\\\"\" ~ column ~ \"\\\"\" }}{% endif %}{{\",\" if not loop.last}}\n {%- endfor -%}\n {%- endif %}\n\n from source\n\n)\n\nselect * from renamed\n{% endset %}\n\n{% if execute %}\n\n{{ print(base_model_sql) }}\n{% do return(base_model_sql) %}\n\n{% endif %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756271.1467514, "supported_languages": null}, "macro.codegen.get_tables_in_schema": {"name": "get_tables_in_schema", "resource_type": "macro", "package_name": "codegen", "path": "macros/generate_source.sql", "original_file_path": "macros/generate_source.sql", "unique_id": "macro.codegen.get_tables_in_schema", "macro_sql": "{% macro get_tables_in_schema(schema_name, database_name=target.database, table_pattern='%', exclude='') %}\n \n {% set tables=dbt_utils.get_relations_by_pattern(\n schema_pattern=schema_name,\n database=database_name,\n table_pattern=table_pattern,\n exclude=exclude\n ) %}\n\n {% set table_list= tables | map(attribute='identifier') %}\n\n {{ return(table_list | sort) }}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.dbt_utils.get_relations_by_pattern"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756271.1502934, "supported_languages": null}, "macro.codegen.generate_source": {"name": "generate_source", "resource_type": "macro", "package_name": "codegen", "path": "macros/generate_source.sql", "original_file_path": "macros/generate_source.sql", "unique_id": "macro.codegen.generate_source", "macro_sql": "{% macro generate_source(schema_name, database_name=target.database, generate_columns=False, include_descriptions=False, include_data_types=True, table_pattern='%', exclude='', name=schema_name, table_names=None, include_database=False, include_schema=False) %}\n {{ return(adapter.dispatch('generate_source', 'codegen')(schema_name, database_name, generate_columns, include_descriptions, include_data_types, table_pattern, exclude, name, table_names, include_database, include_schema)) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.codegen.default__generate_source"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756271.15104, "supported_languages": null}, "macro.codegen.default__generate_source": {"name": "default__generate_source", "resource_type": "macro", "package_name": "codegen", "path": "macros/generate_source.sql", "original_file_path": "macros/generate_source.sql", "unique_id": "macro.codegen.default__generate_source", "macro_sql": "{% macro default__generate_source(schema_name, database_name, generate_columns, include_descriptions, include_data_types, table_pattern, exclude, name, table_names, include_database, include_schema) %}\n\n{% set sources_yaml=[] %}\n{% do sources_yaml.append('version: 2') %}\n{% do sources_yaml.append('') %}\n{% do sources_yaml.append('sources:') %}\n{% do sources_yaml.append(' - name: ' ~ name | lower) %}\n\n{% if include_descriptions %}\n {% do sources_yaml.append(' description: \"\"' ) %}\n{% endif %}\n\n{% if database_name != target.database or include_database %}\n{% do sources_yaml.append(' database: ' ~ database_name | lower) %}\n{% endif %}\n\n{% if schema_name != name or include_schema %}\n{% do sources_yaml.append(' schema: ' ~ schema_name | lower) %}\n{% endif %}\n\n{% do sources_yaml.append(' tables:') %}\n\n{% if table_names is none %}\n{% set tables=codegen.get_tables_in_schema(schema_name, database_name, table_pattern, exclude) %}\n{% else %}\n{% set tables = table_names %}\n{% endif %}\n\n{% for table in tables %}\n {% do sources_yaml.append(' - name: ' ~ table | lower ) %}\n {% if include_descriptions %}\n {% do sources_yaml.append(' description: \"\"' ) %}\n {% endif %}\n {% if generate_columns %}\n {% do sources_yaml.append(' columns:') %}\n\n {% set table_relation=api.Relation.create(\n database=database_name,\n schema=schema_name,\n identifier=table\n ) %}\n\n {% set columns=adapter.get_columns_in_relation(table_relation) %}\n\n {% for column in columns %}\n {% do sources_yaml.append(' - name: ' ~ column.name | lower ) %}\n {% if include_data_types %}\n {% do sources_yaml.append(' data_type: ' ~ codegen.data_type_format_source(column)) %}\n {% endif %}\n {% if include_descriptions %}\n {% do sources_yaml.append(' description: \"\"' ) %}\n {% endif %}\n {% endfor %}\n {% do sources_yaml.append('') %}\n\n {% endif %}\n\n{% endfor %}\n\n{% if execute %}\n\n {% set joined = sources_yaml | join ('\\n') %}\n {{ print(joined) }}\n {% do return(joined) %}\n\n{% endif %}\n\n{% endmacro %}", "depends_on": {"macros": ["macro.codegen.get_tables_in_schema", "macro.codegen.data_type_format_source"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756271.154538, "supported_languages": null}, "macro.codegen.get_model_dependencies": {"name": "get_model_dependencies", "resource_type": "macro", "package_name": "codegen", "path": "macros/helpers/helpers.sql", "original_file_path": "macros/helpers/helpers.sql", "unique_id": "macro.codegen.get_model_dependencies", "macro_sql": "{% macro get_model_dependencies(model_name) %}\n {% for node in graph.nodes.values() | selectattr('name', \"equalto\", model_name) %}\n {{ return(node.depends_on.nodes) }}\n {% endfor %}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756271.156539, "supported_languages": null}, "macro.codegen.add_model_column_descriptions_to_dict": {"name": "add_model_column_descriptions_to_dict", "resource_type": "macro", "package_name": "codegen", "path": "macros/helpers/helpers.sql", "original_file_path": "macros/helpers/helpers.sql", "unique_id": "macro.codegen.add_model_column_descriptions_to_dict", "macro_sql": "{% macro add_model_column_descriptions_to_dict(model_name,dict_with_descriptions={}) %}\n {% for node in graph.nodes.values() | selectattr('name', \"equalto\", model_name) %}\n {% for col_name, col_values in node.columns.items() %}\n {% do dict_with_descriptions.update( {col_name: col_values.description} ) %}\n {% endfor %}\n {% endfor %}\n {{ return(dict_with_descriptions) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756271.1572642, "supported_languages": null}, "macro.codegen.build_dict_column_descriptions": {"name": "build_dict_column_descriptions", "resource_type": "macro", "package_name": "codegen", "path": "macros/helpers/helpers.sql", "original_file_path": "macros/helpers/helpers.sql", "unique_id": "macro.codegen.build_dict_column_descriptions", "macro_sql": "{% macro build_dict_column_descriptions(model_name) %}\n {% if execute %}\n {% set glob_dict = {} %}\n {% for full_model in codegen.get_model_dependencies(model_name) %}\n {% do codegen.add_model_column_descriptions_to_dict(full_model.split('.')[-1],glob_dict) %}\n {% endfor %}\n {{ return(glob_dict) }}\n {% endif %}\n{% endmacro %}", "depends_on": {"macros": ["macro.codegen.get_model_dependencies", "macro.codegen.add_model_column_descriptions_to_dict"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756271.1578848, "supported_languages": null}, "macro.codegen.get_models": {"name": "get_models", "resource_type": "macro", "package_name": "codegen", "path": "macros/helpers/helpers.sql", "original_file_path": "macros/helpers/helpers.sql", "unique_id": "macro.codegen.get_models", "macro_sql": "{% macro get_models(directory=None, prefix=None) %}\n {% set model_names=[] %}\n {% set models = graph.nodes.values() | selectattr('resource_type', \"equalto\", 'model') %}\n {% if directory and prefix %}\n {% for model in models %}\n {% set model_path = \"/\".join(model.path.split(\"/\")[:-1]) %}\n {% if model_path == directory and model.name.startswith(prefix) %}\n {% do model_names.append(model.name) %}\n {% endif %} \n {% endfor %}\n {% elif directory %}\n {% for model in models %}\n {% set model_path = \"/\".join(model.path.split(\"/\")[:-1]) %}\n {% if model_path == directory %}\n {% do model_names.append(model.name) %}\n {% endif %}\n {% endfor %}\n {% elif prefix %}\n {% for model in models if model.name.startswith(prefix) %}\n {% do model_names.append(model.name) %}\n {% endfor %}\n {% else %}\n {% for model in models %}\n {% do model_names.append(model.name) %}\n {% endfor %}\n {% endif %}\n {{ return(model_names) }}\n{% endmacro %}", "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756271.159914, "supported_languages": null}, "macro.codegen.data_type_format_source": {"name": "data_type_format_source", "resource_type": "macro", "package_name": "codegen", "path": "macros/helpers/helpers.sql", "original_file_path": "macros/helpers/helpers.sql", "unique_id": "macro.codegen.data_type_format_source", "macro_sql": "{% macro data_type_format_source(column) -%}\n {{ return(adapter.dispatch('data_type_format_source', 'codegen')(column)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.codegen.default__data_type_format_source"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756271.1601942, "supported_languages": null}, "macro.codegen.default__data_type_format_source": {"name": "default__data_type_format_source", "resource_type": "macro", "package_name": "codegen", "path": "macros/helpers/helpers.sql", "original_file_path": "macros/helpers/helpers.sql", "unique_id": "macro.codegen.default__data_type_format_source", "macro_sql": "{% macro default__data_type_format_source(column) %}\n {% set formatted = codegen.format_column(column) %}\n {{ return(formatted['data_type'] | lower) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.codegen.format_column"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756271.160519, "supported_languages": null}, "macro.codegen.data_type_format_model": {"name": "data_type_format_model", "resource_type": "macro", "package_name": "codegen", "path": "macros/helpers/helpers.sql", "original_file_path": "macros/helpers/helpers.sql", "unique_id": "macro.codegen.data_type_format_model", "macro_sql": "{% macro data_type_format_model(column) -%}\n {{ return(adapter.dispatch('data_type_format_model', 'codegen')(column)) }}\n{%- endmacro %}", "depends_on": {"macros": ["macro.codegen.default__data_type_format_model"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756271.1607754, "supported_languages": null}, "macro.codegen.default__data_type_format_model": {"name": "default__data_type_format_model", "resource_type": "macro", "package_name": "codegen", "path": "macros/helpers/helpers.sql", "original_file_path": "macros/helpers/helpers.sql", "unique_id": "macro.codegen.default__data_type_format_model", "macro_sql": "{% macro default__data_type_format_model(column) %}\n {% set formatted = codegen.format_column(column) %}\n {{ return(formatted['data_type'] | lower) }}\n{% endmacro %}", "depends_on": {"macros": ["macro.codegen.format_column"]}, "description": "", "meta": {}, "docs": {"show": true, "node_color": null}, "patch_path": null, "arguments": [], "created_at": 1723756271.1611168, "supported_languages": null}, "macro.codegen.format_column": {"name": "format_column", "resource_type": "macro", "package_name": "codegen", "path": "macros/vendored/dbt_core/format_column.sql", "original_file_path": "macros/vendored/dbt_core/format_column.sql", "unique_id": "macro.codegen.format_column", "macro_sql": "{% macro 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": 1723756271.1617136, "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": {"unit_tests": {"name": "unit_tests", "definition": {"method": "test_type", "value": "unit"}}, "non_unit_tests": {"name": "non_unit_tests", "definition": {"union": [{"method": "fqn", "value": "*"}, {"exclude": [{"method": "test_type", "value": "unit", "indirect_selection": "empty"}]}]}, "default": true}, "all_tests": {"name": "all_tests", "definition": {"method": "fqn", "value": "*"}}}, "disabled": {}, "parent_map": {"model.aspects.dim_user_pii": ["model.aspects.user_pii"], "model.aspects.user_pii": ["source.aspects.event_sink.external_id", "source.aspects.event_sink.user_profile"], "model.aspects.fact_enrollments": ["model.aspects.course_names", "model.aspects.dim_user_pii", "model.aspects.enrollment_events"], "model.aspects.fact_enrollment_status": ["model.aspects.enrollment_events"], "model.aspects.enrollment_events": ["model.aspects.xapi_events_all_parsed"], "model.aspects.fact_instance_enrollments": ["model.aspects.enrollment_events"], "model.aspects.fact_instance_actors": ["model.aspects.xapi_events_all_parsed"], "model.aspects.fact_instance_courses": ["model.aspects.xapi_events_all_parsed"], "model.aspects.fact_instance_events": ["model.aspects.xapi_events_all_parsed"], "model.aspects.fact_learner_course_grade": ["model.aspects.grading_events"], "model.aspects.grading_events": ["model.aspects.xapi_events_all_parsed"], "model.aspects.fact_learner_course_status": ["model.aspects.grading_events"], "model.aspects.fact_student_status": ["model.aspects.course_names", "model.aspects.dim_user_pii", "model.aspects.fact_enrollment_status", "model.aspects.fact_learner_course_grade", "model.aspects.fact_learner_course_status"], "model.aspects.fact_problem_responses": ["model.aspects.dim_course_blocks", "model.aspects.dim_user_pii", "model.aspects.problem_events"], "model.aspects.int_problems_per_subsection": ["model.aspects.dim_course_blocks"], "model.aspects.int_problem_hints": ["model.aspects.dim_course_blocks", "model.aspects.problem_events"], "model.aspects.subsection_problem_engagement": ["model.aspects.dim_course_blocks", "model.aspects.int_problems_per_subsection", "model.aspects.problem_events"], "model.aspects.section_problem_engagement": ["model.aspects.dim_course_blocks", "model.aspects.int_problems_per_subsection", "model.aspects.problem_events"], "model.aspects.responses": ["model.aspects.problem_events"], "model.aspects.problem_events": ["model.aspects.xapi_events_all_parsed"], "model.aspects.int_problem_results": ["model.aspects.dim_course_blocks", "model.aspects.problem_events", "model.aspects.responses"], "model.aspects.xapi_events_all_parsed": ["source.aspects.xapi.xapi_events_all"], "model.aspects.int_pages_per_subsection": ["model.aspects.dim_course_blocks"], "model.aspects.fact_learner_last_course_visit": ["model.aspects.navigation_events"], "model.aspects.subsection_page_engagement": ["model.aspects.dim_course_blocks", "model.aspects.int_pages_per_subsection", "model.aspects.navigation_events"], "model.aspects.fact_pageview_engagement": ["model.aspects.dim_course_blocks", "model.aspects.dim_user_pii", "model.aspects.section_page_engagement", "model.aspects.subsection_page_engagement"], "model.aspects.fact_navigation": ["model.aspects.dim_course_blocks", "model.aspects.dim_user_pii", "model.aspects.navigation_events"], "model.aspects.fact_navigation_completion": ["model.aspects.fact_navigation", "model.aspects.int_pages_per_subsection"], "model.aspects.navigation_events": ["model.aspects.xapi_events_all_parsed"], "model.aspects.section_page_engagement": ["model.aspects.dim_course_blocks", "model.aspects.int_pages_per_subsection", "model.aspects.navigation_events"], "model.aspects.most_recent_course_blocks": ["source.aspects.event_sink.course_blocks"], "model.aspects.course_block_names": ["model.aspects.most_recent_course_blocks"], "model.aspects.dim_course_blocks": ["model.aspects.course_block_names", "model.aspects.course_names"], "model.aspects.course_names": ["source.aspects.event_sink.course_overviews"], "model.aspects.dim_course_blocks_extended": ["model.aspects.dim_course_blocks"], "model.aspects.fact_video_plays": ["model.aspects.dim_course_blocks_extended", "model.aspects.dim_user_pii", "model.aspects.video_playback_events"], "model.aspects.fact_video_engagement": ["model.aspects.dim_course_blocks", "model.aspects.dim_user_pii", "model.aspects.section_video_engagement", "model.aspects.subsection_video_engagement"], "model.aspects.section_video_engagement": ["model.aspects.fact_video_plays", "model.aspects.int_videos_per_subsection"], "model.aspects.video_playback_events": ["model.aspects.xapi_events_all_parsed"], "model.aspects.subsection_video_engagement": ["model.aspects.fact_video_plays", "model.aspects.int_videos_per_subsection"], "model.aspects.int_videos_per_subsection": ["model.aspects.dim_course_blocks"], "test.aspects.get_problem_id_with_ccx": [], "test.aspects.get_bucket": [], "test.aspects.section_from_display": [], "test.aspects.subsection_from_display": [], "test.aspects.get_problem_id": [], "test.aspects.a_tag": [], "test.aspects.accepted_values_fact_enrollments_enrollment_status__registered__unregistered.f8d10203f4": ["model.aspects.fact_enrollments"], "test.aspects.accepted_values_fact_enrollment_status_enrollment_status__registered__unregistered.893527c11f": ["model.aspects.fact_enrollment_status"], "test.aspects.accepted_values_xapi_fact_instance_enrollments_enrollment_status__xapi_fact_instance_enrollments__registered__unregistered.744ab867be": ["model.aspects.fact_instance_enrollments"], "test.aspects.accepted_values_fact_learner_course_status_approving_state__passed__failed.f9c0c1b85f": ["model.aspects.fact_learner_course_status"], "test.aspects.accepted_values_fact_student_status_enrollment_status__registered__unregistered.53cae8a0f3": ["model.aspects.fact_student_status"], "test.aspects.accepted_values_xapi_section_problem_engagement_engagement_level__xapi_section_problem_engagement__No_problems_attempted_yet__All_problems_attempted__At_least_one_problem_attempted.48ca5955e3": ["model.aspects.section_problem_engagement"], "test.aspects.accepted_values_xapi_subsection_problem_engagement_engagement_level__xapi_subsection_problem_engagement__No_problems_attempted_yet__All_problems_attempted__At_least_one_problem_attempted.51aa37af55": ["model.aspects.subsection_problem_engagement"], "test.aspects.accepted_values_fact_pageview_engagement_content_level__section__subsection.dd9e9af3ed": ["model.aspects.fact_pageview_engagement"], "test.aspects.accepted_values_xapi_section_page_engagement_engagement_level__xapi_section_page_engagement__No_pages_viewed_yet__All_pages_viewed__At_least_one_page_viewed.f10135df89": ["model.aspects.section_page_engagement"], "test.aspects.accepted_values_xapi_subsection_page_engagement_engagement_level__xapi_subsection_page_engagement__No_pages_viewed_yet__All_pages_viewed__At_least_one_page_viewed.bcd23fe35f": ["model.aspects.subsection_page_engagement"], "test.aspects.accepted_values_fact_video_engagement_content_level__section__subsection.636c5e7005": ["model.aspects.fact_video_engagement"], "test.aspects.accepted_values_fact_video_engagement_section_subsection_video_engagement__No_videos_viewed_yet__At_least_one_video_viewed__All_videos_viewed.91f6ccbf80": ["model.aspects.fact_video_engagement"], "test.aspects.accepted_values_xapi_section_video_engagement_engagement_level__xapi_section_video_engagement__No_videos_viewed_yet__All_videos_viewed__At_least_one_video_viewed.597c4fb289": ["model.aspects.section_video_engagement"], "test.aspects.accepted_values_xapi_subsection_video_engagement_engagement_level__xapi_subsection_video_engagement__No_videos_viewed_yet__All_videos_viewed__At_least_one_video_viewed.c9b49600d3": ["model.aspects.subsection_video_engagement"], "source.aspects.event_sink.user_profile": [], "source.aspects.event_sink.external_id": [], "source.aspects.xapi.xapi_events_all": [], "source.aspects.event_sink.course_blocks": [], "source.aspects.event_sink.course_overviews": [], "unit_test.aspects.user_pii.test_user_pii": ["model.aspects.user_pii"], "unit_test.aspects.fact_enrollments.test_fact_enrollments": ["model.aspects.fact_enrollments"], "unit_test.aspects.enrollment_events.test_enrollment_events": ["model.aspects.enrollment_events"], "unit_test.aspects.fact_enrollment_status.test_fact_enrollment_status": ["model.aspects.fact_enrollment_status"], "unit_test.aspects.fact_instance_enrollments.test_fact_instance_enrollments": ["model.aspects.fact_instance_enrollments"], "unit_test.aspects.grading_events.test_grading_events": ["model.aspects.grading_events"], "unit_test.aspects.fact_learner_course_grade.test_fact_learner_course_grade": ["model.aspects.fact_learner_course_grade"], "unit_test.aspects.fact_learner_course_status.test_fact_learner_course_status": ["model.aspects.fact_learner_course_status"], "unit_test.aspects.fact_student_status.test_fact_student_status": ["model.aspects.fact_student_status"], "unit_test.aspects.problem_events.test_problem_events": ["model.aspects.problem_events"], "unit_test.aspects.fact_problem_responses.test_fact_problem_responses": ["model.aspects.fact_problem_responses"], "unit_test.aspects.int_problem_hints.test_int_problem_hints": ["model.aspects.int_problem_hints"], "unit_test.aspects.responses.test_responses": ["model.aspects.responses"], "unit_test.aspects.int_problem_results.test_int_problem_results": ["model.aspects.int_problem_results"], "unit_test.aspects.subsection_problem_engagement.test_subsection_problem_engagement": ["model.aspects.subsection_problem_engagement"], "unit_test.aspects.xapi_events_all_parsed.test_xapi_events_all_parsed": ["model.aspects.xapi_events_all_parsed"], "unit_test.aspects.navigation_events.test_navigation_events": ["model.aspects.navigation_events"], "unit_test.aspects.fact_navigation.test_fact_navigation": ["model.aspects.fact_navigation"], "unit_test.aspects.fact_navigation_completion.test_fact_navigation_completion": ["model.aspects.fact_navigation_completion"], "unit_test.aspects.section_page_engagement.test_section_page_engagement": ["model.aspects.section_page_engagement"], "unit_test.aspects.subsection_page_engagement.test_subsection_page_engagement": ["model.aspects.subsection_page_engagement"], "unit_test.aspects.fact_pageview_engagement.test_fact_pageview_engagement": ["model.aspects.fact_pageview_engagement"], "unit_test.aspects.int_pages_per_subsection.test_macro_items_per_subsection": ["model.aspects.int_pages_per_subsection"], "unit_test.aspects.most_recent_course_blocks.test_most_recent_course_blocks": ["model.aspects.most_recent_course_blocks"], "unit_test.aspects.course_names.test_course_names": ["model.aspects.course_names"], "unit_test.aspects.dim_course_blocks.test_dim_course_blocks": ["model.aspects.dim_course_blocks"], "unit_test.aspects.dim_course_blocks_extended.test_dim_course_blocks_extended": ["model.aspects.dim_course_blocks_extended"], "unit_test.aspects.video_playback_events.test_video_playback_events": ["model.aspects.video_playback_events"], "unit_test.aspects.fact_video_plays.test_fact_video_plays": ["model.aspects.fact_video_plays"], "unit_test.aspects.section_video_engagement.test_section_video_engagement": ["model.aspects.section_video_engagement"], "unit_test.aspects.subsection_video_engagement.test_subsection_video_engagement": ["model.aspects.subsection_video_engagement"], "unit_test.aspects.fact_video_engagement.test_fact_video_engagement": ["model.aspects.fact_video_engagement"]}, "child_map": {"model.aspects.dim_user_pii": ["model.aspects.fact_enrollments", "model.aspects.fact_navigation", "model.aspects.fact_pageview_engagement", "model.aspects.fact_problem_responses", "model.aspects.fact_student_status", "model.aspects.fact_video_engagement", "model.aspects.fact_video_plays"], "model.aspects.user_pii": ["model.aspects.dim_user_pii", "unit_test.aspects.user_pii.test_user_pii"], "model.aspects.fact_enrollments": ["test.aspects.accepted_values_fact_enrollments_enrollment_status__registered__unregistered.f8d10203f4", "unit_test.aspects.fact_enrollments.test_fact_enrollments"], "model.aspects.fact_enrollment_status": ["model.aspects.fact_student_status", "test.aspects.accepted_values_fact_enrollment_status_enrollment_status__registered__unregistered.893527c11f", "unit_test.aspects.fact_enrollment_status.test_fact_enrollment_status"], "model.aspects.enrollment_events": ["model.aspects.fact_enrollment_status", "model.aspects.fact_enrollments", "model.aspects.fact_instance_enrollments", "unit_test.aspects.enrollment_events.test_enrollment_events"], "model.aspects.fact_instance_enrollments": ["test.aspects.accepted_values_xapi_fact_instance_enrollments_enrollment_status__xapi_fact_instance_enrollments__registered__unregistered.744ab867be", "unit_test.aspects.fact_instance_enrollments.test_fact_instance_enrollments"], "model.aspects.fact_instance_actors": [], "model.aspects.fact_instance_courses": [], "model.aspects.fact_instance_events": [], "model.aspects.fact_learner_course_grade": ["model.aspects.fact_student_status", "unit_test.aspects.fact_learner_course_grade.test_fact_learner_course_grade"], "model.aspects.grading_events": ["model.aspects.fact_learner_course_grade", "model.aspects.fact_learner_course_status", "unit_test.aspects.grading_events.test_grading_events"], "model.aspects.fact_learner_course_status": ["model.aspects.fact_student_status", "test.aspects.accepted_values_fact_learner_course_status_approving_state__passed__failed.f9c0c1b85f", "unit_test.aspects.fact_learner_course_status.test_fact_learner_course_status"], "model.aspects.fact_student_status": ["test.aspects.accepted_values_fact_student_status_enrollment_status__registered__unregistered.53cae8a0f3", "unit_test.aspects.fact_student_status.test_fact_student_status"], "model.aspects.fact_problem_responses": ["unit_test.aspects.fact_problem_responses.test_fact_problem_responses"], "model.aspects.int_problems_per_subsection": ["model.aspects.section_problem_engagement", "model.aspects.subsection_problem_engagement"], "model.aspects.int_problem_hints": ["unit_test.aspects.int_problem_hints.test_int_problem_hints"], "model.aspects.subsection_problem_engagement": ["test.aspects.accepted_values_xapi_subsection_problem_engagement_engagement_level__xapi_subsection_problem_engagement__No_problems_attempted_yet__All_problems_attempted__At_least_one_problem_attempted.51aa37af55", "unit_test.aspects.subsection_problem_engagement.test_subsection_problem_engagement"], "model.aspects.section_problem_engagement": ["test.aspects.accepted_values_xapi_section_problem_engagement_engagement_level__xapi_section_problem_engagement__No_problems_attempted_yet__All_problems_attempted__At_least_one_problem_attempted.48ca5955e3"], "model.aspects.responses": ["model.aspects.int_problem_results", "unit_test.aspects.responses.test_responses"], "model.aspects.problem_events": ["model.aspects.fact_problem_responses", "model.aspects.int_problem_hints", "model.aspects.int_problem_results", "model.aspects.responses", "model.aspects.section_problem_engagement", "model.aspects.subsection_problem_engagement", "unit_test.aspects.problem_events.test_problem_events"], "model.aspects.int_problem_results": ["unit_test.aspects.int_problem_results.test_int_problem_results"], "model.aspects.xapi_events_all_parsed": ["model.aspects.enrollment_events", "model.aspects.fact_instance_actors", "model.aspects.fact_instance_courses", "model.aspects.fact_instance_events", "model.aspects.grading_events", "model.aspects.navigation_events", "model.aspects.problem_events", "model.aspects.video_playback_events", "unit_test.aspects.xapi_events_all_parsed.test_xapi_events_all_parsed"], "model.aspects.int_pages_per_subsection": ["model.aspects.fact_navigation_completion", "model.aspects.section_page_engagement", "model.aspects.subsection_page_engagement", "unit_test.aspects.int_pages_per_subsection.test_macro_items_per_subsection"], "model.aspects.fact_learner_last_course_visit": [], "model.aspects.subsection_page_engagement": ["model.aspects.fact_pageview_engagement", "test.aspects.accepted_values_xapi_subsection_page_engagement_engagement_level__xapi_subsection_page_engagement__No_pages_viewed_yet__All_pages_viewed__At_least_one_page_viewed.bcd23fe35f", "unit_test.aspects.subsection_page_engagement.test_subsection_page_engagement"], "model.aspects.fact_pageview_engagement": ["test.aspects.accepted_values_fact_pageview_engagement_content_level__section__subsection.dd9e9af3ed", "unit_test.aspects.fact_pageview_engagement.test_fact_pageview_engagement"], "model.aspects.fact_navigation": ["model.aspects.fact_navigation_completion", "unit_test.aspects.fact_navigation.test_fact_navigation"], "model.aspects.fact_navigation_completion": ["unit_test.aspects.fact_navigation_completion.test_fact_navigation_completion"], "model.aspects.navigation_events": ["model.aspects.fact_learner_last_course_visit", "model.aspects.fact_navigation", "model.aspects.section_page_engagement", "model.aspects.subsection_page_engagement", "unit_test.aspects.navigation_events.test_navigation_events"], "model.aspects.section_page_engagement": ["model.aspects.fact_pageview_engagement", "test.aspects.accepted_values_xapi_section_page_engagement_engagement_level__xapi_section_page_engagement__No_pages_viewed_yet__All_pages_viewed__At_least_one_page_viewed.f10135df89", "unit_test.aspects.section_page_engagement.test_section_page_engagement"], "model.aspects.most_recent_course_blocks": ["model.aspects.course_block_names", "unit_test.aspects.most_recent_course_blocks.test_most_recent_course_blocks"], "model.aspects.course_block_names": ["model.aspects.dim_course_blocks"], "model.aspects.dim_course_blocks": ["model.aspects.dim_course_blocks_extended", "model.aspects.fact_navigation", "model.aspects.fact_pageview_engagement", "model.aspects.fact_problem_responses", "model.aspects.fact_video_engagement", "model.aspects.int_pages_per_subsection", "model.aspects.int_problem_hints", "model.aspects.int_problem_results", "model.aspects.int_problems_per_subsection", "model.aspects.int_videos_per_subsection", "model.aspects.section_page_engagement", "model.aspects.section_problem_engagement", "model.aspects.subsection_page_engagement", "model.aspects.subsection_problem_engagement", "unit_test.aspects.dim_course_blocks.test_dim_course_blocks"], "model.aspects.course_names": ["model.aspects.dim_course_blocks", "model.aspects.fact_enrollments", "model.aspects.fact_student_status", "unit_test.aspects.course_names.test_course_names"], "model.aspects.dim_course_blocks_extended": ["model.aspects.fact_video_plays", "unit_test.aspects.dim_course_blocks_extended.test_dim_course_blocks_extended"], "model.aspects.fact_video_plays": ["model.aspects.section_video_engagement", "model.aspects.subsection_video_engagement", "unit_test.aspects.fact_video_plays.test_fact_video_plays"], "model.aspects.fact_video_engagement": ["test.aspects.accepted_values_fact_video_engagement_content_level__section__subsection.636c5e7005", "test.aspects.accepted_values_fact_video_engagement_section_subsection_video_engagement__No_videos_viewed_yet__At_least_one_video_viewed__All_videos_viewed.91f6ccbf80", "unit_test.aspects.fact_video_engagement.test_fact_video_engagement"], "model.aspects.section_video_engagement": ["model.aspects.fact_video_engagement", "test.aspects.accepted_values_xapi_section_video_engagement_engagement_level__xapi_section_video_engagement__No_videos_viewed_yet__All_videos_viewed__At_least_one_video_viewed.597c4fb289", "unit_test.aspects.section_video_engagement.test_section_video_engagement"], "model.aspects.video_playback_events": ["model.aspects.fact_video_plays", "unit_test.aspects.video_playback_events.test_video_playback_events"], "model.aspects.subsection_video_engagement": ["model.aspects.fact_video_engagement", "test.aspects.accepted_values_xapi_subsection_video_engagement_engagement_level__xapi_subsection_video_engagement__No_videos_viewed_yet__All_videos_viewed__At_least_one_video_viewed.c9b49600d3", "unit_test.aspects.subsection_video_engagement.test_subsection_video_engagement"], "model.aspects.int_videos_per_subsection": ["model.aspects.section_video_engagement", "model.aspects.subsection_video_engagement"], "test.aspects.get_problem_id_with_ccx": [], "test.aspects.get_bucket": [], "test.aspects.section_from_display": [], "test.aspects.subsection_from_display": [], "test.aspects.get_problem_id": [], "test.aspects.a_tag": [], "test.aspects.accepted_values_fact_enrollments_enrollment_status__registered__unregistered.f8d10203f4": [], "test.aspects.accepted_values_fact_enrollment_status_enrollment_status__registered__unregistered.893527c11f": [], "test.aspects.accepted_values_xapi_fact_instance_enrollments_enrollment_status__xapi_fact_instance_enrollments__registered__unregistered.744ab867be": [], "test.aspects.accepted_values_fact_learner_course_status_approving_state__passed__failed.f9c0c1b85f": [], "test.aspects.accepted_values_fact_student_status_enrollment_status__registered__unregistered.53cae8a0f3": [], "test.aspects.accepted_values_xapi_section_problem_engagement_engagement_level__xapi_section_problem_engagement__No_problems_attempted_yet__All_problems_attempted__At_least_one_problem_attempted.48ca5955e3": [], "test.aspects.accepted_values_xapi_subsection_problem_engagement_engagement_level__xapi_subsection_problem_engagement__No_problems_attempted_yet__All_problems_attempted__At_least_one_problem_attempted.51aa37af55": [], "test.aspects.accepted_values_fact_pageview_engagement_content_level__section__subsection.dd9e9af3ed": [], "test.aspects.accepted_values_xapi_section_page_engagement_engagement_level__xapi_section_page_engagement__No_pages_viewed_yet__All_pages_viewed__At_least_one_page_viewed.f10135df89": [], "test.aspects.accepted_values_xapi_subsection_page_engagement_engagement_level__xapi_subsection_page_engagement__No_pages_viewed_yet__All_pages_viewed__At_least_one_page_viewed.bcd23fe35f": [], "test.aspects.accepted_values_fact_video_engagement_content_level__section__subsection.636c5e7005": [], "test.aspects.accepted_values_fact_video_engagement_section_subsection_video_engagement__No_videos_viewed_yet__At_least_one_video_viewed__All_videos_viewed.91f6ccbf80": [], "test.aspects.accepted_values_xapi_section_video_engagement_engagement_level__xapi_section_video_engagement__No_videos_viewed_yet__All_videos_viewed__At_least_one_video_viewed.597c4fb289": [], "test.aspects.accepted_values_xapi_subsection_video_engagement_engagement_level__xapi_subsection_video_engagement__No_videos_viewed_yet__All_videos_viewed__At_least_one_video_viewed.c9b49600d3": [], "source.aspects.event_sink.user_profile": ["model.aspects.user_pii"], "source.aspects.event_sink.external_id": ["model.aspects.user_pii"], "source.aspects.xapi.xapi_events_all": ["model.aspects.xapi_events_all_parsed"], "source.aspects.event_sink.course_blocks": ["model.aspects.most_recent_course_blocks"], "source.aspects.event_sink.course_overviews": ["model.aspects.course_names"], "unit_test.aspects.user_pii.test_user_pii": [], "unit_test.aspects.fact_enrollments.test_fact_enrollments": [], "unit_test.aspects.enrollment_events.test_enrollment_events": [], "unit_test.aspects.fact_enrollment_status.test_fact_enrollment_status": [], "unit_test.aspects.fact_instance_enrollments.test_fact_instance_enrollments": [], "unit_test.aspects.grading_events.test_grading_events": [], "unit_test.aspects.fact_learner_course_grade.test_fact_learner_course_grade": [], "unit_test.aspects.fact_learner_course_status.test_fact_learner_course_status": [], "unit_test.aspects.fact_student_status.test_fact_student_status": [], "unit_test.aspects.problem_events.test_problem_events": [], "unit_test.aspects.fact_problem_responses.test_fact_problem_responses": [], "unit_test.aspects.int_problem_hints.test_int_problem_hints": [], "unit_test.aspects.responses.test_responses": [], "unit_test.aspects.int_problem_results.test_int_problem_results": [], "unit_test.aspects.subsection_problem_engagement.test_subsection_problem_engagement": [], "unit_test.aspects.xapi_events_all_parsed.test_xapi_events_all_parsed": [], "unit_test.aspects.navigation_events.test_navigation_events": [], "unit_test.aspects.fact_navigation.test_fact_navigation": [], "unit_test.aspects.fact_navigation_completion.test_fact_navigation_completion": [], "unit_test.aspects.section_page_engagement.test_section_page_engagement": [], "unit_test.aspects.subsection_page_engagement.test_subsection_page_engagement": [], "unit_test.aspects.fact_pageview_engagement.test_fact_pageview_engagement": [], "unit_test.aspects.int_pages_per_subsection.test_macro_items_per_subsection": [], "unit_test.aspects.most_recent_course_blocks.test_most_recent_course_blocks": [], "unit_test.aspects.course_names.test_course_names": [], "unit_test.aspects.dim_course_blocks.test_dim_course_blocks": [], "unit_test.aspects.dim_course_blocks_extended.test_dim_course_blocks_extended": [], "unit_test.aspects.video_playback_events.test_video_playback_events": [], "unit_test.aspects.fact_video_plays.test_fact_video_plays": [], "unit_test.aspects.section_video_engagement.test_section_video_engagement": [], "unit_test.aspects.subsection_video_engagement.test_subsection_video_engagement": [], "unit_test.aspects.fact_video_engagement.test_fact_video_engagement": []}, "group_map": {}, "saved_queries": {}, "semantic_models": {}, "unit_tests": {"unit_test.aspects.user_pii.test_user_pii": {"model": "user_pii", "given": [{"input": "source(\"event_sink\", \"user_profile\")", "rows": "select * from event_sink.user_profile", "format": "sql", "fixture": null}, {"input": "source(\"event_sink\", \"external_id\")", "rows": "select * from event_sink.external_id", "format": "sql", "fixture": null}], "expect": {"rows": [{"user_id": "0", "external_user_id": "d1396620-e0d3-499c-ada0-f3ba27f9463b", "username": "actor_0", "name": "Actor 0", "email": "actor_0@aspects.invalid"}, {"user_id": "1", "external_user_id": "8cdaa227-33f8-4d0c-8996-b75373f7394b", "username": "actor_1", "name": "Actor 1", "email": "actor_1@aspects.invalid"}, {"user_id": "2", "external_user_id": "ac483c85-5bcc-41d1-8aad-3d84305ee3a5", "username": "actor_2", "name": "Actor 2", "email": "actor_2@aspects.invalid"}, {"user_id": "3", "external_user_id": "e8b54e57-c400-40d9-bab4-a73f2d4aa7ae", "username": "actor_3", "name": "Actor 3", "email": "actor_3@aspects.invalid"}, {"user_id": "4", "external_user_id": "602fedf5-a7ca-41ce-b14d-7f8945e1969a", "username": "actor_4", "name": "Actor 4", "email": "actor_4@aspects.invalid"}, {"user_id": "5", "external_user_id": "6c0eb8ab-6be1-47d2-bd0d-cf507fd763dc", "username": "actor_5", "name": "Actor 5", "email": "actor_5@aspects.invalid"}, {"user_id": "6", "external_user_id": "2369d68b-899d-458a-b780-77ebf4e5f4c3", "username": "actor_6", "name": "Actor 6", "email": "actor_6@aspects.invalid"}, {"user_id": "7", "external_user_id": "a499a2bb-c627-4916-92d1-f6ae6ac57a71", "username": "actor_7", "name": "Actor 7", "email": "actor_7@aspects.invalid"}, {"user_id": "8", "external_user_id": "9066f98a-4696-4dab-9de6-1c04a769f9ac", "username": "actor_8", "name": "Actor 8", "email": "actor_8@aspects.invalid"}, {"user_id": "9", "external_user_id": "168168ea-84e1-4e8c-8e36-db11d23eb1b8", "username": "actor_9", "name": "Actor 9", "email": "actor_9@aspects.invalid"}, {"user_id": "10", "external_user_id": "f8b778fb-aff9-4b63-8fe3-d578f3891dd8", "username": "actor_10", "name": "Actor 10", "email": "actor_10@aspects.invalid"}, {"user_id": "11", "external_user_id": "47f03e71-bf89-470b-8cb5-8affbc109aff", "username": "actor_11", "name": "Actor 11", "email": "actor_11@aspects.invalid"}, {"user_id": "12", "external_user_id": "154fd129-9ceb-4303-9984-d7736031117b", "username": "actor_12", "name": "Actor 12", "email": "actor_12@aspects.invalid"}, {"user_id": "13", "external_user_id": "58d4edfa-97c1-42ba-9ea4-3428c4e3cad9", "username": "actor_13", "name": "Actor 13", "email": "actor_13@aspects.invalid"}, {"user_id": "14", "external_user_id": "6ef32de8-9503-46ed-9764-559e1df8f75e", "username": "actor_14", "name": "Actor 14", "email": "actor_14@aspects.invalid"}, {"user_id": "15", "external_user_id": "a15dee08-edd3-4b54-98b2-e7d2f60a4c19", "username": "actor_15", "name": "Actor 15", "email": "actor_15@aspects.invalid"}, {"user_id": "16", "external_user_id": "5acd076a-e3f8-48e6-9c13-aad953166b68", "username": "actor_16", "name": "Actor 16", "email": "actor_16@aspects.invalid"}, {"user_id": "17", "external_user_id": "c838016f-6640-44d9-a038-33a7cc4018a9", "username": "actor_17", "name": "Actor 17", "email": "actor_17@aspects.invalid"}, {"user_id": "18", "external_user_id": "ac01d5b9-84a7-4df4-bfba-e91dcfad1c14", "username": "actor_18", "name": "Actor 18", "email": "actor_18@aspects.invalid"}, {"user_id": "19", "external_user_id": "96ab90f0-078f-477c-a011-7eda70eba32a", "username": "actor_19", "name": "Actor 19", "email": "actor_19@aspects.invalid"}, {"user_id": "20", "external_user_id": "d5e4ca2b-d877-4bb5-bb8b-8d51bc76f31a", "username": "actor_20", "name": "Actor 20", "email": "actor_20@aspects.invalid"}, {"user_id": "21", "external_user_id": "510eda4f-80fe-4a8c-9dd6-349415991e6d", "username": "actor_21", "name": "Actor 21", "email": "actor_21@aspects.invalid"}, {"user_id": "22", "external_user_id": "2c29167a-6b35-4a92-9615-84e63516f935", "username": "actor_22", "name": "Actor 22", "email": "actor_22@aspects.invalid"}, {"user_id": "23", "external_user_id": "8d500f3f-f97a-4c45-b786-c814ced84bff", "username": "actor_23", "name": "Actor 23", "email": "actor_23@aspects.invalid"}, {"user_id": "24", "external_user_id": "44b445b8-97e5-4208-abcd-5e1b08ee9569", "username": "actor_24", "name": "Actor 24", "email": "actor_24@aspects.invalid"}, {"user_id": "25", "external_user_id": "272f9b05-b2c8-4755-aa4b-087875c8104b", "username": "actor_25", "name": "Actor 25", "email": "actor_25@aspects.invalid"}, {"user_id": "26", "external_user_id": "3ae0a6e3-21af-4185-b3f1-c7125d1c2ac3", "username": "actor_26", "name": "Actor 26", "email": "actor_26@aspects.invalid"}, {"user_id": "27", "external_user_id": "007761a3-b622-4cb9-8461-b2c6daffb402", "username": "actor_27", "name": "Actor 27", "email": "actor_27@aspects.invalid"}, {"user_id": "28", "external_user_id": "af648aba-2da8-4c60-b982-adfc2f42fe78", "username": "actor_28", "name": "Actor 28", "email": "actor_28@aspects.invalid"}, {"user_id": "29", "external_user_id": "d48677ac-2373-457c-8318-30cd736ed206", "username": "actor_29", "name": "Actor 29", "email": "actor_29@aspects.invalid"}, {"user_id": "30", "external_user_id": "baba0235-70c8-45a8-a1e1-72477205b858", "username": "actor_30", "name": "Actor 30", "email": "actor_30@aspects.invalid"}, {"user_id": "31", "external_user_id": "c9d7fefc-f8bd-4162-8a2c-bdba6da6b624", "username": "actor_31", "name": "Actor 31", "email": "actor_31@aspects.invalid"}, {"user_id": "32", "external_user_id": "4e4f1903-4d45-4b85-94d5-af29757b8396", "username": "actor_32", "name": "Actor 32", "email": "actor_32@aspects.invalid"}, {"user_id": "33", "external_user_id": "2c2553fa-e3c2-40d9-82f4-ce6b8bdc85cf", "username": "actor_33", "name": "Actor 33", "email": "actor_33@aspects.invalid"}, {"user_id": "34", "external_user_id": "9344e7e6-2388-4b1b-b6b8-5040aad08ff7", "username": "actor_34", "name": "Actor 34", "email": "actor_34@aspects.invalid"}, {"user_id": "35", "external_user_id": "49d7023e-84c3-4396-9df7-5536b203ac32", "username": "actor_35", "name": "Actor 35", "email": "actor_35@aspects.invalid"}, {"user_id": "36", "external_user_id": "d26c103e-89ba-47f0-89b5-0df2141a43b8", "username": "actor_36", "name": "Actor 36", "email": "actor_36@aspects.invalid"}, {"user_id": "37", "external_user_id": "2f34c036-b8b2-4cf2-8180-1044c4e231ae", "username": "actor_37", "name": "Actor 37", "email": "actor_37@aspects.invalid"}, {"user_id": "38", "external_user_id": "c85ec8e1-26e4-41c5-bf0f-ce4d10e5b3b1", "username": "actor_38", "name": "Actor 38", "email": "actor_38@aspects.invalid"}, {"user_id": "39", "external_user_id": "c3ba8c7b-9b3a-49e3-b54a-4573613dc392", "username": "actor_39", "name": "Actor 39", "email": "actor_39@aspects.invalid"}, {"user_id": "40", "external_user_id": "28613776-d1b8-4d1d-a94f-1095f09efc2b", "username": "actor_40", "name": "Actor 40", "email": "actor_40@aspects.invalid"}, {"user_id": "41", "external_user_id": "f360e005-29c1-4ad8-92a8-308d7047dc6e", "username": "actor_41", "name": "Actor 41", "email": "actor_41@aspects.invalid"}, {"user_id": "42", "external_user_id": "70b53781-f71d-4051-9760-3874b4473a57", "username": "actor_42", "name": "Actor 42", "email": "actor_42@aspects.invalid"}, {"user_id": "43", "external_user_id": "78dc54d4-e68f-4853-b5e3-7a65357fe6ac", "username": "actor_43", "name": "Actor 43", "email": "actor_43@aspects.invalid"}, {"user_id": "44", "external_user_id": "e6e3c0f5-1a3a-4bcc-a3dd-fe2801585240", "username": "actor_44", "name": "Actor 44", "email": "actor_44@aspects.invalid"}, {"user_id": "45", "external_user_id": "9fa89875-36d7-465e-9bae-a05c0e252db4", "username": "actor_45", "name": "Actor 45", "email": "actor_45@aspects.invalid"}, {"user_id": "46", "external_user_id": "fbfb0998-6d7e-4047-9235-266965fda410", "username": "actor_46", "name": "Actor 46", "email": "actor_46@aspects.invalid"}, {"user_id": "47", "external_user_id": "7924fe6c-4fb8-4c08-83c8-8c9f770d37d7", "username": "actor_47", "name": "Actor 47", "email": "actor_47@aspects.invalid"}, {"user_id": "48", "external_user_id": "3760462a-fbb0-45dc-b5e5-76e6c60c72e1", "username": "actor_48", "name": "Actor 48", "email": "actor_48@aspects.invalid"}, {"user_id": "49", "external_user_id": "ed2421ea-45e4-4610-85b1-d58b2cdf628a", "username": "actor_49", "name": "Actor 49", "email": "actor_49@aspects.invalid"}, {"user_id": "50", "external_user_id": "1bf5ad2e-5eb7-4209-bb1c-ca2f4c8826e0", "username": "actor_50", "name": "Actor 50", "email": "actor_50@aspects.invalid"}, {"user_id": "51", "external_user_id": "3f5c36e9-d6ac-422d-9c83-ca3f1d38aa71", "username": "actor_51", "name": "Actor 51", "email": "actor_51@aspects.invalid"}, {"user_id": "52", "external_user_id": "f5975641-7160-4d20-9989-c7f9a993d32c", "username": "actor_52", "name": "Actor 52", "email": "actor_52@aspects.invalid"}, {"user_id": "53", "external_user_id": "3058e600-5bee-4018-920e-52a311963d88", "username": "actor_53", "name": "Actor 53", "email": "actor_53@aspects.invalid"}, {"user_id": "54", "external_user_id": "33909a28-f02d-414f-9794-58bfb18cb977", "username": "actor_54", "name": "Actor 54", "email": "actor_54@aspects.invalid"}, {"user_id": "55", "external_user_id": "465fe6bb-9894-4480-b8ef-e54d97d77fea", "username": "actor_55", "name": "Actor 55", "email": "actor_55@aspects.invalid"}, {"user_id": "56", "external_user_id": "fc35c856-a8c5-4110-b4b4-15b2025094d8", "username": "actor_56", "name": "Actor 56", "email": "actor_56@aspects.invalid"}, {"user_id": "57", "external_user_id": "95af96c4-e45b-401e-b700-e1f147d36297", "username": "actor_57", "name": "Actor 57", "email": "actor_57@aspects.invalid"}, {"user_id": "58", "external_user_id": "0f764bed-e5da-4d50-89d3-66aac42b50e5", "username": "actor_58", "name": "Actor 58", "email": "actor_58@aspects.invalid"}, {"user_id": "59", "external_user_id": "b3abecb9-10c6-4cfd-93ae-92883b2ab749", "username": "actor_59", "name": "Actor 59", "email": "actor_59@aspects.invalid"}, {"user_id": "60", "external_user_id": "bc9d00aa-2239-4a94-90de-b3ea4d390bc0", "username": "actor_60", "name": "Actor 60", "email": "actor_60@aspects.invalid"}, {"user_id": "61", "external_user_id": "43e0dba8-fc43-4567-824d-68bfabb1f312", "username": "actor_61", "name": "Actor 61", "email": "actor_61@aspects.invalid"}, {"user_id": "62", "external_user_id": "49a47dcd-f33e-4ad5-9416-a248494a85af", "username": "actor_62", "name": "Actor 62", "email": "actor_62@aspects.invalid"}, {"user_id": "63", "external_user_id": "4143359b-4690-4687-a2b8-dbe39f5cb330", "username": "actor_63", "name": "Actor 63", "email": "actor_63@aspects.invalid"}, {"user_id": "64", "external_user_id": "68195b77-86d9-4a90-988e-ec5f38d3a929", "username": "actor_64", "name": "Actor 64", "email": "actor_64@aspects.invalid"}, {"user_id": "65", "external_user_id": "2bb929b4-35ff-427e-9c80-addf897d76e7", "username": "actor_65", "name": "Actor 65", "email": "actor_65@aspects.invalid"}, {"user_id": "66", "external_user_id": "a1de350b-e587-4b57-8fc3-48feb69fd890", "username": "actor_66", "name": "Actor 66", "email": "actor_66@aspects.invalid"}, {"user_id": "67", "external_user_id": "ee648ff3-a442-43af-b1f8-d9880957ec86", "username": "actor_67", "name": "Actor 67", "email": "actor_67@aspects.invalid"}, {"user_id": "68", "external_user_id": "1479a01b-d058-4b00-89cf-3e51531f3fb8", "username": "actor_68", "name": "Actor 68", "email": "actor_68@aspects.invalid"}, {"user_id": "69", "external_user_id": "494ed100-58c9-4510-b39a-f7093ea8e906", "username": "actor_69", "name": "Actor 69", "email": "actor_69@aspects.invalid"}, {"user_id": "70", "external_user_id": "8af5a761-d765-4331-8ed3-071c8b282dca", "username": "actor_70", "name": "Actor 70", "email": "actor_70@aspects.invalid"}, {"user_id": "71", "external_user_id": "d9d644d5-2619-4c87-8ce3-f3efae37c2b8", "username": "actor_71", "name": "Actor 71", "email": "actor_71@aspects.invalid"}, {"user_id": "72", "external_user_id": "1efff542-8cfc-4bc9-863d-1bdd3c521515", "username": "actor_72", "name": "Actor 72", "email": "actor_72@aspects.invalid"}, {"user_id": "73", "external_user_id": "abb4911f-0c4a-4904-8004-aacfeb710346", "username": "actor_73", "name": "Actor 73", "email": "actor_73@aspects.invalid"}, {"user_id": "74", "external_user_id": "63c1c83c-725c-47cf-8686-4775d5fa0cf9", "username": "actor_74", "name": "Actor 74", "email": "actor_74@aspects.invalid"}, {"user_id": "75", "external_user_id": "f376194f-4c5c-4357-aae6-780707fcf36a", "username": "actor_75", "name": "Actor 75", "email": "actor_75@aspects.invalid"}, {"user_id": "76", "external_user_id": "dca7ea78-c883-4106-a698-87d5428c9207", "username": "actor_76", "name": "Actor 76", "email": "actor_76@aspects.invalid"}, {"user_id": "77", "external_user_id": "c217b4e2-3bf7-44db-9193-e1abbd905533", "username": "actor_77", "name": "Actor 77", "email": "actor_77@aspects.invalid"}, {"user_id": "78", "external_user_id": "d44a9bd9-6afe-4f1c-9f21-9aef3194c24a", "username": "actor_78", "name": "Actor 78", "email": "actor_78@aspects.invalid"}, {"user_id": "79", "external_user_id": "10063b09-875d-4c3b-8b9c-283aef97a348", "username": "actor_79", "name": "Actor 79", "email": "actor_79@aspects.invalid"}, {"user_id": "80", "external_user_id": "a28e2d80-0b93-4730-973f-15f8b18696de", "username": "actor_80", "name": "Actor 80", "email": "actor_80@aspects.invalid"}, {"user_id": "81", "external_user_id": "107459eb-506c-4347-93d5-22637996edf1", "username": "actor_81", "name": "Actor 81", "email": "actor_81@aspects.invalid"}, {"user_id": "82", "external_user_id": "ff10a27a-fe60-41b6-aa8e-823770c210a3", "username": "actor_82", "name": "Actor 82", "email": "actor_82@aspects.invalid"}, {"user_id": "83", "external_user_id": "9e2f08c5-77f0-4508-99c6-88549bf7c0b4", "username": "actor_83", "name": "Actor 83", "email": "actor_83@aspects.invalid"}, {"user_id": "84", "external_user_id": "14f0b50a-e45e-496f-9511-7437473dba2f", "username": "actor_84", "name": "Actor 84", "email": "actor_84@aspects.invalid"}, {"user_id": "85", "external_user_id": "9d97277c-9df9-475e-a231-1af77bf3311f", "username": "actor_85", "name": "Actor 85", "email": "actor_85@aspects.invalid"}, {"user_id": "86", "external_user_id": "4e0fc096-65d9-4b41-bcbd-564b054e532e", "username": "actor_86", "name": "Actor 86", "email": "actor_86@aspects.invalid"}, {"user_id": "87", "external_user_id": "668402da-eccf-4daf-b931-4c5948668f84", "username": "actor_87", "name": "Actor 87", "email": "actor_87@aspects.invalid"}, {"user_id": "88", "external_user_id": "273d802c-af43-4e17-a03c-0dd9da357be1", "username": "actor_88", "name": "Actor 88", "email": "actor_88@aspects.invalid"}, {"user_id": "89", "external_user_id": "100752b0-091b-40a3-9087-52f0d4aaeb8c", "username": "actor_89", "name": "Actor 89", "email": "actor_89@aspects.invalid"}, {"user_id": "90", "external_user_id": "3044ff34-06c7-4d33-bfe3-405b0f05b984", "username": "actor_90", "name": "Actor 90", "email": "actor_90@aspects.invalid"}, {"user_id": "91", "external_user_id": "060967b4-0899-411a-abba-2fa9528211d9", "username": "actor_91", "name": "Actor 91", "email": "actor_91@aspects.invalid"}, {"user_id": "92", "external_user_id": "39762ebc-1c5b-4ae9-8694-758f6a74b8f3", "username": "actor_92", "name": "Actor 92", "email": "actor_92@aspects.invalid"}, {"user_id": "93", "external_user_id": "61570f19-557c-4dbd-9cd2-9f3c573beb4b", "username": "actor_93", "name": "Actor 93", "email": "actor_93@aspects.invalid"}, {"user_id": "94", "external_user_id": "7ba12e72-5cb4-43f4-b3a9-729e6724ef6a", "username": "actor_94", "name": "Actor 94", "email": "actor_94@aspects.invalid"}, {"user_id": "95", "external_user_id": "3c83b6e9-d3d3-4c18-b6d6-956c1d8334a2", "username": "actor_95", "name": "Actor 95", "email": "actor_95@aspects.invalid"}, {"user_id": "96", "external_user_id": "c3c0c4b2-b284-4f3f-aa18-934e435b6c3c", "username": "actor_96", "name": "Actor 96", "email": "actor_96@aspects.invalid"}, {"user_id": "97", "external_user_id": "829a9444-ced3-4273-9e4b-e8a8bb790c48", "username": "actor_97", "name": "Actor 97", "email": "actor_97@aspects.invalid"}, {"user_id": "98", "external_user_id": "a5a50fa7-26c3-405d-95bb-d1b351ffa191", "username": "actor_98", "name": "Actor 98", "email": "actor_98@aspects.invalid"}, {"user_id": "99", "external_user_id": "7f9d4c07-e6b8-4d48-b207-08ee0f755933", "username": "actor_99", "name": "Actor 99", "email": "actor_99@aspects.invalid"}], "format": "csv", "fixture": "user_pii_expected"}, "name": "test_user_pii", "resource_type": "unit_test", "package_name": "aspects", "path": "users/unit_tests.yaml", "original_file_path": "models/users/unit_tests.yaml", "unique_id": "unit_test.aspects.user_pii.test_user_pii", "fqn": ["aspects", "users", "user_pii", "test_user_pii"], "description": "", "overrides": null, "depends_on": {"macros": [], "nodes": ["model.aspects.user_pii"]}, "config": {"tags": ["ci"], "meta": {}}, "checksum": "2419c73556f5016efddb78316ce28a6c6557a87a1907136ae299d0fc5a79a653", "schema": "xapi", "created_at": 1723756272.5063355, "versions": null, "version": null}, "unit_test.aspects.fact_enrollments.test_fact_enrollments": {"model": "fact_enrollments", "given": [{"input": "ref('course_names')", "rows": "select * from course_names", "format": "sql", "fixture": null}, {"input": "ref('enrollment_events')", "rows": "select * from enrollment_events", "format": "sql", "fixture": null}, {"input": "ref('dim_user_pii')", "rows": "select * from dim_user_pii", "format": "sql", "fixture": null}], "expect": {"rows": "select * from fact_enrollments_expected", "format": "sql", "fixture": null}, "name": "test_fact_enrollments", "resource_type": "unit_test", "package_name": "aspects", "path": "enrollment/unit_tests.yaml", "original_file_path": "models/enrollment/unit_tests.yaml", "unique_id": "unit_test.aspects.fact_enrollments.test_fact_enrollments", "fqn": ["aspects", "enrollment", "fact_enrollments", "test_fact_enrollments"], "description": "", "overrides": null, "depends_on": {"macros": [], "nodes": ["model.aspects.fact_enrollments"]}, "config": {"tags": ["ci"], "meta": {}}, "checksum": "c50232f2c9b3bf9b4e65f5df9e83747c63e20c99f38872bb8e85c62b46b9cfa3", "schema": "xapi", "created_at": 1723756272.5095062, "versions": null, "version": null}, "unit_test.aspects.enrollment_events.test_enrollment_events": {"model": "enrollment_events", "given": [{"input": "ref('xapi_events_all_parsed')", "rows": "select * from xapi.xapi_events_all_parsed", "format": "sql", "fixture": null}], "expect": {"rows": "select * from enrollment_events_expected", "format": "sql", "fixture": null}, "name": "test_enrollment_events", "resource_type": "unit_test", "package_name": "aspects", "path": "enrollment/unit_tests.yaml", "original_file_path": "models/enrollment/unit_tests.yaml", "unique_id": "unit_test.aspects.enrollment_events.test_enrollment_events", "fqn": ["aspects", "enrollment", "enrollment_events", "test_enrollment_events"], "description": "", "overrides": null, "depends_on": {"macros": [], "nodes": ["model.aspects.enrollment_events"]}, "config": {"tags": ["ci"], "meta": {}}, "checksum": "0db3696ea218753a1074842bbedfc293fd39ba95c0364f65e57464a1e9ae7633", "schema": "xapi", "created_at": 1723756272.5112195, "versions": null, "version": null}, "unit_test.aspects.fact_enrollment_status.test_fact_enrollment_status": {"model": "fact_enrollment_status", "given": [{"input": "ref('enrollment_events')", "rows": "select * from enrollment_events", "format": "sql", "fixture": null}], "expect": {"rows": "select * from fact_enrollment_status_expected", "format": "sql", "fixture": null}, "name": "test_fact_enrollment_status", "resource_type": "unit_test", "package_name": "aspects", "path": "enrollment/unit_tests.yaml", "original_file_path": "models/enrollment/unit_tests.yaml", "unique_id": "unit_test.aspects.fact_enrollment_status.test_fact_enrollment_status", "fqn": ["aspects", "enrollment", "fact_enrollment_status", "test_fact_enrollment_status"], "description": "", "overrides": null, "depends_on": {"macros": [], "nodes": ["model.aspects.fact_enrollment_status"]}, "config": {"tags": ["ci"], "meta": {}}, "checksum": "36553adcd997d44cb273afab06f6246b8aa61a5b9e5bf1e40be86dfe2d37f14d", "schema": "xapi", "created_at": 1723756272.5121703, "versions": null, "version": null}, "unit_test.aspects.fact_instance_enrollments.test_fact_instance_enrollments": {"model": "fact_instance_enrollments", "given": [{"input": "ref('enrollment_events')", "rows": "select * from enrollment_events", "format": "sql", "fixture": null}], "expect": {"rows": "select * from fact_instance_enrollments_expected", "format": "sql", "fixture": null}, "name": "test_fact_instance_enrollments", "resource_type": "unit_test", "package_name": "aspects", "path": "instance/unit_tests.yaml", "original_file_path": "models/instance/unit_tests.yaml", "unique_id": "unit_test.aspects.fact_instance_enrollments.test_fact_instance_enrollments", "fqn": ["aspects", "instance", "fact_instance_enrollments", "test_fact_instance_enrollments"], "description": "", "overrides": null, "depends_on": {"macros": [], "nodes": ["model.aspects.fact_instance_enrollments"]}, "config": {"tags": ["ci"], "meta": {}}, "checksum": "cd5503c4cc82480aabbb53a9758f679f51fcab67732c4e00ed60e383175f78a5", "schema": "xapi", "created_at": 1723756272.513158, "versions": null, "version": null}, "unit_test.aspects.grading_events.test_grading_events": {"model": "grading_events", "given": [{"input": "ref('xapi_events_all_parsed')", "rows": "select * from xapi_events_all_parsed", "format": "sql", "fixture": null}], "expect": {"rows": "select * from grading_events_expected", "format": "sql", "fixture": null}, "name": "test_grading_events", "resource_type": "unit_test", "package_name": "aspects", "path": "grading/unit_tests.yaml", "original_file_path": "models/grading/unit_tests.yaml", "unique_id": "unit_test.aspects.grading_events.test_grading_events", "fqn": ["aspects", "grading", "grading_events", "test_grading_events"], "description": "", "overrides": null, "depends_on": {"macros": [], "nodes": ["model.aspects.grading_events"]}, "config": {"tags": ["ci"], "meta": {}}, "checksum": "61dd0d8c98bcedaa4de06acf0020fa16474254bd62790b05bbc4370b07257c5c", "schema": "xapi", "created_at": 1723756272.5144532, "versions": null, "version": null}, "unit_test.aspects.fact_learner_course_grade.test_fact_learner_course_grade": {"model": "fact_learner_course_grade", "given": [{"input": "ref('grading_events')", "rows": "select * from grading_events", "format": "sql", "fixture": null}], "expect": {"rows": [{"org": "Org0", "course_key": "course-v1:Org0+DemoX+2bc51b", "actor_id": "1bf5ad2e-5eb7-4209-bb1c-ca2f4c8826e0", "course_grade": "0.9523809523809523", "emission_time": "2024-03-02 07:57:47"}, {"org": "Org0", "course_key": "course-v1:Org0+DemoX+2bc51b", "actor_id": "2369d68b-899d-458a-b780-77ebf4e5f4c3", "course_grade": "0.7422680412371134", "emission_time": "2024-03-09 17:33:29"}, {"org": "Org0", "course_key": "course-v1:Org0+DemoX+2bc51b", "actor_id": "273d802c-af43-4e17-a03c-0dd9da357be1", "course_grade": "0.45714285714285713", "emission_time": "2024-02-26 15:47:12"}, {"org": "Org0", "course_key": "course-v1:Org0+DemoX+2bc51b", "actor_id": "3c83b6e9-d3d3-4c18-b6d6-956c1d8334a2", "course_grade": "0.9841269841269841", "emission_time": "2024-02-15 09:45:51"}, {"org": "Org0", "course_key": "course-v1:Org0+DemoX+2bc51b", "actor_id": "44b445b8-97e5-4208-abcd-5e1b08ee9569", "course_grade": "0.5", "emission_time": "2024-03-12 10:03:24"}, {"org": "Org0", "course_key": "course-v1:Org0+DemoX+2bc51b", "actor_id": "4e0fc096-65d9-4b41-bcbd-564b054e532e", "course_grade": "0.0425531914893617", "emission_time": "2024-01-27 21:40:19"}, {"org": "Org0", "course_key": "course-v1:Org0+DemoX+2bc51b", "actor_id": "abb4911f-0c4a-4904-8004-aacfeb710346", "course_grade": "0.5", "emission_time": "2024-02-09 02:22:26"}, {"org": "Org0", "course_key": "course-v1:Org0+DemoX+2bc51b", "actor_id": "b3abecb9-10c6-4cfd-93ae-92883b2ab749", "course_grade": "0.8947368421052632", "emission_time": "2023-12-21 11:09:43"}, {"org": "Org0", "course_key": "course-v1:Org0+DemoX+2bc51b", "actor_id": "c85ec8e1-26e4-41c5-bf0f-ce4d10e5b3b1", "course_grade": "0.9240506329113924", "emission_time": "2024-02-23 11:14:00"}, {"org": "Org0", "course_key": "course-v1:Org0+DemoX+2bc51b", "actor_id": "ed2421ea-45e4-4610-85b1-d58b2cdf628a", "course_grade": "0.29411764705882354", "emission_time": "2024-02-16 11:13:49"}, {"org": "Org0", "course_key": "course-v1:Org0+DemoX+2bc51b", "actor_id": "f376194f-4c5c-4357-aae6-780707fcf36a", "course_grade": "0", "emission_time": "2024-02-21 17:29:58"}, {"org": "Org0", "course_key": "course-v1:Org0+DemoX+2bc51b", "actor_id": "f5975641-7160-4d20-9989-c7f9a993d32c", "course_grade": "0.925", "emission_time": "2024-02-28 10:00:34"}, {"org": "Org0", "course_key": "course-v1:Org0+DemoX+81bba1", "actor_id": "100752b0-091b-40a3-9087-52f0d4aaeb8c", "course_grade": "0.2727272727272727", "emission_time": "2020-10-02 10:39:56"}, {"org": "Org0", "course_key": "course-v1:Org0+DemoX+81bba1", "actor_id": "1efff542-8cfc-4bc9-863d-1bdd3c521515", "course_grade": "0.38461538461538464", "emission_time": "2020-08-18 01:32:55"}, {"org": "Org0", "course_key": "course-v1:Org0+DemoX+81bba1", "actor_id": "273d802c-af43-4e17-a03c-0dd9da357be1", "course_grade": "0.3157894736842105", "emission_time": "2020-09-29 21:02:35"}, {"org": "Org0", "course_key": "course-v1:Org0+DemoX+81bba1", "actor_id": "2f34c036-b8b2-4cf2-8180-1044c4e231ae", "course_grade": "0.97", "emission_time": "2020-08-19 09:55:20"}, {"org": "Org0", "course_key": "course-v1:Org0+DemoX+81bba1", "actor_id": "5acd076a-e3f8-48e6-9c13-aad953166b68", "course_grade": "0.09333333333333334", "emission_time": "2020-08-16 17:39:29"}, {"org": "Org0", "course_key": "course-v1:Org0+DemoX+81bba1", "actor_id": "9e2f08c5-77f0-4508-99c6-88549bf7c0b4", "course_grade": "0.45", "emission_time": "2020-09-28 05:18:47"}, {"org": "Org0", "course_key": "course-v1:Org0+DemoX+81bba1", "actor_id": "c838016f-6640-44d9-a038-33a7cc4018a9", "course_grade": "0.9054054054054054", "emission_time": "2020-09-16 09:48:10"}, {"org": "Org1", "course_key": "course-v1:Org1+DemoX+1937e7", "actor_id": "272f9b05-b2c8-4755-aa4b-087875c8104b", "course_grade": "0.75", "emission_time": "2021-07-28 17:01:18"}, {"org": "Org1", "course_key": "course-v1:Org1+DemoX+1937e7", "actor_id": "2f34c036-b8b2-4cf2-8180-1044c4e231ae", "course_grade": "0.5555555555555556", "emission_time": "2021-06-08 23:03:09"}, {"org": "Org1", "course_key": "course-v1:Org1+DemoX+1937e7", "actor_id": "3c83b6e9-d3d3-4c18-b6d6-956c1d8334a2", "course_grade": "0.3333333333333333", "emission_time": "2021-07-11 11:57:37"}, {"org": "Org1", "course_key": "course-v1:Org1+DemoX+1937e7", "actor_id": "3f5c36e9-d6ac-422d-9c83-ca3f1d38aa71", "course_grade": "0", "emission_time": "2021-07-27 06:30:19"}, {"org": "Org1", "course_key": "course-v1:Org1+DemoX+1937e7", "actor_id": "44b445b8-97e5-4208-abcd-5e1b08ee9569", "course_grade": "0.42528735632183906", "emission_time": "2021-07-01 18:31:57"}, {"org": "Org1", "course_key": "course-v1:Org1+DemoX+1937e7", "actor_id": "510eda4f-80fe-4a8c-9dd6-349415991e6d", "course_grade": "0.9333333333333333", "emission_time": "2021-07-06 05:58:00"}, {"org": "Org1", "course_key": "course-v1:Org1+DemoX+1937e7", "actor_id": "63c1c83c-725c-47cf-8686-4775d5fa0cf9", "course_grade": "0.0425531914893617", "emission_time": "2021-07-14 01:22:24"}, {"org": "Org1", "course_key": "course-v1:Org1+DemoX+1937e7", "actor_id": "9066f98a-4696-4dab-9de6-1c04a769f9ac", "course_grade": "0", "emission_time": "2021-07-11 04:26:08"}, {"org": "Org1", "course_key": "course-v1:Org1+DemoX+1937e7", "actor_id": "9fa89875-36d7-465e-9bae-a05c0e252db4", "course_grade": "0.55", "emission_time": "2021-07-18 20:34:16"}, {"org": "Org1", "course_key": "course-v1:Org1+DemoX+1937e7", "actor_id": "a15dee08-edd3-4b54-98b2-e7d2f60a4c19", "course_grade": "0.2823529411764706", "emission_time": "2021-06-17 12:59:49"}, {"org": "Org1", "course_key": "course-v1:Org1+DemoX+1937e7", "actor_id": "a499a2bb-c627-4916-92d1-f6ae6ac57a71", "course_grade": "0.945054945054945", "emission_time": "2021-07-29 08:50:10"}, {"org": "Org1", "course_key": "course-v1:Org1+DemoX+1937e7", "actor_id": "baba0235-70c8-45a8-a1e1-72477205b858", "course_grade": "0.6527777777777778", "emission_time": "2021-07-30 17:06:48"}, {"org": "Org1", "course_key": "course-v1:Org1+DemoX+1937e7", "actor_id": "d9d644d5-2619-4c87-8ce3-f3efae37c2b8", "course_grade": "0.125", "emission_time": "2021-07-06 13:41:30"}, {"org": "Org1", "course_key": "course-v1:Org1+DemoX+1937e7", "actor_id": "e6e3c0f5-1a3a-4bcc-a3dd-fe2801585240", "course_grade": "0.4583333333333333", "emission_time": "2021-07-23 03:33:57"}, {"org": "Org2", "course_key": "course-v1:Org2+DemoX+682526", "actor_id": "107459eb-506c-4347-93d5-22637996edf1", "course_grade": "0.9655172413793104", "emission_time": "2021-12-30 15:58:03"}, {"org": "Org2", "course_key": "course-v1:Org2+DemoX+682526", "actor_id": "44b445b8-97e5-4208-abcd-5e1b08ee9569", "course_grade": "0.35294117647058826", "emission_time": "2021-12-04 11:33:59"}, {"org": "Org2", "course_key": "course-v1:Org2+DemoX+682526", "actor_id": "49a47dcd-f33e-4ad5-9416-a248494a85af", "course_grade": "0.47368421052631576", "emission_time": "2021-12-14 16:05:55"}, {"org": "Org2", "course_key": "course-v1:Org2+DemoX+682526", "actor_id": "4e4f1903-4d45-4b85-94d5-af29757b8396", "course_grade": "0.9166666666666666", "emission_time": "2021-12-31 12:45:01"}, {"org": "Org2", "course_key": "course-v1:Org2+DemoX+682526", "actor_id": "8af5a761-d765-4331-8ed3-071c8b282dca", "course_grade": "0.3333333333333333", "emission_time": "2021-12-01 18:37:19"}, {"org": "Org2", "course_key": "course-v1:Org2+DemoX+682526", "actor_id": "9344e7e6-2388-4b1b-b6b8-5040aad08ff7", "course_grade": "1", "emission_time": "2021-11-05 10:50:55"}, {"org": "Org2", "course_key": "course-v1:Org2+DemoX+682526", "actor_id": "9e2f08c5-77f0-4508-99c6-88549bf7c0b4", "course_grade": "0.6060606060606061", "emission_time": "2022-01-07 07:23:56"}, {"org": "Org2", "course_key": "course-v1:Org2+DemoX+682526", "actor_id": "bc9d00aa-2239-4a94-90de-b3ea4d390bc0", "course_grade": "0.803921568627451", "emission_time": "2021-12-28 10:13:01"}, {"org": "Org2", "course_key": "course-v1:Org2+DemoX+682526", "actor_id": "d9d644d5-2619-4c87-8ce3-f3efae37c2b8", "course_grade": "0.0975609756097561", "emission_time": "2022-01-05 19:22:53"}, {"org": "Org2", "course_key": "course-v1:Org2+DemoX+682526", "actor_id": "e6e3c0f5-1a3a-4bcc-a3dd-fe2801585240", "course_grade": "0.05357142857142857", "emission_time": "2021-12-20 23:24:24"}, {"org": "Org2", "course_key": "course-v1:Org2+DemoX+682526", "actor_id": "ed2421ea-45e4-4610-85b1-d58b2cdf628a", "course_grade": "1", "emission_time": "2022-01-05 00:38:53"}, {"org": "Org2", "course_key": "course-v1:Org2+DemoX+682526", "actor_id": "f5975641-7160-4d20-9989-c7f9a993d32c", "course_grade": "0", "emission_time": "2021-12-29 04:09:26"}, {"org": "Org2", "course_key": "course-v1:Org2+DemoX+e4380c", "actor_id": "060967b4-0899-411a-abba-2fa9528211d9", "course_grade": "0.3333333333333333", "emission_time": "2022-03-12 03:19:12"}, {"org": "Org2", "course_key": "course-v1:Org2+DemoX+e4380c", "actor_id": "1479a01b-d058-4b00-89cf-3e51531f3fb8", "course_grade": "0.2558139534883721", "emission_time": "2022-02-03 03:38:51"}, {"org": "Org2", "course_key": "course-v1:Org2+DemoX+e4380c", "actor_id": "14f0b50a-e45e-496f-9511-7437473dba2f", "course_grade": "0.9", "emission_time": "2022-02-16 20:50:57"}, {"org": "Org2", "course_key": "course-v1:Org2+DemoX+e4380c", "actor_id": "154fd129-9ceb-4303-9984-d7736031117b", "course_grade": "0.4235294117647059", "emission_time": "2021-12-19 01:38:39"}, {"org": "Org2", "course_key": "course-v1:Org2+DemoX+e4380c", "actor_id": "168168ea-84e1-4e8c-8e36-db11d23eb1b8", "course_grade": "0.9736842105263158", "emission_time": "2022-03-10 16:00:16"}, {"org": "Org2", "course_key": "course-v1:Org2+DemoX+e4380c", "actor_id": "1bf5ad2e-5eb7-4209-bb1c-ca2f4c8826e0", "course_grade": "0.7971014492753623", "emission_time": "2022-03-08 22:02:57"}, {"org": "Org2", "course_key": "course-v1:Org2+DemoX+e4380c", "actor_id": "3044ff34-06c7-4d33-bfe3-405b0f05b984", "course_grade": "0.2", "emission_time": "2022-02-23 15:32:09"}, {"org": "Org2", "course_key": "course-v1:Org2+DemoX+e4380c", "actor_id": "33909a28-f02d-414f-9794-58bfb18cb977", "course_grade": "0.16923076923076924", "emission_time": "2022-02-23 01:36:33"}, {"org": "Org2", "course_key": "course-v1:Org2+DemoX+e4380c", "actor_id": "39762ebc-1c5b-4ae9-8694-758f6a74b8f3", "course_grade": "0.203125", "emission_time": "2022-03-10 03:23:14"}, {"org": "Org2", "course_key": "course-v1:Org2+DemoX+e4380c", "actor_id": "47f03e71-bf89-470b-8cb5-8affbc109aff", "course_grade": "0.2222222222222222", "emission_time": "2022-02-25 09:11:16"}, {"org": "Org2", "course_key": "course-v1:Org2+DemoX+e4380c", "actor_id": "61570f19-557c-4dbd-9cd2-9f3c573beb4b", "course_grade": "0.34375", "emission_time": "2022-03-07 16:50:59"}, {"org": "Org2", "course_key": "course-v1:Org2+DemoX+e4380c", "actor_id": "8af5a761-d765-4331-8ed3-071c8b282dca", "course_grade": "0.41304347826086957", "emission_time": "2021-12-28 08:00:26"}, {"org": "Org2", "course_key": "course-v1:Org2+DemoX+e4380c", "actor_id": "8d500f3f-f97a-4c45-b786-c814ced84bff", "course_grade": "0.7037037037037037", "emission_time": "2021-12-29 07:59:57"}, {"org": "Org2", "course_key": "course-v1:Org2+DemoX+e4380c", "actor_id": "a5a50fa7-26c3-405d-95bb-d1b351ffa191", "course_grade": "0.9491525423728814", "emission_time": "2022-02-11 14:03:00"}, {"org": "Org2", "course_key": "course-v1:Org2+DemoX+e4380c", "actor_id": "c9d7fefc-f8bd-4162-8a2c-bdba6da6b624", "course_grade": "0.32558139534883723", "emission_time": "2022-02-13 19:10:54"}, {"org": "Org2", "course_key": "course-v1:Org2+DemoX+e4380c", "actor_id": "f360e005-29c1-4ad8-92a8-308d7047dc6e", "course_grade": "0.5", "emission_time": "2022-02-10 04:52:18"}, {"org": "Org2", "course_key": "course-v1:Org2+DemoX+e4380c", "actor_id": "f8b778fb-aff9-4b63-8fe3-d578f3891dd8", "course_grade": "1", "emission_time": "2021-12-13 07:00:13"}, {"org": "Org3", "course_key": "course-v1:Org3+DemoX+528fdd", "actor_id": "3f5c36e9-d6ac-422d-9c83-ca3f1d38aa71", "course_grade": "0", "emission_time": "2019-10-22 22:26:25"}, {"org": "Org3", "course_key": "course-v1:Org3+DemoX+528fdd", "actor_id": "43e0dba8-fc43-4567-824d-68bfabb1f312", "course_grade": "1", "emission_time": "2019-11-24 00:00:12"}, {"org": "Org3", "course_key": "course-v1:Org3+DemoX+528fdd", "actor_id": "465fe6bb-9894-4480-b8ef-e54d97d77fea", "course_grade": "0", "emission_time": "2019-11-20 13:49:47"}, {"org": "Org3", "course_key": "course-v1:Org3+DemoX+528fdd", "actor_id": "49a47dcd-f33e-4ad5-9416-a248494a85af", "course_grade": "0.8333333333333334", "emission_time": "2019-12-04 20:09:37"}, {"org": "Org3", "course_key": "course-v1:Org3+DemoX+528fdd", "actor_id": "9e2f08c5-77f0-4508-99c6-88549bf7c0b4", "course_grade": "0.8611111111111112", "emission_time": "2019-10-18 09:21:54"}, {"org": "Org3", "course_key": "course-v1:Org3+DemoX+528fdd", "actor_id": "9fa89875-36d7-465e-9bae-a05c0e252db4", "course_grade": "0.14285714285714285", "emission_time": "2019-11-28 00:41:08"}, {"org": "Org3", "course_key": "course-v1:Org3+DemoX+528fdd", "actor_id": "c217b4e2-3bf7-44db-9193-e1abbd905533", "course_grade": "0.2727272727272727", "emission_time": "2019-11-19 20:36:08"}, {"org": "Org3", "course_key": "course-v1:Org3+DemoX+528fdd", "actor_id": "c838016f-6640-44d9-a038-33a7cc4018a9", "course_grade": "0.9722222222222222", "emission_time": "2019-11-23 01:27:41"}, {"org": "Org3", "course_key": "course-v1:Org3+DemoX+528fdd", "actor_id": "c9d7fefc-f8bd-4162-8a2c-bdba6da6b624", "course_grade": "0.09782608695652174", "emission_time": "2019-12-09 12:59:07"}, {"org": "Org3", "course_key": "course-v1:Org3+DemoX+528fdd", "actor_id": "d48677ac-2373-457c-8318-30cd736ed206", "course_grade": "0.6379310344827587", "emission_time": "2019-11-22 01:07:06"}, {"org": "Org4", "course_key": "course-v1:Org4+DemoX+0b1656", "actor_id": "060967b4-0899-411a-abba-2fa9528211d9", "course_grade": "1", "emission_time": "2019-10-06 19:31:46"}, {"org": "Org4", "course_key": "course-v1:Org4+DemoX+0b1656", "actor_id": "100752b0-091b-40a3-9087-52f0d4aaeb8c", "course_grade": "1", "emission_time": "2019-10-02 21:06:02"}, {"org": "Org4", "course_key": "course-v1:Org4+DemoX+0b1656", "actor_id": "1bf5ad2e-5eb7-4209-bb1c-ca2f4c8826e0", "course_grade": "0.25862068965517243", "emission_time": "2019-09-22 20:50:58"}, {"org": "Org4", "course_key": "course-v1:Org4+DemoX+0b1656", "actor_id": "3760462a-fbb0-45dc-b5e5-76e6c60c72e1", "course_grade": "0.9636363636363636", "emission_time": "2019-09-05 22:04:51"}, {"org": "Org4", "course_key": "course-v1:Org4+DemoX+0b1656", "actor_id": "3ae0a6e3-21af-4185-b3f1-c7125d1c2ac3", "course_grade": "0.1724137931034483", "emission_time": "2019-10-01 14:24:07"}, {"org": "Org4", "course_key": "course-v1:Org4+DemoX+0b1656", "actor_id": "43e0dba8-fc43-4567-824d-68bfabb1f312", "course_grade": "0.21212121212121213", "emission_time": "2019-07-08 23:55:34"}, {"org": "Org4", "course_key": "course-v1:Org4+DemoX+0b1656", "actor_id": "47f03e71-bf89-470b-8cb5-8affbc109aff", "course_grade": "0.631578947368421", "emission_time": "2019-09-09 11:41:04"}, {"org": "Org4", "course_key": "course-v1:Org4+DemoX+0b1656", "actor_id": "4e4f1903-4d45-4b85-94d5-af29757b8396", "course_grade": "0.14285714285714285", "emission_time": "2019-07-28 08:23:52"}, {"org": "Org4", "course_key": "course-v1:Org4+DemoX+0b1656", "actor_id": "78dc54d4-e68f-4853-b5e3-7a65357fe6ac", "course_grade": "0.21739130434782608", "emission_time": "2019-10-03 02:59:34"}, {"org": "Org4", "course_key": "course-v1:Org4+DemoX+0b1656", "actor_id": "829a9444-ced3-4273-9e4b-e8a8bb790c48", "course_grade": "0.10204081632653061", "emission_time": "2019-09-30 13:11:31"}, {"org": "Org4", "course_key": "course-v1:Org4+DemoX+0b1656", "actor_id": "8cdaa227-33f8-4d0c-8996-b75373f7394b", "course_grade": "0.9523809523809523", "emission_time": "2019-08-16 19:06:11"}, {"org": "Org4", "course_key": "course-v1:Org4+DemoX+0b1656", "actor_id": "a1de350b-e587-4b57-8fc3-48feb69fd890", "course_grade": "0.8717948717948718", "emission_time": "2019-08-14 21:57:51"}, {"org": "Org4", "course_key": "course-v1:Org4+DemoX+0b1656", "actor_id": "abb4911f-0c4a-4904-8004-aacfeb710346", "course_grade": "0.21568627450980393", "emission_time": "2019-08-20 04:43:18"}, {"org": "Org4", "course_key": "course-v1:Org4+DemoX+0b1656", "actor_id": "ac01d5b9-84a7-4df4-bfba-e91dcfad1c14", "course_grade": "0.8526315789473684", "emission_time": "2019-10-06 08:54:14"}, {"org": "Org4", "course_key": "course-v1:Org4+DemoX+0b1656", "actor_id": "d48677ac-2373-457c-8318-30cd736ed206", "course_grade": "0", "emission_time": "2019-10-07 19:16:02"}, {"org": "Org4", "course_key": "course-v1:Org4+DemoX+0b1656", "actor_id": "f360e005-29c1-4ad8-92a8-308d7047dc6e", "course_grade": "0.3723404255319149", "emission_time": "2019-09-11 10:42:56"}, {"org": "Org4", "course_key": "course-v1:Org4+DemoX+0b1656", "actor_id": "f5975641-7160-4d20-9989-c7f9a993d32c", "course_grade": "0.7777777777777778", "emission_time": "2019-09-12 07:39:30"}, {"org": "Org4", "course_key": "course-v1:Org4+DemoX+0b1656", "actor_id": "fc35c856-a8c5-4110-b4b4-15b2025094d8", "course_grade": "0.5535714285714286", "emission_time": "2019-08-19 20:27:06"}, {"org": "Org4", "course_key": "course-v1:Org4+DemoX+db4c73", "actor_id": "0f764bed-e5da-4d50-89d3-66aac42b50e5", "course_grade": "0.17857142857142858", "emission_time": "2021-09-18 00:19:01"}, {"org": "Org4", "course_key": "course-v1:Org4+DemoX+db4c73", "actor_id": "10063b09-875d-4c3b-8b9c-283aef97a348", "course_grade": "0.9047619047619048", "emission_time": "2021-08-09 09:04:46"}, {"org": "Org4", "course_key": "course-v1:Org4+DemoX+db4c73", "actor_id": "107459eb-506c-4347-93d5-22637996edf1", "course_grade": "0.29411764705882354", "emission_time": "2021-08-16 00:10:13"}, {"org": "Org4", "course_key": "course-v1:Org4+DemoX+db4c73", "actor_id": "272f9b05-b2c8-4755-aa4b-087875c8104b", "course_grade": "0.2727272727272727", "emission_time": "2021-09-03 08:51:59"}, {"org": "Org4", "course_key": "course-v1:Org4+DemoX+db4c73", "actor_id": "3058e600-5bee-4018-920e-52a311963d88", "course_grade": "0.7857142857142857", "emission_time": "2021-08-03 14:26:15"}, {"org": "Org4", "course_key": "course-v1:Org4+DemoX+db4c73", "actor_id": "3c83b6e9-d3d3-4c18-b6d6-956c1d8334a2", "course_grade": "0.21739130434782608", "emission_time": "2021-06-15 19:29:47"}, {"org": "Org4", "course_key": "course-v1:Org4+DemoX+db4c73", "actor_id": "4e0fc096-65d9-4b41-bcbd-564b054e532e", "course_grade": "0.6862745098039216", "emission_time": "2021-09-14 07:34:12"}, {"org": "Org4", "course_key": "course-v1:Org4+DemoX+db4c73", "actor_id": "4e4f1903-4d45-4b85-94d5-af29757b8396", "course_grade": "0.40425531914893614", "emission_time": "2021-09-02 13:46:02"}, {"org": "Org4", "course_key": "course-v1:Org4+DemoX+db4c73", "actor_id": "58d4edfa-97c1-42ba-9ea4-3428c4e3cad9", "course_grade": "0.7457627118644068", "emission_time": "2021-09-16 14:42:06"}, {"org": "Org4", "course_key": "course-v1:Org4+DemoX+db4c73", "actor_id": "70b53781-f71d-4051-9760-3874b4473a57", "course_grade": "0.8867924528301887", "emission_time": "2021-09-08 05:14:22"}, {"org": "Org4", "course_key": "course-v1:Org4+DemoX+db4c73", "actor_id": "9344e7e6-2388-4b1b-b6b8-5040aad08ff7", "course_grade": "0.6", "emission_time": "2021-08-23 13:23:55"}, {"org": "Org4", "course_key": "course-v1:Org4+DemoX+db4c73", "actor_id": "9d97277c-9df9-475e-a231-1af77bf3311f", "course_grade": "0.38095238095238093", "emission_time": "2021-07-20 07:37:47"}, {"org": "Org4", "course_key": "course-v1:Org4+DemoX+db4c73", "actor_id": "a499a2bb-c627-4916-92d1-f6ae6ac57a71", "course_grade": "0.625", "emission_time": "2021-09-12 19:25:10"}, {"org": "Org4", "course_key": "course-v1:Org4+DemoX+db4c73", "actor_id": "ac01d5b9-84a7-4df4-bfba-e91dcfad1c14", "course_grade": "0.0273972602739726", "emission_time": "2021-09-18 11:05:55"}, {"org": "Org7", "course_key": "course-v1:Org7+DemoX+57295b", "actor_id": "0f764bed-e5da-4d50-89d3-66aac42b50e5", "course_grade": "0.09090909090909091", "emission_time": "2023-12-15 11:12:04"}, {"org": "Org7", "course_key": "course-v1:Org7+DemoX+57295b", "actor_id": "1efff542-8cfc-4bc9-863d-1bdd3c521515", "course_grade": "0.5675675675675675", "emission_time": "2023-12-20 05:07:30"}, {"org": "Org7", "course_key": "course-v1:Org7+DemoX+57295b", "actor_id": "3ae0a6e3-21af-4185-b3f1-c7125d1c2ac3", "course_grade": "0.6111111111111112", "emission_time": "2023-12-10 07:41:10"}, {"org": "Org7", "course_key": "course-v1:Org7+DemoX+57295b", "actor_id": "3c83b6e9-d3d3-4c18-b6d6-956c1d8334a2", "course_grade": "0.9104477611940298", "emission_time": "2023-12-22 16:39:38"}, {"org": "Org7", "course_key": "course-v1:Org7+DemoX+57295b", "actor_id": "43e0dba8-fc43-4567-824d-68bfabb1f312", "course_grade": "0.711340206185567", "emission_time": "2023-09-17 02:02:42"}, {"org": "Org7", "course_key": "course-v1:Org7+DemoX+57295b", "actor_id": "49a47dcd-f33e-4ad5-9416-a248494a85af", "course_grade": "0.3488372093023256", "emission_time": "2023-10-02 16:15:16"}, {"org": "Org7", "course_key": "course-v1:Org7+DemoX+57295b", "actor_id": "78dc54d4-e68f-4853-b5e3-7a65357fe6ac", "course_grade": "0.09302325581395349", "emission_time": "2023-11-29 14:24:49"}, {"org": "Org7", "course_key": "course-v1:Org7+DemoX+57295b", "actor_id": "829a9444-ced3-4273-9e4b-e8a8bb790c48", "course_grade": "0.8494623655913979", "emission_time": "2023-12-15 04:25:38"}, {"org": "Org7", "course_key": "course-v1:Org7+DemoX+57295b", "actor_id": "95af96c4-e45b-401e-b700-e1f147d36297", "course_grade": "0.15853658536585366", "emission_time": "2023-12-21 16:27:34"}, {"org": "Org7", "course_key": "course-v1:Org7+DemoX+57295b", "actor_id": "a28e2d80-0b93-4730-973f-15f8b18696de", "course_grade": "0.4444444444444444", "emission_time": "2023-12-27 05:57:32"}, {"org": "Org7", "course_key": "course-v1:Org7+DemoX+57295b", "actor_id": "bc9d00aa-2239-4a94-90de-b3ea4d390bc0", "course_grade": "0.8214285714285714", "emission_time": "2023-11-13 15:42:57"}, {"org": "Org7", "course_key": "course-v1:Org7+DemoX+57295b", "actor_id": "d1396620-e0d3-499c-ada0-f3ba27f9463b", "course_grade": "1", "emission_time": "2023-11-10 07:11:07"}, {"org": "Org7", "course_key": "course-v1:Org7+DemoX+57295b", "actor_id": "fc35c856-a8c5-4110-b4b4-15b2025094d8", "course_grade": "0.8571428571428571", "emission_time": "2023-12-05 11:01:22"}, {"org": "Org7", "course_key": "course-v1:Org7+DemoX+57295b", "actor_id": "ff10a27a-fe60-41b6-aa8e-823770c210a3", "course_grade": "0.3645833333333333", "emission_time": "2023-12-03 15:54:23"}, {"org": "Org8", "course_key": "course-v1:Org8+DemoX+3fefec", "actor_id": "0f764bed-e5da-4d50-89d3-66aac42b50e5", "course_grade": "0.1", "emission_time": "2021-04-10 23:21:35"}, {"org": "Org8", "course_key": "course-v1:Org8+DemoX+3fefec", "actor_id": "33909a28-f02d-414f-9794-58bfb18cb977", "course_grade": "0.75", "emission_time": "2021-04-12 09:21:01"}, {"org": "Org8", "course_key": "course-v1:Org8+DemoX+3fefec", "actor_id": "3c83b6e9-d3d3-4c18-b6d6-956c1d8334a2", "course_grade": "1", "emission_time": "2021-03-23 22:47:43"}, {"org": "Org8", "course_key": "course-v1:Org8+DemoX+3fefec", "actor_id": "44b445b8-97e5-4208-abcd-5e1b08ee9569", "course_grade": "0.18181818181818182", "emission_time": "2021-04-21 01:45:15"}, {"org": "Org8", "course_key": "course-v1:Org8+DemoX+3fefec", "actor_id": "465fe6bb-9894-4480-b8ef-e54d97d77fea", "course_grade": "0.9382716049382716", "emission_time": "2021-04-19 09:57:38"}, {"org": "Org8", "course_key": "course-v1:Org8+DemoX+3fefec", "actor_id": "6c0eb8ab-6be1-47d2-bd0d-cf507fd763dc", "course_grade": "0.6578947368421053", "emission_time": "2021-04-06 22:23:38"}, {"org": "Org8", "course_key": "course-v1:Org8+DemoX+3fefec", "actor_id": "9344e7e6-2388-4b1b-b6b8-5040aad08ff7", "course_grade": "0.8333333333333334", "emission_time": "2021-03-05 00:11:51"}, {"org": "Org8", "course_key": "course-v1:Org8+DemoX+3fefec", "actor_id": "abb4911f-0c4a-4904-8004-aacfeb710346", "course_grade": "0.7096774193548387", "emission_time": "2021-03-11 05:21:54"}, {"org": "Org8", "course_key": "course-v1:Org8+DemoX+3fefec", "actor_id": "bc9d00aa-2239-4a94-90de-b3ea4d390bc0", "course_grade": "0.18333333333333332", "emission_time": "2021-04-17 21:51:01"}, {"org": "Org8", "course_key": "course-v1:Org8+DemoX+3fefec", "actor_id": "c9d7fefc-f8bd-4162-8a2c-bdba6da6b624", "course_grade": "0", "emission_time": "2021-04-20 03:12:51"}, {"org": "Org8", "course_key": "course-v1:Org8+DemoX+3fefec", "actor_id": "fbfb0998-6d7e-4047-9235-266965fda410", "course_grade": "0.8095238095238095", "emission_time": "2021-02-20 06:41:40"}], "format": "csv", "fixture": "fact_learner_course_grade_expected"}, "name": "test_fact_learner_course_grade", "resource_type": "unit_test", "package_name": "aspects", "path": "grading/unit_tests.yaml", "original_file_path": "models/grading/unit_tests.yaml", "unique_id": "unit_test.aspects.fact_learner_course_grade.test_fact_learner_course_grade", "fqn": ["aspects", "grading", "fact_learner_course_grade", "test_fact_learner_course_grade"], "description": "", "overrides": null, "depends_on": {"macros": [], "nodes": ["model.aspects.fact_learner_course_grade"]}, "config": {"tags": ["ci"], "meta": {}}, "checksum": "ea54220153538b9c11778368139019c147f9ebdc52b57da85a807dffc7073f9d", "schema": "xapi", "created_at": 1723756272.515972, "versions": null, "version": null}, "unit_test.aspects.fact_learner_course_status.test_fact_learner_course_status": {"model": "fact_learner_course_status", "given": [{"input": "ref('grading_events')", "rows": "select * from grading_events", "format": "sql", "fixture": null}], "expect": {"rows": [{"org": "Org1", "course_key": "course-v1:Org1+DemoX+1937e7", "actor_id": "3f5c36e9-d6ac-422d-9c83-ca3f1d38aa71", "emission_time": "2021-07-27 06:30:19", "approving_state": "passed"}, {"org": "Org3", "course_key": "course-v1:Org3+DemoX+528fdd", "actor_id": "465fe6bb-9894-4480-b8ef-e54d97d77fea", "emission_time": "2019-11-20 13:49:47", "approving_state": "passed"}, {"org": "Org8", "course_key": "course-v1:Org8+DemoX+3fefec", "actor_id": "c9d7fefc-f8bd-4162-8a2c-bdba6da6b624", "emission_time": "2021-04-20 03:12:51", "approving_state": "passed"}], "format": "csv", "fixture": "fact_learner_course_status_expected"}, "name": "test_fact_learner_course_status", "resource_type": "unit_test", "package_name": "aspects", "path": "grading/unit_tests.yaml", "original_file_path": "models/grading/unit_tests.yaml", "unique_id": "unit_test.aspects.fact_learner_course_status.test_fact_learner_course_status", "fqn": ["aspects", "grading", "fact_learner_course_status", "test_fact_learner_course_status"], "description": "", "overrides": null, "depends_on": {"macros": [], "nodes": ["model.aspects.fact_learner_course_status"]}, "config": {"tags": ["ci"], "meta": {}}, "checksum": "362e4a4eebc4c3164564992707f103c5eb190adba16e06d2797667a07c56df7f", "schema": "xapi", "created_at": 1723756272.5178106, "versions": null, "version": null}, "unit_test.aspects.fact_student_status.test_fact_student_status": {"model": "fact_student_status", "given": [{"input": "ref('fact_enrollment_status')", "rows": "select * from fact_enrollment_status", "format": "sql", "fixture": null}, {"input": "ref('fact_learner_course_status')", "rows": "select * from fact_learner_course_status", "format": "sql", "fixture": null}, {"input": "ref('fact_learner_course_grade')", "rows": "select * from fact_learner_course_grade", "format": "sql", "fixture": null}, {"input": "ref('course_names')", "rows": "select * from course_names", "format": "sql", "fixture": null}, {"input": "ref('dim_user_pii')", "rows": "select * from dim_user_pii", "format": "sql", "fixture": null}], "expect": {"rows": "select * from fact_student_status_expected", "format": "sql", "fixture": null}, "name": "test_fact_student_status", "resource_type": "unit_test", "package_name": "aspects", "path": "grading/unit_tests.yaml", "original_file_path": "models/grading/unit_tests.yaml", "unique_id": "unit_test.aspects.fact_student_status.test_fact_student_status", "fqn": ["aspects", "grading", "fact_student_status", "test_fact_student_status"], "description": "", "overrides": null, "depends_on": {"macros": [], "nodes": ["model.aspects.fact_student_status"]}, "config": {"tags": ["ci"], "meta": {}}, "checksum": "a3667d982d1bef6cc84064449881785273c7d4564621a737a5eeed4f8be7e527", "schema": "xapi", "created_at": 1723756272.5204716, "versions": null, "version": null}, "unit_test.aspects.problem_events.test_problem_events": {"model": "problem_events", "given": [{"input": "ref('xapi_events_all_parsed')", "rows": "select * from xapi_events_all_parsed", "format": "sql", "fixture": null}], "expect": {"rows": "select * from problem_events_expected", "format": "sql", "fixture": null}, "name": "test_problem_events", "resource_type": "unit_test", "package_name": "aspects", "path": "problems/unit_tests.yaml", "original_file_path": "models/problems/unit_tests.yaml", "unique_id": "unit_test.aspects.problem_events.test_problem_events", "fqn": ["aspects", "problems", "problem_events", "test_problem_events"], "description": "", "overrides": null, "depends_on": {"macros": [], "nodes": ["model.aspects.problem_events"]}, "config": {"tags": ["ci"], "meta": {}}, "checksum": "352c286e0047ec054a2c0c1b485462a4aa739337df3ddb3860afe528def98d75", "schema": "xapi", "created_at": 1723756272.5215147, "versions": null, "version": null}, "unit_test.aspects.fact_problem_responses.test_fact_problem_responses": {"model": "fact_problem_responses", "given": [{"input": "ref('problem_events')", "rows": "select * from problem_events", "format": "sql", "fixture": null}, {"input": "ref('dim_course_blocks')", "rows": "select * from dim_course_blocks", "format": "sql", "fixture": null}, {"input": "ref('dim_user_pii')", "rows": "select * from dim_user_pii", "format": "sql", "fixture": null}], "expect": {"rows": "select * from fact_problem_responses_expected", "format": "sql", "fixture": null}, "name": "test_fact_problem_responses", "resource_type": "unit_test", "package_name": "aspects", "path": "problems/unit_tests.yaml", "original_file_path": "models/problems/unit_tests.yaml", "unique_id": "unit_test.aspects.fact_problem_responses.test_fact_problem_responses", "fqn": ["aspects", "problems", "fact_problem_responses", "test_fact_problem_responses"], "description": "", "overrides": null, "depends_on": {"macros": [], "nodes": ["model.aspects.fact_problem_responses"]}, "config": {"tags": ["ci"], "meta": {}}, "checksum": "e957e394172f6eaa9ab43f4f302abfd41a9cba125d0133f94eceb14f14ed9982", "schema": "xapi", "created_at": 1723756272.5235982, "versions": null, "version": null}, "unit_test.aspects.int_problem_hints.test_int_problem_hints": {"model": "int_problem_hints", "given": [{"input": "ref('problem_events')", "rows": "select * from problem_events", "format": "sql", "fixture": null}, {"input": "ref('dim_course_blocks')", "rows": "select * from dim_course_blocks", "format": "sql", "fixture": null}], "expect": {"rows": "select * from int_problem_hints_expected", "format": "sql", "fixture": null}, "name": "test_int_problem_hints", "resource_type": "unit_test", "package_name": "aspects", "path": "problems/unit_tests.yaml", "original_file_path": "models/problems/unit_tests.yaml", "unique_id": "unit_test.aspects.int_problem_hints.test_int_problem_hints", "fqn": ["aspects", "problems", "int_problem_hints", "test_int_problem_hints"], "description": "", "overrides": null, "depends_on": {"macros": [], "nodes": ["model.aspects.int_problem_hints"]}, "config": {"tags": ["ci"], "meta": {}}, "checksum": "41308fff3889e1752293620f111585da9b583b14795b83372f97711487b7a8ad", "schema": "xapi", "created_at": 1723756272.524744, "versions": null, "version": null}, "unit_test.aspects.responses.test_responses": {"model": "responses", "given": [{"input": "ref('problem_events')", "rows": "select * from problem_events", "format": "sql", "fixture": null}], "expect": {"rows": "select * from responses_expected", "format": "sql", "fixture": null}, "name": "test_responses", "resource_type": "unit_test", "package_name": "aspects", "path": "problems/unit_tests.yaml", "original_file_path": "models/problems/unit_tests.yaml", "unique_id": "unit_test.aspects.responses.test_responses", "fqn": ["aspects", "problems", "responses", "test_responses"], "description": "", "overrides": null, "depends_on": {"macros": [], "nodes": ["model.aspects.responses"]}, "config": {"tags": ["ci"], "meta": {}}, "checksum": "66aef0a07a9e15aa96ec14eb1b0071616382606ed81fd00d41f1ba6dae6db5b8", "schema": "xapi", "created_at": 1723756272.5256891, "versions": null, "version": null}, "unit_test.aspects.int_problem_results.test_int_problem_results": {"model": "int_problem_results", "given": [{"input": "ref('problem_events')", "rows": "select * from problem_events", "format": "sql", "fixture": null}, {"input": "ref('responses')", "rows": "select * from responses", "format": "sql", "fixture": null}, {"input": "ref('dim_course_blocks')", "rows": "select * from dim_course_blocks", "format": "sql", "fixture": null}], "expect": {"rows": "select * from int_problem_results_expected", "format": "sql", "fixture": null}, "name": "test_int_problem_results", "resource_type": "unit_test", "package_name": "aspects", "path": "problems/unit_tests.yaml", "original_file_path": "models/problems/unit_tests.yaml", "unique_id": "unit_test.aspects.int_problem_results.test_int_problem_results", "fqn": ["aspects", "problems", "int_problem_results", "test_int_problem_results"], "description": "", "overrides": null, "depends_on": {"macros": [], "nodes": ["model.aspects.int_problem_results"]}, "config": {"tags": ["ci"], "meta": {}}, "checksum": "18bcd158430358f0068ffb2a3037c0d3fac2213d0d3ec9c77a00d9362fb52736", "schema": "xapi", "created_at": 1723756272.527197, "versions": null, "version": null}, "unit_test.aspects.subsection_problem_engagement.test_subsection_problem_engagement": {"model": "subsection_problem_engagement", "given": [{"input": "ref('problem_events')", "rows": "select * from problem_events", "format": "sql", "fixture": null}, {"input": "ref('int_problems_per_subsection')", "rows": "select * from int_problems_per_subsection", "format": "sql", "fixture": null}, {"input": "ref('dim_course_blocks')", "rows": "select * from dim_course_blocks", "format": "sql", "fixture": null}], "expect": {"rows": "select * from subsection_problem_engagement_expected", "format": "sql", "fixture": null}, "name": "test_subsection_problem_engagement", "resource_type": "unit_test", "package_name": "aspects", "path": "problems/unit_tests.yaml", "original_file_path": "models/problems/unit_tests.yaml", "unique_id": "unit_test.aspects.subsection_problem_engagement.test_subsection_problem_engagement", "fqn": ["aspects", "problems", "subsection_problem_engagement", "test_subsection_problem_engagement"], "description": "", "overrides": null, "depends_on": {"macros": [], "nodes": ["model.aspects.subsection_problem_engagement"]}, "config": {"tags": ["ci"], "meta": {}}, "checksum": "4bb2fce399c9042b27a07c3ca8edf6cfe2417e7f6bb1ddc1f6e5a68984703c5c", "schema": "xapi", "created_at": 1723756272.5287614, "versions": null, "version": null}, "unit_test.aspects.xapi_events_all_parsed.test_xapi_events_all_parsed": {"model": "xapi_events_all_parsed", "given": [{"input": "source(\"xapi\", \"xapi_events_all\")", "rows": "select * from xapi.xapi_events_all", "format": "sql", "fixture": null}], "expect": {"rows": "select * from xapi_events_all_parsed_expected", "format": "sql", "fixture": null}, "name": "test_xapi_events_all_parsed", "resource_type": "unit_test", "package_name": "aspects", "path": "base/unit_tests.yaml", "original_file_path": "models/base/unit_tests.yaml", "unique_id": "unit_test.aspects.xapi_events_all_parsed.test_xapi_events_all_parsed", "fqn": ["aspects", "base", "xapi_events_all_parsed", "test_xapi_events_all_parsed"], "description": "", "overrides": null, "depends_on": {"macros": [], "nodes": ["model.aspects.xapi_events_all_parsed"]}, "config": {"tags": ["ci"], "meta": {}}, "checksum": "e55872e02e74e32a8161ece04cf51ac51f14cdc261fd50ffc7ecdd51aba24f6e", "schema": "xapi", "created_at": 1723756272.5303, "versions": null, "version": null}, "unit_test.aspects.navigation_events.test_navigation_events": {"model": "navigation_events", "given": [{"input": "ref('xapi_events_all_parsed')", "rows": "select * from xapi_events_all_parsed", "format": "sql", "fixture": null}], "expect": {"rows": "select * from navigation_events_expected", "format": "sql", "fixture": null}, "name": "test_navigation_events", "resource_type": "unit_test", "package_name": "aspects", "path": "navigation/unit_tests.yaml", "original_file_path": "models/navigation/unit_tests.yaml", "unique_id": "unit_test.aspects.navigation_events.test_navigation_events", "fqn": ["aspects", "navigation", "navigation_events", "test_navigation_events"], "description": "", "overrides": null, "depends_on": {"macros": [], "nodes": ["model.aspects.navigation_events"]}, "config": {"tags": ["ci"], "meta": {}}, "checksum": "7cec5caa66ef5a15c87c60f5b65f10bdacd71eb7839e96d6af8280de91fa49b6", "schema": "xapi", "created_at": 1723756272.5313356, "versions": null, "version": null}, "unit_test.aspects.fact_navigation.test_fact_navigation": {"model": "fact_navigation", "given": [{"input": "ref('navigation_events')", "rows": "select * from navigation_events", "format": "sql", "fixture": null}, {"input": "ref('dim_course_blocks')", "rows": "select * from dim_course_blocks", "format": "sql", "fixture": null}, {"input": "ref('dim_user_pii')", "rows": "select * from dim_user_pii", "format": "sql", "fixture": null}], "expect": {"rows": "select * from fact_navigation_expected", "format": "sql", "fixture": null}, "name": "test_fact_navigation", "resource_type": "unit_test", "package_name": "aspects", "path": "navigation/unit_tests.yaml", "original_file_path": "models/navigation/unit_tests.yaml", "unique_id": "unit_test.aspects.fact_navigation.test_fact_navigation", "fqn": ["aspects", "navigation", "fact_navigation", "test_fact_navigation"], "description": "", "overrides": null, "depends_on": {"macros": [], "nodes": ["model.aspects.fact_navigation"]}, "config": {"tags": ["ci"], "meta": {}}, "checksum": "4480e7af0cff1f530650ef13062f065249858147eff1f31bbc2ab19634dc3614", "schema": "xapi", "created_at": 1723756272.532932, "versions": null, "version": null}, "unit_test.aspects.fact_navigation_completion.test_fact_navigation_completion": {"model": "fact_navigation_completion", "given": [{"input": "ref('fact_navigation')", "rows": "select * from fact_navigation", "format": "sql", "fixture": null}, {"input": "ref('int_pages_per_subsection')", "rows": "select * from int_pages_per_subsection", "format": "sql", "fixture": null}], "expect": {"rows": "select * from fact_navigation_completion_expected", "format": "sql", "fixture": null}, "name": "test_fact_navigation_completion", "resource_type": "unit_test", "package_name": "aspects", "path": "navigation/unit_tests.yaml", "original_file_path": "models/navigation/unit_tests.yaml", "unique_id": "unit_test.aspects.fact_navigation_completion.test_fact_navigation_completion", "fqn": ["aspects", "navigation", "fact_navigation_completion", "test_fact_navigation_completion"], "description": "", "overrides": null, "depends_on": {"macros": [], "nodes": ["model.aspects.fact_navigation_completion"]}, "config": {"tags": ["ci"], "meta": {}}, "checksum": "bd36fe9a7986de81ad13b417ef0d6148ecf61d2c332ecb43a9657181b74aa563", "schema": "xapi", "created_at": 1723756272.5351717, "versions": null, "version": null}, "unit_test.aspects.section_page_engagement.test_section_page_engagement": {"model": "section_page_engagement", "given": [{"input": "ref('navigation_events')", "rows": "select * from navigation_events", "format": "sql", "fixture": null}, {"input": "ref('dim_course_blocks')", "rows": "select * from dim_course_blocks", "format": "sql", "fixture": null}, {"input": "ref('int_pages_per_subsection')", "rows": "select * from int_pages_per_subsection", "format": "sql", "fixture": null}], "expect": {"rows": "select * from section_page_engagement_expected", "format": "sql", "fixture": null}, "name": "test_section_page_engagement", "resource_type": "unit_test", "package_name": "aspects", "path": "navigation/unit_tests.yaml", "original_file_path": "models/navigation/unit_tests.yaml", "unique_id": "unit_test.aspects.section_page_engagement.test_section_page_engagement", "fqn": ["aspects", "navigation", "section_page_engagement", "test_section_page_engagement"], "description": "", "overrides": null, "depends_on": {"macros": [], "nodes": ["model.aspects.section_page_engagement"]}, "config": {"tags": ["ci"], "meta": {}}, "checksum": "5b26c7db58692ccf3ead8571cb55812c451a362a2dbbe56eacf4689d38c41081", "schema": "xapi", "created_at": 1723756272.5361853, "versions": null, "version": null}, "unit_test.aspects.subsection_page_engagement.test_subsection_page_engagement": {"model": "subsection_page_engagement", "given": [{"input": "ref('navigation_events')", "rows": "select * from navigation_events", "format": "sql", "fixture": null}, {"input": "ref('dim_course_blocks')", "rows": "select * from dim_course_blocks", "format": "sql", "fixture": null}, {"input": "ref('int_pages_per_subsection')", "rows": "select * from int_pages_per_subsection", "format": "sql", "fixture": null}], "expect": {"rows": "select * from subsection_page_engagement_expected", "format": "sql", "fixture": null}, "name": "test_subsection_page_engagement", "resource_type": "unit_test", "package_name": "aspects", "path": "navigation/unit_tests.yaml", "original_file_path": "models/navigation/unit_tests.yaml", "unique_id": "unit_test.aspects.subsection_page_engagement.test_subsection_page_engagement", "fqn": ["aspects", "navigation", "subsection_page_engagement", "test_subsection_page_engagement"], "description": "", "overrides": null, "depends_on": {"macros": [], "nodes": ["model.aspects.subsection_page_engagement"]}, "config": {"tags": ["ci"], "meta": {}}, "checksum": "52ae3a98f428ab05b748e9d79cf9d5b0ece49edeb533954d21c16b5e0bd6ded9", "schema": "xapi", "created_at": 1723756272.5372064, "versions": null, "version": null}, "unit_test.aspects.fact_pageview_engagement.test_fact_pageview_engagement": {"model": "fact_pageview_engagement", "given": [{"input": "ref('subsection_page_engagement')", "rows": "select * from subsection_page_engagement", "format": "sql", "fixture": null}, {"input": "ref('section_page_engagement')", "rows": "select * from section_page_engagement", "format": "sql", "fixture": null}, {"input": "ref('dim_course_blocks')", "rows": "select * from dim_course_blocks", "format": "sql", "fixture": null}, {"input": "ref('dim_user_pii')", "rows": "select * from dim_user_pii", "format": "sql", "fixture": null}], "expect": {"rows": "select * from fact_pageview_engagement_expected", "format": "sql", "fixture": null}, "name": "test_fact_pageview_engagement", "resource_type": "unit_test", "package_name": "aspects", "path": "navigation/unit_tests.yaml", "original_file_path": "models/navigation/unit_tests.yaml", "unique_id": "unit_test.aspects.fact_pageview_engagement.test_fact_pageview_engagement", "fqn": ["aspects", "navigation", "fact_pageview_engagement", "test_fact_pageview_engagement"], "description": "", "overrides": null, "depends_on": {"macros": [], "nodes": ["model.aspects.fact_pageview_engagement"]}, "config": {"tags": ["ci"], "meta": {}}, "checksum": "9d81886ab08d129ec0aeb600d3f2de8f66637e18deb9b5c2a6f322c7dcbe964a", "schema": "xapi", "created_at": 1723756272.5392795, "versions": null, "version": null}, "unit_test.aspects.int_pages_per_subsection.test_macro_items_per_subsection": {"model": "int_pages_per_subsection", "given": [{"input": "ref('dim_course_blocks')", "rows": "select * from dim_course_blocks", "format": "sql", "fixture": null}], "expect": {"rows": "select * from items_per_subsection_expected", "format": "sql", "fixture": null}, "name": "test_macro_items_per_subsection", "resource_type": "unit_test", "package_name": "aspects", "path": "navigation/unit_tests.yaml", "original_file_path": "models/navigation/unit_tests.yaml", "unique_id": "unit_test.aspects.int_pages_per_subsection.test_macro_items_per_subsection", "fqn": ["aspects", "navigation", "int_pages_per_subsection", "test_macro_items_per_subsection"], "description": "", "overrides": null, "depends_on": {"macros": [], "nodes": ["model.aspects.int_pages_per_subsection"]}, "config": {"tags": ["ci"], "meta": {}}, "checksum": "b927cade7608af7b5c3fc9532a629c530c9a16f181b7da1fc68a55621520f439", "schema": "xapi", "created_at": 1723756272.5402148, "versions": null, "version": null}, "unit_test.aspects.most_recent_course_blocks.test_most_recent_course_blocks": {"model": "most_recent_course_blocks", "given": [{"input": "source(\"event_sink\", \"course_blocks\")", "rows": "select * from event_sink.course_blocks", "format": "sql", "fixture": null}], "expect": {"rows": "select * from most_recent_course_blocks_expected", "format": "sql", "fixture": null}, "name": "test_most_recent_course_blocks", "resource_type": "unit_test", "package_name": "aspects", "path": "courses/unit_tests.yaml", "original_file_path": "models/courses/unit_tests.yaml", "unique_id": "unit_test.aspects.most_recent_course_blocks.test_most_recent_course_blocks", "fqn": ["aspects", "courses", "most_recent_course_blocks", "test_most_recent_course_blocks"], "description": "", "overrides": null, "depends_on": {"macros": [], "nodes": ["model.aspects.most_recent_course_blocks"]}, "config": {"tags": ["ci"], "meta": {}}, "checksum": "1d63c905aa77f271bec958f3c616c858a1e7e8402f5993d656ddcb6946619d17", "schema": "xapi", "created_at": 1723756272.5417664, "versions": null, "version": null}, "unit_test.aspects.course_names.test_course_names": {"model": "course_names", "given": [{"input": "source(\"event_sink\", \"course_overviews\")", "rows": "select * from event_sink.course_overviews", "format": "sql", "fixture": null}], "expect": {"rows": [{"course_key": "course-v1:Org0+DemoX+2bc51b", "course_name": "2bc51b (small)", "course_run": "2bc51b", "org": "Org0"}, {"course_key": "course-v1:Org0+DemoX+81bba1", "course_name": "81bba1 (small)", "course_run": "81bba1", "org": "Org0"}, {"course_key": "course-v1:Org3+DemoX+528fdd", "course_name": "528fdd (small)", "course_run": "528fdd", "org": "Org3"}, {"course_key": "course-v1:Org2+DemoX+682526", "course_name": "682526 (medium)", "course_run": "682526", "org": "Org2"}, {"course_key": "course-v1:Org7+DemoX+57295b", "course_name": "57295b (medium)", "course_run": "57295b", "org": "Org7"}, {"course_key": "course-v1:Org8+DemoX+3fefec", "course_name": "3fefec (medium)", "course_run": "3fefec", "org": "Org8"}, {"course_key": "course-v1:Org4+DemoX+db4c73", "course_name": "db4c73 (large)", "course_run": "db4c73", "org": "Org4"}, {"course_key": "course-v1:Org1+DemoX+1937e7", "course_name": "1937e7 (large)", "course_run": "1937e7", "org": "Org1"}, {"course_key": "course-v1:Org4+DemoX+0b1656", "course_name": "0b1656 (huge)", "course_run": "0b1656", "org": "Org4"}, {"course_key": "course-v1:Org2+DemoX+e4380c", "course_name": "e4380c (huge)", "course_run": "e4380c", "org": "Org2"}], "format": "csv", "fixture": "course_names_expected"}, "name": "test_course_names", "resource_type": "unit_test", "package_name": "aspects", "path": "courses/unit_tests.yaml", "original_file_path": "models/courses/unit_tests.yaml", "unique_id": "unit_test.aspects.course_names.test_course_names", "fqn": ["aspects", "courses", "course_names", "test_course_names"], "description": "", "overrides": null, "depends_on": {"macros": [], "nodes": ["model.aspects.course_names"]}, "config": {"tags": ["ci"], "meta": {}}, "checksum": "bda2d82f5e5fc74232acab18da06bd276915a0a7d3411e3ebe0b1f299175b4ba", "schema": "xapi", "created_at": 1723756272.5433743, "versions": null, "version": null}, "unit_test.aspects.dim_course_blocks.test_dim_course_blocks": {"model": "dim_course_blocks", "given": [{"input": "ref('course_block_names')", "rows": "select * from course_block_names", "format": "sql", "fixture": null}, {"input": "ref('course_names')", "rows": "select * from course_names", "format": "sql", "fixture": null}], "expect": {"rows": "select * from dim_course_blocks_expected", "format": "sql", "fixture": null}, "name": "test_dim_course_blocks", "resource_type": "unit_test", "package_name": "aspects", "path": "courses/unit_tests.yaml", "original_file_path": "models/courses/unit_tests.yaml", "unique_id": "unit_test.aspects.dim_course_blocks.test_dim_course_blocks", "fqn": ["aspects", "courses", "dim_course_blocks", "test_dim_course_blocks"], "description": "", "overrides": null, "depends_on": {"macros": [], "nodes": ["model.aspects.dim_course_blocks"]}, "config": {"tags": ["dim"], "meta": {}}, "checksum": "4f76f7c6e9c15a6282c34b86bfe6b480fffdcb2326f852cc5321ec196f0d2e41", "schema": "xapi", "created_at": 1723756272.5451605, "versions": null, "version": null}, "unit_test.aspects.dim_course_blocks_extended.test_dim_course_blocks_extended": {"model": "dim_course_blocks_extended", "given": [{"input": "ref('dim_course_blocks')", "rows": "select * from dim_course_blocks", "format": "sql", "fixture": null}], "expect": {"rows": "select * from dim_course_blocks_extended_expected", "format": "sql", "fixture": null}, "name": "test_dim_course_blocks_extended", "resource_type": "unit_test", "package_name": "aspects", "path": "courses/unit_tests.yaml", "original_file_path": "models/courses/unit_tests.yaml", "unique_id": "unit_test.aspects.dim_course_blocks_extended.test_dim_course_blocks_extended", "fqn": ["aspects", "courses", "dim_course_blocks_extended", "test_dim_course_blocks_extended"], "description": "", "overrides": null, "depends_on": {"macros": [], "nodes": ["model.aspects.dim_course_blocks_extended"]}, "config": {"tags": ["ci"], "meta": {}}, "checksum": "ae4110b53564fe97df009dde3e834992d7c5e0347d550c5c320ffa049275e4e5", "schema": "xapi", "created_at": 1723756272.5460782, "versions": null, "version": null}, "unit_test.aspects.video_playback_events.test_video_playback_events": {"model": "video_playback_events", "given": [{"input": "ref('xapi_events_all_parsed')", "rows": "select * from xapi_events_all_parsed", "format": "sql", "fixture": null}], "expect": {"rows": "select * from video_playback_events_expected", "format": "sql", "fixture": null}, "name": "test_video_playback_events", "resource_type": "unit_test", "package_name": "aspects", "path": "video/unit_tests.yaml", "original_file_path": "models/video/unit_tests.yaml", "unique_id": "unit_test.aspects.video_playback_events.test_video_playback_events", "fqn": ["aspects", "video", "video_playback_events", "test_video_playback_events"], "description": "", "overrides": null, "depends_on": {"macros": [], "nodes": ["model.aspects.video_playback_events"]}, "config": {"tags": ["ci"], "meta": {}}, "checksum": "33ff2d6867c179cebb572692ad4c06e9023c4efba1c5d4d8a257dc3f95da1ef3", "schema": "xapi", "created_at": 1723756272.5470679, "versions": null, "version": null}, "unit_test.aspects.fact_video_plays.test_fact_video_plays": {"model": "fact_video_plays", "given": [{"input": "ref('video_playback_events')", "rows": "select * from video_playback_events", "format": "sql", "fixture": null}, {"input": "ref('dim_course_blocks_extended')", "rows": "select * from dim_course_blocks_extended", "format": "sql", "fixture": null}, {"input": "ref('dim_user_pii')", "rows": "select * from dim_user_pii", "format": "sql", "fixture": null}], "expect": {"rows": "select * from fact_video_plays_expected", "format": "sql", "fixture": null}, "name": "test_fact_video_plays", "resource_type": "unit_test", "package_name": "aspects", "path": "video/unit_tests.yaml", "original_file_path": "models/video/unit_tests.yaml", "unique_id": "unit_test.aspects.fact_video_plays.test_fact_video_plays", "fqn": ["aspects", "video", "fact_video_plays", "test_fact_video_plays"], "description": "", "overrides": null, "depends_on": {"macros": [], "nodes": ["model.aspects.fact_video_plays"]}, "config": {"tags": ["ci"], "meta": {}}, "checksum": "e591d0b99775a64721229686a4de8907339e9c7d9af1ae19358be61663edc6e9", "schema": "xapi", "created_at": 1723756272.5491457, "versions": null, "version": null}, "unit_test.aspects.section_video_engagement.test_section_video_engagement": {"model": "section_video_engagement", "given": [{"input": "ref('fact_video_plays')", "rows": "select * from fact_video_plays", "format": "sql", "fixture": null}, {"input": "ref('int_videos_per_subsection')", "rows": "select * from int_videos_per_subsection", "format": "sql", "fixture": null}], "expect": {"rows": "select * from section_video_engagement_expected", "format": "sql", "fixture": null}, "name": "test_section_video_engagement", "resource_type": "unit_test", "package_name": "aspects", "path": "video/unit_tests.yaml", "original_file_path": "models/video/unit_tests.yaml", "unique_id": "unit_test.aspects.section_video_engagement.test_section_video_engagement", "fqn": ["aspects", "video", "section_video_engagement", "test_section_video_engagement"], "description": "", "overrides": null, "depends_on": {"macros": [], "nodes": ["model.aspects.section_video_engagement"]}, "config": {"tags": ["ci"], "meta": {}}, "checksum": "c8da9653c2ff5f15ef11c60e5756a97c4ecaa6b7c39c9f440db0615b96ae31b2", "schema": "xapi", "created_at": 1723756272.5513349, "versions": null, "version": null}, "unit_test.aspects.subsection_video_engagement.test_subsection_video_engagement": {"model": "subsection_video_engagement", "given": [{"input": "ref('fact_video_plays')", "rows": "select * from fact_video_plays", "format": "sql", "fixture": null}, {"input": "ref('int_videos_per_subsection')", "rows": "select * from int_videos_per_subsection", "format": "sql", "fixture": null}], "expect": {"rows": "select * from subsection_video_engagement_expected\norder by org, course_key, subsection_block_id, actor_id", "format": "sql", "fixture": null}, "name": "test_subsection_video_engagement", "resource_type": "unit_test", "package_name": "aspects", "path": "video/unit_tests.yaml", "original_file_path": "models/video/unit_tests.yaml", "unique_id": "unit_test.aspects.subsection_video_engagement.test_subsection_video_engagement", "fqn": ["aspects", "video", "subsection_video_engagement", "test_subsection_video_engagement"], "description": "", "overrides": null, "depends_on": {"macros": [], "nodes": ["model.aspects.subsection_video_engagement"]}, "config": {"tags": ["ci"], "meta": {}}, "checksum": "c9eb6a169a5db395c62fd8849517204c383555076fc213c37c1de95265fdf09b", "schema": "xapi", "created_at": 1723756272.552342, "versions": null, "version": null}, "unit_test.aspects.fact_video_engagement.test_fact_video_engagement": {"model": "fact_video_engagement", "given": [{"input": "ref('subsection_video_engagement')", "rows": "select * from subsection_video_engagement", "format": "sql", "fixture": null}, {"input": "ref('section_video_engagement')", "rows": "select * from section_video_engagement", "format": "sql", "fixture": null}, {"input": "ref('dim_course_blocks')", "rows": "select * from dim_course_blocks", "format": "sql", "fixture": null}, {"input": "ref('dim_user_pii')", "rows": "select * from dim_user_pii", "format": "sql", "fixture": null}], "expect": {"rows": "select * from fact_video_engagement_expected", "format": "sql", "fixture": null}, "name": "test_fact_video_engagement", "resource_type": "unit_test", "package_name": "aspects", "path": "video/unit_tests.yaml", "original_file_path": "models/video/unit_tests.yaml", "unique_id": "unit_test.aspects.fact_video_engagement.test_fact_video_engagement", "fqn": ["aspects", "video", "fact_video_engagement", "test_fact_video_engagement"], "description": "", "overrides": null, "depends_on": {"macros": [], "nodes": ["model.aspects.fact_video_engagement"]}, "config": {"tags": ["ci"], "meta": {}}, "checksum": "e9e7f0776f20dc886c4a396ce85341788ab019a67ec521bb9637fcf9f0344217", "schema": "xapi", "created_at": 1723756272.5544496, "versions": null, "version": null}}}
\ No newline at end of file
diff --git a/partial_parse.msgpack b/partial_parse.msgpack
index 7f9a3612..e400e32f 100644
Binary files a/partial_parse.msgpack and b/partial_parse.msgpack differ
diff --git a/run_results.json b/run_results.json
index ee45bb44..a68d14cf 100644
--- a/run_results.json
+++ b/run_results.json
@@ -1 +1 @@
-{"metadata": {"dbt_schema_version": "https://schemas.getdbt.com/dbt/run-results/v6.json", "dbt_version": "1.8.5", "generated_at": "2024-08-09T18:45:50.467503Z", "invocation_id": "7a90ab1d-4858-4113-a565-f6d0e653511e", "env": {}}, "results": [{"status": "success", "timing": [{"name": "compile", "started_at": "2024-08-09T18:45:49.994856Z", "completed_at": "2024-08-09T18:45:50.055415Z"}, {"name": "execute", "started_at": "2024-08-09T18:45:50.055915Z", "completed_at": "2024-08-09T18:45:50.055929Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.06214261054992676, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.aspects.course_names", "compiled": true, "compiled_code": "\n\nwith\n most_recent_overviews as (\n select org, course_key, max(modified) as last_modified\n from `event_sink`.`course_overviews`\n group by org, course_key\n )\nselect\n course_key,\n display_name as course_name,\n splitByString('+', course_key)[-1] as course_run,\n org\nfrom `event_sink`.`course_overviews` co\ninner join\n most_recent_overviews mro\n on co.org = mro.org\n and co.course_key = mro.course_key\n and co.modified = mro.last_modified", "relation_name": "`xapi`.`course_names`"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-08-09T18:45:50.058377Z", "completed_at": "2024-08-09T18:45:50.063913Z"}, {"name": "execute", "started_at": "2024-08-09T18:45:50.064386Z", "completed_at": "2024-08-09T18:45:50.064393Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.0070917606353759766, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.aspects.most_recent_course_blocks", "compiled": true, "compiled_code": "\n\nselect\n location,\n display_name as block_name,\n toString(section)\n || ':'\n || toString(subsection)\n || ':'\n || toString(unit)\n || ' - '\n || display_name as display_name_with_location,\n JSONExtractInt(xblock_data_json, 'section') as section,\n JSONExtractInt(xblock_data_json, 'subsection') as subsection,\n JSONExtractInt(xblock_data_json, 'unit') as unit,\n JSONExtractBool(xblock_data_json, 'graded') as graded,\n order as course_order,\n course_key,\n dump_id,\n time_last_dumped\nfrom `event_sink`.`course_blocks` course_blocks\njoin\n (\n select location, max(time_last_dumped) as max_time_last_dumped\n from `event_sink`.`course_blocks`\n group by location\n ) latest_course_blocks\n on course_blocks.location = latest_course_blocks.location\n and course_blocks.time_last_dumped = latest_course_blocks.max_time_last_dumped", "relation_name": "`xapi`.`most_recent_course_blocks`"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-08-09T18:45:50.066847Z", "completed_at": "2024-08-09T18:45:50.071879Z"}, {"name": "execute", "started_at": "2024-08-09T18:45:50.072376Z", "completed_at": "2024-08-09T18:45:50.072383Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.006668806076049805, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.aspects.user_pii", "compiled": true, "compiled_code": "\n\nwith\n most_recent_user_profile as (\n select user_id, max(time_last_dumped) as time_last_dumped\n from `event_sink`.`user_profile`\n group by user_id\n )\nselect ex.user_id as user_id, ex.external_user_id, ex.username, up.name, up.email\nfrom `event_sink`.`external_id` ex\nleft outer join most_recent_user_profile mrup on mrup.user_id = ex.user_id\nleft outer join\n `event_sink`.`user_profile` up\n on up.user_id = mrup.user_id\n and up.time_last_dumped = mrup.time_last_dumped", "relation_name": "`xapi`.`user_pii`"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-08-09T18:45:50.074725Z", "completed_at": "2024-08-09T18:45:50.078821Z"}, {"name": "execute", "started_at": "2024-08-09T18:45:50.079325Z", "completed_at": "2024-08-09T18:45:50.079333Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.005650520324707031, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.aspects.xapi_events_all_parsed", "compiled": true, "compiled_code": "\n\nselect\n event_id as event_id,\n toLowCardinality(JSON_VALUE(event::String, '$.verb.id')) as verb_id,\n COALESCE(\n NULLIF(JSON_VALUE(event::String, '$.actor.account.name'), ''),\n NULLIF(JSON_VALUE(event::String, '$.actor.mbox'), ''),\n JSON_VALUE(event::String, '$.actor.mbox_sha1sum')\n ) as actor_id,\n JSON_VALUE(event::String, '$.object.id') as object_id,\n -- If the contextActivities parent is a course, use that. It can be a \"course\"\n -- type, or a \"cmi.interaction\" type for multiple question problem submissions.\n -- Otherwise use the object id for the course id.\n toLowCardinality(\n multiIf(\n -- If the contextActivities parent is a course, use that\n JSON_VALUE(\n event::String, '$.context.contextActivities.parent[0].definition.type'\n )\n = 'http://adlnet.gov/expapi/activities/course',\n JSON_VALUE(event::String, '$.context.contextActivities.parent[0].id'),\n -- Else if the contextActivities parent is a GroupActivity, it's a multi\n -- question problem and we use the grouping id\n JSON_VALUE(\n event::String, '$.context.contextActivities.parent[0].objectType'\n )\n in ('Activity', 'GroupActivity'),\n JSON_VALUE(event::String, '$.context.contextActivities.grouping[0].id'),\n -- Otherwise use the object id\n JSON_VALUE(event::String, '$.object.id')\n )\n ) as course_id,\n toLowCardinality(splitByString('/', course_id)[-1]) as course_key,\n toLowCardinality(\n coalesce(\n get_org_from_course_url(course_id),\n get_org_from_ccx_course_url(course_id),\n ''\n )\n ) as org,\n emission_time as emission_time,\n event::String as event\nfrom `xapi`.`xapi_events_all`", "relation_name": "`xapi`.`xapi_events_all_parsed`"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-08-09T18:45:50.081849Z", "completed_at": "2024-08-09T18:45:50.085414Z"}, {"name": "execute", "started_at": "2024-08-09T18:45:50.085896Z", "completed_at": "2024-08-09T18:45:50.085901Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.0052869319915771484, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.aspects.a_tag", "compiled": true, "compiled_code": "select\n 'http://local.edly.io/xblock/block-v1:OpenedX+DemoX+DemoCourse+type@video+block@d5a54ce52f464acfa7a83ae155712cc3' as object_id,\n 'The Purpose, Power and Reach of the Open edX\u00ae Platform' as video_name,\n \n concat(\n '', video_name, ''\n )\n as object_a_tag\nfrom\n system.numbers\nwhere object_a_tag != 'The Purpose, Power and Reach of the Open edX\u00ae Platform'", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-08-09T18:45:50.088119Z", "completed_at": "2024-08-09T18:45:50.091360Z"}, {"name": "execute", "started_at": "2024-08-09T18:45:50.091841Z", "completed_at": "2024-08-09T18:45:50.091846Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.004774808883666992, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.aspects.get_problem_id", "compiled": true, "compiled_code": "select\n 'http://local.edly.io:8000/xblock/block-v1:edunext+demo+demo+ccx+type@problem+block@3c1646f7133a4c5fb4557d649e22c251'\n as object_id\nfrom system.one\nwhere\n \n regexpExtract(\n object_id, 'xblock/([\\w\\d-\\+:@]*@problem\\+block@[\\w\\d][^_\\/]*)(_\\d_\\d)?', 1\n )\n\n != 'block-v1:edunext+demo+demo+ccx+type@problem+block@3c1646f7133a4c5fb4557d649e22c251'", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-08-09T18:45:50.094100Z", "completed_at": "2024-08-09T18:45:50.096627Z"}, {"name": "execute", "started_at": "2024-08-09T18:45:50.097078Z", "completed_at": "2024-08-09T18:45:50.097083Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.004044294357299805, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.aspects.get_problem_id_with_ccx", "compiled": true, "compiled_code": "select\n 'http://local.edly.io:8000/xblock/ccx-block-v1:edunext+demo+demo+ccx@1+type@problem+block@3c1646f7133a4c5fb4557d649e22c251'\n as object_id\nfrom system.one\nwhere\n \n regexpExtract(\n object_id, 'xblock/([\\w\\d-\\+:@]*@problem\\+block@[\\w\\d][^_\\/]*)(_\\d_\\d)?', 1\n )\n\n != 'ccx-block-v1:edunext+demo+demo+ccx@1+type@problem+block@3c1646f7133a4c5fb4557d649e22c251'", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-08-09T18:45:50.099342Z", "completed_at": "2024-08-09T18:45:50.104168Z"}, {"name": "execute", "started_at": "2024-08-09T18:45:50.104663Z", "completed_at": "2024-08-09T18:45:50.104670Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.006356954574584961, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.aspects.course_block_names", "compiled": true, "compiled_code": "\nselect\n location, block_name, course_key, graded, course_order, display_name_with_location\nfrom `xapi`.`most_recent_course_blocks`", "relation_name": "`xapi`.`course_block_names`"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-08-09T18:45:50.107003Z", "completed_at": "2024-08-09T18:45:50.109635Z"}, {"name": "execute", "started_at": "2024-08-09T18:45:50.110091Z", "completed_at": "2024-08-09T18:45:50.110096Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.004165172576904297, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.aspects.dim_user_pii", "compiled": true, "compiled_code": "select external_user_id, username, name, email from `xapi`.`user_pii` user_pii", "relation_name": "`xapi`.`dim_user_pii`"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-08-09T18:45:50.112244Z", "completed_at": "2024-08-09T18:45:50.117493Z"}, {"name": "execute", "started_at": "2024-08-09T18:45:50.117992Z", "completed_at": "2024-08-09T18:45:50.117996Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.006726264953613281, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.aspects.enrollment_events", "compiled": true, "compiled_code": "\n\nselect\n event_id,\n cast(emission_time as DateTime) as emission_time,\n actor_id,\n object_id,\n course_key,\n org,\n verb_id,\n toLowCardinality(\n JSON_VALUE(\n event,\n '$.object.definition.extensions.\"https://w3id.org/xapi/acrossx/extensions/type\"'\n )\n ) as enrollment_mode\nfrom `xapi`.`xapi_events_all_parsed`\nwhere\n verb_id in (\n 'http://adlnet.gov/expapi/verbs/registered',\n 'http://id.tincanapi.com/verb/unregistered'\n )", "relation_name": "`xapi`.`enrollment_events`"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-08-09T18:45:50.120236Z", "completed_at": "2024-08-09T18:45:50.123807Z"}, {"name": "execute", "started_at": "2024-08-09T18:45:50.124308Z", "completed_at": "2024-08-09T18:45:50.124313Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.005143642425537109, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.aspects.fact_instance_actors", "compiled": true, "compiled_code": "\n\nselect\n date_trunc('day', emission_time) as emission_day,\n uniqCombinedState(actor_id) as actors_cnt\nfrom `xapi`.`xapi_events_all_parsed`\ngroup by emission_day", "relation_name": "`xapi`.`fact_instance_actors`"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-08-09T18:45:50.126527Z", "completed_at": "2024-08-09T18:45:50.129879Z"}, {"name": "execute", "started_at": "2024-08-09T18:45:50.130376Z", "completed_at": "2024-08-09T18:45:50.130380Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.004880666732788086, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.aspects.fact_instance_courses", "compiled": true, "compiled_code": "\n\nselect\n date_trunc('hour', emission_time) as emission_hour,\n uniqCombinedState(course_id) as courses_cnt\nfrom `xapi`.`xapi_events_all_parsed`\ngroup by emission_hour", "relation_name": "`xapi`.`fact_instance_courses`"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-08-09T18:45:50.132665Z", "completed_at": "2024-08-09T18:45:50.135971Z"}, {"name": "execute", "started_at": "2024-08-09T18:45:50.136473Z", "completed_at": "2024-08-09T18:45:50.136477Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.004914283752441406, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.aspects.fact_instance_events", "compiled": true, "compiled_code": "\n\nselect\n date_trunc('day', emission_time) as emission_day,\n uniqCombinedState(event_id) as events_cnt\nfrom `xapi`.`xapi_events_all_parsed`\ngroup by emission_day", "relation_name": "`xapi`.`fact_instance_events`"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-08-09T18:45:50.138632Z", "completed_at": "2024-08-09T18:45:50.142300Z"}, {"name": "execute", "started_at": "2024-08-09T18:45:50.142808Z", "completed_at": "2024-08-09T18:45:50.142813Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.005166769027709961, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.aspects.grading_events", "compiled": true, "compiled_code": "\n\n\nselect\n event_id,\n CAST(emission_time, 'DateTime') as emission_time,\n actor_id,\n object_id,\n course_key,\n org,\n verb_id,\n JSONExtractFloat(event, 'result', 'score', 'scaled') as scaled_score\nfrom `xapi`.`xapi_events_all_parsed`\nwhere\n verb_id in (\n 'http://id.tincanapi.com/verb/earned',\n 'https://w3id.org/xapi/acrossx/verbs/evaluated'\n )\n or (\n verb_id in (\n 'http://adlnet.gov/expapi/verbs/passed',\n 'http://adlnet.gov/expapi/verbs/failed'\n )\n and JSON_VALUE(event::String, '$.object.definition.type')\n = 'http://adlnet.gov/expapi/activities/course'\n )", "relation_name": "`xapi`.`grading_events`"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-08-09T18:45:50.145087Z", "completed_at": "2024-08-09T18:45:50.148791Z"}, {"name": "execute", "started_at": "2024-08-09T18:45:50.149360Z", "completed_at": "2024-08-09T18:45:50.149365Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.005315542221069336, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.aspects.navigation_events", "compiled": true, "compiled_code": "\n\nselect\n event_id,\n cast(emission_time as DateTime) as emission_time,\n actor_id,\n splitByString('/xblock/', object_id)[-1] as block_id,\n course_key,\n org,\n verb_id,\n JSONExtractString(event, 'object', 'definition', 'type') as object_type,\n -- clicking a link and selecting a module outline have no starting-position field\n if(\n object_type in (\n 'http://adlnet.gov/expapi/activities/link',\n 'http://adlnet.gov/expapi/activities/module'\n ),\n 0,\n JSONExtractInt(\n event,\n 'context',\n 'extensions',\n 'http://id.tincanapi.com/extension/starting-position'\n )\n ) as starting_position,\n JSONExtractString(\n event, 'context', 'extensions', 'http://id.tincanapi.com/extension/ending-point'\n ) as ending_point\nfrom `xapi`.`xapi_events_all_parsed`\nwhere verb_id in ('https://w3id.org/xapi/dod-isd/verbs/navigated')", "relation_name": "`xapi`.`navigation_events`"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-08-09T18:45:50.151590Z", "completed_at": "2024-08-09T18:45:50.155558Z"}, {"name": "execute", "started_at": "2024-08-09T18:45:50.156068Z", "completed_at": "2024-08-09T18:45:50.156073Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.005570888519287109, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.aspects.problem_events", "compiled": true, "compiled_code": "\n\nselect\n event_id,\n cast(emission_time as DateTime) as emission_time,\n actor_id,\n object_id,\n course_key,\n org,\n verb_id,\n JSON_VALUE(event, '$.result.response') as responses,\n JSONExtractFloat(event, 'result', 'score', 'scaled') as scaled_score,\n if(\n verb_id = 'https://w3id.org/xapi/acrossx/verbs/evaluated',\n cast(JSON_VALUE(event, '$.result.success') as Bool),\n false\n ) as success,\n toLowCardinality(\n JSON_VALUE(event, '$.object.definition.interactionType')\n ) as interaction_type,\n if(\n verb_id = 'https://w3id.org/xapi/acrossx/verbs/evaluated',\n cast(\n JSON_VALUE(\n event,\n '$.object.definition.extensions.\"http://id.tincanapi.com/extension/attempt-id\"'\n ) as Int16\n ),\n 0\n ) as attempts,\n \n regexpExtract(\n object_id, 'xblock/([\\w\\d-\\+:@]*@problem\\+block@[\\w\\d][^_\\/]*)(_\\d_\\d)?', 1\n )\n as problem_id\nfrom `xapi`.`xapi_events_all_parsed`\nwhere\n verb_id in (\n 'https://w3id.org/xapi/acrossx/verbs/evaluated',\n 'http://adlnet.gov/expapi/verbs/passed',\n 'http://adlnet.gov/expapi/verbs/asked'\n )", "relation_name": "`xapi`.`problem_events`"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-08-09T18:45:50.158301Z", "completed_at": "2024-08-09T18:45:50.162114Z"}, {"name": "execute", "started_at": "2024-08-09T18:45:50.162641Z", "completed_at": "2024-08-09T18:45:50.162646Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.005357980728149414, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.aspects.video_playback_events", "compiled": true, "compiled_code": "\n\nselect\n event_id,\n CAST(emission_time, 'DateTime') as emission_time,\n actor_id,\n object_id,\n course_key,\n org,\n verb_id,\n ceil(\n CAST(\n coalesce(\n nullIf(\n JSON_VALUE(\n event,\n '$.result.extensions.\"https://w3id.org/xapi/video/extensions/time\"'\n ),\n ''\n ),\n nullIf(\n JSON_VALUE(\n event,\n '$.result.extensions.\"https://w3id.org/xapi/video/extensions/time-from\"'\n ),\n ''\n ),\n '0.0'\n ),\n 'Decimal32(2)'\n )\n ) as video_position,\n JSONExtractInt(\n event, 'context', 'extensions', 'https://w3id.org/xapi/video/extensions/length'\n ) as video_duration\nfrom `xapi`.`xapi_events_all_parsed`\nwhere\n (\n verb_id in (\n 'http://adlnet.gov/expapi/verbs/completed',\n 'http://adlnet.gov/expapi/verbs/initialized',\n 'http://adlnet.gov/expapi/verbs/terminated',\n 'https://w3id.org/xapi/video/verbs/paused',\n 'https://w3id.org/xapi/video/verbs/played',\n 'https://w3id.org/xapi/video/verbs/seeked'\n )\n )\n and (object_id like '%video+block%')", "relation_name": "`xapi`.`video_playback_events`"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-08-09T18:45:50.164760Z", "completed_at": "2024-08-09T18:45:50.169373Z"}, {"name": "execute", "started_at": "2024-08-09T18:45:50.169870Z", "completed_at": "2024-08-09T18:45:50.169875Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.006095409393310547, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.aspects.dim_course_blocks", "compiled": true, "compiled_code": "select\n courses.org as org,\n courses.course_key as course_key,\n courses.course_name as course_name,\n courses.course_run as course_run,\n blocks.location as block_id,\n blocks.block_name as block_name,\n \n concat(\n splitByString(\n ':', splitByString(' - ', blocks.display_name_with_location)[1], 1\n )[1],\n ':0:0'\n )\n as section_number,\n \n concat(\n arrayStringConcat(\n splitByString(\n ':', splitByString(' - ', blocks.display_name_with_location)[1], 2\n ),\n ':'\n ),\n ':0'\n )\n\n as subsection_number,\n splitByString(' - ', blocks.display_name_with_location)[1] as hierarchy_location,\n blocks.display_name_with_location as display_name_with_location,\n course_order,\n graded,\n case\n when block_id like '%@chapter+block@%'\n then 'section'\n when block_id like '%@sequential+block@%'\n then 'subsection'\n when block_id like '%@vertical+block@%'\n then 'unit'\n else regexpExtract(block_id, '@([^+]+)\\+block@', 1)\n end as block_type\nfrom `xapi`.`course_block_names` blocks\njoin `xapi`.`course_names` courses on blocks.course_key = courses.course_key", "relation_name": "`xapi`.`dim_course_blocks`"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-08-09T18:45:50.172141Z", "completed_at": "2024-08-09T18:45:50.175541Z"}, {"name": "execute", "started_at": "2024-08-09T18:45:50.176047Z", "completed_at": "2024-08-09T18:45:50.176052Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.0050280094146728516, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.aspects.fact_enrollment_status", "compiled": true, "compiled_code": "\n\nwith\n ranked_enrollments as (\n select\n emission_time,\n org,\n course_key,\n actor_id,\n enrollment_mode,\n splitByString('/', verb_id)[-1] as enrollment_status,\n row_number() over (\n partition by org, course_key, actor_id order by emission_time desc\n ) as rn\n from `xapi`.`enrollment_events`\n )\n\nselect org, course_key, actor_id, enrollment_status, enrollment_mode, emission_time\nfrom ranked_enrollments\nwhere rn = 1", "relation_name": "`xapi`.`fact_enrollment_status`"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-08-09T18:45:50.180142Z", "completed_at": "2024-08-09T18:45:50.183176Z"}, {"name": "execute", "started_at": "2024-08-09T18:45:50.183629Z", "completed_at": "2024-08-09T18:45:50.183634Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.004540443420410156, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.aspects.fact_enrollments", "compiled": true, "compiled_code": "with\n enrollments as (\n select\n emission_time,\n org,\n course_key,\n actor_id,\n enrollment_mode,\n splitByString('/', verb_id)[-1] as enrollment_status\n from `xapi`.`enrollment_events`\n )\n\nselect\n enrollments.emission_time as emission_time,\n enrollments.org as org,\n enrollments.course_key as course_key,\n courses.course_name as course_name,\n courses.course_run as course_run,\n enrollments.actor_id as actor_id,\n enrollments.enrollment_mode as enrollment_mode,\n enrollments.enrollment_status as enrollment_status,\n users.username as username,\n users.name as name,\n users.email as email\nfrom enrollments\njoin `xapi`.`course_names` courses on enrollments.course_key = courses.course_key\nleft outer join\n `xapi`.`dim_user_pii` users on toUUID(actor_id) = users.external_user_id", "relation_name": "`xapi`.`fact_enrollments`"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-08-09T18:45:50.185946Z", "completed_at": "2024-08-09T18:45:50.189291Z"}, {"name": "execute", "started_at": "2024-08-09T18:45:50.189821Z", "completed_at": "2024-08-09T18:45:50.189825Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.004968404769897461, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.aspects.fact_instance_enrollments", "compiled": true, "compiled_code": "\n\nwith\n enrollments as (\n select\n emission_time,\n course_key,\n enrollment_mode,\n splitByString('/', verb_id)[-1] as enrollment_status\n from `xapi`.`enrollment_events`\n )\n\nselect\n date_trunc('day', emission_time) as emission_day,\n enrollments.course_key,\n enrollments.enrollment_mode as enrollment_mode,\n enrollments.enrollment_status as enrollment_status,\n count() as course_enrollment_mode_status_cnt\nfrom enrollments\ngroup by emission_day, course_key, enrollment_mode, enrollment_status", "relation_name": "`xapi`.`fact_instance_enrollments`"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-08-09T18:45:50.192120Z", "completed_at": "2024-08-09T18:45:50.195329Z"}, {"name": "execute", "started_at": "2024-08-09T18:45:50.195807Z", "completed_at": "2024-08-09T18:45:50.195812Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.004710674285888672, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.aspects.fact_learner_course_grade", "compiled": true, "compiled_code": "\n\nwith\n ranked_grades as (\n select\n emission_time,\n org,\n course_key,\n actor_id,\n scaled_score as course_grade,\n row_number() over (\n partition by org, course_key, actor_id order by emission_time desc\n ) as rn\n from `xapi`.`grading_events`\n where object_id like '%/course/%'\n )\n\nselect org, course_key, actor_id, course_grade, emission_time\nfrom ranked_grades\nwhere rn = 1", "relation_name": "`xapi`.`fact_learner_course_grade`"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-08-09T18:45:50.198005Z", "completed_at": "2024-08-09T18:45:50.201181Z"}, {"name": "execute", "started_at": "2024-08-09T18:45:50.201696Z", "completed_at": "2024-08-09T18:45:50.201700Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.00475764274597168, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.aspects.fact_learner_course_status", "compiled": true, "compiled_code": "\n\nwith\n ranked_status as (\n select\n org,\n course_key,\n actor_id,\n splitByString('/', verb_id)[-1] as approving_state,\n emission_time,\n row_number() over (\n partition by org, course_key, actor_id order by emission_time desc\n ) as rn\n from `xapi`.`grading_events`\n where\n verb_id in (\n 'http://adlnet.gov/expapi/verbs/passed',\n 'http://adlnet.gov/expapi/verbs/failed'\n )\n )\n\nselect org, course_key, actor_id, approving_state, emission_time\nfrom ranked_status\nwhere rn = 1", "relation_name": "`xapi`.`fact_learner_course_status`"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-08-09T18:45:50.203918Z", "completed_at": "2024-08-09T18:45:50.207522Z"}, {"name": "execute", "started_at": "2024-08-09T18:45:50.208008Z", "completed_at": "2024-08-09T18:45:50.208012Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.005171537399291992, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.aspects.fact_learner_last_course_visit", "compiled": true, "compiled_code": "\n\nselect org, course_key, actor_id, max(emission_time) as emission_time\nfrom `xapi`.`navigation_events`\ngroup by org, course_key, actor_id", "relation_name": "`xapi`.`fact_learner_last_course_visit`"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-08-09T18:45:50.210445Z", "completed_at": "2024-08-09T18:45:50.214099Z"}, {"name": "execute", "started_at": "2024-08-09T18:45:50.214595Z", "completed_at": "2024-08-09T18:45:50.214599Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.005257844924926758, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.aspects.responses", "compiled": true, "compiled_code": "-- select one record per (learner, problem, course, org) tuple\n-- contains either the first successful attempt\n-- or the most recent unsuccessful attempt\n-- find the timestamp of the earliest successful response\n-- this will be used to pick the xAPI event corresponding to that submission\n\n\nwith\n responses as (\n select emission_time, org, course_key, object_id, problem_id, actor_id, success\n from `xapi`.`problem_events`\n where verb_id = 'https://w3id.org/xapi/acrossx/verbs/evaluated'\n ),\n response_status as (\n select\n org,\n course_key,\n problem_id,\n actor_id,\n MIN(case when success then emission_time else NULL end) as first_success_at,\n MAX(emission_time) as last_attempt_at\n from responses\n group by org, course_key, problem_id, actor_id\n )\nselect\n org,\n course_key,\n problem_id,\n actor_id,\n first_success_at,\n last_attempt_at,\n coalesce(first_success_at, last_attempt_at) as emission_time\nfrom response_status", "relation_name": "`xapi`.`responses`"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-08-09T18:45:50.216794Z", "completed_at": "2024-08-09T18:45:50.219951Z"}, {"name": "execute", "started_at": "2024-08-09T18:45:50.220460Z", "completed_at": "2024-08-09T18:45:50.220465Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.004686594009399414, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.aspects.dim_course_blocks_extended", "compiled": true, "compiled_code": "select\n blocks.org as org,\n blocks.course_key as course_key,\n blocks.course_name as course_name,\n blocks.course_run as course_run,\n blocks.block_id as block_id,\n blocks.block_name as block_name,\n blocks.section_number as section_number,\n blocks.subsection_number as subsection_number,\n blocks.hierarchy_location as hierarchy_location,\n blocks.display_name_with_location as display_name_with_location,\n blocks.graded as graded,\n blocks.course_order as course_order,\n blocks.block_type as block_type,\n section_blocks.display_name_with_location as section_with_name,\n subsection_blocks.display_name_with_location as subsection_with_name\nfrom `xapi`.`dim_course_blocks` blocks\nleft join\n `xapi`.`dim_course_blocks` section_blocks\n on (\n blocks.section_number = section_blocks.hierarchy_location\n and blocks.org = section_blocks.org\n and blocks.course_key = section_blocks.course_key\n and section_blocks.block_id like '%@chapter+block@%'\n )\nleft join\n `xapi`.`dim_course_blocks` subsection_blocks\n on (\n blocks.subsection_number = subsection_blocks.hierarchy_location\n and blocks.org = subsection_blocks.org\n and blocks.course_key = subsection_blocks.course_key\n and subsection_blocks.block_id like '%@sequential+block@%'\n )", "relation_name": "`xapi`.`dim_course_blocks_extended`"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-08-09T18:45:50.222746Z", "completed_at": "2024-08-09T18:45:50.225855Z"}, {"name": "execute", "started_at": "2024-08-09T18:45:50.226347Z", "completed_at": "2024-08-09T18:45:50.226351Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.004601716995239258, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.aspects.fact_navigation", "compiled": true, "compiled_code": "select\n navigation.emission_time as emission_time,\n navigation.org as org,\n navigation.course_key as course_key,\n blocks.course_name as course_name,\n blocks.course_run as course_run,\n navigation.actor_id as actor_id,\n navigation.block_id as block_id,\n blocks.block_name as block_name,\n blocks.display_name_with_location as block_name_with_location,\n blocks.course_order as course_order,\n navigation.object_type as object_type,\n navigation.starting_position as starting_position,\n navigation.ending_point as ending_point,\n users.username as username,\n users.name as name,\n users.email as email\nfrom `xapi`.`navigation_events` navigation\njoin\n `xapi`.`dim_course_blocks` blocks\n on (\n navigation.course_key = blocks.course_key\n and navigation.block_id = blocks.block_id\n )\nleft outer join\n `xapi`.`dim_user_pii` users on toUUID(actor_id) = users.external_user_id", "relation_name": "`xapi`.`fact_navigation`"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-08-09T18:45:50.228483Z", "completed_at": "2024-08-09T18:45:50.232605Z"}, {"name": "execute", "started_at": "2024-08-09T18:45:50.233442Z", "completed_at": "2024-08-09T18:45:50.233449Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.0059850215911865234, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.aspects.fact_problem_responses", "compiled": true, "compiled_code": "with\n responses as (\n select\n emission_time,\n org,\n course_key,\n object_id,\n problem_id,\n actor_id,\n responses,\n success,\n attempts,\n interaction_type\n from `xapi`.`problem_events`\n where verb_id = 'https://w3id.org/xapi/acrossx/verbs/evaluated'\n )\n\nselect\n responses.emission_time as emission_time,\n responses.org as org,\n responses.course_key as course_key,\n blocks.course_name as course_name,\n blocks.course_run as course_run,\n responses.problem_id as problem_id,\n blocks.block_name as problem_name,\n blocks.display_name_with_location as problem_name_with_location,\n \n concat(\n '', blocks.block_name, ''\n )\n as problem_link,\n blocks.graded as graded,\n course_order as course_order,\n responses.actor_id as actor_id,\n responses.responses as responses,\n responses.success as success,\n responses.attempts as attempts,\n responses.interaction_type as interaction_type,\n users.username as username,\n users.name as name,\n users.email as email\nfrom responses\njoin\n `xapi`.`dim_course_blocks` blocks\n on (\n responses.course_key = blocks.course_key\n and responses.problem_id = blocks.block_id\n )\nleft outer join\n `xapi`.`dim_user_pii` users on toUUID(actor_id) = users.external_user_id\ngroup by\n -- multi-part questions include an extra record for the response to the first\n -- part of the question. this group by clause eliminates the duplicate record\n emission_time,\n org,\n course_key,\n course_name,\n course_run,\n problem_id,\n problem_name,\n problem_name_with_location,\n problem_link,\n actor_id,\n responses,\n success,\n attempts,\n course_order,\n graded,\n interaction_type,\n username,\n name,\n email", "relation_name": "`xapi`.`fact_problem_responses`"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-08-09T18:45:50.237167Z", "completed_at": "2024-08-09T18:45:50.246464Z"}, {"name": "execute", "started_at": "2024-08-09T18:45:50.246991Z", "completed_at": "2024-08-09T18:45:50.246996Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.011496305465698242, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.aspects.int_pages_per_subsection", "compiled": true, "compiled_code": "select * from (\n with\n items_per_subsection as (\n select\n org,\n course_key,\n section_number,\n subsection_number,\n course_order,\n graded,\n count(*) as item_count\n from `xapi`.`dim_course_blocks`\n where block_id like '%@vertical+block@%'\n group by\n org, course_key, section_number, subsection_number, course_order, graded\n )\n\n select\n ips.org as org,\n ips.course_key as course_key,\n ips.section_number as section_number,\n section_blocks.display_name_with_location as section_with_name,\n ips.subsection_number as subsection_number,\n subsection_blocks.display_name_with_location as subsection_with_name,\n ips.course_order as course_order,\n ips.graded as graded,\n ips.item_count as item_count,\n subsection_blocks.block_id as subsection_block_id,\n section_blocks.block_id as section_block_id\n from items_per_subsection ips\n left join\n `xapi`.`dim_course_blocks` section_blocks\n on (\n ips.section_number = section_blocks.hierarchy_location\n and ips.org = section_blocks.org\n and ips.course_key = section_blocks.course_key\n and section_blocks.block_id like '%@chapter+block@%'\n )\n left join\n `xapi`.`dim_course_blocks` subsection_blocks\n on (\n ips.subsection_number = subsection_blocks.hierarchy_location\n and ips.org = subsection_blocks.org\n and ips.course_key = subsection_blocks.course_key\n and subsection_blocks.block_id like '%@sequential+block@%'\n )\n)", "relation_name": "`xapi`.`int_pages_per_subsection`"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-08-09T18:45:50.249413Z", "completed_at": "2024-08-09T18:45:50.252351Z"}, {"name": "execute", "started_at": "2024-08-09T18:45:50.252843Z", "completed_at": "2024-08-09T18:45:50.252848Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.004667520523071289, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.aspects.int_problem_hints", "compiled": true, "compiled_code": "with\n hints as (\n select\n emission_time,\n org,\n course_key,\n problem_id,\n actor_id,\n case\n when object_id like '%/hint%'\n then 'hint'\n when object_id like '%/answer%'\n then 'answer'\n else 'N/A'\n end as help_type\n from `xapi`.`problem_events`\n where verb_id = 'http://adlnet.gov/expapi/verbs/asked'\n )\n\nselect\n hints.emission_time as emission_time,\n hints.org as org,\n hints.course_key as course_key,\n blocks.course_name as course_name,\n blocks.course_run as course_run,\n hints.problem_id as problem_id,\n blocks.block_name as problem_name,\n blocks.display_name_with_location as problem_name_with_location,\n blocks.course_order as course_order,\n hints.actor_id as actor_id,\n hints.help_type as help_type\nfrom hints\njoin\n `xapi`.`dim_course_blocks` blocks\n on (hints.course_key = blocks.course_key and hints.problem_id = blocks.block_id)", "relation_name": "`xapi`.`int_problem_hints`"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-08-09T18:45:50.255029Z", "completed_at": "2024-08-09T18:45:50.257740Z"}, {"name": "execute", "started_at": "2024-08-09T18:45:50.258223Z", "completed_at": "2024-08-09T18:45:50.258228Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.004209041595458984, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.aspects.int_problems_per_subsection", "compiled": true, "compiled_code": "select * from (\n with\n items_per_subsection as (\n select\n org,\n course_key,\n section_number,\n subsection_number,\n course_order,\n graded,\n count(*) as item_count\n from `xapi`.`dim_course_blocks`\n where block_id like '%@problem+block@%'\n group by\n org, course_key, section_number, subsection_number, course_order, graded\n )\n\n select\n ips.org as org,\n ips.course_key as course_key,\n ips.section_number as section_number,\n section_blocks.display_name_with_location as section_with_name,\n ips.subsection_number as subsection_number,\n subsection_blocks.display_name_with_location as subsection_with_name,\n ips.course_order as course_order,\n ips.graded as graded,\n ips.item_count as item_count,\n subsection_blocks.block_id as subsection_block_id,\n section_blocks.block_id as section_block_id\n from items_per_subsection ips\n left join\n `xapi`.`dim_course_blocks` section_blocks\n on (\n ips.section_number = section_blocks.hierarchy_location\n and ips.org = section_blocks.org\n and ips.course_key = section_blocks.course_key\n and section_blocks.block_id like '%@chapter+block@%'\n )\n left join\n `xapi`.`dim_course_blocks` subsection_blocks\n on (\n ips.subsection_number = subsection_blocks.hierarchy_location\n and ips.org = subsection_blocks.org\n and ips.course_key = subsection_blocks.course_key\n and subsection_blocks.block_id like '%@sequential+block@%'\n )\n)", "relation_name": "`xapi`.`int_problems_per_subsection`"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-08-09T18:45:50.260524Z", "completed_at": "2024-08-09T18:45:50.263243Z"}, {"name": "execute", "started_at": "2024-08-09T18:45:50.263721Z", "completed_at": "2024-08-09T18:45:50.263725Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.004276752471923828, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.aspects.int_videos_per_subsection", "compiled": true, "compiled_code": "select * from (\n with\n items_per_subsection as (\n select\n org,\n course_key,\n section_number,\n subsection_number,\n course_order,\n graded,\n count(*) as item_count\n from `xapi`.`dim_course_blocks`\n where block_id like '%@video+block@%'\n group by\n org, course_key, section_number, subsection_number, course_order, graded\n )\n\n select\n ips.org as org,\n ips.course_key as course_key,\n ips.section_number as section_number,\n section_blocks.display_name_with_location as section_with_name,\n ips.subsection_number as subsection_number,\n subsection_blocks.display_name_with_location as subsection_with_name,\n ips.course_order as course_order,\n ips.graded as graded,\n ips.item_count as item_count,\n subsection_blocks.block_id as subsection_block_id,\n section_blocks.block_id as section_block_id\n from items_per_subsection ips\n left join\n `xapi`.`dim_course_blocks` section_blocks\n on (\n ips.section_number = section_blocks.hierarchy_location\n and ips.org = section_blocks.org\n and ips.course_key = section_blocks.course_key\n and section_blocks.block_id like '%@chapter+block@%'\n )\n left join\n `xapi`.`dim_course_blocks` subsection_blocks\n on (\n ips.subsection_number = subsection_blocks.hierarchy_location\n and ips.org = subsection_blocks.org\n and ips.course_key = subsection_blocks.course_key\n and subsection_blocks.block_id like '%@sequential+block@%'\n )\n)", "relation_name": "`xapi`.`int_videos_per_subsection`"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-08-09T18:45:50.265967Z", "completed_at": "2024-08-09T18:45:50.277357Z"}, {"name": "execute", "started_at": "2024-08-09T18:45:50.277842Z", "completed_at": "2024-08-09T18:45:50.277847Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.012933731079101562, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.aspects.accepted_values_fact_enrollment_status_enrollment_status__registered__unregistered.893527c11f", "compiled": true, "compiled_code": "\n \n \n\nwith all_values as (\n\n select\n enrollment_status as value_field,\n count(*) as n_records\n\n from `xapi`.`fact_enrollment_status`\n group by enrollment_status\n\n)\n\nselect *\nfrom all_values\nwhere value_field not in (\n 'registered','unregistered'\n)\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-08-09T18:45:50.280234Z", "completed_at": "2024-08-09T18:45:50.283953Z"}, {"name": "execute", "started_at": "2024-08-09T18:45:50.284424Z", "completed_at": "2024-08-09T18:45:50.284429Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.005408525466918945, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.aspects.accepted_values_fact_enrollments_enrollment_status__registered__unregistered.f8d10203f4", "compiled": true, "compiled_code": "\n \n \n\nwith all_values as (\n\n select\n enrollment_status as value_field,\n count(*) as n_records\n\n from `xapi`.`fact_enrollments`\n group by enrollment_status\n\n)\n\nselect *\nfrom all_values\nwhere value_field not in (\n 'registered','unregistered'\n)\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-08-09T18:45:50.286705Z", "completed_at": "2024-08-09T18:45:50.293040Z"}, {"name": "execute", "started_at": "2024-08-09T18:45:50.293566Z", "completed_at": "2024-08-09T18:45:50.293571Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.007903099060058594, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.aspects.accepted_values_xapi_fact_instance_enrollments_enrollment_status__xapi_fact_instance_enrollments__registered__unregistered.744ab867be", "compiled": true, "compiled_code": "\n\nwith all_values as (\n\n select distinct\n enrollment_status as value_field\n\n from xapi.fact_instance_enrollments\n\n),\n\nvalidation_errors as (\n\n select\n value_field\n\n from all_values\n where value_field not in (\n 'registered','unregistered'\n )\n\n)\n\nselect *\nfrom validation_errors\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-08-09T18:45:50.295766Z", "completed_at": "2024-08-09T18:45:50.301115Z"}, {"name": "execute", "started_at": "2024-08-09T18:45:50.301648Z", "completed_at": "2024-08-09T18:45:50.301653Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.006880521774291992, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.aspects.fact_student_status", "compiled": true, "compiled_code": "select\n fes.org as org,\n fes.course_key as course_key,\n fes.actor_id as actor_id,\n courses.course_name as course_name,\n courses.course_run as course_run,\n if(empty(approving_state), 'failed', approving_state) as approving_state,\n enrollment_mode,\n enrollment_status,\n course_grade,\n case\n when course_grade >= 0.9\n then '90-100%'\n when course_grade >= 0.8 and course_grade < 0.9\n then '80-89%'\n when course_grade >= 0.7 and course_grade < 0.8\n then '70-79%'\n when course_grade >= 0.6 and course_grade < 0.7\n then '60-69%'\n when course_grade >= 0.5 and course_grade < 0.6\n then '50-59%'\n when course_grade >= 0.4 and course_grade < 0.5\n then '40-49%'\n when course_grade >= 0.3 and course_grade < 0.4\n then '30-39%'\n when course_grade >= 0.2 and course_grade < 0.3\n then '20-29%'\n when course_grade >= 0.1 and course_grade < 0.2\n then '10-19%'\n else '0-9%'\n end as grade_bucket,\n users.username as username,\n users.name as name,\n users.email as email,\n fes.emission_time as enrolled_at\nfrom `xapi`.`fact_enrollment_status` fes\nleft join\n `xapi`.`fact_learner_course_status` lg\n on fes.org = lg.org\n and fes.course_key = lg.course_key\n and fes.actor_id = lg.actor_id\nleft join\n `xapi`.`fact_learner_course_grade` ls\n on fes.org = ls.org\n and fes.course_key = ls.course_key\n and fes.actor_id = ls.actor_id\njoin\n `xapi`.`course_names` courses\n on fes.org = courses.org\n and fes.course_key = courses.course_key\nleft outer join\n `xapi`.`dim_user_pii` users on toUUID(actor_id) = users.external_user_id", "relation_name": "`xapi`.`fact_student_status`"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-08-09T18:45:50.303946Z", "completed_at": "2024-08-09T18:45:50.308648Z"}, {"name": "execute", "started_at": "2024-08-09T18:45:50.309154Z", "completed_at": "2024-08-09T18:45:50.309158Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.006417274475097656, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.aspects.accepted_values_fact_learner_course_status_approving_state__passed__failed.f9c0c1b85f", "compiled": true, "compiled_code": "\n \n \n\nwith all_values as (\n\n select\n approving_state as value_field,\n count(*) as n_records\n\n from `xapi`.`fact_learner_course_status`\n group by approving_state\n\n)\n\nselect *\nfrom all_values\nwhere value_field not in (\n 'passed','failed'\n)\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-08-09T18:45:50.311433Z", "completed_at": "2024-08-09T18:45:50.314944Z"}, {"name": "execute", "started_at": "2024-08-09T18:45:50.315427Z", "completed_at": "2024-08-09T18:45:50.315432Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.005032062530517578, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.aspects.int_problem_results", "compiled": true, "compiled_code": "-- select one record per (learner, problem, course, org) tuple\n-- contains either the first successful attempt\n-- or the most recent unsuccessful attempt\n-- find the timestamp of the earliest successful response\n-- this will be used to pick the xAPI event corresponding to that submission\nwith\n full_responses as (\n select\n events.emission_time as emission_time,\n events.org as org,\n events.course_key as course_key,\n events.problem_id as problem_id,\n events.object_id as object_id,\n events.actor_id as actor_id,\n events.responses as responses,\n events.success as success,\n events.attempts as attempts,\n events.interaction_type as interaction_type\n from `xapi`.`problem_events` events\n join\n `xapi`.`responses` using (\n org, course_key, problem_id, actor_id, emission_time\n )\n )\n\nselect\n full_responses.emission_time as emission_time,\n full_responses.org as org,\n full_responses.course_key as course_key,\n blocks.course_name as course_name,\n blocks.course_run as course_run,\n full_responses.problem_id as problem_id,\n blocks.block_name as problem_name,\n blocks.display_name_with_location as problem_name_with_location,\n blocks.course_order as course_order,\n \n concat(\n '', blocks.block_name, ''\n )\n as problem_link,\n full_responses.actor_id as actor_id,\n full_responses.responses as responses,\n full_responses.success as success,\n full_responses.attempts as attempts,\n full_responses.interaction_type as interaction_type,\n blocks.graded\nfrom full_responses\njoin\n `xapi`.`dim_course_blocks` blocks\n on (\n full_responses.course_key = blocks.course_key\n and full_responses.problem_id = blocks.block_id\n )", "relation_name": "`xapi`.`int_problem_results`"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-08-09T18:45:50.317673Z", "completed_at": "2024-08-09T18:45:50.323199Z"}, {"name": "execute", "started_at": "2024-08-09T18:45:50.323703Z", "completed_at": "2024-08-09T18:45:50.323708Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.007131099700927734, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.aspects.fact_video_plays", "compiled": true, "compiled_code": "-- model to support number of watches per video\n-- ref:\n-- https://edx.readthedocs.io/projects/edx-insights/en/latest/Reference.html#engagement-computations\nwith\n plays as (\n select\n emission_time,\n org,\n course_key,\n object_id,\n video_duration,\n video_position,\n splitByString('/xblock/', object_id)[-1] as video_id,\n actor_id\n from `xapi`.`video_playback_events`\n where verb_id = 'https://w3id.org/xapi/video/verbs/played'\n )\n\nselect\n plays.emission_time as emission_time,\n plays.org as org,\n plays.course_key as course_key,\n blocks.course_name as course_name,\n blocks.course_run as course_run,\n plays.video_id as video_id,\n blocks.block_name as video_name,\n blocks.display_name_with_location as video_name_with_location,\n \n concat(\n '', blocks.block_name, ''\n )\n as video_link,\n blocks.graded as graded,\n plays.video_position as video_position,\n plays.video_duration as video_duration,\n case\n when video_position/video_duration >= 0.9\n then '90-100%'\n when video_position/video_duration >= 0.8 and video_position/video_duration < 0.9\n then '80-89%'\n when video_position/video_duration >= 0.7 and video_position/video_duration < 0.8\n then '70-79%'\n when video_position/video_duration >= 0.6 and video_position/video_duration < 0.7\n then '60-69%'\n when video_position/video_duration >= 0.5 and video_position/video_duration < 0.6\n then '50-59%'\n when video_position/video_duration >= 0.4 and video_position/video_duration < 0.5\n then '40-49%'\n when video_position/video_duration >= 0.3 and video_position/video_duration < 0.4\n then '30-39%'\n when video_position/video_duration >= 0.2 and video_position/video_duration < 0.3\n then '20-29%'\n when video_position/video_duration >= 0.1 and video_position/video_duration < 0.2\n then '10-19%'\n else '0-9%'\n end as visualization_bucket,\n plays.actor_id as actor_id,\n users.username as username,\n users.name as name,\n users.email as email,\n blocks.section_with_name as section_with_name,\n blocks.subsection_with_name as subsection_with_name,\n blocks.course_order as course_order\nfrom plays\njoin\n `xapi`.`dim_course_blocks_extended` blocks\n on (plays.course_key = blocks.course_key and plays.video_id = blocks.block_id)\nleft outer join\n `xapi`.`dim_user_pii` users on toUUID(actor_id) = users.external_user_id", "relation_name": "`xapi`.`fact_video_plays`"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-08-09T18:45:50.326058Z", "completed_at": "2024-08-09T18:45:50.329384Z"}, {"name": "execute", "started_at": "2024-08-09T18:45:50.329887Z", "completed_at": "2024-08-09T18:45:50.329892Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.004986763000488281, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.aspects.fact_navigation_completion", "compiled": true, "compiled_code": "-- number of learners who've viewed all pages in a section/subsection\nwith\n visited_subsection_pages as (\n select distinct\n date(emission_time) as visited_on,\n org,\n course_key,\n course_name,\n course_run,\n \n concat(\n splitByString(\n ':', splitByString(' - ', block_name_with_location)[1], 1\n )[1],\n ':0:0'\n )\n as section_number,\n \n concat(\n arrayStringConcat(\n splitByString(\n ':', splitByString(' - ', block_name_with_location)[1], 2\n ),\n ':'\n ),\n ':0'\n )\n\n as subsection_number,\n actor_id,\n block_id,\n username,\n name,\n email\n from `xapi`.`fact_navigation`\n )\n\nselect\n visits.visited_on as visited_on,\n visits.org as org,\n visits.course_key as course_key,\n visits.course_name as course_name,\n visits.course_run as course_run,\n pages.section_with_name as section_with_name,\n pages.subsection_with_name as subsection_with_name,\n pages.course_order as course_order,\n pages.item_count as page_count,\n visits.actor_id as actor_id,\n visits.block_id as block_id,\n visits.username as username,\n visits.name as name,\n visits.email as email\nfrom visited_subsection_pages visits\njoin\n `xapi`.`int_pages_per_subsection` pages\n on (\n visits.org = pages.org\n and visits.course_key = pages.course_key\n and visits.section_number = pages.section_number\n and visits.subsection_number = pages.subsection_number\n )", "relation_name": "`xapi`.`fact_navigation_completion`"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-08-09T18:45:50.332148Z", "completed_at": "2024-08-09T18:45:50.336689Z"}, {"name": "execute", "started_at": "2024-08-09T18:45:50.337207Z", "completed_at": "2024-08-09T18:45:50.337211Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.006088733673095703, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.aspects.section_page_engagement", "compiled": true, "compiled_code": "\n\nwith\n fact_navigation as (\n select\n navigation.emission_time as emission_time,\n navigation.org as org,\n navigation.course_key as course_key,\n navigation.actor_id as actor_id,\n navigation.block_id as block_id,\n blocks.display_name_with_location as block_name_with_location\n from `xapi`.`navigation_events` navigation\n join\n `xapi`.`dim_course_blocks` blocks\n on (\n navigation.course_key = blocks.course_key\n and navigation.block_id = blocks.block_id\n )\n ),\n visited_subsection_pages as (\n select distinct\n date(emission_time) as visited_on,\n org,\n course_key,\n \n concat(\n splitByString(\n ':', splitByString(' - ', block_name_with_location)[1], 1\n )[1],\n ':0:0'\n )\n as section_number,\n \n concat(\n arrayStringConcat(\n splitByString(\n ':', splitByString(' - ', block_name_with_location)[1], 2\n ),\n ':'\n ),\n ':0'\n )\n\n as subsection_number,\n actor_id,\n block_id\n from fact_navigation\n ),\n fact_navigation_completion as (\n select\n visits.visited_on as visited_on,\n visits.org as org,\n visits.course_key as course_key,\n pages.section_with_name as section_with_name,\n pages.subsection_with_name as subsection_with_name,\n pages.item_count as item_count,\n visits.actor_id as actor_id,\n visits.block_id as block_id,\n pages.section_block_id as section_block_id\n from visited_subsection_pages visits\n join\n `xapi`.`int_pages_per_subsection` pages\n on (\n visits.org = pages.org\n and visits.course_key = pages.course_key\n and visits.section_number = pages.section_number\n and visits.subsection_number = pages.subsection_number\n )\n ),\n subsection_counts as (\n select\n org,\n course_key,\n section_with_name,\n subsection_with_name,\n actor_id,\n item_count,\n count(distinct block_id) as pages_visited,\n case\n when pages_visited = 0\n then 'No pages viewed yet'\n when pages_visited = item_count\n then 'All pages viewed'\n else 'At least one page viewed'\n end as engagement_level,\n section_block_id\n from fact_navigation_completion\n group by\n org,\n course_key,\n section_with_name,\n subsection_with_name,\n actor_id,\n item_count,\n section_block_id\n ),\n section_counts as (\n select\n org,\n course_key,\n actor_id,\n sum(item_count) as item_count,\n sum(pages_visited) as pages_visited,\n case\n when pages_visited = 0\n then 'No pages viewed yet'\n when pages_visited = item_count\n then 'All pages viewed'\n else 'At least one page viewed'\n end as engagement_level,\n section_block_id\n from subsection_counts\n group by org, course_key, section_block_id, actor_id\n )\n\nselect org, course_key, actor_id, section_block_id, engagement_level\nfrom section_counts", "relation_name": "`xapi`.`section_page_engagement`"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-08-09T18:45:50.339545Z", "completed_at": "2024-08-09T18:45:50.343985Z"}, {"name": "execute", "started_at": "2024-08-09T18:45:50.344475Z", "completed_at": "2024-08-09T18:45:50.344479Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.006055593490600586, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.aspects.subsection_page_engagement", "compiled": true, "compiled_code": "\n\nwith\n fact_navigation as (\n select\n navigation.emission_time as emission_time,\n navigation.org as org,\n navigation.course_key as course_key,\n navigation.actor_id as actor_id,\n navigation.block_id as block_id,\n blocks.display_name_with_location as block_name_with_location\n from `xapi`.`navigation_events` navigation\n join\n `xapi`.`dim_course_blocks` blocks\n on (\n navigation.course_key = blocks.course_key\n and navigation.block_id = blocks.block_id\n )\n ),\n visited_subsection_pages as (\n select distinct\n date(emission_time) as visited_on,\n org,\n course_key,\n \n concat(\n splitByString(\n ':', splitByString(' - ', block_name_with_location)[1], 1\n )[1],\n ':0:0'\n )\n as section_number,\n \n concat(\n arrayStringConcat(\n splitByString(\n ':', splitByString(' - ', block_name_with_location)[1], 2\n ),\n ':'\n ),\n ':0'\n )\n\n as subsection_number,\n actor_id,\n block_id\n from fact_navigation\n ),\n fact_navigation_completion as (\n select\n visits.visited_on as visited_on,\n visits.org as org,\n visits.course_key as course_key,\n pages.section_with_name as section_with_name,\n pages.subsection_with_name as subsection_with_name,\n pages.item_count as item_count,\n visits.actor_id as actor_id,\n visits.block_id as block_id,\n pages.subsection_block_id as subsection_block_id\n from visited_subsection_pages visits\n join\n `xapi`.`int_pages_per_subsection` pages\n on (\n visits.org = pages.org\n and visits.course_key = pages.course_key\n and visits.section_number = pages.section_number\n and visits.subsection_number = pages.subsection_number\n )\n ),\n subsection_counts as (\n select\n org,\n course_key,\n section_with_name,\n subsection_with_name,\n actor_id,\n item_count,\n count(distinct block_id) as pages_visited,\n case\n when pages_visited = 0\n then 'No pages viewed yet'\n when pages_visited = item_count\n then 'All pages viewed'\n else 'At least one page viewed'\n end as engagement_level,\n subsection_block_id\n from fact_navigation_completion\n group by\n org,\n course_key,\n section_with_name,\n subsection_with_name,\n actor_id,\n item_count,\n subsection_block_id\n )\n\nselect org, course_key, actor_id, subsection_block_id, engagement_level\nfrom subsection_counts", "relation_name": "`xapi`.`subsection_page_engagement`"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-08-09T18:45:50.346786Z", "completed_at": "2024-08-09T18:45:50.351863Z"}, {"name": "execute", "started_at": "2024-08-09T18:45:50.352348Z", "completed_at": "2024-08-09T18:45:50.352352Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.0066564083099365234, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.aspects.section_problem_engagement", "compiled": true, "compiled_code": "\n\nwith\n responses as (\n select\n emission_time,\n org,\n course_key,\n object_id,\n problem_id,\n actor_id,\n responses,\n success,\n attempts,\n interaction_type\n from `xapi`.`problem_events`\n where verb_id = 'https://w3id.org/xapi/acrossx/verbs/evaluated'\n ),\n fact_problem_responses as (\n select\n responses.emission_time as emission_time,\n responses.org as org,\n responses.course_key as course_key,\n blocks.course_name as course_name,\n responses.problem_id as problem_id,\n blocks.block_name as problem_name,\n blocks.display_name_with_location as problem_name_with_location,\n \n concat(\n '', blocks.block_name, ''\n )\n as problem_link,\n blocks.graded as graded,\n course_order as course_order,\n responses.actor_id as actor_id,\n responses.responses as responses,\n responses.success as success,\n responses.attempts as attempts,\n responses.interaction_type as interaction_type\n from responses\n join\n `xapi`.`dim_course_blocks` blocks\n on (\n responses.course_key = blocks.course_key\n and responses.problem_id = blocks.block_id\n )\n group by\n -- multi-part questions include an extra record for the response to the\n -- first\n -- part of the question. this group by clause eliminates the duplicate\n -- record\n emission_time,\n org,\n course_key,\n course_name,\n problem_id,\n problem_name,\n problem_name_with_location,\n problem_link,\n actor_id,\n responses,\n success,\n attempts,\n course_order,\n graded,\n interaction_type\n ),\n attempted_subsection_problems as (\n select distinct\n date(emission_time) as attempted_on,\n org,\n course_key,\n \n concat(\n splitByString(\n ':', splitByString(' - ', problem_name_with_location)[1], 1\n )[1],\n ':0:0'\n )\n as section_number,\n \n concat(\n arrayStringConcat(\n splitByString(\n ':', splitByString(' - ', problem_name_with_location)[1], 2\n ),\n ':'\n ),\n ':0'\n )\n\n as subsection_number,\n course_order as course_order,\n graded,\n actor_id,\n problem_id\n from fact_problem_responses\n ),\n fact_problem_engagement_per_subsection as (\n select\n attempts.org as org,\n attempts.course_key as course_key,\n problems.section_with_name as section_with_name,\n problems.subsection_with_name as subsection_with_name,\n problems.item_count as item_count,\n attempts.actor_id as actor_id,\n attempts.problem_id as problem_id,\n problems.section_block_id as section_block_id\n from attempted_subsection_problems attempts\n join\n `xapi`.`int_problems_per_subsection` problems\n on (\n attempts.org = problems.org\n and attempts.course_key = problems.course_key\n and attempts.section_number = problems.section_number\n and attempts.subsection_number = problems.subsection_number\n )\n ),\n subsection_counts as (\n select\n org,\n course_key,\n section_with_name,\n subsection_with_name,\n actor_id,\n item_count,\n count(distinct problem_id) as problems_attempted,\n case\n when problems_attempted = 0\n then 'No problems attempted yet'\n when problems_attempted = item_count\n then 'All problems attempted'\n else 'At least one problem attempted'\n end as engagement_level,\n section_block_id\n from fact_problem_engagement_per_subsection\n group by\n org,\n course_key,\n section_with_name,\n subsection_with_name,\n actor_id,\n item_count,\n section_block_id\n ),\n section_counts as (\n select\n org,\n course_key,\n actor_id,\n sum(item_count) as item_count,\n sum(problems_attempted) as problems_attempted,\n case\n when problems_attempted = 0\n then 'No problems attempted yet'\n when problems_attempted = item_count\n then 'All problems attempted'\n else 'At least one problem attempted'\n end as engagement_level,\n section_block_id\n from subsection_counts\n group by org, course_key, section_block_id, actor_id\n )\n\nselect org, course_key, actor_id, section_block_id, engagement_level\nfrom section_counts", "relation_name": "`xapi`.`section_problem_engagement`"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-08-09T18:45:50.354600Z", "completed_at": "2024-08-09T18:45:50.359397Z"}, {"name": "execute", "started_at": "2024-08-09T18:45:50.359885Z", "completed_at": "2024-08-09T18:45:50.359889Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.006284475326538086, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.aspects.subsection_problem_engagement", "compiled": true, "compiled_code": "\n\nwith\n responses as (\n select\n emission_time,\n org,\n course_key,\n object_id,\n problem_id,\n actor_id,\n responses,\n success,\n attempts,\n interaction_type\n from `xapi`.`problem_events`\n where verb_id = 'https://w3id.org/xapi/acrossx/verbs/evaluated'\n ),\n fact_problem_responses as (\n select\n responses.emission_time as emission_time,\n responses.org as org,\n responses.course_key as course_key,\n blocks.course_name as course_name,\n responses.problem_id as problem_id,\n blocks.block_name as problem_name,\n blocks.display_name_with_location as problem_name_with_location,\n \n concat(\n '', blocks.block_name, ''\n )\n as problem_link,\n blocks.graded as graded,\n course_order as course_order,\n responses.actor_id as actor_id,\n responses.responses as responses,\n responses.success as success,\n responses.attempts as attempts,\n responses.interaction_type as interaction_type\n from responses\n join\n `xapi`.`dim_course_blocks` blocks\n on (\n responses.course_key = blocks.course_key\n and responses.problem_id = blocks.block_id\n )\n group by\n -- multi-part questions include an extra record for the response to the\n -- first\n -- part of the question. this group by clause eliminates the duplicate\n -- record\n emission_time,\n org,\n course_key,\n course_name,\n problem_id,\n problem_name,\n problem_name_with_location,\n problem_link,\n actor_id,\n responses,\n success,\n attempts,\n course_order,\n graded,\n interaction_type\n ),\n attempted_subsection_problems as (\n select distinct\n date(emission_time) as attempted_on,\n org,\n course_key,\n \n concat(\n splitByString(\n ':', splitByString(' - ', problem_name_with_location)[1], 1\n )[1],\n ':0:0'\n )\n as section_number,\n \n concat(\n arrayStringConcat(\n splitByString(\n ':', splitByString(' - ', problem_name_with_location)[1], 2\n ),\n ':'\n ),\n ':0'\n )\n\n as subsection_number,\n course_order as course_order,\n graded,\n actor_id,\n problem_id\n from fact_problem_responses\n ),\n fact_problem_engagement_per_subsection as (\n select\n attempts.org as org,\n attempts.course_key as course_key,\n problems.section_with_name as section_with_name,\n problems.subsection_with_name as subsection_with_name,\n problems.item_count as item_count,\n attempts.actor_id as actor_id,\n attempts.problem_id as problem_id,\n problems.subsection_block_id as subsection_block_id\n from attempted_subsection_problems attempts\n join\n `xapi`.`int_problems_per_subsection` problems\n on (\n attempts.org = problems.org\n and attempts.course_key = problems.course_key\n and attempts.section_number = problems.section_number\n and attempts.subsection_number = problems.subsection_number\n )\n ),\n subsection_counts as (\n select\n org,\n course_key,\n section_with_name,\n subsection_with_name,\n actor_id,\n item_count,\n count(distinct problem_id) as problems_attempted,\n case\n when problems_attempted = 0\n then 'No problems attempted yet'\n when problems_attempted = item_count\n then 'All problems attempted'\n else 'At least one problem attempted'\n end as engagement_level,\n subsection_block_id\n from fact_problem_engagement_per_subsection\n group by\n org,\n course_key,\n section_with_name,\n subsection_with_name,\n actor_id,\n item_count,\n subsection_block_id\n )\n\nselect org, course_key, actor_id, subsection_block_id, engagement_level\nfrom subsection_counts", "relation_name": "`xapi`.`subsection_problem_engagement`"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-08-09T18:45:50.362277Z", "completed_at": "2024-08-09T18:45:50.366074Z"}, {"name": "execute", "started_at": "2024-08-09T18:45:50.366543Z", "completed_at": "2024-08-09T18:45:50.366548Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.005315542221069336, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.aspects.accepted_values_fact_student_status_enrollment_status__registered__unregistered.53cae8a0f3", "compiled": true, "compiled_code": "\n \n \n\nwith all_values as (\n\n select\n enrollment_status as value_field,\n count(*) as n_records\n\n from `xapi`.`fact_student_status`\n group by enrollment_status\n\n)\n\nselect *\nfrom all_values\nwhere value_field not in (\n 'registered','unregistered'\n)\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-08-09T18:45:50.368755Z", "completed_at": "2024-08-09T18:45:50.373040Z"}, {"name": "execute", "started_at": "2024-08-09T18:45:50.373551Z", "completed_at": "2024-08-09T18:45:50.373555Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.005795717239379883, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.aspects.section_video_engagement", "compiled": true, "compiled_code": "\n\nwith\n viewed_subsection_videos as (\n select distinct\n date(emission_time) as viewed_on,\n org,\n course_key,\n \n concat(\n splitByString(\n ':', splitByString(' - ', video_name_with_location)[1], 1\n )[1],\n ':0:0'\n )\n as section_number,\n \n concat(\n arrayStringConcat(\n splitByString(\n ':', splitByString(' - ', video_name_with_location)[1], 2\n ),\n ':'\n ),\n ':0'\n )\n\n as subsection_number,\n actor_id,\n video_id\n from `xapi`.`fact_video_plays`\n ),\n fact_video_engagement_per_subsection as (\n select\n views.org as org,\n views.course_key as course_key,\n videos.section_with_name as section_with_name,\n videos.subsection_with_name as subsection_with_name,\n videos.item_count as item_count,\n views.actor_id as actor_id,\n views.video_id as video_id,\n videos.section_block_id as section_block_id\n from viewed_subsection_videos views\n join\n `xapi`.`int_videos_per_subsection` videos\n on (\n views.org = videos.org\n and views.course_key = videos.course_key\n and views.section_number = videos.section_number\n and views.subsection_number = videos.subsection_number\n )\n ),\n subsection_counts as (\n select\n org,\n course_key,\n section_with_name,\n subsection_with_name,\n actor_id,\n item_count,\n count(distinct video_id) as videos_viewed,\n case\n when videos_viewed = 0\n then 'No videos viewed yet'\n when videos_viewed = item_count\n then 'All videos viewed'\n else 'At least one video viewed'\n end as engagement_level,\n section_block_id\n from fact_video_engagement_per_subsection\n group by\n org,\n course_key,\n section_with_name,\n subsection_with_name,\n actor_id,\n item_count,\n section_block_id\n ),\n section_counts as (\n select\n org,\n course_key,\n actor_id,\n sum(item_count) as item_count,\n sum(videos_viewed) as videos_viewed,\n case\n when videos_viewed = 0\n then 'No videos viewed yet'\n when videos_viewed = item_count\n then 'All videos viewed'\n else 'At least one video viewed'\n end as engagement_level,\n section_block_id\n from subsection_counts\n group by org, course_key, section_block_id, actor_id\n )\nselect org, course_key, actor_id, section_block_id, engagement_level\nfrom section_counts", "relation_name": "`xapi`.`section_video_engagement`"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-08-09T18:45:50.375791Z", "completed_at": "2024-08-09T18:45:50.379976Z"}, {"name": "execute", "started_at": "2024-08-09T18:45:50.380461Z", "completed_at": "2024-08-09T18:45:50.380466Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.0058460235595703125, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.aspects.subsection_video_engagement", "compiled": true, "compiled_code": "\n\nwith\n viewed_subsection_videos as (\n select distinct\n date(emission_time) as viewed_on,\n org,\n course_key,\n \n concat(\n splitByString(\n ':', splitByString(' - ', video_name_with_location)[1], 1\n )[1],\n ':0:0'\n )\n as section_number,\n \n concat(\n arrayStringConcat(\n splitByString(\n ':', splitByString(' - ', video_name_with_location)[1], 2\n ),\n ':'\n ),\n ':0'\n )\n\n as subsection_number,\n actor_id,\n video_id\n from `xapi`.`fact_video_plays`\n ),\n fact_video_engagement_per_subsection as (\n select\n views.org as org,\n views.course_key as course_key,\n videos.section_with_name as section_with_name,\n videos.subsection_with_name as subsection_with_name,\n videos.item_count as item_count,\n views.actor_id as actor_id,\n views.video_id as video_id,\n videos.subsection_block_id as subsection_block_id\n from viewed_subsection_videos views\n join\n `xapi`.`int_videos_per_subsection` videos\n on (\n views.org = videos.org\n and views.course_key = videos.course_key\n and views.section_number = videos.section_number\n and views.subsection_number = videos.subsection_number\n )\n ),\n subsection_counts as (\n select\n org,\n course_key,\n section_with_name,\n subsection_with_name,\n actor_id,\n item_count,\n count(distinct video_id) as videos_viewed,\n case\n when videos_viewed = 0\n then 'No videos viewed yet'\n when videos_viewed = item_count\n then 'All videos viewed'\n else 'At least one video viewed'\n end as engagement_level,\n subsection_block_id\n from fact_video_engagement_per_subsection\n group by\n org,\n course_key,\n section_with_name,\n subsection_with_name,\n actor_id,\n item_count,\n subsection_block_id\n )\nselect org, course_key, actor_id, subsection_block_id, engagement_level\nfrom subsection_counts", "relation_name": "`xapi`.`subsection_video_engagement`"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-08-09T18:45:50.383029Z", "completed_at": "2024-08-09T18:45:50.390417Z"}, {"name": "execute", "started_at": "2024-08-09T18:45:50.390943Z", "completed_at": "2024-08-09T18:45:50.390948Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.009058475494384766, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.aspects.accepted_values_xapi_section_page_engagement_engagement_level__xapi_section_page_engagement__No_pages_viewed_yet__All_pages_viewed__At_least_one_page_viewed.f10135df89", "compiled": true, "compiled_code": "\n\nwith all_values as (\n\n select distinct\n engagement_level as value_field\n\n from xapi.section_page_engagement\n\n),\n\nvalidation_errors as (\n\n select\n value_field\n\n from all_values\n where value_field not in (\n 'No pages viewed yet','All pages viewed','At least one page viewed'\n )\n\n)\n\nselect *\nfrom validation_errors\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-08-09T18:45:50.393313Z", "completed_at": "2024-08-09T18:45:50.396676Z"}, {"name": "execute", "started_at": "2024-08-09T18:45:50.397161Z", "completed_at": "2024-08-09T18:45:50.397165Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.004927635192871094, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.aspects.fact_pageview_engagement", "compiled": true, "compiled_code": "with\n subsection_engagement as (\n select\n org,\n course_key,\n 'subsection' as content_level,\n actor_id,\n subsection_block_id as block_id,\n engagement_level as section_subsection_page_engagement\n from `xapi`.`subsection_page_engagement`\n ),\n section_engagement as (\n select\n org,\n course_key,\n 'section' as content_level,\n actor_id,\n section_block_id as block_id,\n engagement_level as section_subsection_page_engagement\n from `xapi`.`section_page_engagement`\n ),\n page_engagement as (\n select *\n from subsection_engagement\n union all\n select *\n from section_engagement\n )\n\nselect\n pv.org as org,\n pv.course_key as course_key,\n course_blocks.course_run as course_run,\n course_blocks.display_name_with_location as section_subsection_name,\n pv.content_level as content_level,\n pv.actor_id as actor_id,\n pv.section_subsection_page_engagement as section_subsection_page_engagement,\n users.username as username,\n users.name as name,\n users.email as email\nfrom page_engagement pv\njoin\n `xapi`.`dim_course_blocks` course_blocks\n on (\n pv.org = course_blocks.org\n and pv.course_key = course_blocks.course_key\n and pv.block_id = course_blocks.block_id\n )\nleft outer join\n `xapi`.`dim_user_pii` users on toUUID(pv.actor_id) = users.external_user_id", "relation_name": "`xapi`.`fact_pageview_engagement`"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-08-09T18:45:50.399594Z", "completed_at": "2024-08-09T18:45:50.404045Z"}, {"name": "execute", "started_at": "2024-08-09T18:45:50.404515Z", "completed_at": "2024-08-09T18:45:50.404520Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.006045341491699219, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.aspects.accepted_values_xapi_subsection_page_engagement_engagement_level__xapi_subsection_page_engagement__No_pages_viewed_yet__All_pages_viewed__At_least_one_page_viewed.bcd23fe35f", "compiled": true, "compiled_code": "\n\nwith all_values as (\n\n select distinct\n engagement_level as value_field\n\n from xapi.subsection_page_engagement\n\n),\n\nvalidation_errors as (\n\n select\n value_field\n\n from all_values\n where value_field not in (\n 'No pages viewed yet','All pages viewed','At least one page viewed'\n )\n\n)\n\nselect *\nfrom validation_errors\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-08-09T18:45:50.406786Z", "completed_at": "2024-08-09T18:45:50.412604Z"}, {"name": "execute", "started_at": "2024-08-09T18:45:50.413109Z", "completed_at": "2024-08-09T18:45:50.413114Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.0073566436767578125, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.aspects.accepted_values_xapi_section_problem_engagement_engagement_level__xapi_section_problem_engagement__No_problems_attempted_yet__All_problems_attempted__At_least_one_problem_attempted.48ca5955e3", "compiled": true, "compiled_code": "\n\nwith all_values as (\n\n select distinct\n engagement_level as value_field\n\n from xapi.section_problem_engagement\n\n),\n\nvalidation_errors as (\n\n select\n value_field\n\n from all_values\n where value_field not in (\n 'No problems attempted yet','All problems attempted','At least one problem attempted'\n )\n\n)\n\nselect *\nfrom validation_errors\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-08-09T18:45:50.415388Z", "completed_at": "2024-08-09T18:45:50.419581Z"}, {"name": "execute", "started_at": "2024-08-09T18:45:50.420065Z", "completed_at": "2024-08-09T18:45:50.420070Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.005713701248168945, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.aspects.accepted_values_xapi_subsection_problem_engagement_engagement_level__xapi_subsection_problem_engagement__No_problems_attempted_yet__All_problems_attempted__At_least_one_problem_attempted.51aa37af55", "compiled": true, "compiled_code": "\n\nwith all_values as (\n\n select distinct\n engagement_level as value_field\n\n from xapi.subsection_problem_engagement\n\n),\n\nvalidation_errors as (\n\n select\n value_field\n\n from all_values\n where value_field not in (\n 'No problems attempted yet','All problems attempted','At least one problem attempted'\n )\n\n)\n\nselect *\nfrom validation_errors\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-08-09T18:45:50.422435Z", "completed_at": "2024-08-09T18:45:50.428062Z"}, {"name": "execute", "started_at": "2024-08-09T18:45:50.428550Z", "completed_at": "2024-08-09T18:45:50.428555Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.007235288619995117, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.aspects.accepted_values_xapi_section_video_engagement_engagement_level__xapi_section_video_engagement__No_videos_viewed_yet__All_videos_viewed__At_least_one_video_viewed.597c4fb289", "compiled": true, "compiled_code": "\n\nwith all_values as (\n\n select distinct\n engagement_level as value_field\n\n from xapi.section_video_engagement\n\n),\n\nvalidation_errors as (\n\n select\n value_field\n\n from all_values\n where value_field not in (\n 'No videos viewed yet','All videos viewed','At least one video viewed'\n )\n\n)\n\nselect *\nfrom validation_errors\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-08-09T18:45:50.430762Z", "completed_at": "2024-08-09T18:45:50.434285Z"}, {"name": "execute", "started_at": "2024-08-09T18:45:50.434763Z", "completed_at": "2024-08-09T18:45:50.434767Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.005056142807006836, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.aspects.fact_video_engagement", "compiled": true, "compiled_code": "with\n subsection_engagement as (\n select\n org,\n course_key,\n 'subsection' as content_level,\n actor_id,\n subsection_block_id as block_id,\n engagement_level as section_subsection_video_engagement\n from `xapi`.`subsection_video_engagement`\n ),\n section_engagement as (\n select\n org,\n course_key,\n 'section' as content_level,\n actor_id,\n section_block_id as block_id,\n engagement_level as section_subsection_video_engagement\n from `xapi`.`section_video_engagement`\n ),\n video_engagement as (\n select *\n from subsection_engagement\n union all\n select *\n from section_engagement\n )\nselect\n ve.org as org,\n ve.course_key as course_key,\n course_blocks.course_run as course_run,\n course_blocks.display_name_with_location as section_subsection_name,\n ve.content_level as content_level,\n ve.actor_id as actor_id,\n ve.section_subsection_video_engagement as section_subsection_video_engagement,\n users.username as username,\n users.name as name,\n users.email as email\nfrom video_engagement ve\njoin\n `xapi`.`dim_course_blocks` course_blocks\n on (\n ve.org = course_blocks.org\n and ve.course_key = course_blocks.course_key\n and ve.block_id = course_blocks.block_id\n )\nleft outer join\n `xapi`.`dim_user_pii` users on toUUID(ve.actor_id) = users.external_user_id", "relation_name": "`xapi`.`fact_video_engagement`"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-08-09T18:45:50.437279Z", "completed_at": "2024-08-09T18:45:50.441513Z"}, {"name": "execute", "started_at": "2024-08-09T18:45:50.442038Z", "completed_at": "2024-08-09T18:45:50.442047Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.005952119827270508, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.aspects.accepted_values_xapi_subsection_video_engagement_engagement_level__xapi_subsection_video_engagement__No_videos_viewed_yet__All_videos_viewed__At_least_one_video_viewed.c9b49600d3", "compiled": true, "compiled_code": "\n\nwith all_values as (\n\n select distinct\n engagement_level as value_field\n\n from xapi.subsection_video_engagement\n\n),\n\nvalidation_errors as (\n\n select\n value_field\n\n from all_values\n where value_field not in (\n 'No videos viewed yet','All videos viewed','At least one video viewed'\n )\n\n)\n\nselect *\nfrom validation_errors\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-08-09T18:45:50.444239Z", "completed_at": "2024-08-09T18:45:50.449024Z"}, {"name": "execute", "started_at": "2024-08-09T18:45:50.449528Z", "completed_at": "2024-08-09T18:45:50.449535Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.00638580322265625, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.aspects.accepted_values_fact_pageview_engagement_content_level__section__subsection.dd9e9af3ed", "compiled": true, "compiled_code": "\n \n \n\nwith all_values as (\n\n select\n content_level as value_field,\n count(*) as n_records\n\n from `xapi`.`fact_pageview_engagement`\n group by content_level\n\n)\n\nselect *\nfrom all_values\nwhere value_field not in (\n 'section','subsection'\n)\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-08-09T18:45:50.451795Z", "completed_at": "2024-08-09T18:45:50.455532Z"}, {"name": "execute", "started_at": "2024-08-09T18:45:50.456022Z", "completed_at": "2024-08-09T18:45:50.456027Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.005280017852783203, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.aspects.accepted_values_fact_video_engagement_content_level__section__subsection.636c5e7005", "compiled": true, "compiled_code": "\n \n \n\nwith all_values as (\n\n select\n content_level as value_field,\n count(*) as n_records\n\n from `xapi`.`fact_video_engagement`\n group by content_level\n\n)\n\nselect *\nfrom all_values\nwhere value_field not in (\n 'section','subsection'\n)\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-08-09T18:45:50.458491Z", "completed_at": "2024-08-09T18:45:50.464073Z"}, {"name": "execute", "started_at": "2024-08-09T18:45:50.464550Z", "completed_at": "2024-08-09T18:45:50.464555Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.007147073745727539, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.aspects.accepted_values_fact_video_engagement_section_subsection_video_engagement__No_videos_viewed_yet__At_least_one_video_viewed__All_videos_viewed.91f6ccbf80", "compiled": true, "compiled_code": "\n \n \n\nwith all_values as (\n\n select\n section_subsection_video_engagement as value_field,\n count(*) as n_records\n\n from `xapi`.`fact_video_engagement`\n group by section_subsection_video_engagement\n\n)\n\nselect *\nfrom all_values\nwhere value_field not in (\n 'No videos viewed yet','At least one video viewed','All videos viewed'\n)\n\n\n", "relation_name": null}], "elapsed_time": 0.5861163139343262, "args": {"introspect": true, "enable_legacy_logger": false, "log_path": "/home/runner/work/aspects-dbt/aspects-dbt/logs", "printer_width": 80, "strict_mode": false, "defer": false, "send_anonymous_usage_stats": true, "select": [], "cache_selected_only": false, "warn_error_options": {"include": [], "exclude": []}, "write_json": true, "indirect_selection": "eager", "favor_state": false, "project_dir": "/home/runner/work/aspects-dbt/aspects-dbt", "vars": {}, "exclude": [], "static": false, "invocation_command": "dbt docs generate", "log_file_max_bytes": 10485760, "compile": true, "which": "generate", "log_level_file": "debug", "empty_catalog": false, "use_colors_file": true, "use_colors": true, "static_parser": true, "version_check": true, "require_explicit_package_overrides_for_builtin_materializations": true, "quiet": false, "populate_cache": true, "print": true, "macro_debugging": false, "log_format": "default", "log_format_file": "debug", "partial_parse_file_diff": true, "require_resource_names_without_spaces": false, "source_freshness_run_project_hooks": false, "log_level": "info", "show_resource_report": false, "partial_parse": true, "profiles_dir": "./.github/"}}
\ No newline at end of file
+{"metadata": {"dbt_schema_version": "https://schemas.getdbt.com/dbt/run-results/v6.json", "dbt_version": "1.8.5", "generated_at": "2024-08-15T21:11:17.766879Z", "invocation_id": "8b4070f2-5f6a-4318-8b6e-0095cfa33985", "env": {}}, "results": [{"status": "success", "timing": [{"name": "compile", "started_at": "2024-08-15T21:11:17.335551Z", "completed_at": "2024-08-15T21:11:17.344651Z"}, {"name": "execute", "started_at": "2024-08-15T21:11:17.345182Z", "completed_at": "2024-08-15T21:11:17.345193Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.010723114013671875, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.aspects.course_names", "compiled": true, "compiled_code": "\n\nwith\n most_recent_overviews as (\n select org, course_key, max(modified) as last_modified\n from `event_sink`.`course_overviews`\n group by org, course_key\n )\nselect\n course_key,\n display_name as course_name,\n splitByString('+', course_key)[-1] as course_run,\n org\nfrom `event_sink`.`course_overviews` co\ninner join\n most_recent_overviews mro\n on co.org = mro.org\n and co.course_key = mro.course_key\n and co.modified = mro.last_modified", "relation_name": "`xapi`.`course_names`"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-08-15T21:11:17.347539Z", "completed_at": "2024-08-15T21:11:17.352773Z"}, {"name": "execute", "started_at": "2024-08-15T21:11:17.353298Z", "completed_at": "2024-08-15T21:11:17.353305Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.006813526153564453, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.aspects.most_recent_course_blocks", "compiled": true, "compiled_code": "\n\nselect\n location,\n display_name as block_name,\n toString(section)\n || ':'\n || toString(subsection)\n || ':'\n || toString(unit)\n || ' - '\n || display_name as display_name_with_location,\n JSONExtractInt(xblock_data_json, 'section') as section,\n JSONExtractInt(xblock_data_json, 'subsection') as subsection,\n JSONExtractInt(xblock_data_json, 'unit') as unit,\n JSONExtractBool(xblock_data_json, 'graded') as graded,\n order as course_order,\n course_key,\n dump_id,\n time_last_dumped\nfrom `event_sink`.`course_blocks` course_blocks\njoin\n (\n select location, max(time_last_dumped) as max_time_last_dumped\n from `event_sink`.`course_blocks`\n group by location\n ) latest_course_blocks\n on course_blocks.location = latest_course_blocks.location\n and course_blocks.time_last_dumped = latest_course_blocks.max_time_last_dumped", "relation_name": "`xapi`.`most_recent_course_blocks`"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-08-15T21:11:17.355552Z", "completed_at": "2024-08-15T21:11:17.360366Z"}, {"name": "execute", "started_at": "2024-08-15T21:11:17.360842Z", "completed_at": "2024-08-15T21:11:17.360848Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.006332874298095703, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.aspects.user_pii", "compiled": true, "compiled_code": "\n\nwith\n most_recent_user_profile as (\n select user_id, max(time_last_dumped) as time_last_dumped\n from `event_sink`.`user_profile`\n group by user_id\n )\nselect ex.user_id as user_id, ex.external_user_id, ex.username, up.name, up.email\nfrom `event_sink`.`external_id` ex\nleft outer join most_recent_user_profile mrup on mrup.user_id = ex.user_id\nleft outer join\n `event_sink`.`user_profile` up\n on up.user_id = mrup.user_id\n and up.time_last_dumped = mrup.time_last_dumped", "relation_name": "`xapi`.`user_pii`"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-08-15T21:11:17.363031Z", "completed_at": "2024-08-15T21:11:17.367005Z"}, {"name": "execute", "started_at": "2024-08-15T21:11:17.367487Z", "completed_at": "2024-08-15T21:11:17.367494Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.005425691604614258, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.aspects.xapi_events_all_parsed", "compiled": true, "compiled_code": "\n\nselect\n event_id as event_id,\n toLowCardinality(JSON_VALUE(event::String, '$.verb.id')) as verb_id,\n COALESCE(\n NULLIF(JSON_VALUE(event::String, '$.actor.account.name'), ''),\n NULLIF(JSON_VALUE(event::String, '$.actor.mbox'), ''),\n JSON_VALUE(event::String, '$.actor.mbox_sha1sum')\n ) as actor_id,\n JSON_VALUE(event::String, '$.object.id') as object_id,\n -- If the contextActivities parent is a course, use that. It can be a \"course\"\n -- type, or a \"cmi.interaction\" type for multiple question problem submissions.\n -- Otherwise use the object id for the course id.\n toLowCardinality(\n multiIf(\n -- If the contextActivities parent is a course, use that\n JSON_VALUE(\n event::String, '$.context.contextActivities.parent[0].definition.type'\n )\n = 'http://adlnet.gov/expapi/activities/course',\n JSON_VALUE(event::String, '$.context.contextActivities.parent[0].id'),\n -- Else if the contextActivities parent is a GroupActivity, it's a multi\n -- question problem and we use the grouping id\n JSON_VALUE(\n event::String, '$.context.contextActivities.parent[0].objectType'\n )\n in ('Activity', 'GroupActivity'),\n JSON_VALUE(event::String, '$.context.contextActivities.grouping[0].id'),\n -- Otherwise use the object id\n JSON_VALUE(event::String, '$.object.id')\n )\n ) as course_id,\n toLowCardinality(splitByString('/', course_id)[-1]) as course_key,\n toLowCardinality(\n coalesce(\n get_org_from_course_url(course_id),\n get_org_from_ccx_course_url(course_id),\n ''\n )\n ) as org,\n emission_time as emission_time,\n event::String as event\nfrom `xapi`.`xapi_events_all`", "relation_name": "`xapi`.`xapi_events_all_parsed`"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-08-15T21:11:17.369912Z", "completed_at": "2024-08-15T21:11:17.373513Z"}, {"name": "execute", "started_at": "2024-08-15T21:11:17.373976Z", "completed_at": "2024-08-15T21:11:17.373982Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.005323648452758789, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.aspects.a_tag", "compiled": true, "compiled_code": "select\n 'http://local.edly.io/xblock/block-v1:OpenedX+DemoX+DemoCourse+type@video+block@d5a54ce52f464acfa7a83ae155712cc3' as object_id,\n 'The Purpose, Power and Reach of the Open edX\u00ae Platform' as video_name,\n \n concat(\n '', video_name, ''\n )\n as object_a_tag\nfrom\n system.numbers\nwhere object_a_tag != 'The Purpose, Power and Reach of the Open edX\u00ae Platform'", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-08-15T21:11:17.376162Z", "completed_at": "2024-08-15T21:11:17.382624Z"}, {"name": "execute", "started_at": "2024-08-15T21:11:17.383092Z", "completed_at": "2024-08-15T21:11:17.383098Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.007965564727783203, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.aspects.get_bucket", "compiled": true, "compiled_code": "select 0.95 as field\nfrom system.one\nwhere \n case\n when field >= 0.9\n then '90-100%'\n when field >= 0.8 and field < 0.9\n then '80-89%'\n when field >= 0.7 and field < 0.8\n then '70-79%'\n when field >= 0.6 and field < 0.7\n then '60-69%'\n when field >= 0.5 and field < 0.6\n then '50-59%'\n when field >= 0.4 and field < 0.5\n then '40-49%'\n when field >= 0.3 and field < 0.4\n then '30-39%'\n when field >= 0.2 and field < 0.3\n then '20-29%'\n when field >= 0.1 and field < 0.2\n then '10-19%'\n else '0-9%'\n end != '90-100%'\n\nunion all \n\nselect 0.8 as field\nfrom system.one\nwhere \n case\n when field >= 0.9\n then '90-100%'\n when field >= 0.8 and field < 0.9\n then '80-89%'\n when field >= 0.7 and field < 0.8\n then '70-79%'\n when field >= 0.6 and field < 0.7\n then '60-69%'\n when field >= 0.5 and field < 0.6\n then '50-59%'\n when field >= 0.4 and field < 0.5\n then '40-49%'\n when field >= 0.3 and field < 0.4\n then '30-39%'\n when field >= 0.2 and field < 0.3\n then '20-29%'\n when field >= 0.1 and field < 0.2\n then '10-19%'\n else '0-9%'\n end != '80-89%'\n\nunion all \n\nselect 0.700009 as field\nfrom system.one\nwhere \n case\n when field >= 0.9\n then '90-100%'\n when field >= 0.8 and field < 0.9\n then '80-89%'\n when field >= 0.7 and field < 0.8\n then '70-79%'\n when field >= 0.6 and field < 0.7\n then '60-69%'\n when field >= 0.5 and field < 0.6\n then '50-59%'\n when field >= 0.4 and field < 0.5\n then '40-49%'\n when field >= 0.3 and field < 0.4\n then '30-39%'\n when field >= 0.2 and field < 0.3\n then '20-29%'\n when field >= 0.1 and field < 0.2\n then '10-19%'\n else '0-9%'\n end != '70-79%'\n\nunion all \n\nselect 0.69999 as field\nfrom system.one\nwhere \n case\n when field >= 0.9\n then '90-100%'\n when field >= 0.8 and field < 0.9\n then '80-89%'\n when field >= 0.7 and field < 0.8\n then '70-79%'\n when field >= 0.6 and field < 0.7\n then '60-69%'\n when field >= 0.5 and field < 0.6\n then '50-59%'\n when field >= 0.4 and field < 0.5\n then '40-49%'\n when field >= 0.3 and field < 0.4\n then '30-39%'\n when field >= 0.2 and field < 0.3\n then '20-29%'\n when field >= 0.1 and field < 0.2\n then '10-19%'\n else '0-9%'\n end != '60-69%'\n\nunion all \n\nselect 0.5 as field\nfrom system.one\nwhere \n case\n when field >= 0.9\n then '90-100%'\n when field >= 0.8 and field < 0.9\n then '80-89%'\n when field >= 0.7 and field < 0.8\n then '70-79%'\n when field >= 0.6 and field < 0.7\n then '60-69%'\n when field >= 0.5 and field < 0.6\n then '50-59%'\n when field >= 0.4 and field < 0.5\n then '40-49%'\n when field >= 0.3 and field < 0.4\n then '30-39%'\n when field >= 0.2 and field < 0.3\n then '20-29%'\n when field >= 0.1 and field < 0.2\n then '10-19%'\n else '0-9%'\n end != '50-59%'\n\nunion all \n\nselect 0.4123 as field\nfrom system.one\nwhere \n case\n when field >= 0.9\n then '90-100%'\n when field >= 0.8 and field < 0.9\n then '80-89%'\n when field >= 0.7 and field < 0.8\n then '70-79%'\n when field >= 0.6 and field < 0.7\n then '60-69%'\n when field >= 0.5 and field < 0.6\n then '50-59%'\n when field >= 0.4 and field < 0.5\n then '40-49%'\n when field >= 0.3 and field < 0.4\n then '30-39%'\n when field >= 0.2 and field < 0.3\n then '20-29%'\n when field >= 0.1 and field < 0.2\n then '10-19%'\n else '0-9%'\n end != '40-49%'\n\nunion all \n\nselect 0.3000000000 as field\nfrom system.one\nwhere \n case\n when field >= 0.9\n then '90-100%'\n when field >= 0.8 and field < 0.9\n then '80-89%'\n when field >= 0.7 and field < 0.8\n then '70-79%'\n when field >= 0.6 and field < 0.7\n then '60-69%'\n when field >= 0.5 and field < 0.6\n then '50-59%'\n when field >= 0.4 and field < 0.5\n then '40-49%'\n when field >= 0.3 and field < 0.4\n then '30-39%'\n when field >= 0.2 and field < 0.3\n then '20-29%'\n when field >= 0.1 and field < 0.2\n then '10-19%'\n else '0-9%'\n end != '30-39%'\n\nunion all \n\nselect 0.276734 as field\nfrom system.one\nwhere \n case\n when field >= 0.9\n then '90-100%'\n when field >= 0.8 and field < 0.9\n then '80-89%'\n when field >= 0.7 and field < 0.8\n then '70-79%'\n when field >= 0.6 and field < 0.7\n then '60-69%'\n when field >= 0.5 and field < 0.6\n then '50-59%'\n when field >= 0.4 and field < 0.5\n then '40-49%'\n when field >= 0.3 and field < 0.4\n then '30-39%'\n when field >= 0.2 and field < 0.3\n then '20-29%'\n when field >= 0.1 and field < 0.2\n then '10-19%'\n else '0-9%'\n end != '20-29%'\n\nunion all \n\nselect 0.11111 as field\nfrom system.one\nwhere \n case\n when field >= 0.9\n then '90-100%'\n when field >= 0.8 and field < 0.9\n then '80-89%'\n when field >= 0.7 and field < 0.8\n then '70-79%'\n when field >= 0.6 and field < 0.7\n then '60-69%'\n when field >= 0.5 and field < 0.6\n then '50-59%'\n when field >= 0.4 and field < 0.5\n then '40-49%'\n when field >= 0.3 and field < 0.4\n then '30-39%'\n when field >= 0.2 and field < 0.3\n then '20-29%'\n when field >= 0.1 and field < 0.2\n then '10-19%'\n else '0-9%'\n end != '10-19%'\n\nunion all \n\nselect 0.0342 as field\nfrom system.one\nwhere \n case\n when field >= 0.9\n then '90-100%'\n when field >= 0.8 and field < 0.9\n then '80-89%'\n when field >= 0.7 and field < 0.8\n then '70-79%'\n when field >= 0.6 and field < 0.7\n then '60-69%'\n when field >= 0.5 and field < 0.6\n then '50-59%'\n when field >= 0.4 and field < 0.5\n then '40-49%'\n when field >= 0.3 and field < 0.4\n then '30-39%'\n when field >= 0.2 and field < 0.3\n then '20-29%'\n when field >= 0.1 and field < 0.2\n then '10-19%'\n else '0-9%'\n end != '0-9%'\n\nunion all \n\nselect 0.00000005 as field\nfrom system.one\nwhere \n case\n when field >= 0.9\n then '90-100%'\n when field >= 0.8 and field < 0.9\n then '80-89%'\n when field >= 0.7 and field < 0.8\n then '70-79%'\n when field >= 0.6 and field < 0.7\n then '60-69%'\n when field >= 0.5 and field < 0.6\n then '50-59%'\n when field >= 0.4 and field < 0.5\n then '40-49%'\n when field >= 0.3 and field < 0.4\n then '30-39%'\n when field >= 0.2 and field < 0.3\n then '20-29%'\n when field >= 0.1 and field < 0.2\n then '10-19%'\n else '0-9%'\n end != '0-9%'\n\nunion all \n\nselect -0.1 as field\nfrom system.one\nwhere \n case\n when field >= 0.9\n then '90-100%'\n when field >= 0.8 and field < 0.9\n then '80-89%'\n when field >= 0.7 and field < 0.8\n then '70-79%'\n when field >= 0.6 and field < 0.7\n then '60-69%'\n when field >= 0.5 and field < 0.6\n then '50-59%'\n when field >= 0.4 and field < 0.5\n then '40-49%'\n when field >= 0.3 and field < 0.4\n then '30-39%'\n when field >= 0.2 and field < 0.3\n then '20-29%'\n when field >= 0.1 and field < 0.2\n then '10-19%'\n else '0-9%'\n end != '0-9%'\n\nunion all \n\nselect 123 as field\nfrom system.one\nwhere \n case\n when field >= 0.9\n then '90-100%'\n when field >= 0.8 and field < 0.9\n then '80-89%'\n when field >= 0.7 and field < 0.8\n then '70-79%'\n when field >= 0.6 and field < 0.7\n then '60-69%'\n when field >= 0.5 and field < 0.6\n then '50-59%'\n when field >= 0.4 and field < 0.5\n then '40-49%'\n when field >= 0.3 and field < 0.4\n then '30-39%'\n when field >= 0.2 and field < 0.3\n then '20-29%'\n when field >= 0.1 and field < 0.2\n then '10-19%'\n else '0-9%'\n end != '90-100%'", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-08-15T21:11:17.385274Z", "completed_at": "2024-08-15T21:11:17.389392Z"}, {"name": "execute", "started_at": "2024-08-15T21:11:17.389841Z", "completed_at": "2024-08-15T21:11:17.389847Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.0056307315826416016, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.aspects.get_problem_id", "compiled": true, "compiled_code": "select\n 'http://local.edly.io:8000/xblock/block-v1:edunext+demo+demo+ccx+type@problem+block@3c1646f7133a4c5fb4557d649e22c251'\n as object_id\nfrom system.one\nwhere\n \n regexpExtract(\n object_id, 'xblock/([\\w\\d-\\+:@]*@problem\\+block@[\\w\\d][^_\\/]*)(_\\d_\\d)?', 1\n )\n\n != 'block-v1:edunext+demo+demo+ccx+type@problem+block@3c1646f7133a4c5fb4557d649e22c251'\n\nunion all\n\nselect\n 'http://localhost:18000/course/course-v1:Org1+DemoX+1937e7'\n as object_id\nfrom system.one\nwhere\n \n regexpExtract(\n object_id, 'xblock/([\\w\\d-\\+:@]*@problem\\+block@[\\w\\d][^_\\/]*)(_\\d_\\d)?', 1\n )\n\n != ''\n\nunion all\n\nselect\n 'http://localhost:18000/xblock/block-v1:course-v1:Org0+DemoX+2bc51b+type@problem+block@09b07a8d'\n as object_id\nfrom system.one\nwhere\n \n regexpExtract(\n object_id, 'xblock/([\\w\\d-\\+:@]*@problem\\+block@[\\w\\d][^_\\/]*)(_\\d_\\d)?', 1\n )\n\n != 'block-v1:course-v1:Org0+DemoX+2bc51b+type@problem+block@09b07a8d'\n\nunion all\n\nselect\n 'http://localhost:18000/xblock/block-v1:course-v1:Org0+DemoX+2bc51b+type@problem+block@09b07a8d/answer'\n as object_id\nfrom system.one\nwhere\n \n regexpExtract(\n object_id, 'xblock/([\\w\\d-\\+:@]*@problem\\+block@[\\w\\d][^_\\/]*)(_\\d_\\d)?', 1\n )\n\n != 'block-v1:course-v1:Org0+DemoX+2bc51b+type@problem+block@09b07a8d'\n\nunion all\n\nselect\n 'http://localhost:18000/xblock/block-v1:course-v1:Org0+DemoX+81bba1+type@problem+block@20d3f709/hint/1'\n as object_id\nfrom system.one\nwhere\n \n regexpExtract(\n object_id, 'xblock/([\\w\\d-\\+:@]*@problem\\+block@[\\w\\d][^_\\/]*)(_\\d_\\d)?', 1\n )\n\n != 'block-v1:course-v1:Org0+DemoX+81bba1+type@problem+block@20d3f709'\n\nunion all\n\nselect\n 'http://localhost:18000/xblock/block-v1:course-v1:Org0+DemoX+81bba1+type@problem+block@20d3f709/hint/1'\n as object_id\nfrom system.one\nwhere\n \n regexpExtract(\n object_id, 'xblock/([\\w\\d-\\+:@]*@problem\\+block@[\\w\\d][^_\\/]*)(_\\d_\\d)?', 1\n )\n\n != 'block-v1:course-v1:Org0+DemoX+81bba1+type@problem+block@20d3f709'", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-08-15T21:11:17.391964Z", "completed_at": "2024-08-15T21:11:17.394446Z"}, {"name": "execute", "started_at": "2024-08-15T21:11:17.394934Z", "completed_at": "2024-08-15T21:11:17.394940Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.003947257995605469, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.aspects.get_problem_id_with_ccx", "compiled": true, "compiled_code": "select\n 'http://local.edly.io:8000/xblock/ccx-block-v1:edunext+demo+demo+ccx@1+type@problem+block@3c1646f7133a4c5fb4557d649e22c251'\n as object_id\nfrom system.one\nwhere\n \n regexpExtract(\n object_id, 'xblock/([\\w\\d-\\+:@]*@problem\\+block@[\\w\\d][^_\\/]*)(_\\d_\\d)?', 1\n )\n\n != 'ccx-block-v1:edunext+demo+demo+ccx@1+type@problem+block@3c1646f7133a4c5fb4557d649e22c251'", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-08-15T21:11:17.397099Z", "completed_at": "2024-08-15T21:11:17.402125Z"}, {"name": "execute", "started_at": "2024-08-15T21:11:17.402583Z", "completed_at": "2024-08-15T21:11:17.402587Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.006505012512207031, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.aspects.section_from_display", "compiled": true, "compiled_code": "select \n '1:2:3 - Course 1a2b3c' as display_name_with_location\nfrom system.one\nwhere \n \n concat(\n splitByString(\n ':', splitByString(' - ', display_name_with_location)[1], 1\n )[1],\n ':0:0'\n )\n\n != '1:0:0'\n\nunion all \n\nselect \n '1:2:33 - Video 12' as display_name_with_location\nfrom system.one\nwhere \n \n concat(\n splitByString(\n ':', splitByString(' - ', display_name_with_location)[1], 1\n )[1],\n ':0:0'\n )\n\n != '1:0:0'\n\nunion all \n\nselect \n '1:22:3 - Vertical 345' as display_name_with_location\nfrom system.one\nwhere \n \n concat(\n splitByString(\n ':', splitByString(' - ', display_name_with_location)[1], 1\n )[1],\n ':0:0'\n )\n\n != '1:0:0'\n\nunion all \n\nselect \n '11:2:3 - Sequential 678' as display_name_with_location\nfrom system.one\nwhere \n \n concat(\n splitByString(\n ':', splitByString(' - ', display_name_with_location)[1], 1\n )[1],\n ':0:0'\n )\n\n != '11:0:0'", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-08-15T21:11:17.404718Z", "completed_at": "2024-08-15T21:11:17.408471Z"}, {"name": "execute", "started_at": "2024-08-15T21:11:17.408974Z", "completed_at": "2024-08-15T21:11:17.408981Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.005319118499755859, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.aspects.subsection_from_display", "compiled": true, "compiled_code": "select \n '1:2:3 - Chapter 123' as display_name_with_location\nfrom system.one\nwhere \n \n concat(\n arrayStringConcat(\n splitByString(\n ':', splitByString(' - ', display_name_with_location)[1], 2\n ),\n ':'\n ),\n ':0'\n )\n\n != '1:2:0'\n\nunion all \n\nselect \n '1:2:33 - Problem 456' as display_name_with_location\nfrom system.one\nwhere \n \n concat(\n arrayStringConcat(\n splitByString(\n ':', splitByString(' - ', display_name_with_location)[1], 2\n ),\n ':'\n ),\n ':0'\n )\n\n != '1:2:0'\n\nunion all \n\nselect \n '1:22:3 - Sequential 789' as display_name_with_location\nfrom system.one\nwhere \n \n concat(\n arrayStringConcat(\n splitByString(\n ':', splitByString(' - ', display_name_with_location)[1], 2\n ),\n ':'\n ),\n ':0'\n )\n\n != '1:22:0'\n\nunion all \n\nselect \n '11:2:3 - Vertical 123' as display_name_with_location\nfrom system.one\nwhere \n \n concat(\n arrayStringConcat(\n splitByString(\n ':', splitByString(' - ', display_name_with_location)[1], 2\n ),\n ':'\n ),\n ':0'\n )\n\n != '11:2:0'", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-08-15T21:11:17.411150Z", "completed_at": "2024-08-15T21:11:17.415423Z"}, {"name": "execute", "started_at": "2024-08-15T21:11:17.415921Z", "completed_at": "2024-08-15T21:11:17.415925Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.005760669708251953, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.aspects.course_block_names", "compiled": true, "compiled_code": "\nselect\n location, block_name, course_key, graded, course_order, display_name_with_location\nfrom `xapi`.`most_recent_course_blocks`", "relation_name": "`xapi`.`course_block_names`"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-08-15T21:11:17.418210Z", "completed_at": "2024-08-15T21:11:17.420691Z"}, {"name": "execute", "started_at": "2024-08-15T21:11:17.421211Z", "completed_at": "2024-08-15T21:11:17.421216Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.00410008430480957, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.aspects.dim_user_pii", "compiled": true, "compiled_code": "select external_user_id, username, name, email from `xapi`.`user_pii` user_pii", "relation_name": "`xapi`.`dim_user_pii`"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-08-15T21:11:17.423330Z", "completed_at": "2024-08-15T21:11:17.426932Z"}, {"name": "execute", "started_at": "2024-08-15T21:11:17.427445Z", "completed_at": "2024-08-15T21:11:17.427451Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.0051364898681640625, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.aspects.enrollment_events", "compiled": true, "compiled_code": "\n\nselect\n event_id,\n cast(emission_time as DateTime) as emission_time,\n actor_id,\n object_id,\n course_key,\n org,\n verb_id,\n toLowCardinality(\n JSON_VALUE(\n event,\n '$.object.definition.extensions.\"https://w3id.org/xapi/acrossx/extensions/type\"'\n )\n ) as enrollment_mode\nfrom `xapi`.`xapi_events_all_parsed`\nwhere\n verb_id in (\n 'http://adlnet.gov/expapi/verbs/registered',\n 'http://id.tincanapi.com/verb/unregistered'\n )", "relation_name": "`xapi`.`enrollment_events`"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-08-15T21:11:17.429728Z", "completed_at": "2024-08-15T21:11:17.433018Z"}, {"name": "execute", "started_at": "2024-08-15T21:11:17.433512Z", "completed_at": "2024-08-15T21:11:17.433516Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.004830121994018555, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.aspects.fact_instance_actors", "compiled": true, "compiled_code": "\n\nselect\n date_trunc('day', emission_time) as emission_day,\n uniqCombinedState(actor_id) as actors_cnt\nfrom `xapi`.`xapi_events_all_parsed`\ngroup by emission_day", "relation_name": "`xapi`.`fact_instance_actors`"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-08-15T21:11:17.435643Z", "completed_at": "2024-08-15T21:11:17.439047Z"}, {"name": "execute", "started_at": "2024-08-15T21:11:17.439574Z", "completed_at": "2024-08-15T21:11:17.439578Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.004942655563354492, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.aspects.fact_instance_courses", "compiled": true, "compiled_code": "\n\nselect\n date_trunc('hour', emission_time) as emission_hour,\n uniqCombinedState(course_id) as courses_cnt\nfrom `xapi`.`xapi_events_all_parsed`\ngroup by emission_hour", "relation_name": "`xapi`.`fact_instance_courses`"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-08-15T21:11:17.441673Z", "completed_at": "2024-08-15T21:11:17.444918Z"}, {"name": "execute", "started_at": "2024-08-15T21:11:17.445413Z", "completed_at": "2024-08-15T21:11:17.445418Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.004730939865112305, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.aspects.fact_instance_events", "compiled": true, "compiled_code": "\n\nselect\n date_trunc('day', emission_time) as emission_day,\n uniqCombinedState(event_id) as events_cnt\nfrom `xapi`.`xapi_events_all_parsed`\ngroup by emission_day", "relation_name": "`xapi`.`fact_instance_events`"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-08-15T21:11:17.447528Z", "completed_at": "2024-08-15T21:11:17.451232Z"}, {"name": "execute", "started_at": "2024-08-15T21:11:17.451752Z", "completed_at": "2024-08-15T21:11:17.451756Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.005215644836425781, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.aspects.grading_events", "compiled": true, "compiled_code": "\n\n\nselect\n event_id,\n CAST(emission_time, 'DateTime') as emission_time,\n actor_id,\n object_id,\n course_key,\n org,\n verb_id,\n JSONExtractFloat(event, 'result', 'score', 'scaled') as scaled_score\nfrom `xapi`.`xapi_events_all_parsed`\nwhere\n verb_id in (\n 'http://id.tincanapi.com/verb/earned',\n 'https://w3id.org/xapi/acrossx/verbs/evaluated'\n )\n or (\n verb_id in (\n 'http://adlnet.gov/expapi/verbs/passed',\n 'http://adlnet.gov/expapi/verbs/failed'\n )\n and JSON_VALUE(event::String, '$.object.definition.type')\n = 'http://adlnet.gov/expapi/activities/course'\n )", "relation_name": "`xapi`.`grading_events`"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-08-15T21:11:17.453953Z", "completed_at": "2024-08-15T21:11:17.457684Z"}, {"name": "execute", "started_at": "2024-08-15T21:11:17.458185Z", "completed_at": "2024-08-15T21:11:17.458189Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.005189180374145508, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.aspects.navigation_events", "compiled": true, "compiled_code": "\n\nselect\n event_id,\n cast(emission_time as DateTime) as emission_time,\n actor_id,\n splitByString('/xblock/', object_id)[-1] as block_id,\n course_key,\n org,\n verb_id,\n JSONExtractString(event, 'object', 'definition', 'type') as object_type,\n -- clicking a link and selecting a module outline have no starting-position field\n if(\n object_type in (\n 'http://adlnet.gov/expapi/activities/link',\n 'http://adlnet.gov/expapi/activities/module'\n ),\n 0,\n JSONExtractInt(\n event,\n 'context',\n 'extensions',\n 'http://id.tincanapi.com/extension/starting-position'\n )\n ) as starting_position,\n JSONExtractString(\n event, 'context', 'extensions', 'http://id.tincanapi.com/extension/ending-point'\n ) as ending_point\nfrom `xapi`.`xapi_events_all_parsed`\nwhere verb_id in ('https://w3id.org/xapi/dod-isd/verbs/navigated')", "relation_name": "`xapi`.`navigation_events`"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-08-15T21:11:17.460325Z", "completed_at": "2024-08-15T21:11:17.465668Z"}, {"name": "execute", "started_at": "2024-08-15T21:11:17.466121Z", "completed_at": "2024-08-15T21:11:17.466125Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.006859540939331055, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.aspects.problem_events", "compiled": true, "compiled_code": "\n\nselect\n event_id,\n cast(emission_time as DateTime) as emission_time,\n actor_id,\n object_id,\n course_key,\n org,\n verb_id,\n JSON_VALUE(event, '$.result.response') as responses,\n JSONExtractFloat(event, 'result', 'score', 'scaled') as scaled_score,\n if(\n verb_id = 'https://w3id.org/xapi/acrossx/verbs/evaluated',\n cast(JSON_VALUE(event, '$.result.success') as Bool),\n false\n ) as success,\n toLowCardinality(\n JSON_VALUE(event, '$.object.definition.interactionType')\n ) as interaction_type,\n if(\n verb_id = 'https://w3id.org/xapi/acrossx/verbs/evaluated',\n cast(\n JSON_VALUE(\n event,\n '$.object.definition.extensions.\"http://id.tincanapi.com/extension/attempt-id\"'\n ) as Int16\n ),\n 0\n ) as attempts,\n \n regexpExtract(\n object_id, 'xblock/([\\w\\d-\\+:@]*@problem\\+block@[\\w\\d][^_\\/]*)(_\\d_\\d)?', 1\n )\n as problem_id\nfrom `xapi`.`xapi_events_all_parsed`\nwhere\n verb_id in (\n 'https://w3id.org/xapi/acrossx/verbs/evaluated',\n 'http://adlnet.gov/expapi/verbs/passed',\n 'http://adlnet.gov/expapi/verbs/asked'\n )", "relation_name": "`xapi`.`problem_events`"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-08-15T21:11:17.468477Z", "completed_at": "2024-08-15T21:11:17.472203Z"}, {"name": "execute", "started_at": "2024-08-15T21:11:17.472712Z", "completed_at": "2024-08-15T21:11:17.472717Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.005304098129272461, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.aspects.video_playback_events", "compiled": true, "compiled_code": "\n\nselect\n event_id,\n CAST(emission_time, 'DateTime') as emission_time,\n actor_id,\n object_id,\n course_key,\n org,\n verb_id,\n ceil(\n CAST(\n coalesce(\n nullIf(\n JSON_VALUE(\n event,\n '$.result.extensions.\"https://w3id.org/xapi/video/extensions/time\"'\n ),\n ''\n ),\n nullIf(\n JSON_VALUE(\n event,\n '$.result.extensions.\"https://w3id.org/xapi/video/extensions/time-from\"'\n ),\n ''\n ),\n '0.0'\n ),\n 'Decimal32(2)'\n )\n ) as video_position,\n JSONExtractInt(\n event, 'context', 'extensions', 'https://w3id.org/xapi/video/extensions/length'\n ) as video_duration\nfrom `xapi`.`xapi_events_all_parsed`\nwhere\n (\n verb_id in (\n 'http://adlnet.gov/expapi/verbs/completed',\n 'http://adlnet.gov/expapi/verbs/initialized',\n 'http://adlnet.gov/expapi/verbs/terminated',\n 'https://w3id.org/xapi/video/verbs/paused',\n 'https://w3id.org/xapi/video/verbs/played',\n 'https://w3id.org/xapi/video/verbs/seeked'\n )\n )\n and (object_id like '%video+block%')", "relation_name": "`xapi`.`video_playback_events`"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-08-15T21:11:17.474831Z", "completed_at": "2024-08-15T21:11:17.478060Z"}, {"name": "execute", "started_at": "2024-08-15T21:11:17.478514Z", "completed_at": "2024-08-15T21:11:17.478518Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.004661083221435547, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.aspects.dim_course_blocks", "compiled": true, "compiled_code": "select\n courses.org as org,\n courses.course_key as course_key,\n courses.course_name as course_name,\n courses.course_run as course_run,\n blocks.location as block_id,\n blocks.block_name as block_name,\n \n concat(\n splitByString(\n ':', splitByString(' - ', blocks.display_name_with_location)[1], 1\n )[1],\n ':0:0'\n )\n as section_number,\n \n concat(\n arrayStringConcat(\n splitByString(\n ':', splitByString(' - ', blocks.display_name_with_location)[1], 2\n ),\n ':'\n ),\n ':0'\n )\n\n as subsection_number,\n splitByString(' - ', blocks.display_name_with_location)[1] as hierarchy_location,\n blocks.display_name_with_location as display_name_with_location,\n course_order,\n graded,\n case\n when block_id like '%@chapter+block@%'\n then 'section'\n when block_id like '%@sequential+block@%'\n then 'subsection'\n when block_id like '%@vertical+block@%'\n then 'unit'\n else regexpExtract(block_id, '@([^+]+)\\+block@', 1)\n end as block_type\nfrom `xapi`.`course_block_names` blocks\njoin `xapi`.`course_names` courses on blocks.course_key = courses.course_key", "relation_name": "`xapi`.`dim_course_blocks`"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-08-15T21:11:17.480868Z", "completed_at": "2024-08-15T21:11:17.483955Z"}, {"name": "execute", "started_at": "2024-08-15T21:11:17.484482Z", "completed_at": "2024-08-15T21:11:17.484487Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.00474095344543457, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.aspects.fact_enrollment_status", "compiled": true, "compiled_code": "\n\nwith\n ranked_enrollments as (\n select\n emission_time,\n org,\n course_key,\n actor_id,\n enrollment_mode,\n splitByString('/', verb_id)[-1] as enrollment_status,\n row_number() over (\n partition by org, course_key, actor_id order by emission_time desc\n ) as rn\n from `xapi`.`enrollment_events`\n )\n\nselect org, course_key, actor_id, enrollment_status, enrollment_mode, emission_time\nfrom ranked_enrollments\nwhere rn = 1", "relation_name": "`xapi`.`fact_enrollment_status`"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-08-15T21:11:17.486666Z", "completed_at": "2024-08-15T21:11:17.489746Z"}, {"name": "execute", "started_at": "2024-08-15T21:11:17.490240Z", "completed_at": "2024-08-15T21:11:17.490244Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.0045299530029296875, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.aspects.fact_enrollments", "compiled": true, "compiled_code": "with\n enrollments as (\n select\n emission_time,\n org,\n course_key,\n actor_id,\n enrollment_mode,\n splitByString('/', verb_id)[-1] as enrollment_status\n from `xapi`.`enrollment_events`\n )\n\nselect\n enrollments.emission_time as emission_time,\n enrollments.org as org,\n enrollments.course_key as course_key,\n courses.course_name as course_name,\n courses.course_run as course_run,\n enrollments.actor_id as actor_id,\n enrollments.enrollment_mode as enrollment_mode,\n enrollments.enrollment_status as enrollment_status,\n users.username as username,\n users.name as name,\n users.email as email\nfrom enrollments\njoin `xapi`.`course_names` courses on enrollments.course_key = courses.course_key\nleft outer join\n `xapi`.`dim_user_pii` users on toUUID(actor_id) = users.external_user_id", "relation_name": "`xapi`.`fact_enrollments`"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-08-15T21:11:17.492418Z", "completed_at": "2024-08-15T21:11:17.495778Z"}, {"name": "execute", "started_at": "2024-08-15T21:11:17.496276Z", "completed_at": "2024-08-15T21:11:17.496281Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.0048596858978271484, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.aspects.fact_instance_enrollments", "compiled": true, "compiled_code": "\n\nwith\n enrollments as (\n select\n emission_time,\n course_key,\n enrollment_mode,\n splitByString('/', verb_id)[-1] as enrollment_status\n from `xapi`.`enrollment_events`\n )\n\nselect\n date_trunc('day', emission_time) as emission_day,\n enrollments.course_key,\n enrollments.enrollment_mode as enrollment_mode,\n enrollments.enrollment_status as enrollment_status,\n count() as course_enrollment_mode_status_cnt\nfrom enrollments\ngroup by emission_day, course_key, enrollment_mode, enrollment_status", "relation_name": "`xapi`.`fact_instance_enrollments`"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-08-15T21:11:17.498511Z", "completed_at": "2024-08-15T21:11:17.501617Z"}, {"name": "execute", "started_at": "2024-08-15T21:11:17.502114Z", "completed_at": "2024-08-15T21:11:17.502119Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.0046274662017822266, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.aspects.fact_learner_course_grade", "compiled": true, "compiled_code": "\n\nwith\n ranked_grades as (\n select\n emission_time,\n org,\n course_key,\n actor_id,\n scaled_score as course_grade,\n row_number() over (\n partition by org, course_key, actor_id order by emission_time desc\n ) as rn\n from `xapi`.`grading_events`\n where object_id like '%/course/%'\n )\n\nselect org, course_key, actor_id, course_grade, emission_time\nfrom ranked_grades\nwhere rn = 1", "relation_name": "`xapi`.`fact_learner_course_grade`"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-08-15T21:11:17.504246Z", "completed_at": "2024-08-15T21:11:17.507326Z"}, {"name": "execute", "started_at": "2024-08-15T21:11:17.507812Z", "completed_at": "2024-08-15T21:11:17.507835Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.00460362434387207, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.aspects.fact_learner_course_status", "compiled": true, "compiled_code": "\n\nwith\n ranked_status as (\n select\n org,\n course_key,\n actor_id,\n splitByString('/', verb_id)[-1] as approving_state,\n emission_time,\n row_number() over (\n partition by org, course_key, actor_id order by emission_time desc\n ) as rn\n from `xapi`.`grading_events`\n where\n verb_id in (\n 'http://adlnet.gov/expapi/verbs/passed',\n 'http://adlnet.gov/expapi/verbs/failed'\n )\n )\n\nselect org, course_key, actor_id, approving_state, emission_time\nfrom ranked_status\nwhere rn = 1", "relation_name": "`xapi`.`fact_learner_course_status`"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-08-15T21:11:17.510165Z", "completed_at": "2024-08-15T21:11:17.513712Z"}, {"name": "execute", "started_at": "2024-08-15T21:11:17.514208Z", "completed_at": "2024-08-15T21:11:17.514213Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.005178213119506836, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.aspects.fact_learner_last_course_visit", "compiled": true, "compiled_code": "\n\nselect org, course_key, actor_id, max(emission_time) as emission_time\nfrom `xapi`.`navigation_events`\ngroup by org, course_key, actor_id", "relation_name": "`xapi`.`fact_learner_last_course_visit`"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-08-15T21:11:17.516277Z", "completed_at": "2024-08-15T21:11:17.520056Z"}, {"name": "execute", "started_at": "2024-08-15T21:11:17.520544Z", "completed_at": "2024-08-15T21:11:17.520548Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.005221843719482422, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.aspects.responses", "compiled": true, "compiled_code": "-- select one record per (learner, problem, course, org) tuple\n-- contains either the first successful attempt\n-- or the most recent unsuccessful attempt\n-- find the timestamp of the earliest successful response\n-- this will be used to pick the xAPI event corresponding to that submission\n\n\nwith\n responses as (\n select emission_time, org, course_key, object_id, problem_id, actor_id, success\n from `xapi`.`problem_events`\n where verb_id = 'https://w3id.org/xapi/acrossx/verbs/evaluated'\n ),\n response_status as (\n select\n org,\n course_key,\n problem_id,\n actor_id,\n MIN(case when success then emission_time else NULL end) as first_success_at,\n MAX(emission_time) as last_attempt_at\n from responses\n group by org, course_key, problem_id, actor_id\n )\nselect\n org,\n course_key,\n problem_id,\n actor_id,\n first_success_at,\n last_attempt_at,\n coalesce(first_success_at, last_attempt_at) as emission_time\nfrom response_status", "relation_name": "`xapi`.`responses`"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-08-15T21:11:17.524475Z", "completed_at": "2024-08-15T21:11:17.527504Z"}, {"name": "execute", "started_at": "2024-08-15T21:11:17.528027Z", "completed_at": "2024-08-15T21:11:17.528031Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.006268024444580078, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.aspects.dim_course_blocks_extended", "compiled": true, "compiled_code": "select\n blocks.org as org,\n blocks.course_key as course_key,\n blocks.course_name as course_name,\n blocks.course_run as course_run,\n blocks.block_id as block_id,\n blocks.block_name as block_name,\n blocks.section_number as section_number,\n blocks.subsection_number as subsection_number,\n blocks.hierarchy_location as hierarchy_location,\n blocks.display_name_with_location as display_name_with_location,\n blocks.graded as graded,\n blocks.course_order as course_order,\n blocks.block_type as block_type,\n section_blocks.display_name_with_location as section_with_name,\n subsection_blocks.display_name_with_location as subsection_with_name\nfrom `xapi`.`dim_course_blocks` blocks\nleft join\n `xapi`.`dim_course_blocks` section_blocks\n on (\n blocks.section_number = section_blocks.hierarchy_location\n and blocks.org = section_blocks.org\n and blocks.course_key = section_blocks.course_key\n and section_blocks.block_id like '%@chapter+block@%'\n )\nleft join\n `xapi`.`dim_course_blocks` subsection_blocks\n on (\n blocks.subsection_number = subsection_blocks.hierarchy_location\n and blocks.org = subsection_blocks.org\n and blocks.course_key = subsection_blocks.course_key\n and subsection_blocks.block_id like '%@sequential+block@%'\n )", "relation_name": "`xapi`.`dim_course_blocks_extended`"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-08-15T21:11:17.530346Z", "completed_at": "2024-08-15T21:11:17.533377Z"}, {"name": "execute", "started_at": "2024-08-15T21:11:17.533859Z", "completed_at": "2024-08-15T21:11:17.533864Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.004615068435668945, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.aspects.fact_navigation", "compiled": true, "compiled_code": "select\n navigation.emission_time as emission_time,\n navigation.org as org,\n navigation.course_key as course_key,\n blocks.course_name as course_name,\n blocks.course_run as course_run,\n navigation.actor_id as actor_id,\n navigation.block_id as block_id,\n blocks.block_name as block_name,\n blocks.display_name_with_location as block_name_with_location,\n blocks.course_order as course_order,\n navigation.object_type as object_type,\n navigation.starting_position as starting_position,\n navigation.ending_point as ending_point,\n users.username as username,\n users.name as name,\n users.email as email\nfrom `xapi`.`navigation_events` navigation\njoin\n `xapi`.`dim_course_blocks` blocks\n on (\n navigation.course_key = blocks.course_key\n and navigation.block_id = blocks.block_id\n )\nleft outer join\n `xapi`.`dim_user_pii` users on toUUID(actor_id) = users.external_user_id", "relation_name": "`xapi`.`fact_navigation`"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-08-15T21:11:17.536293Z", "completed_at": "2024-08-15T21:11:17.541067Z"}, {"name": "execute", "started_at": "2024-08-15T21:11:17.541702Z", "completed_at": "2024-08-15T21:11:17.541708Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.006694793701171875, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.aspects.fact_problem_responses", "compiled": true, "compiled_code": "with\n responses as (\n select\n emission_time,\n org,\n course_key,\n object_id,\n problem_id,\n actor_id,\n responses,\n success,\n attempts,\n interaction_type\n from `xapi`.`problem_events`\n where verb_id = 'https://w3id.org/xapi/acrossx/verbs/evaluated'\n )\n\nselect\n responses.emission_time as emission_time,\n responses.org as org,\n responses.course_key as course_key,\n blocks.course_name as course_name,\n blocks.course_run as course_run,\n responses.problem_id as problem_id,\n blocks.block_name as problem_name,\n blocks.display_name_with_location as problem_name_with_location,\n \n concat(\n '', blocks.block_name, ''\n )\n as problem_link,\n blocks.graded as graded,\n course_order as course_order,\n responses.actor_id as actor_id,\n responses.responses as responses,\n responses.success as success,\n responses.attempts as attempts,\n responses.interaction_type as interaction_type,\n users.username as username,\n users.name as name,\n users.email as email\nfrom responses\njoin\n `xapi`.`dim_course_blocks` blocks\n on (\n responses.course_key = blocks.course_key\n and responses.problem_id = blocks.block_id\n )\nleft outer join\n `xapi`.`dim_user_pii` users on toUUID(actor_id) = users.external_user_id\ngroup by\n -- multi-part questions include an extra record for the response to the first\n -- part of the question. this group by clause eliminates the duplicate record\n emission_time,\n org,\n course_key,\n course_name,\n course_run,\n problem_id,\n problem_name,\n problem_name_with_location,\n problem_link,\n actor_id,\n responses,\n success,\n attempts,\n course_order,\n graded,\n interaction_type,\n username,\n name,\n email", "relation_name": "`xapi`.`fact_problem_responses`"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-08-15T21:11:17.544602Z", "completed_at": "2024-08-15T21:11:17.550388Z"}, {"name": "execute", "started_at": "2024-08-15T21:11:17.551052Z", "completed_at": "2024-08-15T21:11:17.551057Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.007761478424072266, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.aspects.int_pages_per_subsection", "compiled": true, "compiled_code": "select * from (\n with\n items_per_subsection as (\n select\n org,\n course_key,\n section_number,\n subsection_number,\n course_order,\n graded,\n count(*) as item_count\n from `xapi`.`dim_course_blocks`\n where block_id like '%@vertical+block@%'\n group by\n org, course_key, section_number, subsection_number, course_order, graded\n )\n\n select\n ips.org as org,\n ips.course_key as course_key,\n ips.section_number as section_number,\n section_blocks.display_name_with_location as section_with_name,\n ips.subsection_number as subsection_number,\n subsection_blocks.display_name_with_location as subsection_with_name,\n ips.course_order as course_order,\n ips.graded as graded,\n ips.item_count as item_count,\n subsection_blocks.block_id as subsection_block_id,\n section_blocks.block_id as section_block_id\n from items_per_subsection ips\n left join\n `xapi`.`dim_course_blocks` section_blocks\n on (\n ips.section_number = section_blocks.hierarchy_location\n and ips.org = section_blocks.org\n and ips.course_key = section_blocks.course_key\n and section_blocks.block_id like '%@chapter+block@%'\n )\n left join\n `xapi`.`dim_course_blocks` subsection_blocks\n on (\n ips.subsection_number = subsection_blocks.hierarchy_location\n and ips.org = subsection_blocks.org\n and ips.course_key = subsection_blocks.course_key\n and subsection_blocks.block_id like '%@sequential+block@%'\n )\n)", "relation_name": "`xapi`.`int_pages_per_subsection`"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-08-15T21:11:17.554279Z", "completed_at": "2024-08-15T21:11:17.558376Z"}, {"name": "execute", "started_at": "2024-08-15T21:11:17.559008Z", "completed_at": "2024-08-15T21:11:17.559013Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.006376981735229492, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.aspects.int_problem_hints", "compiled": true, "compiled_code": "with\n hints as (\n select\n emission_time,\n org,\n course_key,\n problem_id,\n actor_id,\n case\n when object_id like '%/hint%'\n then 'hint'\n when object_id like '%/answer%'\n then 'answer'\n else 'N/A'\n end as help_type\n from `xapi`.`problem_events`\n where verb_id = 'http://adlnet.gov/expapi/verbs/asked'\n )\n\nselect\n hints.emission_time as emission_time,\n hints.org as org,\n hints.course_key as course_key,\n blocks.course_name as course_name,\n blocks.course_run as course_run,\n hints.problem_id as problem_id,\n blocks.block_name as problem_name,\n blocks.display_name_with_location as problem_name_with_location,\n blocks.course_order as course_order,\n hints.actor_id as actor_id,\n hints.help_type as help_type\nfrom hints\njoin\n `xapi`.`dim_course_blocks` blocks\n on (hints.course_key = blocks.course_key and hints.problem_id = blocks.block_id)", "relation_name": "`xapi`.`int_problem_hints`"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-08-15T21:11:17.562011Z", "completed_at": "2024-08-15T21:11:17.564980Z"}, {"name": "execute", "started_at": "2024-08-15T21:11:17.565458Z", "completed_at": "2024-08-15T21:11:17.565463Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.00488591194152832, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.aspects.int_problems_per_subsection", "compiled": true, "compiled_code": "select * from (\n with\n items_per_subsection as (\n select\n org,\n course_key,\n section_number,\n subsection_number,\n course_order,\n graded,\n count(*) as item_count\n from `xapi`.`dim_course_blocks`\n where block_id like '%@problem+block@%'\n group by\n org, course_key, section_number, subsection_number, course_order, graded\n )\n\n select\n ips.org as org,\n ips.course_key as course_key,\n ips.section_number as section_number,\n section_blocks.display_name_with_location as section_with_name,\n ips.subsection_number as subsection_number,\n subsection_blocks.display_name_with_location as subsection_with_name,\n ips.course_order as course_order,\n ips.graded as graded,\n ips.item_count as item_count,\n subsection_blocks.block_id as subsection_block_id,\n section_blocks.block_id as section_block_id\n from items_per_subsection ips\n left join\n `xapi`.`dim_course_blocks` section_blocks\n on (\n ips.section_number = section_blocks.hierarchy_location\n and ips.org = section_blocks.org\n and ips.course_key = section_blocks.course_key\n and section_blocks.block_id like '%@chapter+block@%'\n )\n left join\n `xapi`.`dim_course_blocks` subsection_blocks\n on (\n ips.subsection_number = subsection_blocks.hierarchy_location\n and ips.org = subsection_blocks.org\n and ips.course_key = subsection_blocks.course_key\n and subsection_blocks.block_id like '%@sequential+block@%'\n )\n)", "relation_name": "`xapi`.`int_problems_per_subsection`"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-08-15T21:11:17.567658Z", "completed_at": "2024-08-15T21:11:17.570350Z"}, {"name": "execute", "started_at": "2024-08-15T21:11:17.570848Z", "completed_at": "2024-08-15T21:11:17.570853Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.004194021224975586, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.aspects.int_videos_per_subsection", "compiled": true, "compiled_code": "select * from (\n with\n items_per_subsection as (\n select\n org,\n course_key,\n section_number,\n subsection_number,\n course_order,\n graded,\n count(*) as item_count\n from `xapi`.`dim_course_blocks`\n where block_id like '%@video+block@%'\n group by\n org, course_key, section_number, subsection_number, course_order, graded\n )\n\n select\n ips.org as org,\n ips.course_key as course_key,\n ips.section_number as section_number,\n section_blocks.display_name_with_location as section_with_name,\n ips.subsection_number as subsection_number,\n subsection_blocks.display_name_with_location as subsection_with_name,\n ips.course_order as course_order,\n ips.graded as graded,\n ips.item_count as item_count,\n subsection_blocks.block_id as subsection_block_id,\n section_blocks.block_id as section_block_id\n from items_per_subsection ips\n left join\n `xapi`.`dim_course_blocks` section_blocks\n on (\n ips.section_number = section_blocks.hierarchy_location\n and ips.org = section_blocks.org\n and ips.course_key = section_blocks.course_key\n and section_blocks.block_id like '%@chapter+block@%'\n )\n left join\n `xapi`.`dim_course_blocks` subsection_blocks\n on (\n ips.subsection_number = subsection_blocks.hierarchy_location\n and ips.org = subsection_blocks.org\n and ips.course_key = subsection_blocks.course_key\n and subsection_blocks.block_id like '%@sequential+block@%'\n )\n)", "relation_name": "`xapi`.`int_videos_per_subsection`"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-08-15T21:11:17.573001Z", "completed_at": "2024-08-15T21:11:17.584256Z"}, {"name": "execute", "started_at": "2024-08-15T21:11:17.584731Z", "completed_at": "2024-08-15T21:11:17.584736Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.012742757797241211, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.aspects.accepted_values_fact_enrollment_status_enrollment_status__registered__unregistered.893527c11f", "compiled": true, "compiled_code": "\n \n \n\nwith all_values as (\n\n select\n enrollment_status as value_field,\n count(*) as n_records\n\n from `xapi`.`fact_enrollment_status`\n group by enrollment_status\n\n)\n\nselect *\nfrom all_values\nwhere value_field not in (\n 'registered','unregistered'\n)\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-08-15T21:11:17.586967Z", "completed_at": "2024-08-15T21:11:17.590714Z"}, {"name": "execute", "started_at": "2024-08-15T21:11:17.591207Z", "completed_at": "2024-08-15T21:11:17.591211Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.0052416324615478516, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.aspects.accepted_values_fact_enrollments_enrollment_status__registered__unregistered.f8d10203f4", "compiled": true, "compiled_code": "\n \n \n\nwith all_values as (\n\n select\n enrollment_status as value_field,\n count(*) as n_records\n\n from `xapi`.`fact_enrollments`\n group by enrollment_status\n\n)\n\nselect *\nfrom all_values\nwhere value_field not in (\n 'registered','unregistered'\n)\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-08-15T21:11:17.593391Z", "completed_at": "2024-08-15T21:11:17.601101Z"}, {"name": "execute", "started_at": "2024-08-15T21:11:17.601586Z", "completed_at": "2024-08-15T21:11:17.601591Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.009232759475708008, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.aspects.accepted_values_xapi_fact_instance_enrollments_enrollment_status__xapi_fact_instance_enrollments__registered__unregistered.744ab867be", "compiled": true, "compiled_code": "\n\nwith all_values as (\n\n select distinct\n enrollment_status as value_field\n\n from xapi.fact_instance_enrollments\n\n),\n\nvalidation_errors as (\n\n select\n value_field\n\n from all_values\n where value_field not in (\n 'registered','unregistered'\n )\n\n)\n\nselect *\nfrom validation_errors\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-08-15T21:11:17.603735Z", "completed_at": "2024-08-15T21:11:17.607583Z"}, {"name": "execute", "started_at": "2024-08-15T21:11:17.608061Z", "completed_at": "2024-08-15T21:11:17.608066Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.0053558349609375, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.aspects.fact_student_status", "compiled": true, "compiled_code": "select\n fes.org as org,\n fes.course_key as course_key,\n fes.actor_id as actor_id,\n courses.course_name as course_name,\n courses.course_run as course_run,\n if(empty(approving_state), 'failed', approving_state) as approving_state,\n enrollment_mode,\n enrollment_status,\n course_grade,\n case\n when course_grade >= 0.9\n then '90-100%'\n when course_grade >= 0.8 and course_grade < 0.9\n then '80-89%'\n when course_grade >= 0.7 and course_grade < 0.8\n then '70-79%'\n when course_grade >= 0.6 and course_grade < 0.7\n then '60-69%'\n when course_grade >= 0.5 and course_grade < 0.6\n then '50-59%'\n when course_grade >= 0.4 and course_grade < 0.5\n then '40-49%'\n when course_grade >= 0.3 and course_grade < 0.4\n then '30-39%'\n when course_grade >= 0.2 and course_grade < 0.3\n then '20-29%'\n when course_grade >= 0.1 and course_grade < 0.2\n then '10-19%'\n else '0-9%'\n end as grade_bucket,\n users.username as username,\n users.name as name,\n users.email as email,\n fes.emission_time as enrolled_at\nfrom `xapi`.`fact_enrollment_status` fes\nleft join\n `xapi`.`fact_learner_course_status` lg\n on fes.org = lg.org\n and fes.course_key = lg.course_key\n and fes.actor_id = lg.actor_id\nleft join\n `xapi`.`fact_learner_course_grade` ls\n on fes.org = ls.org\n and fes.course_key = ls.course_key\n and fes.actor_id = ls.actor_id\njoin\n `xapi`.`course_names` courses\n on fes.org = courses.org\n and fes.course_key = courses.course_key\nleft outer join\n `xapi`.`dim_user_pii` users on toUUID(actor_id) = users.external_user_id", "relation_name": "`xapi`.`fact_student_status`"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-08-15T21:11:17.610296Z", "completed_at": "2024-08-15T21:11:17.614954Z"}, {"name": "execute", "started_at": "2024-08-15T21:11:17.615458Z", "completed_at": "2024-08-15T21:11:17.615463Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.006142854690551758, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.aspects.accepted_values_fact_learner_course_status_approving_state__passed__failed.f9c0c1b85f", "compiled": true, "compiled_code": "\n \n \n\nwith all_values as (\n\n select\n approving_state as value_field,\n count(*) as n_records\n\n from `xapi`.`fact_learner_course_status`\n group by approving_state\n\n)\n\nselect *\nfrom all_values\nwhere value_field not in (\n 'passed','failed'\n)\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-08-15T21:11:17.617627Z", "completed_at": "2024-08-15T21:11:17.621107Z"}, {"name": "execute", "started_at": "2024-08-15T21:11:17.621583Z", "completed_at": "2024-08-15T21:11:17.621587Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.004994630813598633, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.aspects.int_problem_results", "compiled": true, "compiled_code": "-- select one record per (learner, problem, course, org) tuple\n-- contains either the first successful attempt\n-- or the most recent unsuccessful attempt\n-- find the timestamp of the earliest successful response\n-- this will be used to pick the xAPI event corresponding to that submission\nwith\n full_responses as (\n select\n events.emission_time as emission_time,\n events.org as org,\n events.course_key as course_key,\n events.problem_id as problem_id,\n events.object_id as object_id,\n events.actor_id as actor_id,\n events.responses as responses,\n events.success as success,\n events.attempts as attempts,\n events.interaction_type as interaction_type\n from `xapi`.`problem_events` events\n join\n `xapi`.`responses` using (\n org, course_key, problem_id, actor_id, emission_time\n )\n )\n\nselect\n full_responses.emission_time as emission_time,\n full_responses.org as org,\n full_responses.course_key as course_key,\n blocks.course_name as course_name,\n blocks.course_run as course_run,\n full_responses.problem_id as problem_id,\n blocks.block_name as problem_name,\n blocks.display_name_with_location as problem_name_with_location,\n blocks.course_order as course_order,\n \n concat(\n '', blocks.block_name, ''\n )\n as problem_link,\n full_responses.actor_id as actor_id,\n full_responses.responses as responses,\n full_responses.success as success,\n full_responses.attempts as attempts,\n full_responses.interaction_type as interaction_type,\n blocks.graded\nfrom full_responses\njoin\n `xapi`.`dim_course_blocks` blocks\n on (\n full_responses.course_key = blocks.course_key\n and full_responses.problem_id = blocks.block_id\n )", "relation_name": "`xapi`.`int_problem_results`"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-08-15T21:11:17.623681Z", "completed_at": "2024-08-15T21:11:17.627220Z"}, {"name": "execute", "started_at": "2024-08-15T21:11:17.627696Z", "completed_at": "2024-08-15T21:11:17.627700Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.005019187927246094, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.aspects.fact_video_plays", "compiled": true, "compiled_code": "-- model to support number of watches per video\n-- ref:\n-- https://edx.readthedocs.io/projects/edx-insights/en/latest/Reference.html#engagement-computations\nwith\n plays as (\n select\n emission_time,\n org,\n course_key,\n object_id,\n video_duration,\n video_position,\n splitByString('/xblock/', object_id)[-1] as video_id,\n actor_id\n from `xapi`.`video_playback_events`\n where verb_id = 'https://w3id.org/xapi/video/verbs/played'\n )\n\nselect\n plays.emission_time as emission_time,\n plays.org as org,\n plays.course_key as course_key,\n blocks.course_name as course_name,\n blocks.course_run as course_run,\n plays.video_id as video_id,\n blocks.block_name as video_name,\n blocks.display_name_with_location as video_name_with_location,\n \n concat(\n '', blocks.block_name, ''\n )\n as video_link,\n blocks.graded as graded,\n plays.video_position as video_position,\n plays.video_duration as video_duration,\n case\n when video_position/video_duration >= 0.9\n then '90-100%'\n when video_position/video_duration >= 0.8 and video_position/video_duration < 0.9\n then '80-89%'\n when video_position/video_duration >= 0.7 and video_position/video_duration < 0.8\n then '70-79%'\n when video_position/video_duration >= 0.6 and video_position/video_duration < 0.7\n then '60-69%'\n when video_position/video_duration >= 0.5 and video_position/video_duration < 0.6\n then '50-59%'\n when video_position/video_duration >= 0.4 and video_position/video_duration < 0.5\n then '40-49%'\n when video_position/video_duration >= 0.3 and video_position/video_duration < 0.4\n then '30-39%'\n when video_position/video_duration >= 0.2 and video_position/video_duration < 0.3\n then '20-29%'\n when video_position/video_duration >= 0.1 and video_position/video_duration < 0.2\n then '10-19%'\n else '0-9%'\n end as visualization_bucket,\n plays.actor_id as actor_id,\n users.username as username,\n users.name as name,\n users.email as email,\n blocks.section_with_name as section_with_name,\n blocks.subsection_with_name as subsection_with_name,\n blocks.course_order as course_order\nfrom plays\njoin\n `xapi`.`dim_course_blocks_extended` blocks\n on (plays.course_key = blocks.course_key and plays.video_id = blocks.block_id)\nleft outer join\n `xapi`.`dim_user_pii` users on toUUID(actor_id) = users.external_user_id", "relation_name": "`xapi`.`fact_video_plays`"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-08-15T21:11:17.629972Z", "completed_at": "2024-08-15T21:11:17.633347Z"}, {"name": "execute", "started_at": "2024-08-15T21:11:17.633816Z", "completed_at": "2024-08-15T21:11:17.633821Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.004940509796142578, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.aspects.fact_navigation_completion", "compiled": true, "compiled_code": "-- number of learners who've viewed all pages in a section/subsection\nwith\n visited_subsection_pages as (\n select distinct\n date(emission_time) as visited_on,\n org,\n course_key,\n course_name,\n course_run,\n \n concat(\n splitByString(\n ':', splitByString(' - ', block_name_with_location)[1], 1\n )[1],\n ':0:0'\n )\n as section_number,\n \n concat(\n arrayStringConcat(\n splitByString(\n ':', splitByString(' - ', block_name_with_location)[1], 2\n ),\n ':'\n ),\n ':0'\n )\n\n as subsection_number,\n actor_id,\n block_id,\n username,\n name,\n email\n from `xapi`.`fact_navigation`\n )\n\nselect\n visits.visited_on as visited_on,\n visits.org as org,\n visits.course_key as course_key,\n visits.course_name as course_name,\n visits.course_run as course_run,\n pages.section_with_name as section_with_name,\n pages.subsection_with_name as subsection_with_name,\n pages.course_order as course_order,\n pages.item_count as page_count,\n visits.actor_id as actor_id,\n visits.block_id as block_id,\n visits.username as username,\n visits.name as name,\n visits.email as email\nfrom visited_subsection_pages visits\njoin\n `xapi`.`int_pages_per_subsection` pages\n on (\n visits.org = pages.org\n and visits.course_key = pages.course_key\n and visits.section_number = pages.section_number\n and visits.subsection_number = pages.subsection_number\n )", "relation_name": "`xapi`.`fact_navigation_completion`"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-08-15T21:11:17.635931Z", "completed_at": "2024-08-15T21:11:17.640308Z"}, {"name": "execute", "started_at": "2024-08-15T21:11:17.640814Z", "completed_at": "2024-08-15T21:11:17.640819Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.005861759185791016, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.aspects.section_page_engagement", "compiled": true, "compiled_code": "\n\nwith\n fact_navigation as (\n select\n navigation.emission_time as emission_time,\n navigation.org as org,\n navigation.course_key as course_key,\n navigation.actor_id as actor_id,\n navigation.block_id as block_id,\n blocks.display_name_with_location as block_name_with_location\n from `xapi`.`navigation_events` navigation\n join\n `xapi`.`dim_course_blocks` blocks\n on (\n navigation.course_key = blocks.course_key\n and navigation.block_id = blocks.block_id\n )\n ),\n visited_subsection_pages as (\n select distinct\n date(emission_time) as visited_on,\n org,\n course_key,\n \n concat(\n splitByString(\n ':', splitByString(' - ', block_name_with_location)[1], 1\n )[1],\n ':0:0'\n )\n as section_number,\n \n concat(\n arrayStringConcat(\n splitByString(\n ':', splitByString(' - ', block_name_with_location)[1], 2\n ),\n ':'\n ),\n ':0'\n )\n\n as subsection_number,\n actor_id,\n block_id\n from fact_navigation\n ),\n fact_navigation_completion as (\n select\n visits.visited_on as visited_on,\n visits.org as org,\n visits.course_key as course_key,\n pages.section_with_name as section_with_name,\n pages.subsection_with_name as subsection_with_name,\n pages.item_count as item_count,\n visits.actor_id as actor_id,\n visits.block_id as block_id,\n pages.section_block_id as section_block_id\n from visited_subsection_pages visits\n join\n `xapi`.`int_pages_per_subsection` pages\n on (\n visits.org = pages.org\n and visits.course_key = pages.course_key\n and visits.section_number = pages.section_number\n and visits.subsection_number = pages.subsection_number\n )\n ),\n subsection_counts as (\n select\n org,\n course_key,\n section_with_name,\n subsection_with_name,\n actor_id,\n item_count,\n count(distinct block_id) as pages_visited,\n case\n when pages_visited = 0\n then 'No pages viewed yet'\n when pages_visited = item_count\n then 'All pages viewed'\n else 'At least one page viewed'\n end as engagement_level,\n section_block_id\n from fact_navigation_completion\n group by\n org,\n course_key,\n section_with_name,\n subsection_with_name,\n actor_id,\n item_count,\n section_block_id\n ),\n section_counts as (\n select\n org,\n course_key,\n actor_id,\n sum(item_count) as item_count,\n sum(pages_visited) as pages_visited,\n case\n when pages_visited = 0\n then 'No pages viewed yet'\n when pages_visited = item_count\n then 'All pages viewed'\n else 'At least one page viewed'\n end as engagement_level,\n section_block_id\n from subsection_counts\n group by org, course_key, section_block_id, actor_id\n )\n\nselect org, course_key, actor_id, section_block_id, engagement_level\nfrom section_counts", "relation_name": "`xapi`.`section_page_engagement`"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-08-15T21:11:17.643120Z", "completed_at": "2024-08-15T21:11:17.647480Z"}, {"name": "execute", "started_at": "2024-08-15T21:11:17.647952Z", "completed_at": "2024-08-15T21:11:17.647956Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.0058557987213134766, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.aspects.subsection_page_engagement", "compiled": true, "compiled_code": "\n\nwith\n fact_navigation as (\n select\n navigation.emission_time as emission_time,\n navigation.org as org,\n navigation.course_key as course_key,\n navigation.actor_id as actor_id,\n navigation.block_id as block_id,\n blocks.display_name_with_location as block_name_with_location\n from `xapi`.`navigation_events` navigation\n join\n `xapi`.`dim_course_blocks` blocks\n on (\n navigation.course_key = blocks.course_key\n and navigation.block_id = blocks.block_id\n )\n ),\n visited_subsection_pages as (\n select distinct\n date(emission_time) as visited_on,\n org,\n course_key,\n \n concat(\n splitByString(\n ':', splitByString(' - ', block_name_with_location)[1], 1\n )[1],\n ':0:0'\n )\n as section_number,\n \n concat(\n arrayStringConcat(\n splitByString(\n ':', splitByString(' - ', block_name_with_location)[1], 2\n ),\n ':'\n ),\n ':0'\n )\n\n as subsection_number,\n actor_id,\n block_id\n from fact_navigation\n ),\n fact_navigation_completion as (\n select\n visits.visited_on as visited_on,\n visits.org as org,\n visits.course_key as course_key,\n pages.section_with_name as section_with_name,\n pages.subsection_with_name as subsection_with_name,\n pages.item_count as item_count,\n visits.actor_id as actor_id,\n visits.block_id as block_id,\n pages.subsection_block_id as subsection_block_id\n from visited_subsection_pages visits\n join\n `xapi`.`int_pages_per_subsection` pages\n on (\n visits.org = pages.org\n and visits.course_key = pages.course_key\n and visits.section_number = pages.section_number\n and visits.subsection_number = pages.subsection_number\n )\n ),\n subsection_counts as (\n select\n org,\n course_key,\n section_with_name,\n subsection_with_name,\n actor_id,\n item_count,\n count(distinct block_id) as pages_visited,\n case\n when pages_visited = 0\n then 'No pages viewed yet'\n when pages_visited = item_count\n then 'All pages viewed'\n else 'At least one page viewed'\n end as engagement_level,\n subsection_block_id\n from fact_navigation_completion\n group by\n org,\n course_key,\n section_with_name,\n subsection_with_name,\n actor_id,\n item_count,\n subsection_block_id\n )\n\nselect org, course_key, actor_id, subsection_block_id, engagement_level\nfrom subsection_counts", "relation_name": "`xapi`.`subsection_page_engagement`"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-08-15T21:11:17.650172Z", "completed_at": "2024-08-15T21:11:17.655004Z"}, {"name": "execute", "started_at": "2024-08-15T21:11:17.655479Z", "completed_at": "2024-08-15T21:11:17.655483Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.006267070770263672, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.aspects.section_problem_engagement", "compiled": true, "compiled_code": "\n\nwith\n responses as (\n select\n emission_time,\n org,\n course_key,\n object_id,\n problem_id,\n actor_id,\n responses,\n success,\n attempts,\n interaction_type\n from `xapi`.`problem_events`\n where verb_id = 'https://w3id.org/xapi/acrossx/verbs/evaluated'\n ),\n fact_problem_responses as (\n select\n responses.emission_time as emission_time,\n responses.org as org,\n responses.course_key as course_key,\n blocks.course_name as course_name,\n responses.problem_id as problem_id,\n blocks.block_name as problem_name,\n blocks.display_name_with_location as problem_name_with_location,\n \n concat(\n '', blocks.block_name, ''\n )\n as problem_link,\n blocks.graded as graded,\n course_order as course_order,\n responses.actor_id as actor_id,\n responses.responses as responses,\n responses.success as success,\n responses.attempts as attempts,\n responses.interaction_type as interaction_type\n from responses\n join\n `xapi`.`dim_course_blocks` blocks\n on (\n responses.course_key = blocks.course_key\n and responses.problem_id = blocks.block_id\n )\n group by\n -- multi-part questions include an extra record for the response to the\n -- first\n -- part of the question. this group by clause eliminates the duplicate\n -- record\n emission_time,\n org,\n course_key,\n course_name,\n problem_id,\n problem_name,\n problem_name_with_location,\n problem_link,\n actor_id,\n responses,\n success,\n attempts,\n course_order,\n graded,\n interaction_type\n ),\n attempted_subsection_problems as (\n select distinct\n date(emission_time) as attempted_on,\n org,\n course_key,\n \n concat(\n splitByString(\n ':', splitByString(' - ', problem_name_with_location)[1], 1\n )[1],\n ':0:0'\n )\n as section_number,\n \n concat(\n arrayStringConcat(\n splitByString(\n ':', splitByString(' - ', problem_name_with_location)[1], 2\n ),\n ':'\n ),\n ':0'\n )\n\n as subsection_number,\n course_order as course_order,\n graded,\n actor_id,\n problem_id\n from fact_problem_responses\n ),\n fact_problem_engagement_per_subsection as (\n select\n attempts.org as org,\n attempts.course_key as course_key,\n problems.section_with_name as section_with_name,\n problems.subsection_with_name as subsection_with_name,\n problems.item_count as item_count,\n attempts.actor_id as actor_id,\n attempts.problem_id as problem_id,\n problems.section_block_id as section_block_id\n from attempted_subsection_problems attempts\n join\n `xapi`.`int_problems_per_subsection` problems\n on (\n attempts.org = problems.org\n and attempts.course_key = problems.course_key\n and attempts.section_number = problems.section_number\n and attempts.subsection_number = problems.subsection_number\n )\n ),\n subsection_counts as (\n select\n org,\n course_key,\n section_with_name,\n subsection_with_name,\n actor_id,\n item_count,\n count(distinct problem_id) as problems_attempted,\n case\n when problems_attempted = 0\n then 'No problems attempted yet'\n when problems_attempted = item_count\n then 'All problems attempted'\n else 'At least one problem attempted'\n end as engagement_level,\n section_block_id\n from fact_problem_engagement_per_subsection\n group by\n org,\n course_key,\n section_with_name,\n subsection_with_name,\n actor_id,\n item_count,\n section_block_id\n ),\n section_counts as (\n select\n org,\n course_key,\n actor_id,\n sum(item_count) as item_count,\n sum(problems_attempted) as problems_attempted,\n case\n when problems_attempted = 0\n then 'No problems attempted yet'\n when problems_attempted = item_count\n then 'All problems attempted'\n else 'At least one problem attempted'\n end as engagement_level,\n section_block_id\n from subsection_counts\n group by org, course_key, section_block_id, actor_id\n )\n\nselect org, course_key, actor_id, section_block_id, engagement_level\nfrom section_counts", "relation_name": "`xapi`.`section_problem_engagement`"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-08-15T21:11:17.657717Z", "completed_at": "2024-08-15T21:11:17.664163Z"}, {"name": "execute", "started_at": "2024-08-15T21:11:17.664648Z", "completed_at": "2024-08-15T21:11:17.664653Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.008053064346313477, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.aspects.subsection_problem_engagement", "compiled": true, "compiled_code": "\n\nwith\n responses as (\n select\n emission_time,\n org,\n course_key,\n object_id,\n problem_id,\n actor_id,\n responses,\n success,\n attempts,\n interaction_type\n from `xapi`.`problem_events`\n where verb_id = 'https://w3id.org/xapi/acrossx/verbs/evaluated'\n ),\n fact_problem_responses as (\n select\n responses.emission_time as emission_time,\n responses.org as org,\n responses.course_key as course_key,\n blocks.course_name as course_name,\n responses.problem_id as problem_id,\n blocks.block_name as problem_name,\n blocks.display_name_with_location as problem_name_with_location,\n \n concat(\n '', blocks.block_name, ''\n )\n as problem_link,\n blocks.graded as graded,\n course_order as course_order,\n responses.actor_id as actor_id,\n responses.responses as responses,\n responses.success as success,\n responses.attempts as attempts,\n responses.interaction_type as interaction_type\n from responses\n join\n `xapi`.`dim_course_blocks` blocks\n on (\n responses.course_key = blocks.course_key\n and responses.problem_id = blocks.block_id\n )\n group by\n -- multi-part questions include an extra record for the response to the\n -- first\n -- part of the question. this group by clause eliminates the duplicate\n -- record\n emission_time,\n org,\n course_key,\n course_name,\n problem_id,\n problem_name,\n problem_name_with_location,\n problem_link,\n actor_id,\n responses,\n success,\n attempts,\n course_order,\n graded,\n interaction_type\n ),\n attempted_subsection_problems as (\n select distinct\n date(emission_time) as attempted_on,\n org,\n course_key,\n \n concat(\n splitByString(\n ':', splitByString(' - ', problem_name_with_location)[1], 1\n )[1],\n ':0:0'\n )\n as section_number,\n \n concat(\n arrayStringConcat(\n splitByString(\n ':', splitByString(' - ', problem_name_with_location)[1], 2\n ),\n ':'\n ),\n ':0'\n )\n\n as subsection_number,\n course_order as course_order,\n graded,\n actor_id,\n problem_id\n from fact_problem_responses\n ),\n fact_problem_engagement_per_subsection as (\n select\n attempts.org as org,\n attempts.course_key as course_key,\n problems.section_with_name as section_with_name,\n problems.subsection_with_name as subsection_with_name,\n problems.item_count as item_count,\n attempts.actor_id as actor_id,\n attempts.problem_id as problem_id,\n problems.subsection_block_id as subsection_block_id\n from attempted_subsection_problems attempts\n join\n `xapi`.`int_problems_per_subsection` problems\n on (\n attempts.org = problems.org\n and attempts.course_key = problems.course_key\n and attempts.section_number = problems.section_number\n and attempts.subsection_number = problems.subsection_number\n )\n ),\n subsection_counts as (\n select\n org,\n course_key,\n section_with_name,\n subsection_with_name,\n actor_id,\n item_count,\n count(distinct problem_id) as problems_attempted,\n case\n when problems_attempted = 0\n then 'No problems attempted yet'\n when problems_attempted = item_count\n then 'All problems attempted'\n else 'At least one problem attempted'\n end as engagement_level,\n subsection_block_id\n from fact_problem_engagement_per_subsection\n group by\n org,\n course_key,\n section_with_name,\n subsection_with_name,\n actor_id,\n item_count,\n subsection_block_id\n )\n\nselect org, course_key, actor_id, subsection_block_id, engagement_level\nfrom subsection_counts", "relation_name": "`xapi`.`subsection_problem_engagement`"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-08-15T21:11:17.666958Z", "completed_at": "2024-08-15T21:11:17.670617Z"}, {"name": "execute", "started_at": "2024-08-15T21:11:17.671107Z", "completed_at": "2024-08-15T21:11:17.671112Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.005208730697631836, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.aspects.accepted_values_fact_student_status_enrollment_status__registered__unregistered.53cae8a0f3", "compiled": true, "compiled_code": "\n \n \n\nwith all_values as (\n\n select\n enrollment_status as value_field,\n count(*) as n_records\n\n from `xapi`.`fact_student_status`\n group by enrollment_status\n\n)\n\nselect *\nfrom all_values\nwhere value_field not in (\n 'registered','unregistered'\n)\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-08-15T21:11:17.673299Z", "completed_at": "2024-08-15T21:11:17.677363Z"}, {"name": "execute", "started_at": "2024-08-15T21:11:17.677863Z", "completed_at": "2024-08-15T21:11:17.677867Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.005580902099609375, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.aspects.section_video_engagement", "compiled": true, "compiled_code": "\n\nwith\n viewed_subsection_videos as (\n select distinct\n date(emission_time) as viewed_on,\n org,\n course_key,\n \n concat(\n splitByString(\n ':', splitByString(' - ', video_name_with_location)[1], 1\n )[1],\n ':0:0'\n )\n as section_number,\n \n concat(\n arrayStringConcat(\n splitByString(\n ':', splitByString(' - ', video_name_with_location)[1], 2\n ),\n ':'\n ),\n ':0'\n )\n\n as subsection_number,\n actor_id,\n video_id\n from `xapi`.`fact_video_plays`\n ),\n fact_video_engagement_per_subsection as (\n select\n views.org as org,\n views.course_key as course_key,\n videos.section_with_name as section_with_name,\n videos.subsection_with_name as subsection_with_name,\n videos.item_count as item_count,\n views.actor_id as actor_id,\n views.video_id as video_id,\n videos.section_block_id as section_block_id\n from viewed_subsection_videos views\n join\n `xapi`.`int_videos_per_subsection` videos\n on (\n views.org = videos.org\n and views.course_key = videos.course_key\n and views.section_number = videos.section_number\n and views.subsection_number = videos.subsection_number\n )\n ),\n subsection_counts as (\n select\n org,\n course_key,\n section_with_name,\n subsection_with_name,\n actor_id,\n item_count,\n count(distinct video_id) as videos_viewed,\n case\n when videos_viewed = 0\n then 'No videos viewed yet'\n when videos_viewed = item_count\n then 'All videos viewed'\n else 'At least one video viewed'\n end as engagement_level,\n section_block_id\n from fact_video_engagement_per_subsection\n group by\n org,\n course_key,\n section_with_name,\n subsection_with_name,\n actor_id,\n item_count,\n section_block_id\n ),\n section_counts as (\n select\n org,\n course_key,\n actor_id,\n sum(item_count) as item_count,\n sum(videos_viewed) as videos_viewed,\n case\n when videos_viewed = 0\n then 'No videos viewed yet'\n when videos_viewed = item_count\n then 'All videos viewed'\n else 'At least one video viewed'\n end as engagement_level,\n section_block_id\n from subsection_counts\n group by org, course_key, section_block_id, actor_id\n )\nselect org, course_key, actor_id, section_block_id, engagement_level\nfrom section_counts", "relation_name": "`xapi`.`section_video_engagement`"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-08-15T21:11:17.680102Z", "completed_at": "2024-08-15T21:11:17.684232Z"}, {"name": "execute", "started_at": "2024-08-15T21:11:17.684716Z", "completed_at": "2024-08-15T21:11:17.684721Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.00567173957824707, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.aspects.subsection_video_engagement", "compiled": true, "compiled_code": "\n\nwith\n viewed_subsection_videos as (\n select distinct\n date(emission_time) as viewed_on,\n org,\n course_key,\n \n concat(\n splitByString(\n ':', splitByString(' - ', video_name_with_location)[1], 1\n )[1],\n ':0:0'\n )\n as section_number,\n \n concat(\n arrayStringConcat(\n splitByString(\n ':', splitByString(' - ', video_name_with_location)[1], 2\n ),\n ':'\n ),\n ':0'\n )\n\n as subsection_number,\n actor_id,\n video_id\n from `xapi`.`fact_video_plays`\n ),\n fact_video_engagement_per_subsection as (\n select\n views.org as org,\n views.course_key as course_key,\n videos.section_with_name as section_with_name,\n videos.subsection_with_name as subsection_with_name,\n videos.item_count as item_count,\n views.actor_id as actor_id,\n views.video_id as video_id,\n videos.subsection_block_id as subsection_block_id\n from viewed_subsection_videos views\n join\n `xapi`.`int_videos_per_subsection` videos\n on (\n views.org = videos.org\n and views.course_key = videos.course_key\n and views.section_number = videos.section_number\n and views.subsection_number = videos.subsection_number\n )\n ),\n subsection_counts as (\n select\n org,\n course_key,\n section_with_name,\n subsection_with_name,\n actor_id,\n item_count,\n count(distinct video_id) as videos_viewed,\n case\n when videos_viewed = 0\n then 'No videos viewed yet'\n when videos_viewed = item_count\n then 'All videos viewed'\n else 'At least one video viewed'\n end as engagement_level,\n subsection_block_id\n from fact_video_engagement_per_subsection\n group by\n org,\n course_key,\n section_with_name,\n subsection_with_name,\n actor_id,\n item_count,\n subsection_block_id\n )\nselect distinct org, course_key, actor_id, subsection_block_id, engagement_level\nfrom subsection_counts", "relation_name": "`xapi`.`subsection_video_engagement`"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-08-15T21:11:17.686933Z", "completed_at": "2024-08-15T21:11:17.692748Z"}, {"name": "execute", "started_at": "2024-08-15T21:11:17.693268Z", "completed_at": "2024-08-15T21:11:17.693273Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.007401704788208008, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.aspects.accepted_values_xapi_section_page_engagement_engagement_level__xapi_section_page_engagement__No_pages_viewed_yet__All_pages_viewed__At_least_one_page_viewed.f10135df89", "compiled": true, "compiled_code": "\n\nwith all_values as (\n\n select distinct\n engagement_level as value_field\n\n from xapi.section_page_engagement\n\n),\n\nvalidation_errors as (\n\n select\n value_field\n\n from all_values\n where value_field not in (\n 'No pages viewed yet','All pages viewed','At least one page viewed'\n )\n\n)\n\nselect *\nfrom validation_errors\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-08-15T21:11:17.695430Z", "completed_at": "2024-08-15T21:11:17.698738Z"}, {"name": "execute", "started_at": "2024-08-15T21:11:17.699250Z", "completed_at": "2024-08-15T21:11:17.699254Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.00480961799621582, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.aspects.fact_pageview_engagement", "compiled": true, "compiled_code": "with\n subsection_engagement as (\n select\n org,\n course_key,\n 'subsection' as content_level,\n actor_id,\n subsection_block_id as block_id,\n engagement_level as section_subsection_page_engagement\n from `xapi`.`subsection_page_engagement`\n ),\n section_engagement as (\n select\n org,\n course_key,\n 'section' as content_level,\n actor_id,\n section_block_id as block_id,\n engagement_level as section_subsection_page_engagement\n from `xapi`.`section_page_engagement`\n ),\n page_engagement as (\n select *\n from subsection_engagement\n union all\n select *\n from section_engagement\n )\n\nselect\n pv.org as org,\n pv.course_key as course_key,\n course_blocks.course_run as course_run,\n course_blocks.display_name_with_location as section_subsection_name,\n pv.content_level as content_level,\n pv.actor_id as actor_id,\n pv.section_subsection_page_engagement as section_subsection_page_engagement,\n users.username as username,\n users.name as name,\n users.email as email\nfrom page_engagement pv\njoin\n `xapi`.`dim_course_blocks` course_blocks\n on (\n pv.org = course_blocks.org\n and pv.course_key = course_blocks.course_key\n and pv.block_id = course_blocks.block_id\n )\nleft outer join\n `xapi`.`dim_user_pii` users on toUUID(pv.actor_id) = users.external_user_id", "relation_name": "`xapi`.`fact_pageview_engagement`"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-08-15T21:11:17.701589Z", "completed_at": "2024-08-15T21:11:17.705706Z"}, {"name": "execute", "started_at": "2024-08-15T21:11:17.706180Z", "completed_at": "2024-08-15T21:11:17.706184Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.005644083023071289, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.aspects.accepted_values_xapi_subsection_page_engagement_engagement_level__xapi_subsection_page_engagement__No_pages_viewed_yet__All_pages_viewed__At_least_one_page_viewed.bcd23fe35f", "compiled": true, "compiled_code": "\n\nwith all_values as (\n\n select distinct\n engagement_level as value_field\n\n from xapi.subsection_page_engagement\n\n),\n\nvalidation_errors as (\n\n select\n value_field\n\n from all_values\n where value_field not in (\n 'No pages viewed yet','All pages viewed','At least one page viewed'\n )\n\n)\n\nselect *\nfrom validation_errors\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-08-15T21:11:17.708397Z", "completed_at": "2024-08-15T21:11:17.713944Z"}, {"name": "execute", "started_at": "2024-08-15T21:11:17.714420Z", "completed_at": "2024-08-15T21:11:17.714425Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.0070803165435791016, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.aspects.accepted_values_xapi_section_problem_engagement_engagement_level__xapi_section_problem_engagement__No_problems_attempted_yet__All_problems_attempted__At_least_one_problem_attempted.48ca5955e3", "compiled": true, "compiled_code": "\n\nwith all_values as (\n\n select distinct\n engagement_level as value_field\n\n from xapi.section_problem_engagement\n\n),\n\nvalidation_errors as (\n\n select\n value_field\n\n from all_values\n where value_field not in (\n 'No problems attempted yet','All problems attempted','At least one problem attempted'\n )\n\n)\n\nselect *\nfrom validation_errors\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-08-15T21:11:17.716745Z", "completed_at": "2024-08-15T21:11:17.720857Z"}, {"name": "execute", "started_at": "2024-08-15T21:11:17.721365Z", "completed_at": "2024-08-15T21:11:17.721369Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.005816459655761719, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.aspects.accepted_values_xapi_subsection_problem_engagement_engagement_level__xapi_subsection_problem_engagement__No_problems_attempted_yet__All_problems_attempted__At_least_one_problem_attempted.51aa37af55", "compiled": true, "compiled_code": "\n\nwith all_values as (\n\n select distinct\n engagement_level as value_field\n\n from xapi.subsection_problem_engagement\n\n),\n\nvalidation_errors as (\n\n select\n value_field\n\n from all_values\n where value_field not in (\n 'No problems attempted yet','All problems attempted','At least one problem attempted'\n )\n\n)\n\nselect *\nfrom validation_errors\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-08-15T21:11:17.723599Z", "completed_at": "2024-08-15T21:11:17.729077Z"}, {"name": "execute", "started_at": "2024-08-15T21:11:17.729590Z", "completed_at": "2024-08-15T21:11:17.729595Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.0070018768310546875, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.aspects.accepted_values_xapi_section_video_engagement_engagement_level__xapi_section_video_engagement__No_videos_viewed_yet__All_videos_viewed__At_least_one_video_viewed.597c4fb289", "compiled": true, "compiled_code": "\n\nwith all_values as (\n\n select distinct\n engagement_level as value_field\n\n from xapi.section_video_engagement\n\n),\n\nvalidation_errors as (\n\n select\n value_field\n\n from all_values\n where value_field not in (\n 'No videos viewed yet','All videos viewed','At least one video viewed'\n )\n\n)\n\nselect *\nfrom validation_errors\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-08-15T21:11:17.731744Z", "completed_at": "2024-08-15T21:11:17.736767Z"}, {"name": "execute", "started_at": "2024-08-15T21:11:17.737265Z", "completed_at": "2024-08-15T21:11:17.737269Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.0065495967864990234, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.aspects.fact_video_engagement", "compiled": true, "compiled_code": "with\n subsection_engagement as (\n select\n org,\n course_key,\n 'subsection' as content_level,\n actor_id,\n subsection_block_id as block_id,\n engagement_level as section_subsection_video_engagement\n from `xapi`.`subsection_video_engagement`\n ),\n section_engagement as (\n select\n org,\n course_key,\n 'section' as content_level,\n actor_id,\n section_block_id as block_id,\n engagement_level as section_subsection_video_engagement\n from `xapi`.`section_video_engagement`\n ),\n video_engagement as (\n select *\n from subsection_engagement\n union all\n select *\n from section_engagement\n )\nselect\n ve.org as org,\n ve.course_key as course_key,\n course_blocks.course_run as course_run,\n course_blocks.display_name_with_location as section_subsection_name,\n ve.content_level as content_level,\n ve.actor_id as actor_id,\n ve.section_subsection_video_engagement as section_subsection_video_engagement,\n users.username as username,\n users.name as name,\n users.email as email\nfrom video_engagement ve\njoin\n `xapi`.`dim_course_blocks` course_blocks\n on (\n ve.org = course_blocks.org\n and ve.course_key = course_blocks.course_key\n and ve.block_id = course_blocks.block_id\n )\nleft outer join\n `xapi`.`dim_user_pii` users on toUUID(ve.actor_id) = users.external_user_id", "relation_name": "`xapi`.`fact_video_engagement`"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-08-15T21:11:17.739445Z", "completed_at": "2024-08-15T21:11:17.743754Z"}, {"name": "execute", "started_at": "2024-08-15T21:11:17.744237Z", "completed_at": "2024-08-15T21:11:17.744242Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.005839824676513672, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.aspects.accepted_values_xapi_subsection_video_engagement_engagement_level__xapi_subsection_video_engagement__No_videos_viewed_yet__All_videos_viewed__At_least_one_video_viewed.c9b49600d3", "compiled": true, "compiled_code": "\n\nwith all_values as (\n\n select distinct\n engagement_level as value_field\n\n from xapi.subsection_video_engagement\n\n),\n\nvalidation_errors as (\n\n select\n value_field\n\n from all_values\n where value_field not in (\n 'No videos viewed yet','All videos viewed','At least one video viewed'\n )\n\n)\n\nselect *\nfrom validation_errors\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-08-15T21:11:17.746410Z", "completed_at": "2024-08-15T21:11:17.751026Z"}, {"name": "execute", "started_at": "2024-08-15T21:11:17.751516Z", "completed_at": "2024-08-15T21:11:17.751521Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.006139278411865234, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.aspects.accepted_values_fact_pageview_engagement_content_level__section__subsection.dd9e9af3ed", "compiled": true, "compiled_code": "\n \n \n\nwith all_values as (\n\n select\n content_level as value_field,\n count(*) as n_records\n\n from `xapi`.`fact_pageview_engagement`\n group by content_level\n\n)\n\nselect *\nfrom all_values\nwhere value_field not in (\n 'section','subsection'\n)\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-08-15T21:11:17.753712Z", "completed_at": "2024-08-15T21:11:17.757322Z"}, {"name": "execute", "started_at": "2024-08-15T21:11:17.757787Z", "completed_at": "2024-08-15T21:11:17.757792Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.005067110061645508, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.aspects.accepted_values_fact_video_engagement_content_level__section__subsection.636c5e7005", "compiled": true, "compiled_code": "\n \n \n\nwith all_values as (\n\n select\n content_level as value_field,\n count(*) as n_records\n\n from `xapi`.`fact_video_engagement`\n group by content_level\n\n)\n\nselect *\nfrom all_values\nwhere value_field not in (\n 'section','subsection'\n)\n\n\n", "relation_name": null}, {"status": "success", "timing": [{"name": "compile", "started_at": "2024-08-15T21:11:17.759977Z", "completed_at": "2024-08-15T21:11:17.763638Z"}, {"name": "execute", "started_at": "2024-08-15T21:11:17.764113Z", "completed_at": "2024-08-15T21:11:17.764117Z"}], "thread_id": "Thread-1 (worker)", "execution_time": 0.0051593780517578125, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.aspects.accepted_values_fact_video_engagement_section_subsection_video_engagement__No_videos_viewed_yet__At_least_one_video_viewed__All_videos_viewed.91f6ccbf80", "compiled": true, "compiled_code": "\n \n \n\nwith all_values as (\n\n select\n section_subsection_video_engagement as value_field,\n count(*) as n_records\n\n from `xapi`.`fact_video_engagement`\n group by section_subsection_video_engagement\n\n)\n\nselect *\nfrom all_values\nwhere value_field not in (\n 'No videos viewed yet','At least one video viewed','All videos viewed'\n)\n\n\n", "relation_name": null}], "elapsed_time": 0.5853276252746582, "args": {"source_freshness_run_project_hooks": false, "show_resource_report": false, "log_format_file": "debug", "require_explicit_package_overrides_for_builtin_materializations": true, "select": [], "macro_debugging": false, "require_resource_names_without_spaces": false, "log_format": "default", "printer_width": 80, "strict_mode": false, "which": "generate", "print": true, "write_json": true, "partial_parse_file_diff": true, "invocation_command": "dbt docs generate", "static": false, "profiles_dir": "./.github/", "exclude": [], "log_level_file": "debug", "compile": true, "empty_catalog": false, "favor_state": false, "introspect": true, "project_dir": "/home/runner/work/aspects-dbt/aspects-dbt", "log_level": "info", "indirect_selection": "eager", "warn_error_options": {"include": [], "exclude": []}, "enable_legacy_logger": false, "vars": {}, "send_anonymous_usage_stats": true, "log_path": "/home/runner/work/aspects-dbt/aspects-dbt/logs", "cache_selected_only": false, "quiet": false, "use_colors": true, "version_check": true, "populate_cache": true, "partial_parse": true, "use_colors_file": true, "log_file_max_bytes": 10485760, "defer": false, "static_parser": true}}
\ No newline at end of file