skip to navigation
skip to content

Not Logged In

pgwrap 0.3

Simple PostgreSQL database wrapper - provides wrapper over psycopg2 supporting a Python API for common sql functions

Latest Version: 0.7

The 'pgwrap' module provides a simple wrapper over psycopg2 supporting a Python API for common sql functions.

This is not intended to provide an ORM-like functionality, just some basic functionality to make it easier to interact with PostgreSQL from python code for simple use-cases. For more complex operations direct SQL access is available.

These 'module' include:

  • Simplified handling of connections/cursor
    • Background connection pool (provided by psycopg2.pool)
    • Cursor context handler
  • Python API to wrap basic SQL functionality
    • select,update,delete,join)
    • These methods are implemented as extensions to the cursor context handler (allowing then to be used transactionally where needed), however are also available as stand-alone methods which create an implicit cursor for simple queries
  • Query results as dict (using psycopg2.extras.RealDictCursor)

Basic usage:

>>> from pgwrap import connect,query
>>> connect(url="postgres://localhost")
>>> query_one("select version()")
{'version': 'PostgreSQL...'}

The module wraps the excellent 'psycopg2' library and most of the functionality is provided by this behind the scenes.


0.1 19-10-2012 Initial import 0.2 10-10-2012 Remove psycopg2 dep in 0.3 10-10-2012 Remove hstore default for cursor
File Type Py Version Uploaded on Size
pgwrap-0.3.tar.gz (md5) Source 2012-10-20 5KB
  • Downloads (All Versions):
  • 6 downloads in the last day
  • 86 downloads in the last week
  • 462 downloads in the last month