Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SPIKE: iceberg as config of table materialization #961

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dbt/include/snowflake/macros/materializations/table.sql
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

{#-- Drop the relation if it was a view to "convert" it in a table. This may lead to
-- downtime, but it should be a relatively infrequent occurrence #}
{% if old_relation is not none and not old_relation.is_table %}
{% if old_relation is not none %}
{{ log("Dropping relation " ~ old_relation ~ " because it is of type " ~ old_relation.type) }}
{{ drop_relation_if_exists(old_relation) }}
{% endif %}
Expand Down
16 changes: 14 additions & 2 deletions dbt/include/snowflake/macros/relations/table/create.sql
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
{% macro snowflake__create_table_as(temporary, relation, compiled_code, language='sql') -%}
{{ log('XXX: am i here?', info=True) }}
{%- set transient = config.get('transient', default=true) -%}
{%- set iceberg = config.get('iceberg', default=true) -%}
{%- set catalog = config.get('catalog') -%}
{%- set external_volume = config.get('external_volume') -%}
{%- set base_location = config.get('base_location') -%}

{% if temporary -%}
{%- set table_type = "temporary" -%}
{%- elif transient -%}
{%- set table_type = "transient" -%}
{# {%- elif transient -%}
{%- set table_type = "transient" -%} #}
{%- elif iceberg -%}
{%- set table_type = "iceberg" -%}
{%- else -%}
{%- set table_type = "" -%}
{%- endif %}
Expand Down Expand Up @@ -33,6 +40,11 @@
{{ get_table_columns_and_constraints() }}
{% set compiled_code = get_select_subquery(compiled_code) %}
{% endif %}
{% if iceberg and catalog and external_volume %}
CATALOG="{{ catalog }}",
EXTERNAL_VOLUME="{{ external_volume }}",
BASE_LOCATION="{{ base_location }}"
{% endif %}
{% if copy_grants and not temporary -%} copy grants {%- endif %} as
(
{%- if cluster_by_string is not none -%}
Expand Down
Loading