Re: [RFC] ideas for a new Python DBAPI driver (was Re: libpq test suite)

From: Manlio Perillo <manlio(dot)perillo(at)gmail(dot)com>
To: Andrew McNamara <andrewm(at)object-craft(dot)com(dot)au>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: [RFC] ideas for a new Python DBAPI driver (was Re: libpq test suite)
Date: 2013-02-15 20:23:18
Message-ID: 511E9936.6000003@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Il 15/02/2013 02:45, Andrew McNamara ha scritto:
>> For my Python DBAPI2 PostgreSQL driver I plan the following optimizations:
>
> I suggest you have a look at my Python ocpgdb driver:
>
> http://code.google.com/p/ocpgdb/
>

Thanks, I did not know it.

> It uses the v3 binary protocol exclusively (to avoid the usual escaping
> security issues). A number of gotchyas were discovered along the way -
> in particular, you must be a lot more careful about types (as you note
> in a later reply).

Note that this query:
curs.execute('SELECT * FROM foo WHERE bah > %s', '2006-1-1')

is IMHO incorrect, as per DBAPI 2.0:
http://www.python.org/dev/peps/pep-0249/#type-objects-and-constructors

> There were also some issues with the v3 protocol,
> most of which have been fixed now.
>

I hope the issues are discussed in the commit log messages; I'm creating
a git local mirror of the svn repository.

> ocpgdb does not implement everything, just the bits I needed. That said,
> other people/projects are using it in production, and it's proven to be
> fast and stable.
>

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

iEYEARECAAYFAlEemTYACgkQscQJ24LbaUTujgCfZhrNTsqy/PvRJ4qwLVqy8QVT
lNwAnjsJooEv/vss32RNMKEISOdZ16F1
=nKO5
-----END PGP SIGNATURE-----

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2013-02-15 20:32:05 Re: BUG #7873: pg_restore --clean tries to drop tables that don't exist
Previous Message David E. Wheeler 2013-02-15 19:58:53 Re: JSON Function Bike Shedding