Which Python module for PostgreSQL?

Skip Montanaro skip at pobox.com
Wed Mar 3 10:05:42 CET 2004

    simo> I'd like to know too - I had a play with psychog but couldn't get
    simo> it to connect, and couldn't find any documentation for it.

If you're familiar with SQL programming in Python in general, it's pretty
straightforward.  It does adhere to v2 of the DB API, so PEP-249 is useful
reading.  Also, see the doc/examples directory.  Here's a psycopg "hello
world" (change the connect arg to suit your server):

    import psycopg
    conn = psycopg.connect('dbname=test user=test')
    curs = conn.cursor()
    curs.execute("""select 'hello world'""")
    print curs.fetchall()


More information about the Python-list mailing list