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

Don't set primary key unconditionally for every model #867

Open
ankiaga opened this issue Apr 17, 2024 · 0 comments
Open

Don't set primary key unconditionally for every model #867

ankiaga opened this issue Apr 17, 2024 · 0 comments
Assignees
Labels
api: spanner Issues related to the googleapis/python-spanner-django API. priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@ankiaga
Copy link
Contributor

ankiaga commented Apr 17, 2024

We are setting primary key unconditionally here which was leading to many test failures (and is an actual issue).
We have overcame this issue for passing different tests by commenting the code but we need to make the proper fix

For a model definition where Django would normally think that the default is NOT_PROVIDED, we set a different default. That again causes Django to behave differently here
If the pk.default had been NOT_PROVIDED (as Django expects when a normal generated primary key is being used), then force_insert=True had not been set

Please see more details here https://code.djangoproject.com/ticket/33052.

@ankiaga ankiaga added type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. priority: p2 Moderately-important priority. Fix may not be included in next release. labels Apr 17, 2024
@product-auto-label product-auto-label bot added the api: spanner Issues related to the googleapis/python-spanner-django API. label Apr 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: spanner Issues related to the googleapis/python-spanner-django API. priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

No branches or pull requests

1 participant