googleapis / python-spanner-django

Cloud Spanner database backend for Django
BSD 3-Clause "New" or "Revised" License
88 stars 27 forks source link

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

Open ankiaga opened 4 months ago

ankiaga commented 4 months ago

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.