-
-
Notifications
You must be signed in to change notification settings - Fork 540
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
Sqlalchemy can't reflect schema with foreign key #8316
Comments
Interesting...there must be some foreign key syntax we don't support (or don't exactly match MySQL). We'll fix this tomorrow. It's a holiday today. Thanks for the report. |
Hi @MhhhxX, thanks for reporting this one. I am able to reproduce the error. I tracked down the query that SQL Alchemy is executing to this: select table_schema, table_name, column_name from information_schema.columns where (table_schema, table_name, lower(column_name)) in (('sep3', 'Task', 'TASK_ID')); This query doesn't return any results, so SQL Alchemy must fall back to the My first guess is that this may come down to differences in collations used in MySQL and Dolt. I'll poke around some more there and see what we can find. |
A couple more clues on this one... When used directly in an equality condition, the match is treated case insensitively: select table_schema, table_name, column_name from information_schema.columns where table_name='TAsk' and table_schema='SEP3';
+--------------+------------+-------------+
| TABLE_SCHEMA | TABLE_NAME | COLUMN_NAME |
+--------------+------------+-------------+
| sep3 | Task | TASK_ID |
+--------------+------------+-------------+ When used with an select table_schema, table_name, column_name from information_schema.columns where (table_name, table_schema) in (('TAsk', 'SEP3'));
Empty set (0.01 sec) When the collation is explicitly added after the select table_schema, table_name, column_name from information_schema.columns where (table_name, lower(table_schema) collate utf8mb3_tolower_ci) in (('TAsk', 'SEP3'));
+--------------+------------+-------------+
| TABLE_SCHEMA | TABLE_NAME | COLUMN_NAME |
+--------------+------------+-------------+
| sep3 | Task | TASK_ID |
+--------------+------------+-------------+ |
Awesome thank you very much for the quick help! |
Dolt
Create a Dolt database with the following tables, and fire up the server (version 1.42.15):
Python
Install sqlalchemy==1.4 via pip, and then execute the following:
The python code produces following error:
The text was updated successfully, but these errors were encountered: