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

Fix changeset method for multi-flush transactions #144

Merged
merged 1 commit into from
Nov 5, 2017
Merged

Fix changeset method for multi-flush transactions #144

merged 1 commit into from
Nov 5, 2017

Conversation

oinopion
Copy link
Contributor

@oinopion oinopion commented Jun 20, 2016

When in the same transaction you create object, flush, update object and commit transaction, Continuum will first flush insert version, but later it will update it to be update (happening here: https://github.com/kvesteri/sqlalchemy-continuum/blob/master/sqlalchemy_continuum/unit_of_work.py#L168)

This causes changeset to return empty dict for such changes, which is incorrect. I can see two solutions:

  1. Change behaviour of changeset to not ignore such versions
  2. Change behaviour of process_operation to not change insert into update (explored in Versioning issues on session.flush #79)

This PR changes behaviour of changeset method to not ignore changes on update versions without previous versions.

This fixes #141.

@netcriptus
Copy link
Contributor

@kvesteri any chance this can be merged to master anytime soon now? I'm struggling with the same problem, and this PR solves it.

@kvesteri kvesteri merged commit 95a7a65 into kvesteri:master Nov 5, 2017
@kvesteri
Copy link
Owner

kvesteri commented Nov 5, 2017

Thanks for the PR! 🚋

@oinopion oinopion deleted the fix-changeset branch November 7, 2017 11:23
@oinopion
Copy link
Contributor Author

oinopion commented Nov 7, 2017

🙌

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.

Updating newly flushed object can break changeset
3 participants