Skip to content

DesignSafe-CI/dsdatabase

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

65 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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()

About

DesignSafe library for managing databases

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages