Skip to content

Instantly share code, notes, and snippets.

@einyx
Last active August 29, 2015 13:57
Show Gist options
  • Save einyx/6025f7307ff302021b9d to your computer and use it in GitHub Desktop.
Save einyx/6025f7307ff302021b9d to your computer and use it in GitHub Desktop.
(redash)alessiog@ip-10-2-2-76:/opt/redash/redash$ cat redash/settings.py
import json
import os
import urlparse
def parse_db_url(url):
url_parts = urlparse.urlparse(url)
connection = {
'engine': 'peewee.PostgresqlDatabase',
'name': "redash",
'password': "test",
'host': "somehost.com
'port': 5432,
}
# if url_parts.hostname and not url_parts.path:
# connection['name'] = url_parts.hostname
# else:
# connection['name'] = url_parts.path[1:]
# connection['host'] = url_parts.hostname
# connection['port'] = url_parts.port
# connection['user'] = url_parts.username
# connection['password'] = url_parts.password
return connection
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment