diff --git a/python_modules/libraries/dagster-dbt/packages/dagster/.gitignore b/python_modules/libraries/dagster-dbt/packages/dagster/.gitignore new file mode 100644 index 0000000000000..087d06284c9a7 --- /dev/null +++ b/python_modules/libraries/dagster-dbt/packages/dagster/.gitignore @@ -0,0 +1,3 @@ +target/ +dbt_packages/ +logs/ diff --git a/python_modules/libraries/dagster-dbt/packages/dagster/dbt_project.yml b/python_modules/libraries/dagster-dbt/packages/dagster/dbt_project.yml new file mode 100644 index 0000000000000..8717ebb08fe42 --- /dev/null +++ b/python_modules/libraries/dagster-dbt/packages/dagster/dbt_project.yml @@ -0,0 +1,9 @@ +name: "dagster" +version: "0.0.1" +config-version: 2 + +require-dbt-version: [">=1.5.0", "<2.0.0"] + +macro-paths: ["macros"] + +clean-targets: ["target", "dbt_packages"] diff --git a/python_modules/libraries/dagster-dbt/packages/dagster/macros/dagster__log_columns_in_relation.sql b/python_modules/libraries/dagster-dbt/packages/dagster/macros/dagster__log_columns_in_relation.sql new file mode 100644 index 0000000000000..2d7c8ab81c547 --- /dev/null +++ b/python_modules/libraries/dagster-dbt/packages/dagster/macros/dagster__log_columns_in_relation.sql @@ -0,0 +1,11 @@ +{% macro dagster__log_columns_in_relation() %} + {%- set columns = adapter.get_columns_in_relation(this) -%} + {%- set table_schema = {} -%} + + {% for column in columns %} + {%- set serializable_column = {column.name: {'data_type': column.data_type}} -%} + {%- set _ = table_schema.update(serializable_column) -%} + {% endfor %} + + {% do log(tojson(table_schema), info=true) %} +{% endmacro %}