Postgresql - Preferred Python Library

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Graeme Matthew

    #1

    Postgresql - Preferred Python Library

    Hi All


    I have noticed that there are a numbe rof client libraries for connecting to
    Postgres.

    Can anyone tell me what is the recommended Python library for database
    connections

    many thanks


  • Lee Harr

    #2
    Re: Postgresql - Preferred Python Library

    On 2004-09-10, Matt Goodall <matt@pollenati on.net> wrote:[color=blue]
    > I've just started experimenting with psycopg2
    > (http://wiki.initd.org/Projects/PsycopgTwo) and it's looking good.
    >
    > As far as I know, psycopg2 is the only DB-API 2.0 implementation for
    > PostgreSQL that uses Python 2.3's datetime types by default.[/color]


    ooh, aah. :o)

    Yes, the datetime handling in the older psycopg was getting on my
    nerves... Native datetime is going to make things much nicer.

    That said, psycopg works very well for me.

    The only other thing that is a bit strange is passing array
    types in to the database. I have been using this:

    alist = ['foo', 'bar']
    query = 'SELECT ARRAY%(alist)s'
    execute(query, locals())

    It works perfectly well, but it seems a bit strange...

    Comment

    • David Cook

      #3
      Re: Postgresql - Preferred Python Library

      On 2004-09-09, Graeme Matthew <graeme.matthew @contrado.com.a u> wrote:
      [color=blue]
      > Can anyone tell me what is the recommended Python library for database
      > connections[/color]

      My preference is psycopg, but I also try to test with the standard one that
      comes with postgres (the DBAPI module is pgdb) and pyPgSQL.

      Dave Cook

      Comment

      • Tim Roberts

        #4
        Re: Postgresql - Preferred Python Library

        Cliff Wells <clifford.wells @comcast.net> wrote:[color=blue]
        >On Thu, 2004-09-09 at 16:21, Graeme Matthew wrote:[color=green]
        >>
        >> I have noticed that there are a numbe rof client libraries for connecting to
        >> Postgres.
        >>
        >> Can anyone tell me what is the recommended Python library for database
        >> connections[/color]
        >
        >I'd strongly recommend psycopg. I've used both psycopg and the pgsql
        >module and found psycopg to be much more stable.[/color]

        So have I, and I wish I could quantify the difference. It's not like
        pyPgSQL crashes on me every day, but there's something intangible about
        psycopg that appeals to me. I've switched to it everywhere.
        --
        - Tim Roberts, timr@probo.com
        Providenza & Boekelheide, Inc.

        Comment

        • Cliff Wells

          #5
          Re: Postgresql - Preferred Python Library

          On Fri, 2004-09-10 at 23:04 -0700, Tim Roberts wrote:[color=blue]
          > Cliff Wells <clifford.wells @comcast.net> wrote:[color=green]
          > >On Thu, 2004-09-09 at 16:21, Graeme Matthew wrote:[color=darkred]
          > >>
          > >> I have noticed that there are a numbe rof client libraries for connecting to
          > >> Postgres.
          > >>
          > >> Can anyone tell me what is the recommended Python library for database
          > >> connections[/color]
          > >
          > >I'd strongly recommend psycopg. I've used both psycopg and the pgsql
          > >module and found psycopg to be much more stable.[/color]
          >
          > So have I, and I wish I could quantify the difference. It's not like
          > pyPgSQL crashes on me every day, but there's something intangible about
          > psycopg that appeals to me. I've switched to it everywhere.[/color]

          My tangible difference was that a script I have that inserts about
          40,000 records into a table (as a single transaction) could never
          complete (hard crash) with the standard pgsql module but completes
          without a hitch with psycopg. Other than that I don't have a problem
          with it <wink>.

          Cliff

          --
          Cliff Wells <clifford.wells @comcast.net>

          Comment

          • Harald Massa

            #6
            Re: Postgresql - Preferred Python Library

            > I've just started experimenting with psycopg2[color=blue]
            > (http://wiki.initd.org/Projects/PsycopgTwo) and it's looking good.[/color]

            Matt,

            on my research of Python connectors to postgresql I also saw psycopg. I had
            to stop further testing because no win32 binaries were available.

            My knowledge grew since then, and meanwhile I was able to compile pyPgSQL
            myself using the instructions and MingW32.

            I was not able to compile psycopg2 with MingW32. I assume you use it
            outside windows, or do you have any binaries for Win32 and psycopg? The
            type issue sounds promising, would like to test it ..

            Harald

            Comment

            • Irmen de Jong

              #7
              Re: Postgresql - Preferred Python Library

              Harald Massa wrote:
              [color=blue][color=green]
              >>I've just started experimenting with psycopg2
              >>(http://wiki.initd.org/Projects/PsycopgTwo) and it's looking good.[/color]
              >
              >
              > Matt,
              >
              > on my research of Python connectors to postgresql I also saw psycopg. I had
              > to stop further testing because no win32 binaries were available.[/color]

              They are!
              Look here: http://www.stickpeople.com/projects/...opg/index.html

              That link is on their site http://initd.org/software/initd/psycopg ....


              --Irmen

              Comment

              Working...