Apologies if I'm misunderstanding. Please advice if I should post elsewhere. But shouldn't iterdump() properly detect VARCHAR columns with binary data and output X'' strings instead of throwing an error? This is what sqlite3 .dump does.
File "foo.py", line 79, in dump_sqlite_db
for line in conn.iterdump():
File "/usr/lib/python3.11/sqlite3/dump.py", line 63, in _iterdump
for row in query_res:
sqlite3.OperationalError: Could not decode to UTF-8 column ''INSERT INTO "sync_entities_metadata" VALUES('||quote("storage_key")||','||quote("metadata")||')'' with text 'INSERT INTO "sync_entities_metadata" VALUES(1,'v10����
File "foo.py", line 79, in dump_sqlite_db
for line in conn.iterdump():
File "/usr/lib/python3.11/sqlite3/dump.py", line 43, in _iterdump
elif table_name.startswith('sqlite_'):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: startswith first arg must be bytes or a tuple of bytes, not str
Bug report
Checklist
and am confident this bug has not been reported before
CPython versions tested on:
3.11
Operating systems tested on:
Linux
Output from running 'python -VV' on the command line:
Python 3.11.5 (main, Aug 25 2023, 13:19:53) [GCC 9.4.0]
A clear and concise description of the bug:
Apologies if I'm misunderstanding. Please advice if I should post elsewhere. But shouldn't iterdump() properly detect VARCHAR columns with binary data and output X'' strings instead of throwing an error? This is what
sqlite3 .dumpdoes.The above will throw an error:
I tried enabling
conn.text_factory = bytesas a workaround, but now get a different error.Linked PRs