On Thu, 18 Aug 2016 15:51:56 +0200
Christoph Zwerschke <[email protected]> wrote:
> Am 17.08.2016 um 18:41 schrieb D'Arcy J.M. Cain:
> > It seems that we support positional arguments.  How hard would it
> > be to port named arguments from the DB-API interface to the classic
> > one?  
> 
> The C module and the DB wrapper take named arguments as well, they
> only have different names (dbname <> database, password <> passwd),
> and pgdb also takes a "dsn" parameter with a horrible syntax using
> colons which conflicts with the use of the colon as separator between
> host and port.
> 
> I thought this could be improved, too.
> 
> Instead of that old dsn syntax we could accept libpq connection
> strings like "host=localhost port=5432 dbname=mydb" and connection
> URIs like "postgresql://user:password@localhost:5432/mydb".
> 
> And the classic module should accept the same parameter names as pgdb 
> does. The old names should be accepted as well at least until 6.0.

All good ideas but not what I meant.  I can do this in pgdb:

>>> Q = "SELECT * FROM artran WHERE glaccount = %(glaccount)s AND trdate > 
>>> %(trdate)s"
>>> x = dict(trdate = "jan 1 2016", glaccount = "1140-0000")
>>> res = con.execute(Q, x)

I would like to do the same thing in pg.

-- 
D'Arcy J.M. Cain
PyGreSQL Development Group
http://www.PyGreSQL.org IM:[email protected]
_______________________________________________
PyGreSQL mailing list
[email protected]
https://mail.vex.net/mailman/listinfo.cgi/pygresql

Reply via email to