Simple PostgreSQL database wrapper - provides wrapper over psycopg2 supporting a Python API for common sql functions
Project description
pgwrap - simple PostgreSQL database wrapper
-------------------------------------------
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.
-------------------------------------------
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.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pgwrap-0.1.tar.gz
(5.5 kB
view hashes)