On Mon, 2007-07-23 at 20:00 +0000, Ian Michael Gumby wrote:
>
>
> >From: Carsten Haese <carsten@uniqsys.com>
> >To: informix-list@iiug.org
> >Subject: Python Corner: Filling In The Blanks
>
> >I have just completed another article in my "Python Corner" blog that
> >discusses the topic of Informix application development in Python. This
> >edition covers how to perform queries with variable parameters. Head on
> >over to http://informixdb.blogspot.com/2007/...in-blanks.html
> >for the article.
> >
>
> Very cool!
Thanks, I'm glad one reader liked it
> I like the use of locals() to automatically build your dictionary.
Yeah, I'm proud of this "trick". I'm wondering why it's not used more
widely.
> One of the *big* downsides to Oracle's cx_Oracle module is that you must
> have only those variables used in the query in the dictionary.
I guess that would explain why cx_Oracle users don't use the locals()
trick. I'm wondering why cx_Oracle would reject an over-specified
dictionary, except maybe in an overly broad attempt at preventing
errors. After all, it takes additional work to determine that the
dictionary provides keys that aren't in the query.
> And its also
> cool that you support the :varname format. This would make porting Oracle
> centric python scripts easier to Informix.
You can thank the DB-API specification for that. ":name" is the
specified format for named parameters. (Well, the spec also allows
%(name)s, but that's an abomination that should have never been added to
the spec in the first place, and InformixDB doesn't recognize it.)
Cheers,
--
Carsten Haese
http://informixdb.sourceforge.net