Simple decorator for multiprocessing and psql insertion
Project description
gerardo
gerardo provides decorators to easily compute in parallel and store the results in a PostgreSQL database.
Usage
See examples/example.py for more details.
from gerardo import psql_mp_insert, psql_handler
# Set a PostgreSQL handler
pghost = os.environ["PGHOST"]
DSN = {
"host": pghost,
"port": "",
"user": "",
"password": "",
"dbname": "example_db",
}
PSQL_TABLE = "test_table"
COLUMNS = [('x', 'INT'), ('y', 'INT')]
PH = psql_handler(DSN, PSQL_TABLE, COLUMNS)
# Define a single-variable function.
@psql_mp_insert(PH)
def f(x):
return (x[0]+x[1], x[0]*x[1])
# Compute by forming a list of arguments
list_args = [(x, y) for x in range(5) for y in range(10)]
f(list_args)
Installation
pip install gerardo --user
Homepage
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
gerardo-0.1.1.tar.gz
(2.8 kB
view details)
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 gerardo-0.1.1.tar.gz.
File metadata
- Download URL: gerardo-0.1.1.tar.gz
- Upload date:
- Size: 2.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.28.1 CPython/3.7.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e4495ec62032e1ca966293f092c4f9d1e21f53132c64749db2b75028e061d48f
|
|
| MD5 |
8b38d46898e8e248e0824474d952a5c9
|
|
| BLAKE2b-256 |
d513fa7b87af52b432144545f2dcd85168c62faafaf436aca571e15de16f451c
|
File details
Details for the file gerardo-0.1.1-py3-none-any.whl.
File metadata
- Download URL: gerardo-0.1.1-py3-none-any.whl
- Upload date:
- Size: 4.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.28.1 CPython/3.7.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5bcada70095789db00777e37c74931d9d8b8f4cc2480d6b1d5233bf789ffb62e
|
|
| MD5 |
ba87b0564ad5c046901bcee589de098d
|
|
| BLAKE2b-256 |
84313542809f296ba1f5e5c15f1788633123f1941b457d009beae1184c0c5d60
|