dbt-msft / tsql-utils

dbt-utils for the dbt-msft family of packages
MIT License
25 stars 24 forks source link

The insert by period materialization for TSQL #56

Closed davidclarance closed 2 years ago

davidclarance commented 2 years ago

The insert_by_period materialization provides the ability to iteratively insert rows into a table one period (day, week, month, year etc) at a time.

Basic functionality

The way this works is that you define the config block and a placeholder flag in the following way:

{{
  config(
    materialized = 'insert_by_period',
    period = 'day',
    timestamp_field = 'SnapshotDate',
    start_date = '2018-01-01',
    stop_date = '2018-01-10',
  )
}}

with payments as (

  select *
  from {{ ref('payments') }}
  where __PERIOD_FILTER__ -- This will be replaced with a filter in the materialization code

)

Config values defined:

Extended functionality

Help required

Thanks

davidclarance commented 2 years ago

This PR address #57