-
Notifications
You must be signed in to change notification settings - Fork 30
django: add support for FOREIGN KEY constraints #313
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
Comments
As per https://cloud.google.com/spanner/docs/foreign-keys/overview#how-to-define-foreign-keys this is a little more involved because other SQL as there seem to be 2 flavors: but the ALTER statements are familiar though it DOESN'T support CASCADE. |
I'll start looking at this but it's not the sort of change we can merge until the build is green as I don't have much confidence it won't break something unexpected. At first glance, I see tracebacks like this:
I haven't investigated in detail, but I think it suggests that when flushing the database after a test, we have to know the order in which to delete rows so as not to cause a foreign constraint violation. I don't think this is possible so if there's no DELETE CASCADE support, that may be a blocker. |
@bvandiver @skuruppu please take a look at @timgraham's postulation
@timgraham I think that as this is being investigated, please don't get blocked, you can keep working on other things like the unexplored Django features. |
…elations Implemented: * DatabaseIntrospection.get_primary_key_column * DatabaseIntrospection.get_relations However, get_relations tests CANNOT yet be enabled because Cloud Spanner doesn't yet have ON DELETE cascading for FOREIGN KEYS which limits #313, which renders the method useless as it will always return {} instead of being populated with values that are derived from FOREIGN KEYs. Fixes #312 Updates #311
…elations Implemented: * DatabaseIntrospection.get_primary_key_column * DatabaseIntrospection.get_relations However, get_relations tests CANNOT yet be enabled because Cloud Spanner doesn't yet have ON DELETE cascading for FOREIGN KEYS which limits #313, which renders the method useless as it will always return {} instead of being populated with values that are derived from FOREIGN KEYs. Fixes #312 Updates #311
…elations Implemented: * DatabaseIntrospection.get_primary_key_column * DatabaseIntrospection.get_relations However, get_relations tests CANNOT yet be enabled because Cloud Spanner doesn't yet have ON DELETE cascading for FOREIGN KEYS which limits #313, which renders the method useless as it will always return {} instead of being populated with values that are derived from FOREIGN KEYs. Fixes #312 Updates #311
…elations Implemented: * DatabaseIntrospection.get_primary_key_column * DatabaseIntrospection.get_relations However, get_relations tests CANNOT yet be enabled because Cloud Spanner doesn't yet have ON DELETE cascading for FOREIGN KEYS which limits #313, which renders the method useless as it will always return {} instead of being populated with values that are derived from FOREIGN KEYs. Fixes #312 Updates #311
…elations Implemented: * DatabaseIntrospection.get_primary_key_column * DatabaseIntrospection.get_relations However, get_relations tests CANNOT yet be enabled because Cloud Spanner doesn't yet have ON DELETE cascading for FOREIGN KEYS which limits #313, which renders the method useless as it will always return {} instead of being populated with values that are derived from FOREIGN KEYs. Fixes #312 Updates #311
…elations Implemented: * DatabaseIntrospection.get_primary_key_column * DatabaseIntrospection.get_relations However, get_relations tests CANNOT yet be enabled because Cloud Spanner doesn't yet have ON DELETE cascading for FOREIGN KEYS which limits #313, which renders the method useless as it will always return {} instead of being populated with values that are derived from FOREIGN KEYs. Fixes #312 Updates #311
It disables parts of tests that don't apply until support for foriegn keys is added (refs #313).
It disables parts of tests that don't apply until support for foriegn keys is added (refs #313).
This is a documented limitation that we do not plan on taking up any time soon, hence closing the issue: |
On Thu 5 Mar 2020, Cloud Spanner announced support for FOREIGN KEYS as per https://cloud.google.com/spanner/docs/release-notes and https://cloud.google.com/spanner/docs/foreign-keys/overview
We need to add support for FOREIGN KEYS now, perhaps per https://github.com/orijtech/django-spanner/blob/189b71de3ab868c4924708396086843db6a6e506/spanner/django/features.py#L13
and then enable the tests that assumed no FOREIGN KEY support.
The text was updated successfully, but these errors were encountered: