DOC: Clarify dispatch behavior of read_sql (#18925) · pandas-dev/pandas@a18d725 (original) (raw)

`@@ -337,15 +337,22 @@ def read_sql(sql, con, index_col=None, coerce_float=True, params=None,

`

337

337

`"""

`

338

338

` Read SQL query or database table into a DataFrame.

`

339

339

``

``

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

+

340

347

` Parameters

`

341

348

` ----------

`

342

349

` 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

`

345

352

` or DBAPI2 connection (fallback mode)

`

``

353

+

346

354

` 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.

`

349

356

` index_col : string or list of strings, optional, default: None

`

350

357

` Column(s) to set as index(MultiIndex).

`

351

358

` coerce_float : boolean, default True

`

`@@ -377,14 +384,6 @@ def read_sql(sql, con, index_col=None, coerce_float=True, params=None,

`

377

384

` -------

`

378

385

` DataFrame

`

379

386

``

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

``

-

388

387

` See also

`

389

388

` --------

`

390

389

` read_sql_table : Read SQL database table into a DataFrame.

`