MCPcopy Create free account
hub / github.com/dask/dask / read_sql

Function read_sql

dask/dataframe/io/sql.py:356–392  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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

Callers 1

test_read_sqlFunction · 0.90

Calls 2

read_sql_tableFunction · 0.85
read_sql_queryFunction · 0.85

Tested by 1

test_read_sqlFunction · 0.72