-
-
Notifications
You must be signed in to change notification settings - Fork 31.8k
Unable to call iterdump method for Sqlite3 connections #118221
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
Comments
FTR, the traceback is: Traceback (most recent call last):
File "../iterdump.py", line 26, in <module>
main()
File "../iterdump.py", line 22, in main
for line in conn.iterdump():
File "/opt/homebrew/Cellar/[email protected]/3.8.19/Frameworks/Python.framework/Versions/3.8/lib/python3.8/sqlite3/dump.py", line 55, in _iterdump
query_res = cu.execute(q)
sqlite3.OperationalError: no such table: name Happens on Python versions from 3.8 through 3.13. Using the |
sqlite3. Row can't meet the needs of the production environment, is there any other way? |
The problem is that |
Well, Thanks! |
I still think we should fix this. Perhaps a mention in the docs is sufficient. |
…mp() The iterdump() implementation depends on the row factory returning resulting rows as tuples; it will fail with custom row factories like for example a dict factory. Fixed by overriding the row factory of the cursor used by iterdump(). FTR, this does not affect the row factory of the parent connection.
The solution is easier: overriding the row factory of a cursor does not impact the row factory of the parent connection, so all we need to do is to make sure the cursor used by |
…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 <[email protected]> Co-authored-by: Serhiy Storchaka <[email protected]>
Resolved by:
Thanks for the report, @kesry! |
…ump() (#118223) (#118270) 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 <[email protected]> Co-authored-by: Serhiy Storchaka <[email protected]>
Greet!👍 |
Bug report
Bug description:
CPython versions tested on:
3.12
Operating systems tested on:
Windows
Linked PRs
The text was updated successfully, but these errors were encountered: