我有一个我创建的sqlite3数据库,我正在填充db2数据库中的数据。运行以下内容时出错:
for row in db2_connection.execute(query):
sqlite3_connection.execute("INSERT INTO MY_TABLE VALUES (?, ?, ?)", row)
这是错误:
File "example.py", line 72, in load_micr_db
sqlite3_connection.execute("INSERT INTO MY_TABLE VALUES (?, ?, ?)", row)
sqlite3.ProgrammingError: You must not use 8-bit bytestrings unless you use a
text_factory that can interpret 8-bit bytestrings (like text_factory = str).
It is highly recommended that you instead just switch your application to
Unicode strings.
这听起来很棒,但我不知道如何遵循它。如何“将我的应用程序切换到Unicode字符串”?
我正在使用Python 2.6,pyodbc
来查询db2 9,sqlite3
。
答案 0 :(得分:3)