-
-
Notifications
You must be signed in to change notification settings - Fork 115
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
Represent compound foreign keys in table.foreign_keys output #594
Comments
Digging in a bit more: >>> pprint(list(db.query('PRAGMA foreign_key_list(courses)')))
[{'from': 'campus_name',
'id': 0,
'match': 'NONE',
'on_delete': 'NO ACTION',
'on_update': 'NO ACTION',
'seq': 0,
'table': 'departments',
'to': 'campus_name'},
{'from': 'dept_code',
'id': 0,
'match': 'NONE',
'on_delete': 'NO ACTION',
'on_update': 'NO ACTION',
'seq': 1,
'table': 'departments',
'to': 'dept_code'}] I think the way you tell it's a compound foreign key is that both of those have the same Right now I ignore those columns entirely: sqlite-utils/sqlite_utils/db.py Lines 1523 to 1540 in 622c3a5
|
Changing this without breaking backwards compatibility (and forcing a 4.0 release) will be tricky, because sqlite-utils/sqlite_utils/db.py Lines 148 to 150 in 622c3a5
I could swap it out for a for table, column, other_table, other_column in table.foreign_keys:
# ... |
Given this schema:
The output of
db["courses"].foreign_keys
right now is:Which suggests two normal foreign keys, not one compound foreign key.
The text was updated successfully, but these errors were encountered: