Home

pypg

pypg is a pure Python database driver for Postgresql.   I developed it as an experiment to determine its feasibility.  

Some of the things I hope to learn:

  1. Will it be fast enough?
  2. Will it consume too much memory holding result sets?
  3. How difficult is the network programming?
  4. How difficult is implementing the Postgresql protocol?

To save some time, I used the PyGreSQL driver and replaced the C portion with a Python module.

The code is early alpha quality and you can download it here if you would like to play around with it.   Usage is similar to PyGreSQL.  It supports md5, cleartext, and trust authentication.

Example:

import pypg
con = pypg.connect(host='localhost', database='dbname', user='user', password='pass')
cur = con.cursor()
cur.execute('query here')
result = cur.fetchall()
con.close()

Have Fun!