Commit 13e05a95 authored by Hamaker, Alec's avatar Hamaker, Alec
Browse files

Merge branch 'develop' of https://code.ornl.gov/eagle-i/common_package into develop

parents d2fe2dd4 f009e634
Loading
Loading
Loading
Loading
+17 −0
Original line number Diff line number Diff line
@@ -2,8 +2,25 @@

## Scripts

Contains a script for testing the connection to a database `test-db-conn`
Set variables in the script to match:
- DB_HOST: a string representing the hostname or IP address hosting the database (default localhost)
- DB_PORT: an integer representing the port to connect to the database on (default 5432)
- DB_DB: a string representing the database to connect to (default postgres)
- MAX_RETRIES: an integer representing the maximum number of times to retry the connection (default 60)
Usage: `test-db-conn -d <DB_DB> -h <DB_HOST> -p <DB_PORT> -r <MAX_RETRIES>`

## Classes

Database(ABC) is and abstract class that can be found in `database.py`.
Database takes in environmental variables for connection to a database: 
DATABASE_TIMEOUT, DATABASE_DB, DATABASE_USER, DATABASE_PW, DATABASE_HOST,
DATABASE_PORT, DATABASE_SCHEMA
These environmental variables are read in using `env.py` function check_environment and have default values assigned.
Best practice is to use `with` to enter the database, i.e. `with Database as db:`



## Mixins

## Functions