mirror of
https://github.com/jazzband/dj-database-url.git
synced 2026-03-16 22:20:24 +00:00
Merge pull request #76 from uncovertruth/add_redshift_support
add redshift support
This commit is contained in:
commit
97bc560445
3 changed files with 17 additions and 1 deletions
|
|
@ -19,7 +19,7 @@ Supported Databases
|
|||
-------------------
|
||||
|
||||
Support currently exists for PostgreSQL, PostGIS, MySQL, MySQL (GIS),
|
||||
Oracle, Oracle (GIS), and SQLite.
|
||||
Oracle, Oracle (GIS), Redshift, and SQLite.
|
||||
|
||||
Installation
|
||||
------------
|
||||
|
|
@ -72,6 +72,8 @@ URL schema
|
|||
+-------------+-----------------------------------------------+--------------------------------------------------+
|
||||
| Oracle (GIS)| ``django.contrib.gis.db.backends.oracle`` | ``oraclegis://USER:PASSWORD@HOST:PORT/NAME`` |
|
||||
+-------------+-----------------------------------------------+--------------------------------------------------+
|
||||
| Redshift | ``django_redshift_backend`` | ``redshift://USER:PASSWORD@HOST:PORT/NAME`` |
|
||||
+-------------+-----------------------------------------------+--------------------------------------------------+
|
||||
|
||||
.. [1] With PostgreSQL, you can also use unix domain socket paths with
|
||||
`percent encoding <http://www.postgresql.org/docs/9.2/interactive/libpq-connect.html#AEN38162>`_:
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ urlparse.uses_netloc.append('spatialite')
|
|||
urlparse.uses_netloc.append('sqlite')
|
||||
urlparse.uses_netloc.append('oracle')
|
||||
urlparse.uses_netloc.append('oraclegis')
|
||||
urlparse.uses_netloc.append('redshift')
|
||||
|
||||
DEFAULT_ENV = 'DATABASE_URL'
|
||||
|
||||
|
|
@ -37,6 +38,7 @@ SCHEMES = {
|
|||
'sqlite': 'django.db.backends.sqlite3',
|
||||
'oracle': 'django.db.backends.oracle',
|
||||
'oraclegis': 'django.contrib.gis.db.backends.oracle',
|
||||
'redshift': 'django_redshift_backend',
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -257,6 +257,18 @@ class DatabaseTestSuite(unittest.TestCase):
|
|||
assert url['HOST'] == ''
|
||||
assert url['PORT'] == ''
|
||||
|
||||
def test_redshift_parsing(self):
|
||||
url = 'redshift://uf07k1i6d8ia0v:wegauwhgeuioweg@ec2-107-21-253-135.compute-1.amazonaws.com:5439/d8r82722r2kuvn'
|
||||
url = dj_database_url.parse(url)
|
||||
|
||||
assert url['ENGINE'] == 'django_redshift_backend'
|
||||
assert url['NAME'] == 'd8r82722r2kuvn'
|
||||
assert url['HOST'] == 'ec2-107-21-253-135.compute-1.amazonaws.com'
|
||||
assert url['USER'] == 'uf07k1i6d8ia0v'
|
||||
assert url['PASSWORD'] == 'wegauwhgeuioweg'
|
||||
assert url['PORT'] == 5439
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
|
|
|||
Loading…
Reference in a new issue