Skip to content

Commit

Permalink
added delta_table_replace materialization
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeremynadal33 committed Aug 6, 2024
1 parent 726ae4c commit 3e43926
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 1 deletion.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
## New versio
## New version
- Fix session provisioning timeout and delay handling
- Add delta_table_replace materialization

## v1.8.1
- Fix typo in README.md
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{% materialization delta_table_replace, adapter='glue' %}
{%- set partition_by = config.get('partition_by', none) -%}
{%- set table_properties = config.get('table_properties', default={}) -%}
{% set lf_tags_config = config.get('lf_tags_config') -%}
{%- set lf_grants = config.get('lf_grants') -%}
{%- set target_relation = this -%}
{%- set build_sql = delta_create_or_replace(target_relation, table_properties) -%}

{{ run_hooks(pre_hooks) }}

{%- call statement('main') -%}
{{ build_sql }}
{%- endcall -%}

{% do persist_docs(target_relation, model) %}

{% do persist_constraints(target_relation, model) %}

{% if lf_tags_config is not none %}
{{ adapter.add_lf_tags(target_relation, lf_tags_config) }}
{% endif %}

{% if lf_grants is not none %}
{{ adapter.apply_lf_grants(target_relation, lf_grants) }}
{% endif %}

{{ run_hooks(post_hooks) }}

{{ return({'relations': [target_relation]}) }}

{% endmaterialization %}

{% macro delta_create_or_replace(relation, table_properties) %}
create or replace table {{ relation }}
using delta
{{ set_table_properties(table_properties) }}
{{ partition_cols(label="partitioned by") }}
{{ glue__location_clause(relation) }}
{{ comment_clause() }}
as
{{ sql }}
{% endmacro %}

0 comments on commit 3e43926

Please sign in to comment.