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.5.0a19.tar.gz (34.3 kB view details)

Uploaded Source

Built Distribution

geneweaver_db-0.5.0a19-py3-none-any.whl (52.9 kB view details)

Uploaded Python 3

File details

Details for the file geneweaver_db-0.5.0a19.tar.gz.

File metadata

  • Download URL: geneweaver_db-0.5.0a19.tar.gz
  • Upload date:
  • Size: 34.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.9.20 Linux/6.8.0-1014-azure

File hashes

Hashes for geneweaver_db-0.5.0a19.tar.gz
Algorithm Hash digest
SHA256 4590b24bc71e5df32b80657683b5daac69d63121e43abca24f38f636df446b8e
MD5 f19f4ec3487aa92c67438d5de3e50669
BLAKE2b-256 e0a913cc8fa1ab85c0d3d54827bd2d647eadc3bdac6f35e1a6998f295fd3e381

See more details on using hashes here.

File details

Details for the file geneweaver_db-0.5.0a19-py3-none-any.whl.

File metadata

  • Download URL: geneweaver_db-0.5.0a19-py3-none-any.whl
  • Upload date:
  • Size: 52.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.9.20 Linux/6.8.0-1014-azure

File hashes

Hashes for geneweaver_db-0.5.0a19-py3-none-any.whl
Algorithm Hash digest
SHA256 37a74569ab9cf861a2310dd83c9f9a9fe01935947a6b6f25425cd870ebcb22df
MD5 07c2b98f30a9f1425926833b446a1bb0
BLAKE2b-256 71eb7de85ff4fa49388e25ea3e4108d9fc16f34d1b0e734b9ba4b06c229b8420

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