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: override AutoField default value only for Spanner #780

Merged
merged 1 commit into from Jul 20, 2022

Conversation

IlyaFaer
Copy link
Contributor

Fixes #742

@IlyaFaer IlyaFaer added the type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. label Jul 19, 2022
@product-auto-label product-auto-label bot added the api: spanner Issues related to the googleapis/python-spanner-django API. label Jul 19, 2022
if (
django.db.connection.settings_dict["ENGINE"] == "django_spanner"
and self.default == NOT_PROVIDED
):
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Using the INT64 random key only in case it's a Spanner database and default value/function for the auto-field is not provided. Thus, outside Spanner database it'll work as always, and for Spanner users will still be able to override the key with whatever they want.

@IlyaFaer IlyaFaer added the owlbot:run Add this label to trigger the Owlbot post processor. label Jul 19, 2022
@gcf-owl-bot gcf-owl-bot bot removed the owlbot:run Add this label to trigger the Owlbot post processor. label Jul 19, 2022
@IlyaFaer IlyaFaer requested a review from asthamohta July 19, 2022 08:52
@IlyaFaer IlyaFaer marked this pull request as ready for review July 19, 2022 08:52
Copy link
Contributor

@asthamohta asthamohta left a comment

Choose a reason for hiding this comment

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

Lgtm

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. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Autofield patching doesn't work for multi-database migration against MySQL
2 participants