Skip to main content

Database Interaction Services for GeneWeaver

Project description

Geneweaver DB

Tests Style Coverage

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

geneweaver_db-0.6.0a4.tar.gz (34.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

geneweaver_db-0.6.0a4-py3-none-any.whl (55.9 kB view details)

Uploaded Python 3

File details

Details for the file geneweaver_db-0.6.0a4.tar.gz.

File metadata

  • Download URL: geneweaver_db-0.6.0a4.tar.gz
  • Upload date:
  • Size: 34.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.9.25 Linux/6.14.0-1017-azure

File hashes

Hashes for geneweaver_db-0.6.0a4.tar.gz
Algorithm Hash digest
SHA256 5bb1f494d9eb1754baee6635b6f596a773ca962e37911fd4ee8edbf30661e23c
MD5 d43e2fc52a8ddbb533f52808451bcddb
BLAKE2b-256 5dc25599ad86b5dfcc3c770a5b7e897d7c8fc985e5357938f1d1442ac59875ea

See more details on using hashes here.

File details

Details for the file geneweaver_db-0.6.0a4-py3-none-any.whl.

File metadata

  • Download URL: geneweaver_db-0.6.0a4-py3-none-any.whl
  • Upload date:
  • Size: 55.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.9.25 Linux/6.14.0-1017-azure

File hashes

Hashes for geneweaver_db-0.6.0a4-py3-none-any.whl
Algorithm Hash digest
SHA256 4ba9675acfa3c187bd8b1ecc8e586fa63064e1c8689711d99fa9f84d878470b4
MD5 3c0b6b49dd7c761b29439bea6efd1f15
BLAKE2b-256 d63e2273d44214d3401ef1845449ce9ef5344dabb3066bf793c1fc85405100ee

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page