reVX.handlers.database.Database

class Database(db_name, db_host='gds_edit.nrel.gov', db_user=None, db_pass=None, db_port=5432)[source]

Bases: object

Framework to interact with the reV/reVX database.

Parameters:
  • db_name (str) – Database name.

  • db_host (str) – Database host name.

  • db_user (str) – Your database user name.

  • db_pass (str) – Database password (None if your password is cached).

  • db_port (int) – Database port.

Methods

get_table(table, schema, db_name[, wait, ...])

Get a table using a database query.

Attributes

con

Return the database connection object.

property con

Return the database connection object.

classmethod get_table(table, schema, db_name, wait=300, db_host='gds_edit.nrel.gov', db_user=None, db_pass=None, db_port=5432)[source]

Get a table using a database query.

Parameters:
  • table (str) – Table name to retrieve from schema.

  • schema (str) – Schema name being accessed in the database.

  • db_name (str) – Database name.

  • wait (int) – Integer seconds to wait for DB connection to become available before raising exception.

  • db_host (str) – Database host name.

  • db_user (str) – Your database user name.

  • db_pass (str) – Database password (None if your password is cached).

  • db_port (int) – Database port.

Returns:

df (pd.DataFrame) – Dataframe representation of schema.table.