From 85ae2c763537bf76caf9b5a5d6e1a01e24491a75 Mon Sep 17 00:00:00 2001 From: Artjoms Iskovs Date: Thu, 30 Dec 2021 15:04:40 +0000 Subject: [PATCH] Fix generated dbt project - use "ephemeral" instead of cte for materialization The sample job in the suite at https://github.com/mildbyte/template-test-2/runs/4667663552?check_suite_focus=true now actually completes (but doesn't do anything) because it just makes an unchecked CTE (the source tables don't exist). Fails as expected (https://github.com/mildbyte/template-test-2/runs/4667687824?check_suite_focus=true) if we materialize as tables since then the relation indeed doesn't exist. --- splitgraph/cloud/project/templates.py | 2 +- .../splitgraph_template/dbt_project.yml | 2 +- .../generate_project_dbt/dbt_project.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/splitgraph/cloud/project/templates.py b/splitgraph/cloud/project/templates.py index 7c75863f..899da0fd 100644 --- a/splitgraph/cloud/project/templates.py +++ b/splitgraph/cloud/project/templates.py @@ -67,7 +67,7 @@ # Here as a starting point. You can reference these models downstream in models that actually # materialize as tables. staging: - +materialized: cte + +materialized: ephemeral """ SOURCES_YML_TEMPLATE = """# This file defines all data sources referenced by this model. The mapping diff --git a/test/splitgraph/cloud/project/snapshots/test_dbt/test_generate_dbt_project/splitgraph_template/dbt_project.yml b/test/splitgraph/cloud/project/snapshots/test_dbt/test_generate_dbt_project/splitgraph_template/dbt_project.yml index 82da3bc1..5b62a246 100644 --- a/test/splitgraph/cloud/project/snapshots/test_dbt/test_generate_dbt_project/splitgraph_template/dbt_project.yml +++ b/test/splitgraph/cloud/project/snapshots/test_dbt/test_generate_dbt_project/splitgraph_template/dbt_project.yml @@ -30,4 +30,4 @@ models: # Here as a starting point. You can reference these models downstream in models that actually # materialize as tables. staging: - +materialized: cte + +materialized: ephemeral diff --git a/test/splitgraph/cloud/project/snapshots/test_generation/test_generate_project_with_dbt/generate_project_dbt/dbt_project.yml b/test/splitgraph/cloud/project/snapshots/test_generation/test_generate_project_with_dbt/generate_project_dbt/dbt_project.yml index 82da3bc1..5b62a246 100644 --- a/test/splitgraph/cloud/project/snapshots/test_generation/test_generate_project_with_dbt/generate_project_dbt/dbt_project.yml +++ b/test/splitgraph/cloud/project/snapshots/test_generation/test_generate_project_with_dbt/generate_project_dbt/dbt_project.yml @@ -30,4 +30,4 @@ models: # Here as a starting point. You can reference these models downstream in models that actually # materialize as tables. staging: - +materialized: cte + +materialized: ephemeral