Skip to content

Commit 8aea425

Browse files
authored
query fix to accept dict as parameters
The existingfunction discarded the values of the dict. the fix passes dicts as is.
1 parent d2476eb commit 8aea425

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

apswutils/db.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,8 @@ def query(
418418
:param params: Parameters to use in that query - an iterable for ``where id = ?``
419419
parameters, or a dictionary for ``where id = :id``
420420
"""
421-
cursor = self.execute(sql, tuple(params or tuple()))
421+
params = params if isinstance(params, dict) else tuple(params or tuple())
422+
cursor = self.execute(sql, params)
422423
cursor.row_trace = cursor_row2dict
423424
yield from cursor
424425

0 commit comments

Comments
 (0)