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

dbt-postgres 'microbatch' strategy #146

Merged
merged 7 commits into from
Sep 12, 2024
Merged
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
6 changes: 6 additions & 0 deletions .changes/unreleased/Features-20240911-141416.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
kind: Features
body: 'Microbatch incremental strategy implementation: merge'
time: 2024-09-11T14:14:16.538536-04:00
custom:
Author: michelleark
Issue: "149"
2 changes: 1 addition & 1 deletion dbt/adapters/postgres/impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ def valid_incremental_strategies(self):
"""The set of standard builtin strategies which this adapter supports out-of-the-box.
Not used to validate custom strategies defined by end users.
"""
return ["append", "delete+insert", "merge"]
return ["append", "delete+insert", "merge", "microbatch"]

def debug_query(self):
self.execute("select 1 as id")
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,14 @@
{% endif %}

{% endmacro %}


{% macro postgres__get_incremental_microbatch_sql(arg_dict) %}

{% if arg_dict["unique_key"] %}
{% do return(adapter.dispatch('get_incremental_merge_sql', 'dbt')(arg_dict)) %}
{% else %}
{{ exceptions.raise_compiler_error("dbt-postgres 'microbatch' requires a `unique_key` config") }}
{% endif %}

{% endmacro %}
7 changes: 7 additions & 0 deletions tests/functional/adapter/test_incremental_microbatch.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from dbt.tests.adapter.incremental.test_incremental_microbatch import (
BaseMicrobatch,
)


class TestPostgresMicrobatch(BaseMicrobatch):
pass
Loading