Skip to content

Conversation

@waltaskew
Copy link
Contributor

@waltaskew waltaskew commented Jun 2, 2025

BEGIN_COMMIT_OVERRIDE
fix: support retrieval of cross-schema foreign keys

Allow get_multi_foreign_keys to retrieve foreign keys between tables in different schemas. The current SQL used to retrieve them has a mistake in the JOINs, confusing the table_schema column and the constraint_schema column. This goes unnoticed as long as everything is in the same schema.

Include schema names in ALTER TABLE schema.table DROP CONSTRAINT fk_constraint DDL and quote the table name.

fixes: #638
END_COMMIT_OVERRIDE

@product-auto-label product-auto-label bot added the api: spanner Issues related to the googleapis/python-spanner-sqlalchemy API. label Jun 2, 2025
Allow `get_multi_foreign_keys` to retrieve foreign keys between tables
in different schemas. The current SQL used to retrieve them has a
mistake in the JOINs used to retrieve them, confusing the `table_schema`
column and the `constraint_schema` column. This goes unnoticed as long
as everything is in the same schema.

Include schemas names in ALTER TABLE schema.table DROP CONSTRAINT DDL
and quote the table name.

fixes: googleapis#638
@waltaskew waltaskew force-pushed the detect-cross-schema-fks branch from 9ff2066 to 2593ac7 Compare June 4, 2025 01:08
@waltaskew
Copy link
Contributor Author

@olavloite would you mind taking a look at this when you have a chance? We're having a bit of trouble from this bug.

@olavloite olavloite added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jun 20, 2025
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jun 20, 2025
@olavloite olavloite merged commit ef07a1f into googleapis:main Jun 20, 2025
14 checks passed
@olavloite olavloite changed the title bug: Support Retrieval of Cross-Schema Foreign Keys fix: Support Retrieval of Cross-Schema Foreign Keys Jun 20, 2025
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-sqlalchemy API.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Schema Support

3 participants