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.3.0.tar.gz (24.5 kB view details)

Uploaded Source

Built Distribution

geneweaver_db-0.3.0-py3-none-any.whl (36.2 kB view details)

Uploaded Python 3

File details

Details for the file geneweaver_db-0.3.0.tar.gz.

File metadata

  • Download URL: geneweaver_db-0.3.0.tar.gz
  • Upload date:
  • Size: 24.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.2 CPython/3.9.19 Linux/6.5.0-1018-azure

File hashes

Hashes for geneweaver_db-0.3.0.tar.gz
Algorithm Hash digest
SHA256 7095923621f7b56a480ace897db95923ebd82a13ed9f42e89f3ca6ef61bdbacf
MD5 afa8843941c0c8ad220a8ec3e4b3e087
BLAKE2b-256 b7a1ad507c137d4f249807d2d26fa85455d0271b8caafaa0e6f7d532ffba99dd

See more details on using hashes here.

File details

Details for the file geneweaver_db-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: geneweaver_db-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 36.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.2 CPython/3.9.19 Linux/6.5.0-1018-azure

File hashes

Hashes for geneweaver_db-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b3faa38dfc57c61ed04aa6ad3fce4ed31731911b7af6686f217a260e598baf30
MD5 00c8bfb0c677bf6f724ae38cb0193921
BLAKE2b-256 bf98ffd836b5b39f7299c3874318e12f034db1a2f0c6a53c6a637f173c6794a8

See more details on using hashes here.

Supported by

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