pysqlite2 fetching from select different than pysqlite?

Tim Golden tim.golden at viacom-outdoor.co.uk
Thu Jul 27 08:34:50 EDT 2006


[schwehr at gmail.com]

| I have some old pysqlite 1.x code that uses a pattern like this:
| 
| cu.execute('SELECT weight FROM weights WHERE samplename="foo")
| row = cu.fetchone()
| weight=row['weight']
| 
| It seems like lookups by name are no longer supported in 
| pysqlite2. 

According to this:

http://initd.org/pub/software/pysqlite/doc/usage-guide.html#accessing-co
lumns-by-name-instead-of-by-index

you have to specify a .row_factory before running the select

TJG

________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________



More information about the Python-list mailing list