Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

db_url() fail with oracle dsn #507

Open
lsaavedr opened this issue Oct 25, 2023 · 0 comments
Open

db_url() fail with oracle dsn #507

lsaavedr opened this issue Oct 25, 2023 · 0 comments

Comments

@lsaavedr
Copy link

db_url fail with oracle url without path, for example:

import environ
env = environ.Env()

DB_URL = 'oracle://super_user:super_pass@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=oracle_dev)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=XEPDB1)))'

DB = env.db('', default=DB_URL)
print("NAME:", DB['NAME'])
NAME: %28DESCRIPTION=%28ADDRESS=%28PROTOCOL=TCP%29%28HOST=oracle_dev%29%28PORT=1521%29%29%28CONNECT_DATA=%28SERVICE_NAME=XEPDB1%29%29%29

but with path (adding a simple / to de end): DB_URL = 'oracle://super_user:super_pass@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=oracle_dev)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=XEPDB1)))/':

NAME: (description=(address=(protocol=tcp)(host=oracle_dev)(port=1521))(connect_data=(service_name=xepdb1)))

suggested patch is:

--- /srv/env/lib/python3.10/site-packages/environ/environ.py
+++ /srv/env/lib/python3.10/site-packages/environ/environ.py
@@ -521,7 +521,7 @@
         config = {}
 
         # handle unexpected URL schemes with special characters
-        if not url.path:
+        if not url.path and not url.scheme=='oracle':
             url = _urlparse_quote(urlunparse(url))
         # Remove query strings.
         path = url.path[1:]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant