Thread: pgsql for Python

pgsql for Python

From
Marek Pętlicki
Date:
Has anybody used http://sourceforge.net/projects/pgsql ?
I maintain production system based on Python and PostgreSQL.

I currently use PoPy, but for a few reasons it doesn't satysfy me fully.
The pgsql seems OK at first sight (especially libpq-to-Python API) but
for the production system I need Python DB API 2.0 compliant library.
Has anybody tested it yet? What is the status of PostgreSQL 7.1
compliance for today?

Any Python geeks out here? ;-)

bye

--
Marek Pętlicki <marpet@buy.pl>


Re: pgsql for Python

From
Joel Burton
Date:
On Wed, 28 Feb 2001, [iso-8859-2] Marek P�tlicki wrote:

> Has anybody used http://sourceforge.net/projects/pgsql ?
> I maintain production system based on Python and PostgreSQL.
>
> I currently use PoPy, but for a few reasons it doesn't satysfy me fully.
> The pgsql seems OK at first sight (especially libpq-to-Python API) but
> for the production system I need Python DB API 2.0 compliant library.
> Has anybody tested it yet? What is the status of PostgreSQL 7.1
> compliance for today?
>
> Any Python geeks out here? ;-)

Partially a Python geek here.

I use PoPy and think it's dandy. I also thought it *was* the DB API 2.0--
am I mistaken here?

PyGreSQL is more commonly used, and has (IMHO) a simpler, more dict-like
interface, but isn't (AFAIK) thread-safe, nor DB API compliant.

--
Joel Burton   <jburton@scw.org>
Director of Information Systems, Support Center of Washington


Re: Re: pgsql for Python

From
Shaw Terwilliger
Date:
Joel Burton wrote:
> PyGreSQL is more commonly used, and has (IMHO) a simpler, more dict-like
> interface, but isn't (AFAIK) thread-safe, nor DB API compliant.

I wrote a small web application server in python (www.lloop.com) using
Python and PyGreSQL.  PyGreSQL was (mostly) thread safe, in practice, when
I started using it.  I did a little bit of concurrency testing, found a few
uninitialized variables in the PyGreSQL module that caused crashes, but
these were easily fixed.  If by thread-safe you mean a connection can be
safely shared between multiple concurrent threads, I don't know what to say
(never tried that).  Pooling PyGreSQL connections and checking them in and
out to Python threads seemed to work well.

I haven't done much Python work lately, so I haven't tried PoPy (it sounds
nice).

--
Shaw Terwilliger <sterwill@sourcegear.com>
SourceGear Corporation
217.356.0105 x 641

Attachment

Re: Re: pgsql for Python

From
Marek Pętlicki
Date:
On Friday, March, 2001-03-02 at 14:16:02, Joel Burton wrote:
> On Wed, 28 Feb 2001, [iso-8859-2] Marek Pętlicki wrote:
>
> > Has anybody used http://sourceforge.net/projects/pgsql ?
> > I maintain production system based on Python and PostgreSQL.
> >
> > I currently use PoPy, but for a few reasons it doesn't satysfy me fully.
> > The pgsql seems OK at first sight (especially libpq-to-Python API) but
> > for the production system I need Python DB API 2.0 compliant library.
> > Has anybody tested it yet? What is the status of PostgreSQL 7.1
> > compliance for today?
> >
> > Any Python geeks out here? ;-)
>
> Partially a Python geek here.
>
> I use PoPy and think it's dandy. I also thought it *was* the DB API 2.0--
> am I mistaken here?

yes, it _is_ compliant, when complaining about compatibility I meant
pgsql's libpq-to-Python API, which in my opinion is very cool thing (but
as I said I need DB API 2.0).

What I don't like in PoPy is its oversimplistic approach towards more
complex types in PostgreSQL. Returning Numerics as strings for example
is a little bit too much for me...

> PyGreSQL is more commonly used, and has (IMHO) a simpler, more dict-like
> interface, but isn't (AFAIK) thread-safe, nor DB API compliant.

yes, it is commonly used partly because it is distributed together with
PostgreSQL :-)

Anyway I must say, after a few glances at http://sourceforge.net/projects/pgsql
that it is very interesting project, especially because of its better
support of PostgreSQL types (like Numeric, Money or arrays), aspecially
better from PoPy, which I have most experience with. A few
improvements should be added to it though to make it really the best
PostgreSQL API for Python, IMO.

regards

--
Marek Pętlicki <marpet@buy.pl>


Re: Re: pgsql for Python

From
"Brent R. Matzelle"
Date:
> > I use PoPy and think it's dandy. I also thought it *was* the
> DB API 2.0--
> > am I mistaken here?

I noticed a couple posts asking for PoPy RPMs so I created some and posted
them below if anyone is interested.

http://www.linuxshare.com/popy/

Brent


Re: Re: pgsql for Python

From
Lamar Owen
Date:
"Brent R. Matzelle" wrote:
>
> > > I use PoPy and think it's dandy. I also thought it *was* the
> > DB API 2.0--
> > > am I mistaken here?
>
> I noticed a couple posts asking for PoPy RPMs so I created some and posted
> them below if anyone is interested.

What's the difference between PoPy and the PygreSQL driver included in
the PostgreSQL distribution?  Just curious.
--
Lamar Owen
WGCR Internet Radio
1 Peter 4:11

Re: Re: pgsql for Python

From
"Brent R. Matzelle"
Date:
> What's the difference between PoPy and the PygreSQL driver
> included in
> the PostgreSQL distribution?  Just curious.

Several things actually.  PyGreSQL is a C module and two Python
script files, while PoPy is built entirely as a C module which
should mean more speed.  PoPy is Python DB API 2.0 compliant
(http://www.python.org/topics/database/DatabaseAPI-2.0.html)
which is the equivalent of JDBC for Java and DBI for Perl.
PyGreSQL is not compliant.  PoPy is threadsafe, while PyGreSQL
is not.

Brent

__________________________________________________
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail.
http://personal.mail.yahoo.com/