Skip to content

Commit ffa7fd3

Browse files
gpoulinjeffreystarr
authored andcommitted
Fix SQLLegacy to allow parameters as mapping
1 parent db57de8 commit ffa7fd3

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

pandas/io/sql.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,10 @@ def _convert_params(sql, params):
3131
"""convert sql and params args to DBAPI2.0 compliant format"""
3232
args = [sql]
3333
if params is not None:
34-
args += list(params)
34+
if hasattr(params, 'keys'): # test if params is a mapping
35+
args += [params]
36+
else:
37+
args += [list(params)]
3538
return args
3639

3740

@@ -200,7 +203,7 @@ def read_sql(sql, con, index_col=None, flavor='sqlite', coerce_float=True,
200203
Attempt to convert values to non-string, non-numeric objects (like
201204
decimal.Decimal) to floating point, useful for SQL result sets
202205
cur : depreciated, cursor is obtained from connection
203-
params : list or tuple, optional
206+
params : list, tuple or dict, optional
204207
List of parameters to pass to execute method.
205208
parse_dates : list or dict
206209
- List of column names to parse as dates

0 commit comments

Comments
 (0)