[DB-SIG] Re: cx_Oracle - passing unnecessary bind variables
Anthony Tuininga
anthony at computronix.com
Mon Nov 24 13:32:41 EST 2003
On Mon, 2003-11-24 at 11:00, Dieter Maurer wrote:
> Anthony Tuininga wrote at 2003-11-24 08:22 -0700:
> > ...
> > Since cx_Oracle allows keyword arguments for executing SQL statements,
> > this one has not proved to be a problem to me. This is something that I
> > wish the DB API standard would "officially" endorse. Specifically, this
> > is permitted in cx_Oracle:
> >
> > cursor.execute(sql, var1=value1, var2=value2, var3=value3....)
> >
> > which allows for the building of a dictionary quite easily. There are a
> > few cases where it might be convenient to pass a prebuilt dictionary but
> > they are few and far between -- unless you can give me some additional
> > examples??
>
> That is no longer an issue:
>
> When you have a dictionary "d" and you need keyword arguments,
> you simply pass "**d", e.g.:
>
> cursor.execute(sql, **d)
Could you explain exactly what you mean? I believe the syntax you show
is invalid in the DB API. Specifically, you must call
cursor.execute(sql, d)
where d is a dictionary. Keyword arguments are not supported by the DB
API but they are with cx_Oracle. Or am I missing something here and you
are referring to something else?
--
Anthony Tuininga
anthony at computronix.com
Computronix
Distinctive Software. Real People.
Suite 200, 10216 - 124 Street NW
Edmonton, AB, Canada T5N 4A3
Phone: (780) 454-3700
Fax: (780) 454-3838
http://www.computronix.com
More information about the DB-SIG
mailing list