Skip to content

Commit 1bb8d07

Browse files
Merge pull request #11004 from terrytangyuan/sqlDefault
DOC: consistent doc-string with function declaration, added missing param doc-string for sql.py
2 parents 2531503 + 3471536 commit 1bb8d07

File tree

1 file changed

+30
-25
lines changed

1 file changed

+30
-25
lines changed

pandas/io/sql.py

Lines changed: 30 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,8 @@ def execute(sql, con, cur=None, params=None):
143143
Using SQLAlchemy makes it possible to use any DB supported by that
144144
library.
145145
If a DBAPI2 object, only sqlite3 is supported.
146-
cur : deprecated, cursor is obtained from connection
147-
params : list or tuple, optional
146+
cur : deprecated, cursor is obtained from connection, default: None
147+
params : list or tuple, optional, default: None
148148
List of parameters to pass to execute method.
149149
150150
Returns
@@ -189,8 +189,9 @@ def tquery(sql, con=None, cur=None, retry=True):
189189
----------
190190
sql: string
191191
SQL query to be executed
192-
con: DBAPI2 connection
193-
cur: deprecated, cursor is obtained from connection
192+
con: DBAPI2 connection, default: None
193+
cur: deprecated, cursor is obtained from connection, default: None
194+
retry: boolean value to specify whether to retry after failure, default: True
194195
195196
Returns
196197
-------
@@ -242,9 +243,10 @@ def uquery(sql, con=None, cur=None, retry=True, params=None):
242243
----------
243244
sql: string
244245
SQL query to be executed
245-
con: DBAPI2 connection
246-
cur: deprecated, cursor is obtained from connection
247-
params: list or tuple, optional
246+
con: DBAPI2 connection, default: None
247+
cur: deprecated, cursor is obtained from connection, default: None
248+
retry: boolean value to specify whether to retry after failure, default: True
249+
params: list or tuple, optional, default: None
248250
List of parameters to pass to execute method.
249251
250252
Returns
@@ -294,12 +296,12 @@ def read_sql_table(table_name, con, schema=None, index_col=None,
294296
schema : string, default None
295297
Name of SQL schema in database to query (if database flavor
296298
supports this). If None, use default schema (default).
297-
index_col : string, optional
299+
index_col : string, optional, default: None
298300
Column to set as index
299301
coerce_float : boolean, default True
300302
Attempt to convert values to non-string, non-numeric objects (like
301303
decimal.Decimal) to floating point. Can result in loss of Precision.
302-
parse_dates : list or dict
304+
parse_dates : list or dict, default: None
303305
- List of column names to parse as dates
304306
- Dict of ``{column_name: format string}`` where format string is
305307
strftime compatible in case of parsing string times or is one of
@@ -308,7 +310,7 @@ def read_sql_table(table_name, con, schema=None, index_col=None,
308310
to the keyword arguments of :func:`pandas.to_datetime`
309311
Especially useful with databases without native Datetime support,
310312
such as SQLite
311-
columns : list
313+
columns : list, default: None
312314
List of column names to select from sql table
313315
chunksize : int, default None
314316
If specified, return an iterator where `chunksize` is the number of
@@ -369,18 +371,18 @@ def read_sql_query(sql, con, index_col=None, coerce_float=True, params=None,
369371
Using SQLAlchemy makes it possible to use any DB supported by that
370372
library.
371373
If a DBAPI2 object, only sqlite3 is supported.
372-
index_col : string, optional
374+
index_col : string, optional, default: None
373375
Column name to use as index for the returned DataFrame object.
374376
coerce_float : boolean, default True
375377
Attempt to convert values to non-string, non-numeric objects (like
376378
decimal.Decimal) to floating point, useful for SQL result sets
377-
params : list, tuple or dict, optional
379+
params : list, tuple or dict, optional, default: None
378380
List of parameters to pass to execute method. The syntax used
379381
to pass parameters is database driver dependent. Check your
380382
database driver documentation for which of the five syntax styles,
381383
described in PEP 249's paramstyle, is supported.
382384
Eg. for psycopg2, uses %(name)s so use params={'name' : 'value'}
383-
parse_dates : list or dict
385+
parse_dates : list or dict, default: None
384386
- List of column names to parse as dates
385387
- Dict of ``{column_name: format string}`` where format string is
386388
strftime compatible in case of parsing string times or is one of
@@ -428,18 +430,18 @@ def read_sql(sql, con, index_col=None, coerce_float=True, params=None,
428430
Using SQLAlchemy makes it possible to use any DB supported by that
429431
library.
430432
If a DBAPI2 object, only sqlite3 is supported.
431-
index_col : string, optional
433+
index_col : string, optional, default: None
432434
column name to use as index for the returned DataFrame object.
433435
coerce_float : boolean, default True
434436
Attempt to convert values to non-string, non-numeric objects (like
435437
decimal.Decimal) to floating point, useful for SQL result sets
436-
params : list, tuple or dict, optional
438+
params : list, tuple or dict, optional, default: None
437439
List of parameters to pass to execute method. The syntax used
438440
to pass parameters is database driver dependent. Check your
439441
database driver documentation for which of the five syntax styles,
440442
described in PEP 249's paramstyle, is supported.
441443
Eg. for psycopg2, uses %(name)s so use params={'name' : 'value'}
442-
parse_dates : list or dict
444+
parse_dates : list or dict, default: None
443445
- List of column names to parse as dates
444446
- Dict of ``{column_name: format string}`` where format string is
445447
strftime compatible in case of parsing string times or is one of
@@ -448,7 +450,7 @@ def read_sql(sql, con, index_col=None, coerce_float=True, params=None,
448450
to the keyword arguments of :func:`pandas.to_datetime`
449451
Especially useful with databases without native Datetime support,
450452
such as SQLite
451-
columns : list
453+
columns : list, default: None
452454
List of column names to select from sql table (only used when reading
453455
a table).
454456
chunksize : int, default None
@@ -1061,13 +1063,13 @@ def read_table(self, table_name, index_col=None, coerce_float=True,
10611063
----------
10621064
table_name : string
10631065
Name of SQL table in database
1064-
index_col : string, optional
1066+
index_col : string, optional, default: None
10651067
Column to set as index
10661068
coerce_float : boolean, default True
10671069
Attempt to convert values to non-string, non-numeric objects
10681070
(like decimal.Decimal) to floating point. This can result in
10691071
loss of precision.
1070-
parse_dates : list or dict
1072+
parse_dates : list or dict, default: None
10711073
- List of column names to parse as dates
10721074
- Dict of ``{column_name: format string}`` where format string is
10731075
strftime compatible in case of parsing string times or is one of
@@ -1076,7 +1078,7 @@ def read_table(self, table_name, index_col=None, coerce_float=True,
10761078
to the keyword arguments of :func:`pandas.to_datetime`.
10771079
Especially useful with databases without native Datetime support,
10781080
such as SQLite
1079-
columns : list
1081+
columns : list, default: None
10801082
List of column names to select from sql table
10811083
schema : string, default None
10821084
Name of SQL schema in database to query (if database flavor
@@ -1123,18 +1125,18 @@ def read_query(self, sql, index_col=None, coerce_float=True,
11231125
----------
11241126
sql : string
11251127
SQL query to be executed
1126-
index_col : string, optional
1128+
index_col : string, optional, default: None
11271129
Column name to use as index for the returned DataFrame object.
11281130
coerce_float : boolean, default True
11291131
Attempt to convert values to non-string, non-numeric objects (like
11301132
decimal.Decimal) to floating point, useful for SQL result sets
1131-
params : list, tuple or dict, optional
1133+
params : list, tuple or dict, optional, default: None
11321134
List of parameters to pass to execute method. The syntax used
11331135
to pass parameters is database driver dependent. Check your
11341136
database driver documentation for which of the five syntax styles,
11351137
described in PEP 249's paramstyle, is supported.
11361138
Eg. for psycopg2, uses %(name)s so use params={'name' : 'value'}
1137-
parse_dates : list or dict
1139+
parse_dates : list or dict, default: None
11381140
- List of column names to parse as dates
11391141
- Dict of ``{column_name: format string}`` where format string is
11401142
strftime compatible in case of parsing string times or is one of
@@ -1143,6 +1145,9 @@ def read_query(self, sql, index_col=None, coerce_float=True,
11431145
to the keyword arguments of :func:`pandas.to_datetime`
11441146
Especially useful with databases without native Datetime support,
11451147
such as SQLite
1148+
chunksize : int, default None
1149+
If specified, return an iterator where `chunksize` is the number
1150+
of rows to include in each chunk.
11461151
11471152
Returns
11481153
-------
@@ -1650,11 +1655,11 @@ def get_schema(frame, name, flavor='sqlite', keys=None, con=None, dtype=None):
16501655
The flavor of SQL to use. Ignored when using SQLAlchemy connectable.
16511656
'mysql' is deprecated and will be removed in future versions, but it
16521657
will be further supported through SQLAlchemy engines.
1653-
keys : string or sequence
1658+
keys : string or sequence, default: None
16541659
columns to use a primary key
16551660
con: an open SQL database connection object or a SQLAlchemy connectable
16561661
Using SQLAlchemy makes it possible to use any DB supported by that
1657-
library.
1662+
library, default: None
16581663
If a DBAPI2 object, only sqlite3 is supported.
16591664
dtype : dict of column name to SQL type, default None
16601665
Optional specifying the datatype for columns. The SQL type should

0 commit comments

Comments
 (0)