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

Make merge write_disposition fall back to append behavior when no merge or primary keys are set #1047

Closed
wants to merge 0 commits into from

Conversation

sh-rp
Copy link
Collaborator

@sh-rp sh-rp commented Mar 4, 2024

Description

Currently the merge jobs will delete all data in the tables if no merge or primary keys are present, this behavior is not intuitive and can also lead to unexpected data loss.

Copy link

netlify bot commented Mar 4, 2024

Deploy Preview for dlt-hub-docs ready!

Name Link
🔨 Latest commit 0abad12
🔍 Latest deploy log https://app.netlify.com/sites/dlt-hub-docs/deploys/661ea0631876c6000823ccdf
😎 Deploy Preview https://deploy-preview-1047--dlt-hub-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@sh-rp sh-rp marked this pull request as ready for review March 4, 2024 15:52
@sh-rp sh-rp requested a review from rudolfix March 4, 2024 15:52
Copy link
Collaborator

@rudolfix rudolfix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is a good start :)

  1. there's already test for it (test_merge_no_merge_keys)
  2. we should also test what happens if we have hard delete column
  3. filesystem also fallbacks to replace when there are no keys (and I think there's a test for it)
  4. what about vector databases? they support limited merge (on primary key). I think they do not fallback to replace but make sure

[t["name"] for t in table_chain],
f"There is no unique column (ie _dlt_id) in top table {root_table['name']} so"
" it is not possible to link child tables to it.",
if not fallback_to_append:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe we could extract delete code block to separate method?

@rudolfix
Copy link
Collaborator

rudolfix commented Mar 4, 2024

@sh-rp also you must update docs where I think we say we replace

@sh-rp sh-rp changed the title Make merge write_disposition fall back to append behavior when noe merge or primary keys are set Make merge write_disposition fall back to append behavior when nomerge or primary keys are set Mar 5, 2024
@sh-rp sh-rp changed the title Make merge write_disposition fall back to append behavior when nomerge or primary keys are set Make merge write_disposition fall back to append behavior when no merge or primary keys are set Mar 5, 2024
@sh-rp sh-rp self-assigned this Mar 18, 2024
@sh-rp sh-rp force-pushed the d#/merge_fallback branch 2 times, most recently from 4291338 to 61120f2 Compare March 26, 2024 12:44
@sh-rp sh-rp closed this Apr 16, 2024
@sh-rp sh-rp force-pushed the d#/merge_fallback branch from ef96969 to 0abad12 Compare April 16, 2024 15:59
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

Successfully merging this pull request may close these issues.

2 participants