Skip to content

Commit

Permalink
Explicitly convert bind_params to list or dict
Browse files Browse the repository at this point in the history
Earlier, we were returning an OrderedDict. But some sql drivers explicitly require a dict object
Similarly, previously, in case of list, we were returning OrderDict.values(). Now, we explicitly convert that to a list
  • Loading branch information
Sripathi Krishnan committed May 27, 2020
1 parent 5827c76 commit 543810a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions jinjasql/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,10 @@ def _prepare_query(self, template, data):
query = template.render(data)
bind_params = _thread_local.bind_params
if self.param_style in ('named', 'pyformat'):
return query, bind_params
bind_params = dict(bind_params)
else:
return query, bind_params.values()
bind_params = list(bind_params.values())
return query, bind_params
finally:
del _thread_local.bind_params
del _thread_local.param_style
Expand Down

0 comments on commit 543810a

Please sign in to comment.