Erlend E. Aasland <erlend.aasl...@innova.no> added the comment:
I modified your second example slightly: ``` import sqlite3 conn = sqlite3.connect(":memory:") conn.text_factory=bytes conn.row_factory = sqlite3.Row cursor = conn.execute("CREATE TABLE foo (bar)") numbers = range(4) cursor.executemany("INSERT INTO foo (bar) VALUES (?)", ((str(v),) for v in numbers)) cursor.execute("SELECT bar FROM foo") print("first fetch") for row in cursor.fetchmany(2): print(type(row[0])) conn.__init__(":memory:") conn.execute("CREATE TABLE foo (bar)") letters = "a", "b", "c", "d" conn.executemany("INSERT INTO foo (bar) VALUES (?)", ((v,) for v in letters)) # Currently this uses the old database, old row_factory, but new text_factory" print("second fetch") for row in cursor.fetchall(): print(type(row[0])) ``` Here's the output: first fetch <class 'bytes'> <class 'bytes'> second fetch <class 'str'> <class 'str'> ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue45126> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com