Re: Error using row object as args for a query

Gerhard Häring <[email protected]>
Newsgroups gmane.comp.python.db.pysqlite.user
Message-ID <[email protected]>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

TiNo wrote:
>     Gerhard wrote:
>     If you use a sequence as parameter, you need to use the question
>     mark as
>     placeholder, and if you use a dictionary as parameter, you need to use
>     named placeholders (:name). So you can use either
> 
> 
> I know, and that was not my question.
> I try to use a Row object as parameter, but what is a Row object when
> row_factory is set to pysqlite2.dbapi2.Row?
> when I try (as I do in my example code):
>>>> print x['a']
> it prints the correct value, which makes it appear to be a dictionary,
> but apparently it isn't as my code is not working.

It's a customly written class, because subclassing dict or tuple was too
much effort at the time I wrote it.

> Can I (easily) make a dict of a Row object, and therefore use named
> placeholders?

Unfortunately not at the moment, you would need a custom function to
convert sqlite.Row objects to tuples or dictionaries.

- -- Gerhard
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFGWOFdIO4ozGCH14RAvOQAJ0UILa/mgoDbBkuDFeanFuDyzW3ZQCgqUyn
yax5mmIZgj+tTDH1Twd2gTQ=
=srSc
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.