database_connections.Connections package

Submodules

database_connections.Connections.athena module

class database_connections.Connections.athena.Athena(**kwargs)[source]

Bases: DatabaseConnection

Need the following attributes to be stored: aws_conn_params = { ‘aws_access_key_id’ : ‘XXXXXX’,

‘aws_secret_access_key’ : ‘XXXXXX’, ‘aws_session_token’ : ‘XXXXXX’, ‘N # of other params’ : ‘XXXXXX’, ‘region_name’ : ‘us-east-1’, ‘work_group’ : ‘s3_staging_dir’ : }

get_conn(**kwargs)[source]
write(**kwargs)[source]

given the pandas DF, table_name, and other kwargs, write to database connection

database_connections.Connections.athena.get_DatabaseConnection(**kwargs)[source]

returns the class instance of the said object

database_connections.Connections.databricks module

class database_connections.Connections.databricks.Databricks(**kwargs)[source]

Bases: DatabaseConnection

To run the Databricks module, you need to set the following attributes:

server_hostname http_path access_token

get_conn(**kwargs)[source]
init(**kwargs)[source]

sets attributes, gets connection, and prints attributes

database_connections.Connections.databricks.get_DatabaseConnection(**kwargs)[source]

returns the class instance of the said object

database_connections.Connections.oracle module

class database_connections.Connections.oracle.Oracle(**kwargs)[source]

Bases: DatabaseConnection

To run the Oracle module, you need to set the following attributes:

dsn username passkey_path encpass_path

or

host port sid username passkey_path encpass_path

create_generic_select(table_name, top=None)[source]

returns a string with a generic select

get_all_tables()[source]

returns a list of all available table names

get_conn(**kwargs)[source]

get the connection to cx_Oracle

get_dsn()[source]

make a dsn connection if one doesnt exist

get_password()[source]

get password by custom decrypting

init(**kwargs)[source]

sets attributes, gets connection, and prints attributes

database_connections.Connections.oracle.get_DatabaseConnection(**kwargs)[source]

returns the class instance of the said object

database_connections.Connections.redshift module

class database_connections.Connections.redshift.Redshift(**kwargs)[source]

Bases: DatabaseConnection

To run the SQLite module, you need to set the following attributes:

engine = ‘engine code’ schema = ‘dfg_analytics’

create_generic_select(table_name, top=None)[source]

returns a string with a generic select

get_all_tables()[source]
get_conn()[source]
init(**kwargs)[source]

sets attributes, gets connection, and prints attributes

write(df, table_name, **kwargs)[source]

given the pandas DF, table_name, and other kwargs, write to database connection

database_connections.Connections.redshift.get_DatabaseConnection(**kwargs)[source]

returns the class instance of the said object

database_connections.Connections.sqlite module

class database_connections.Connections.sqlite.SQLite(**kwargs)[source]

Bases: DatabaseConnection

To run the SQLite module, you need to set the following attributes:

db_path = ‘/path/to/database.db’

close_conn()[source]

close the connection

create_generic_select(table_name, top=None)[source]

returns a string with a generic select statement

exit()[source]
get_all_tables()[source]

returns a list of all available table names

get_conn(**kwargs)[source]
database_connections.Connections.sqlite.get_DatabaseConnection(**kwargs)[source]

returns the class instance of the said object

database_connections.Connections.teradata module

class database_connections.Connections.teradata.Teradata(**kwargs)[source]

Bases: DatabaseConnection

To run the teradata module, you need to set the following attributes:

host = username = passkey_path= ‘PassKey.properties’ encpass_path= ‘EncPass.properties’

create_generic_select(table_name, top=None)[source]

returns a string with a generic select

get_conn(**kwargs)[source]
get_password()[source]
init(**kwargs)[source]

sets attributes, gets connection, and prints attributes

query(query_string='', query_file=None)[source]

Teradata has special query method, so this class overwrites the parent class’s method

database_connections.Connections.teradata.get_DatabaseConnection(**kwargs)[source]

returns the class instance of the said object

Module contents