This project is under current development, and is intended as a database connection manager specifically for mechasqueak3.
However, it does have applications as a standalone, simple database query tool with a simple connection pool.
This project is currently in pre-release. Use at your own risk!
- Python 3.7+
- psycopg2 (available via
pipenv install psycopg
or by utilizing our pipfile) - A postgreSQL database (9.5+)
This is python library. Install using pip/pipenv
and import the DatabaseManager with from limpet import DatabaseManager
Create the DatabaseManager:
>>> DatabaseManager(dbhost='DatabaseServer.org',
... dport=5432,
... dbname='DatabaseName',
... dbuser='DatabaseUserName',
... dbpassword='UserPassword')
and query the database using:
DatabaseManager.query(query, values)
- query expects a psycopg2.sql.SQL composed object (details)
- values is a tuple containing (in order) the values used in the query object.
.query() returns a list object, containing a tuple for each row result.
If there are no results, the list will be empty.
That's it.
Limpet is licensed under the BSD 3-Clause License.