Read SQL query or database table into a DataFrame. This function is a convenience wrapper around ``read_sql_table`` and ``read_sql_query``. It will delegate to the specific function depending on the provided input. A SQL query will be routed to ``read_sql_query``, while a datab
(sql, con, index_col, **kwargs)
| 351 | |
| 352 | |
| 353 | def read_sql(sql, con, index_col, **kwargs): |
| 354 | """ |
| 355 | Read SQL query or database table into a DataFrame. |
| 356 | |
| 357 | This function is a convenience wrapper around ``read_sql_table`` and |
| 358 | ``read_sql_query``. It will delegate to the specific function depending |
| 359 | on the provided input. A SQL query will be routed to ``read_sql_query``, |
| 360 | while a database table name will be routed to ``read_sql_table``. |
| 361 | Note that the delegated function might have more specific notes about |
| 362 | their functionality not listed here. |
| 363 | |
| 364 | Parameters |
| 365 | ---------- |
| 366 | sql : str or SQLAlchemy Selectable |
| 367 | Name of SQL table in database or SQL query to be executed. TextClause is not supported |
| 368 | con : str |
| 369 | Full sqlalchemy URI for the database connection |
| 370 | index_col : str |
| 371 | Column which becomes the index, and defines the partitioning. Should |
| 372 | be a indexed column in the SQL server, and any orderable type. If the |
| 373 | type is number or time, then partition boundaries can be inferred from |
| 374 | ``npartitions`` or ``bytes_per_chunk``; otherwise must supply explicit |
| 375 | ``divisions``. |
| 376 | |
| 377 | Returns |
| 378 | ------- |
| 379 | dask.dataframe |
| 380 | |
| 381 | See Also |
| 382 | -------- |
| 383 | read_sql_table : Read SQL database table into a DataFrame. |
| 384 | read_sql_query : Read SQL query into a DataFrame. |
| 385 | """ |
| 386 | if isinstance(sql, str): |
| 387 | return read_sql_table(sql, con, index_col, **kwargs) |
| 388 | else: |
| 389 | return read_sql_query(sql, con, index_col, **kwargs) |
| 390 | |
| 391 | |
| 392 | def _read_sql_chunk(q, uri, meta, engine_kwargs=None, **kwargs): |
searching dependent graphs…