Scaffold domain digital-core
This commit is contained in:
commit
64e0ce27ba
13 files changed
+212
No files matched your search
@@ -0,0 +1,52 @@
|
||||
{#-
|
||||
Macros that make dbt-postgres work against pg_ducklake. Verified 2026-09-17 with
|
||||
dbt-core 1.12.5 / dbt-postgres 1.11.0 for table, view and incremental models.
|
||||
-#}
|
||||
|
||||
{#-
|
||||
dbt-postgres stages incremental rows in `create temporary table ... as`. The dbt role
|
||||
runs with default_table_access_method = ducklake, and DuckLake tables cannot be
|
||||
temporary ("temporary tables are not supported with ducklake access method"), so
|
||||
temporary tables are pinned to heap. Everything else is dbt-postgres's macro verbatim.
|
||||
-#}
|
||||
{% macro postgres__create_table_as(temporary, relation, sql) -%}
|
||||
{%- set unlogged = config.get('unlogged', default=false) -%}
|
||||
{%- set sql_header = config.get('sql_header', none) -%}
|
||||
|
||||
{{ sql_header if sql_header is not none }}
|
||||
|
||||
create {% if temporary -%}
|
||||
temporary
|
||||
{%- elif unlogged -%}
|
||||
unlogged
|
||||
{%- endif %} table {{ relation }}
|
||||
{% if temporary -%} using heap {%- endif %}
|
||||
{% set contract_config = config.get('contract') %}
|
||||
{% if contract_config.enforced %}
|
||||
{{ get_assert_columns_equivalent(sql) }}
|
||||
{% endif -%}
|
||||
{% if contract_config.enforced and (not temporary) -%}
|
||||
{{ get_table_columns_and_constraints() }} ;
|
||||
insert into {{ relation }} (
|
||||
{{ adapter.dispatch('get_column_names', 'dbt')() }}
|
||||
)
|
||||
{%- set sql = get_select_subquery(sql) %}
|
||||
{% else %}
|
||||
as
|
||||
{% endif %}
|
||||
(
|
||||
{{ sql }}
|
||||
);
|
||||
{%- endmacro %}
|
||||
|
||||
{#-
|
||||
A model's +schema is its experience product's schema, used as given rather than
|
||||
prefixed with the target schema, so the product reads as lake.<schema>.<table>.
|
||||
-#}
|
||||
{% macro generate_schema_name(custom_schema_name, node) -%}
|
||||
{%- if custom_schema_name is none -%}
|
||||
{{ target.schema }}
|
||||
{%- else -%}
|
||||
{{ custom_schema_name | trim }}
|
||||
{%- endif -%}
|
||||
{%- endmacro %}
|
||||
Reference in new issue
Block a user