mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
gh-118221: Always use the default row factory in sqlite3.iterdump() (#118223)
sqlite3.iterdump() depends on the row factory returning resulting rows as tuples; it will fail with custom row factories like for example a dict factory. With this commit, we explicitly reset the row factory of the cursor used by iterdump(), so we always get predictable results. This does not affect the row factory of the parent connection. Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com> Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
This commit is contained in:
parent
796b3fb280
commit
e38b43c213
3 changed files with 18 additions and 0 deletions
|
@ -26,6 +26,7 @@ def _iterdump(connection, *, filter=None):
|
|||
|
||||
writeable_schema = False
|
||||
cu = connection.cursor()
|
||||
cu.row_factory = None # Make sure we get predictable results.
|
||||
# Disable foreign key constraints, if there is any foreign key violation.
|
||||
violations = cu.execute("PRAGMA foreign_key_check").fetchall()
|
||||
if violations:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue