[pysqlite] Substituted arguments showing as tuples
"Milo Pschigoda" <[email protected]> Mon, 4 Aug 2008 16:51:10 -0700
| Newsgroups | gmane.comp.python.db.pysqlite.user |
|---|---|
| Message-ID | <[email protected]> |
I'm trying to use sqlite's argument substituition, but I'm having problems:
cur.execute("create table color (id integer primary key,color string)")
cur.execute("insert into color values(null,?)",('other',))
cur.execute("insert into color values(null,?)",('multi/patterned',))
cur.execute("insert into color values(null,?)",('white',))
is what I have currently, but when I pull the information out with this code
colors=cur.execute("select color from color").fetchall()
print "Colors:"
print colors
print type(colors[0])
I get this output:
Colors:
[(u'other',), (u'multi/patterned',), (u'white',), (u'black',),
(u'natural',), (u'red',), (u'green',), (u'blue',)]
<type 'tuple'>
I even tried this line:
cur.execute("insert into color values(?,?)",(1,'other'))
with the same <type 'tuple'> result. I can work around this problem,
but I feel I shouldn't have to, I don't remember ever having to
before. What am I doing wrong here?