Author erlendaasland
Recipients erlendaasland, petr.viktorin
Date 2021-09-08.08:29:45
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1631089785.77.0.463794086086.issue45126@roundup.psfhosted.org>
In-reply-to
Content
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'>
History
Date User Action Args
2021-09-08 08:29:45erlendaaslandsetrecipients: + erlendaasland, petr.viktorin
2021-09-08 08:29:45erlendaaslandsetmessageid: <1631089785.77.0.463794086086.issue45126@roundup.psfhosted.org>
2021-09-08 08:29:45erlendaaslandlinkissue45126 messages
2021-09-08 08:29:45erlendaaslandcreate