In my Python application, I use sqlite3.Row as the factory string to index the results by name for some time without any problems. I recently moved the application to a new server (no code changes), and I found that this indexing method now unexpectedly fails on the new server, given a rather specific condition. I do not see any explanation.
The problem occurs on a new server when there is a keyword in my select request DISTINCT:
import sqlite3
conn = sqlite3.connect(':memory:')
conn.row_factory = sqlite3.Row
c = conn.cursor()
c.execute('create table test ([name] text)')
c.execute("insert into test values ('testing')")
conn.commit()
c.execute('select [name] from test')
row = c.fetchone()
print row['name'] # works fine on both machines
c.execute('select distinct [name] from test') # add distinct keyword
row = c.fetchone()
print row['name'] # fails on new server (no item with that key)
, , , . Debian (: Ubuntu 8.10, : Debian 5.0.3), Python 2.5.2. , sqlite3 Python, , , python .
- - - ?
,