SNOW-835006: Schema-qualified metadata reflection does not include schemas for tables referenced via foreign keys #420
Labels
bug
Something isn't working
status-triage_done
Initial triage done, will be further handled by the driver team
Please answer these questions before submitting your issue. Thanks!
3.10.10
macOS-13.4-x86_64-i386-64bit
pip freeze
)?Relevant modules:
test_schema
, and tablestest_table_1
andtest_table_2
.test_table_1
contains a foreign key referencingtest_table_2
I expected:
metadata.tables
to contain 2 keys,test_schema.test_table_1
andtest_schema.test_table_2
,Table
objects to be associated withtest_schema
, andmetadata.tables['test_schema.test_table_1'].foreign_key_constraints.pop().referred_table
should resolve to theTable
object fortest_schema.test_table_2
.Instead, it contained
test_schema.test_table_1
andtest_table_2
. TheTable
object returned fortest_table_2
was not associated with a schema.metadata.tables['test_schema.test_table_1'].foreign_key_constraints.pop().referred_table
raises the following error:I have a workaround for this issue: list all of the foreign keys using
SHOW IMPORTED KEYS
, pull out all of the fk-referenced table names, and include them explicitly along with the requested tables inonly=
; and then filter the non-schema-qualified tables out ofmetadata.tables
. This is unwieldy, and made even more so by #388.snowflake_sqlalchemy_logs.txt
The text was updated successfully, but these errors were encountered: