New submission from Mark Lawrence: Code adopted from here https://docs.python.org/3/library/sqlite3.html#default-adapters-and-converters.
import sqlite3 import datetime con = sqlite3.connect(":memory:", detect_types=sqlite3.PARSE_DECLTYPES|sqlite3.PARSE_COLNAMES) con.row_factory = sqlite3.Row cur = con.cursor() cur.execute("create table test(d date, ts timestamp)") today = datetime.date.today() now = datetime.datetime.now() cur.execute("insert into test(d, ts) values (?, ?)", (today, now)) cur.execute('select current_date as "d [date]", current_timestamp as "ts [timestamp]"') row = cur.fetchone() print(row.keys()) cur.execute('select current_date as "nit [date]", current_timestamp as "nit [timestamp]"') row = cur.fetchone() print(row.keys()) cur.execute('select current_date as " [date]", current_timestamp as " [timestamp]"') row = cur.fetchone() print(row.keys()) Output --- c:\Users\Mark\MyPython>sqlite3_error.py ['d', 'ts'] ['nit', 'nit'] ['', ''] This clearly defeats the purpose of using keys to access the given columns. Hardly a show stopper but I thought I'd flag it up. ---------- components: Library (Lib) messages: 218200 nosy: BreamoreBoy priority: normal severity: normal status: open title: sqlite3 Row can return duplicate keys when using adapters type: behavior versions: Python 2.7, Python 3.4, Python 3.5 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue21465> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com