Skip to content

Commit d52575d

Browse files
committed
Fix type hint for params passed to read_sql_query
1 parent 7ee7453 commit d52575d

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

doc/source/whatsnew/v2.1.0.rst

+1
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,7 @@ MultiIndex
219219

220220
I/O
221221
^^^
222+
- Bug in type hint for ``params`` argument in :func:`read_sql_query` (:issue:`49716`)
222223
- Bug in :func:`read_html`, tail texts were removed together with elements containing ``display:none`` style (:issue:`51629`)
223224
- :meth:`DataFrame.to_orc` now raising ``ValueError`` when non-default :class:`Index` is given (:issue:`51828`)
224225
- Bug in :func:`read_html`, style elements were read into DataFrames (:issue:`52197`)

pandas/io/sql.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
Any,
2626
Iterator,
2727
Literal,
28+
Mapping,
2829
cast,
2930
overload,
3031
)
@@ -357,7 +358,7 @@ def read_sql_query(
357358
con,
358359
index_col: str | list[str] | None = ...,
359360
coerce_float=...,
360-
params: list[str] | dict[str, str] | None = ...,
361+
params: list[Any] | Mapping[str, Any] | None = ...,
361362
parse_dates: list[str] | dict[str, str] | None = ...,
362363
chunksize: None = ...,
363364
dtype: DtypeArg | None = ...,
@@ -372,7 +373,7 @@ def read_sql_query(
372373
con,
373374
index_col: str | list[str] | None = ...,
374375
coerce_float=...,
375-
params: list[str] | dict[str, str] | None = ...,
376+
params: list[Any] | Mapping[str, Any] | None = ...,
376377
parse_dates: list[str] | dict[str, str] | None = ...,
377378
chunksize: int = ...,
378379
dtype: DtypeArg | None = ...,
@@ -386,7 +387,7 @@ def read_sql_query(
386387
con,
387388
index_col: str | list[str] | None = None,
388389
coerce_float: bool = True,
389-
params: list[str] | dict[str, str] | None = None,
390+
params: list[Any] | Mapping[str, Any] | None = None,
390391
parse_dates: list[str] | dict[str, str] | None = None,
391392
chunksize: int | None = None,
392393
dtype: DtypeArg | None = None,
@@ -411,7 +412,7 @@ def read_sql_query(
411412
coerce_float : bool, default True
412413
Attempts to convert values of non-string, non-numeric objects (like
413414
decimal.Decimal) to floating point. Useful for SQL result sets.
414-
params : list, tuple or dict, optional, default: None
415+
params : list, tuple or mapping, optional, default: None
415416
List of parameters to pass to execute method. The syntax used
416417
to pass parameters is database driver dependent. Check your
417418
database driver documentation for which of the five syntax styles,

0 commit comments

Comments
 (0)