-
Notifications
You must be signed in to change notification settings - Fork 30
django: implement DatabaseIntrospection.get_relations() #311
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
I think we can run this SQL: SELECT tc.COLUMN_NAME as orig_col, ccu.TABLE_NAME, ccu.COLUMN_NAME as ref_col
from
INFORMATION_SCHEMA.KEY_COLUMN_USAGE AS tc
JOIN
INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS as rc
ON
tc.CONSTRAINT_NAME = rc.CONSTRAINT_NAME
JOIN
INFORMATION_SCHEMA.CONSTRAINT_COLUMN_USAGE as ccu
ON
rc.UNIQUE_CONSTRAINT_NAME = ccu.CONSTRAINT_NAME
WHERE
tc.TABLE_NAME=tableName |
I've prepared a PR and will mail it shortly. |
Actually we can't support this feature until we've figured out how to handle foreign keys as per #313. I've written the code for it, but then I noticed that we don't even issue the FOREIGN KEY constraints thus the tests will perennially fail. |
odeke-em
added a commit
that referenced
this issue
Mar 10, 2020
…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
odeke-em
added a commit
that referenced
this issue
Mar 10, 2020
…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
odeke-em
added a commit
that referenced
this issue
Mar 10, 2020
…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
odeke-em
added a commit
that referenced
this issue
Mar 10, 2020
…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
odeke-em
added a commit
that referenced
this issue
Mar 12, 2020
…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
odeke-em
added a commit
that referenced
this issue
Mar 13, 2020
…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
Implemented in 9ca5262. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Test: introspection.tests.IntrospectionTests.test_get_relations
The text was updated successfully, but these errors were encountered: