Skip to content

Instantly share code, notes, and snippets.

View seamus-mckinsey's full-sized avatar

Seamus McKinsey seamus-mckinsey

View GitHub Profile
@seamus-mckinsey
seamus-mckinsey / snowflake_insert_by_period_materialization
Created May 12, 2021 20:59
adaption of the insert by period dbt materialization for snowflake
{% macro get_period_boundaries_noquote(target_schema, target_table, timestamp_field, start_date, stop_date, period) -%}
{% call statement('period_boundaries', fetch_result=True) -%}
with data as (
select
coalesce(max({{timestamp_field}}), '{{start_date}}')::timestamp as start_timestamp,
coalesce(
{{dbt_utils.dateadd('millisecond',
-1,
"nullif('" ~ stop_date ~ "','')::timestamp")}},
{{dbt_utils.current_timestamp()}}

Keybase proof

I hereby claim:

  • I am seamus-mckinsey on github.
  • I am seamus_mckinsey (https://keybase.io/seamus_mckinsey) on keybase.
  • I have a public key ASDe1NvnW2XXa08bvroLy-7IL45sGlovI57J--LHX-AuDwo

To claim this, I am signing this object: