def get_db_connection()

in postgresql_metrics/postgres_queries.py [0:0]


def get_db_connection(database, username, password, host='127.0.0.1', port=5432,
                      connect_timeout=10):
    connection = psycopg2.connect(user=username,
                                  password=password,
                                  host=host,
                                  port=int(port),
                                  database=database,
                                  connect_timeout=connect_timeout)
    connection.autocommit = True
    return connection