Skip to content

Instantly share code, notes, and snippets.

@neilkod
Created May 4, 2011 21:09
Show Gist options
  • Save neilkod/956039 to your computer and use it in GitHub Desktop.
Save neilkod/956039 to your computer and use it in GitHub Desktop.
get_database_parameters.py
def get_database_parameters(db_name):
""" given a database name (db_name), returns a dict with
host, database, username, password """
keys = ['hostname', 'database', 'username', 'password']
values = [dbconfig.get(db_name, x) for x in keys]
db_params = dict(zip(keys, values))
return db_params
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment