Skip to content

Commit 7223e63

Browse files
committed
documentation cleanups
1 parent 4f72010 commit 7223e63

File tree

1 file changed

+66
-6
lines changed

1 file changed

+66
-6
lines changed

pandas/io/sql.py

+66-6
Original file line numberDiff line numberDiff line change
@@ -2128,8 +2128,35 @@ def read_table(
21282128
----------
21292129
table_name : str
21302130
Name of SQL table in database.
2131+
coerce_float : bool, default True
2132+
Raises NotImplementedError
2133+
parse_dates : list or dict, default: None
2134+
- List of column names to parse as dates.
2135+
- Dict of ``{column_name: format string}`` where format string is
2136+
strftime compatible in case of parsing string times, or is one of
2137+
(D, s, ns, ms, us) in case of parsing integer timestamps.
2138+
- Dict of ``{column_name: arg}``, where the arg corresponds
2139+
to the keyword arguments of :func:`pandas.to_datetime`.
2140+
Especially useful with databases without native Datetime support,
2141+
such as SQLite.
2142+
columns : list, default: None
2143+
List of column names to select from SQL table.
21312144
schema : string, default None
2132-
Name of SQL schema in database to read from
2145+
Name of SQL schema in database to query (if database flavor
2146+
supports this). If specified, this overwrites the default
2147+
schema of the SQL database object.
2148+
chunksize : int, default None
2149+
Raises NotImplementedError
2150+
dtype_backend : {'numpy_nullable', 'pyarrow'}, default 'numpy_nullable'
2151+
Back-end data type applied to the resultant :class:`DataFrame`
2152+
(still experimental). Behaviour is as follows:
2153+
2154+
* ``"numpy_nullable"``: returns nullable-dtype-backed :class:`DataFrame`
2155+
(default).
2156+
* ``"pyarrow"``: returns pyarrow-backed nullable :class:`ArrowDtype`
2157+
DataFrame.
2158+
2159+
.. versionadded:: 2.0
21332160
21342161
Returns
21352162
-------
@@ -2198,12 +2225,34 @@ def read_query(
21982225
dtype_backend: DtypeBackend | Literal["numpy"] = "numpy",
21992226
) -> DataFrame | Iterator[DataFrame]:
22002227
"""
2201-
Read SQL query into a DataFrame. Keyword arguments are discarded.
2228+
Read SQL query into a DataFrame.
22022229
22032230
Parameters
22042231
----------
22052232
sql : str
22062233
SQL query to be executed.
2234+
index_col : string, optional, default: None
2235+
Column name to use as index for the returned DataFrame object.
2236+
coerce_float : bool, default True
2237+
Raises NotImplementedError
2238+
params : list, tuple or dict, optional, default: None
2239+
Raises NotImplementedError
2240+
parse_dates : list or dict, default: None
2241+
- List of column names to parse as dates.
2242+
- Dict of ``{column_name: format string}`` where format string is
2243+
strftime compatible in case of parsing string times, or is one of
2244+
(D, s, ns, ms, us) in case of parsing integer timestamps.
2245+
- Dict of ``{column_name: arg dict}``, where the arg dict
2246+
corresponds to the keyword arguments of
2247+
:func:`pandas.to_datetime` Especially useful with databases
2248+
without native Datetime support, such as SQLite.
2249+
chunksize : int, default None
2250+
Raises NotImplementedError
2251+
dtype : Type name or dict of columns
2252+
Data type for data or columns. E.g. np.float64 or
2253+
{'a': np.float64, 'b': np.int32, 'c': 'Int64'}
2254+
2255+
.. versionadded:: 1.3.0
22072256
22082257
Returns
22092258
-------
@@ -2263,7 +2312,6 @@ def to_sql(
22632312
) -> int | None:
22642313
"""
22652314
Write records stored in a DataFrame to a SQL database.
2266-
Only frame, name, if_exists, index and schema are valid arguments.
22672315
22682316
Parameters
22692317
----------
@@ -2274,25 +2322,37 @@ def to_sql(
22742322
- fail: If table exists, do nothing.
22752323
- replace: If table exists, drop it, recreate it, and insert data.
22762324
- append: If table exists, insert data. Create if does not exist.
2325+
index : boolean, default True
2326+
Write DataFrame index as a column.
2327+
index_label : string or sequence, default None
2328+
Raises NotImplementedError
22772329
schema : string, default None
22782330
Name of SQL schema in database to write to (if database flavor
22792331
supports this). If specified, this overwrites the default
22802332
schema of the SQLDatabase object.
2333+
chunksize : int, default None
2334+
Raises NotImplementedError
2335+
dtype : single type or dict of column name to SQL type, default None
2336+
Raises NotImplementedError
2337+
method : {None', 'multi', callable}, default None
2338+
Raises NotImplementedError
2339+
engine : {'auto', 'sqlalchemy'}, default 'auto'
2340+
Raises NotImplementedError if not set to 'auto'
22812341
"""
22822342
if index_label:
22832343
raise NotImplementedError(
22842344
"'index_label' is not implemented for ADBC drivers"
22852345
)
2286-
if schema:
2287-
raise NotImplementedError("'schema' is not implemented for ADBC drivers")
22882346
if chunksize:
22892347
raise NotImplementedError("'chunksize' is not implemented for ADBC drivers")
22902348
if dtype:
22912349
raise NotImplementedError("'dtype' is not implemented for ADBC drivers")
22922350
if method:
22932351
raise NotImplementedError("'method' is not implemented for ADBC drivers")
22942352
if engine != "auto":
2295-
raise NotImplementedError("'auto' is not implemented for ADBC drivers")
2353+
raise NotImplementedError(
2354+
"engine != 'auto' not implemented for ADBC drivers"
2355+
)
22962356

22972357
if schema:
22982358
table_name = f"{schema}.{name}"

0 commit comments

Comments
 (0)