Skip to main content

DS Database

build and test License

dsdatabase is a library that simplifies accessing databases on DesignSafe via Jupyter Notebooks.

Features

Connects to SQL databases on DesignSafe:

Database dbname env_prefix
NGL ngl NGL_
Earthake Recovery eq EQ_
Vp vp VP_

Define the following environment variables:

{env_prefix}DB_USER
{env_prefix}DB_PASSWORD
{env_prefix}DB_HOST
{env_prefix}DB_PORT

For e.g., to add the environment variable NGL_DB_USER edit ~/.bashrc, ~/.zshrc, or a similar shell-specific configuration file for the current user and add export NGL_DB_USER="dspublic".

Installation

Install dsdatabase via pip

pip3 install dsdatabase

To install the current development version of the library use:

pip install git+https://github.com/DesignSafe-CI/dsdatabase.git --quiet

Example usage:

from dsdatabase.db import DSDatabase

db = DSDatabase("ngl")
sql = 'SELECT * FROM SITE'
df = db.read_sql(sql)
print(df)

# Optionally, close the database connection when done
db.close()

Metadata

Release files for dsdatabase 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dsdatabase 0.1.0
File Size Uploaded
dsdatabase-0.1.0.tar.gz 3.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for dsdatabase 0.1.0
File Interpreter ABI Platform
dsdatabase-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 8.2 kB

Release files / dsdatabase-0.1.0.tar.gz

Download URL dsdatabase-0.1.0.tar.gz
Size 3.7 kB
Tags Source
SHA-256 checksum
How to use checksums
a9de9fba97d1d4dd1dcae326f383fc02692887581a8c9c7191397cab780a383c
BLAKE2b-256 checksum
How to use checksums
c5a8a93249c960a89ed488ee03a597aa94bac858e9fea5013101fd24b2b99ca4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/4.0.2 CPython/3.11.6

Release files / dsdatabase-0.1.0-py3-none-any.whl

Download URL dsdatabase-0.1.0-py3-none-any.whl
Size 4.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0107f7a43bd413fa22e40578b96bfcc391dbd4752ec33261533a72a0014d7536
BLAKE2b-256 checksum
How to use checksums
d7f11227c131853972e3567801efde6ab7d24fca50c82bce0a3d66cf25038b9b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/4.0.2 CPython/3.11.6

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page