Connection¶
-
class
pg_utils.connection.
Connection
(username=None, password=None, hostname=None, database=None, env_username='pg_username', env_password='pg_password', env_hostname='pg_hostname', env_database='pg_database', **other_connection_kwargs)[source]¶ This is a wrapper class around psycopg2’s
Connection
object. Its main purpose is for the simple specification of login information via environment variables.Parameters: - username (str) – Username. Overrides the corresponding environment variable.
- password (str) – Password. Overrides the corresponding environment variable.
- hostname (str) – Hostname. Overrides the corresponding environment variable.
- database (str) – The name of the database. Overrides the corresponding environment variable.
- env_username (str) – The name of the environment variable to use for your username.
- env_password (str) – The name of the environment variable to use for your password.
- env_hostname (str) – The name of the environment variable to use for the hostname.
- env_database (str) – The name of the environment variable to use for the database.
- other_connection_kwargs (None|dict) – Other keyword arguments (if any) that you’d like to pass to the psycopg2
Connection
object.
Variables: connection (psycopg2.extensions.connection) – The resulting raw connection object.