[issue15545] sqlite3.Connection.iterdump() does not work with row_factory = sqlite3.Row

Pierre Le Marre report at bugs.python.org
Fri Aug 3 10:27:02 CEST 2012


Pierre Le Marre added the comment:

I use Python 3.2.3 on GNU/Linux 64bits (openSUSE 12.2).
I have created an in-memory connection with the following code:

conn = sqlite3.connect(":memory:", detect_types=sqlite3.PARSE_DECLTYPES, check_same_thread=False)
conn.row_factory = sqlite3.Row

Then I have filled the database, but when it comes to copy it via conn.iterdump(), it crashed with the following message:

File "/usr/lib64/python3.2/sqlite3/dump.py", line 30, in _iterdump
    for table_name, type, sql in sorted(schema_res.fetchall()):
TypeError: unorderable types: sqlite3.Row() < sqlite3.Row()

It seems that the error appears because of the use of "sorted()". In fact, if I don't change conn.row_factory or if I use a custom class _Row implementing __lt__ method (see below) this error does not appear.

class _Row(sqlite3.Row):
    def __lt__(self, x):
        return False

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue15545>
_______________________________________


More information about the Python-bugs-list mailing list