Database Interaction Services for GeneWeaver
Project description
Geneweaver DB
The Geneweaver DB library provides database access functionality for the Geneweaver project. The library contains SQL queries wrapped in standard python functions, as well as a database connection manager.
Installation
To install the Geneweaver DB library, run one of the following commands:
Using Pip
pip install geneweaver-db
Using Poetry
poetry add geneweaver-db
Usage
The Geneweaver DB library is intended to be used as a dependency for other Geneweaver packages, but can also be used as a stand-alone pacakge.
The package has three main sections:
geneweaver.db
- contains non-async database functions.geneweaver.db.aio
- contains async database functions.geneweaver.db.query
- contains SQL queries and SQL generation functions.
Database functions usually take a Cursor
or AsyncCursor
object as their first
argument.
Non-Async Functions
import psycopg
import geneweaver
from geneweaver.db.core.settings import settings
def get_my_gene():
with psycopg.connect(settings.URI) as conn:
with conn.cursor() as cur:
result = geneweaver.db.gene.get(cur, 'my_gene')
return result
Async Functions
import psycopg
import geneweaver
from geneweaver.db.core.settings import settings
async def get_my_gene():
async with psycopg.AsyncConnection.connect(settings.URI) as conn:
async with conn.cursor() as cur:
result = await geneweaver.db.aio.gene.get(cur, 'my_gene')
return result
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
Built Distribution
File details
Details for the file geneweaver_db-0.5.0a11.tar.gz
.
File metadata
- Download URL: geneweaver_db-0.5.0a11.tar.gz
- Upload date:
- Size: 31.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.9.19 Linux/6.5.0-1023-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0d7ea75a9ffad41677ea0f7a2aaa43c0a58f7427778d815185f962714bd6faa5 |
|
MD5 | 020785a501664d59e9759df9a123f987 |
|
BLAKE2b-256 | c2d8e2b1fac83c3049af1cd497a33a38d51f2d7d4446a03add26e8f132259cfb |
File details
Details for the file geneweaver_db-0.5.0a11-py3-none-any.whl
.
File metadata
- Download URL: geneweaver_db-0.5.0a11-py3-none-any.whl
- Upload date:
- Size: 47.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.9.19 Linux/6.5.0-1023-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3384f9c35eeb0cf4cb532a12f11dabd6ae3318ece6639183e92dd9f052cace45 |
|
MD5 | 12def8f0dfcfa3ccfd388cd2af0d4910 |
|
BLAKE2b-256 | ff51f012d27d11fd886f60b512a35bfe7bb232b9a10bcd435477ab08e785a367 |