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

Option to sync insert only #110

Open
fabioespinosa opened this issue Aug 23, 2022 · 7 comments
Open

Option to sync insert only #110

fabioespinosa opened this issue Aug 23, 2022 · 7 comments

Comments

@fabioespinosa
Copy link

Awesome project, works amazingly well.

We are using it in my company to transition to postgres, and during the syncing phase it would be pretty useful to have a "just append whatever is new" instead of deleting the old.

This way we can migrate and perform one last "sync" so that whichever rows in the previous DB get added without deleting the new ones inserted by new users.

@willbryant
Copy link
Owner

Hmm interesting. What would happen if there's any conflicting unique keys?

@denji
Copy link

denji commented Aug 24, 2022

@willbryant Anything can happen, as the function and trigger can be used on either side.

@fabioespinosa
Copy link
Author

fabioespinosa commented Aug 25, 2022

yeah, that would certainly be a problem for incremental primary keys and so FKs. We could assume the schema is full of uuids or we could do:

on conflict do nothing

So we give priority to the data that is already there.

If someone were to use this with incremental PKs they could perhaps sum a fixed number to the all the old PKs (on the from database) and then perform the sync, then reset the sequence.

@PekopT
Copy link

PekopT commented Oct 13, 2022

It's data warehouse case. Will be very useful for us too.

@PekopT
Copy link

PekopT commented Dec 14, 2022

@willbryant any updates on this?

@willbryant
Copy link
Owner

Honestly I think I'm missing something, I don't really understand why you would Kitchen Sync for this, it feels so far away from the current behavior and scope of the tool. I've always seen KS's job as being to scan the data and fix up any mismatches.

There's lots of ETL/ELT tools that do a "start from the last row" methodology if you just want to quickly pick up new stuff and there's no changes in history at the source end and new data at the receiving end. In the 'one last "sync" so that whichever rows in the previous DB get added without deleting the new ones inserted by new users' use case, I have trouble imagining that there are many schema where that could produce a valid result. If there's new rows at both ends, for example, any conflicting FKs are going to end up with mis-attributed associations.

If your app's schema does support this, then you probably want multi-master replication?

@willbryant
Copy link
Owner

OK team, in the spirit of Christmas, I've drafted https://github.com/willbryant/kitchen_sync/tree/insert_only so you can try it and find out.

Not gonna merge it at the moment as I strongly suspect it isn't all that useful, but let me know how you find it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants