Added unit tests for inspect() foreign key detection

Used them to fix a bug with it.

Refs #85
This commit is contained in:
Simon Willison 2017-11-17 08:08:11 -08:00
commit 45e502aace
2 changed files with 77 additions and 1 deletions

View file

@ -215,7 +215,7 @@ def get_all_foreign_keys(conn):
for table in tables:
infos = conn.execute(
'PRAGMA foreign_key_list([{}])'.format(table)
).fetchmany()
).fetchall()
for info in infos:
if info is not None:
id, seq, table_name, from_, to_, on_update, on_delete, match = info