mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
#15545: fix sqlite3.iterdump regression on unsortable row_factory objects.
The fix for issue 9750 introduced a regression by sorting the row objects returned by fetchall. But if a row_factory such as sqlite3.Row is used, the rows may not be sortable (in Python3), which leads to an exception. The sorting is still a nice idea, so the patch moves the sort into the sql. Fix and test by Peter Otten.
This commit is contained in:
parent
78470b4c3a
commit
b52312923b
3 changed files with 27 additions and 1 deletions
|
@ -25,9 +25,10 @@ def _iterdump(connection):
|
|||
FROM "sqlite_master"
|
||||
WHERE "sql" NOT NULL AND
|
||||
"type" == 'table'
|
||||
ORDER BY "name"
|
||||
"""
|
||||
schema_res = cu.execute(q)
|
||||
for table_name, type, sql in sorted(schema_res.fetchall()):
|
||||
for table_name, type, sql in schema_res.fetchall():
|
||||
if table_name == 'sqlite_sequence':
|
||||
yield('DELETE FROM "sqlite_sequence";')
|
||||
elif table_name == 'sqlite_stat1':
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue