You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Does not seem worth a pull request however I will if that is preferred
--- /home/wkv/anaconda3/lib/python3.7/site-packages/sql/parse.py.orig 2020-09-19 01:41:43.191856384 -0600
+++ /home/wkv/anaconda3/lib/python3.7/site-packages/sql/parse.py 2020-11-19 10:42:20.759017035 -0700
@@ -11,10 +11,12 @@
parser = CP.ConfigParser()
parser.read(config.dsn_filename)
cfg_dict = dict(parser.items(section))
+ if 'query' in cfg_dict and cfg_dict['query'].find('{') >= 0:
+ cfg_dict['query'] = json.loads(cfg_dict['query']) # sqlalchemy requires query to be key value pairs so decode it as json
return str(URL(**cfg_dict))
-def _connection_string(s):
+def _connection_string(s, config):
s = expandvars(s) # for environment variables
if "@" in s or "://" in s:
@@ -44,7 +46,7 @@
pieces = cell.split(None, 3)
if not pieces:
return result
- result["connection"] = _connection_string(pieces[0])
+ result["connection"] = _connection_string(pieces[0], config)
if result["connection"]:
pieces.pop(0)
if len(pieces) > 1 and pieces[1] == "<<":
The text was updated successfully, but these errors were encountered:
wkvolkman
changed the title
Small patch to enable query string for Oracle DBs
Small patch to enable DSN query string for Oracle DBs and others
Nov 20, 2020
This is a definite bug, and is a reasonable looking fix. sqlalchemy.engine.URL expects 'query' to be a dict; not a string, so tunneling it through the DSN.ini format as a JSON object string is the most straightforward way to go here. Am going to raise a PR with a similar fix.
Does not seem worth a pull request however I will if that is preferred
The text was updated successfully, but these errors were encountered: