-
Notifications
You must be signed in to change notification settings - Fork 30
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
Fix unique constraint error #27
base: master
Are you sure you want to change the base?
Conversation
b3b35f6
to
fa3d6f4
Compare
I am curious of in which situations one would like to add the same content into the database? If I recall correctly the original idea has been not to accept this behavior. Thank you for your contributions! |
I also seem to remember being designed as a one-shot thing. But your changes are exactly what I would do to allow incremental updating. I guess one use case would be "create the DB, get newer version of gtfs a week later, incrementally update" ? I'd be careful that no other bugs appear on multiple import. For example, post-processing creating duplicate structures or multiple IDs for the same object. I'm cautiously optimistic about this, but if you're using this successfully, then that makes me positive. |
Yes, @rkdarst, that is exactly my use case. I haven't tested this yet on the post-processing as I cannot get the tests working on Windows, so, for the time being, I would leave this PR to your suggestion. |
fa3d6f4
to
7f96fc6
Compare
Rebased onto |
So, I think this is a good idea, assuming it works and makes no other problems. I can't think of any... Does it work for you with various tests, no corruption from re-importing something that already is in there? If so, let's do it. |
I think we should do this, it will help someone and won't hurt those doing it the old way. If problems appear later, we can fix or revert. I just added a changelog entry (and unfortunately had to merge master in - I didn't want to rebase your branch, but feel free to if you want). Could you add a test of some sort - I don't know just what, but you can probably figure out sooner than me. Even a simple thing that tries to load the same file twice would work. Can you think of easy, more advanced tests to add? |
This commit fixes situation when the database is already filled with data and the user tries to add them again. In such a case, the script failed with
IntegrityError: UNIQUE constraint failed when inserting a value