Allow db name to be overridden

This commit is contained in:
Roberto Agostino Vitillo 2015-07-08 15:44:22 +01:00
Родитель 1bcc982f50
Коммит 4479e5f7d8
2 изменённых файлов: 3 добавлений и 3 удалений

Просмотреть файл

@ -27,7 +27,7 @@ histogram_revision_map = {"nightly": "https://hg.mozilla.org/mozilla-central/rev
_metric_printable = set(string.ascii_uppercase + string.digits + "_-[]")
def create_connection(autocommit=True, host_override=None):
def create_connection(autocommit=True, host_override=None, dbname_override=None):
# import boto.rds2 # The serializer doesn't pick this one up for some reason when using emacs...
connection_string = os.getenv("DB_TEST_URL") # Used only for testing
@ -41,7 +41,7 @@ def create_connection(autocommit=True, host_override=None):
rds = boto.rds2.connect_to_region("us-west-2")
db = rds.describe_db_instances("telemetry-aggregates")["DescribeDBInstancesResponse"]["DescribeDBInstancesResult"]["DBInstances"][0]
host = host_override or db["Endpoint"]["Address"]
dbname = db["DBName"]
dbname = dbname_override or db["DBName"]
user = db["MasterUsername"]
conn = psycopg2.connect(dbname=dbname, user=user, password=config["password"], host=host)

Просмотреть файл

@ -12,7 +12,7 @@ import setuptools.command.install
setup(name='python_mozaggregator',
version='0.2.1.2',
version='0.2.1.3',
author='Roberto Agostino Vitillo',
author_email='rvitillo@mozilla.com',
description='Telemetry aggregation job',