Skip to content

Commit a18d725

Browse files
gfyoungjreback
authored andcommitted
DOC: Clarify dispatch behavior of read_sql (#18925)
* DOC: Clarify dispatch behavior of read_sql [ci skip] Closes gh-18861. * Address reviewer comments
1 parent fb95f7f commit a18d725

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

pandas/io/sql.py

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -337,15 +337,22 @@ def read_sql(sql, con, index_col=None, coerce_float=True, params=None,
337337
"""
338338
Read SQL query or database table into a DataFrame.
339339
340+
This function is a convenience wrapper around ``read_sql_table`` and
341+
``read_sql_query`` (for backward compatibility). It will delegate
342+
to the specific function depending on the provided input. A SQL query
343+
will be routed to ``read_sql_query``, while a database table name will
344+
be routed to ``read_sql_table``. Note that the delegated function might
345+
have more specific notes about their functionality not listed here.
346+
340347
Parameters
341348
----------
342349
sql : string or SQLAlchemy Selectable (select or text object)
343-
SQL query to be executed.
344-
con : SQLAlchemy connectable(engine/connection) or database string URI
350+
SQL query to be executed or a table name.
351+
con : SQLAlchemy connectable (engine/connection) or database string URI
345352
or DBAPI2 connection (fallback mode)
353+
346354
Using SQLAlchemy makes it possible to use any DB supported by that
347-
library.
348-
If a DBAPI2 object, only sqlite3 is supported.
355+
library. If a DBAPI2 object, only sqlite3 is supported.
349356
index_col : string or list of strings, optional, default: None
350357
Column(s) to set as index(MultiIndex).
351358
coerce_float : boolean, default True
@@ -377,14 +384,6 @@ def read_sql(sql, con, index_col=None, coerce_float=True, params=None,
377384
-------
378385
DataFrame
379386
380-
Notes
381-
-----
382-
This function is a convenience wrapper around ``read_sql_table`` and
383-
``read_sql_query`` (and for backward compatibility) and will delegate
384-
to the specific function depending on the provided input (database
385-
table name or SQL query). The delegated function might have more specific
386-
notes about their functionality not listed here.
387-
388387
See also
389388
--------
390389
read_sql_table : Read SQL database table into a DataFrame.

0 commit comments

Comments
 (0)