Psycopg wrapper
Project description
Moliere
psycopg2-binary wrapper for easy application integration (e.g. flask web sites).
Installation
$ pip install moliere
Usage
import moliere
# Creating instance.
db = moliere.Pgdb()
# Connecting to database.
db.connect(host, db_name, user, pwd)
# Query execution. Return list of dicts (psycopg2 RealDictCursor).
result = db.execute(
'SELECT * FROM table WHERE id>%(id)s;',
{
'id': 7
})
# Closing connection.
db.disconnect()
Automatic connection
While create instance Moliere try to find environment variables with endings DB_HOST, DB_NAME, DB_USER and DB_PWD. If it success connection will create automatically.
Also it have builtin instance of Pgbd named DB_OBJ, so if you have necessary environment variables you can use package like this:
from moliere import DB_OBJ
result = DB_OBJ.execute(
'SELECT * FROM table WHERE id>%(id)s;',
{
'id': 7
})
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file Moliere-0.0.8.tar.gz.
File metadata
- Download URL: Moliere-0.0.8.tar.gz
- Upload date:
- Size: 3.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1a6338d4712d7bd5c95df81a3d4218c05e2c6660498711ab501f18e9a7fcf63b
|
|
| MD5 |
7eac89cd8294b5dd80d4cbe9d9903f99
|
|
| BLAKE2b-256 |
0b5ecce62698db3bf4160d95e90fb454b90990d8628a04ecb0fd703ec2d7c519
|
File details
Details for the file Moliere-0.0.8-py3-none-any.whl.
File metadata
- Download URL: Moliere-0.0.8-py3-none-any.whl
- Upload date:
- Size: 3.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
80c1ecf37a805e945a40265531e226579ac58cc907ecd22a9597eb1836d06921
|
|
| MD5 |
d2ea309683d3b17c92de265ba4d8b838
|
|
| BLAKE2b-256 |
153b442975c8e41b0919cf2527f548da402ab7494900903e79db3141b612adc9
|