Skip to content

Commit

Permalink
support asyngpg param styles
Browse files Browse the repository at this point in the history
  • Loading branch information
a.zubarev committed Jun 4, 2019
1 parent c81795b commit fc3ce9d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion jinjasql/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,9 @@ def _bind_param(already_bound, key, value):
return ":%s" % new_key
elif param_style == 'pyformat':
return "%%(%s)s" % new_key
elif param_style == 'asyncpg':
_thread_local.param_index += 1
return "$%s" % _thread_local.param_index
else:
raise AssertionError("Invalid param_style - %s" % param_style)

Expand All @@ -147,7 +150,7 @@ class JinjaSql(object):
# named "where name = :name"
# format "where name = %s"
# pyformat "where name = %(name)s"
VALID_PARAM_STYLES = ('qmark', 'numeric', 'named', 'format', 'pyformat')
VALID_PARAM_STYLES = ('qmark', 'numeric', 'named', 'format', 'pyformat', 'asyncpg')
def __init__(self, env=None, param_style='format'):
self.env = env or Environment()
self._prepare_environment()
Expand Down

0 comments on commit fc3ce9d

Please sign in to comment.