Skip to content

Commit

Permalink
feat: convert document_metadata to have microbatching
Browse files Browse the repository at this point in the history
  • Loading branch information
njogz committed Oct 14, 2024
1 parent af1cf8d commit 40e0bfa
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions models/root/document_metadata.sql
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
{{
config(
materialized = 'incremental',
incremental_strategy='microbatch',
event_time='saved_timestamp',
begin='2020-01-01',
batch_size='day'
unique_key='uuid',
on_schema_change='append_new_columns',
post_hook='delete from {{this}} where _deleted=true',
Expand All @@ -19,6 +23,3 @@ SELECT
saved_timestamp,
doc->>'type' as doc_type
from {{ source('couchdb', env_var('POSTGRES_TABLE')) }} source_table
{% if is_incremental() %}
WHERE source_table.saved_timestamp >= {{ max_existing_timestamp('saved_timestamp') }}
{% endif %}

0 comments on commit 40e0bfa

Please sign in to comment.