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

Incremental merge or insert+update fail if configuring composite unique key #109

Open
jaceksan opened this issue Oct 2, 2023 · 4 comments

Comments

@jaceksan
Copy link

jaceksan commented Oct 2, 2023

Example:

  materialized='incremental',
  unique_key=['pull_request_number', 'repo_id']

Using dbt-vertica version 1.5.0.

@jaceksan
Copy link
Author

jaceksan commented Oct 2, 2023

It generates query such as:

delete from "XXX"."github_input_stage"."pull_requests_extract_json"
where (['pull_request_number', 'repo_id']) in (
  select (['pull_request_number', 'repo_id'])
  from "pull_requests_extract_json__dbt_tmp"
  ....

@barloc
Copy link
Contributor

barloc commented Oct 3, 2023

Hello.
Use it via concat or hash unique_key='hash(load_dt,table_schema,table_name)',. Adapter doesn't support list for this option, only string value.
From documentation: The unique_key config parameter is required for using the merge strategy, the value accepted by this parameter is a single table column.

@jaceksan
Copy link
Author

jaceksan commented Oct 3, 2023

I see.
On the other hand, the list is supported by Snowflake ;-)

@ajay-abrol2
Copy link
Collaborator

Working on to support unique_key parameter as a list. So it will always accept list not string value even for single value.

Examples are below:
for single column, configuration should be : unique_key=['columname']
for multiple columns, configuration should be: unique_key=['col1','col2','col3']

jaceksan added a commit to jaceksan/gooddata-data-pipeline that referenced this issue Dec 5, 2023
Vertica does not support multi-column PK in incremental loads

I created an issue for that:
vertica/dbt-vertica#109
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants