Skip to content

Commit cb178d9

Browse files
committed
Add pandas-gbq args to function signature directly.
1 parent 2e5b148 commit cb178d9

File tree

2 files changed

+29
-26
lines changed

2 files changed

+29
-26
lines changed

pandas/core/frame.py

+24-22
Original file line numberDiff line numberDiff line change
@@ -1119,7 +1119,7 @@ def to_dict(self, orient='dict', into=dict):
11191119
def to_gbq(
11201120
self, destination_table, project_id, chunksize=10000,
11211121
verbose=True, reauth=False, if_exists='fail', private_key=None,
1122-
**kwargs):
1122+
auth_local_webserver=False, table_schema=None):
11231123
"""
11241124
Write a DataFrame to a Google BigQuery table.
11251125
@@ -1142,6 +1142,8 @@ def to_gbq(
11421142
11431143
Parameters
11441144
----------
1145+
dataframe : DataFrame
1146+
DataFrame to be written to Google BigQuery.
11451147
destination_table : string
11461148
Name of table to be written, in the form 'dataset.tablename'.
11471149
project_id : str
@@ -1163,35 +1165,35 @@ def to_gbq(
11631165
Service account private key in JSON format. Can be file path
11641166
or string contents. This is useful for remote server
11651167
authentication (eg. Jupyter/IPython notebook on remote host).
1166-
kwargs : dict
1167-
Arbitrary keyword arguments.
1168-
1169-
auth_local_webserver (boolean): default False
1170-
Use the [local webserver flow] instead of the [console flow]
1171-
when getting user credentials.
1172-
1173-
.. [local webserver flow]
1174-
http://google-auth-oauthlib.readthedocs.io/en/latest/reference/google_auth_oauthlib.flow.html#google_auth_oauthlib.flow.InstalledAppFlow.run_local_server
1175-
.. [console flow]
1176-
http://google-auth-oauthlib.readthedocs.io/en/latest/reference/google_auth_oauthlib.flow.html#google_auth_oauthlib.flow.InstalledAppFlow.run_console
1177-
.. versionadded:: pandas-gbq-0.2.0
1178-
table_schema (list of dicts):
1179-
List of BigQuery table fields to which according DataFrame
1180-
columns conform to, e.g. `[{'name': 'col1', 'type':
1181-
'STRING'},...]`. If schema is not provided, it will be
1182-
generated according to dtypes of DataFrame columns. See
1183-
BigQuery API documentation on available names of a field.
1184-
.. versionadded:: pandas-gbq-0.3.1
1168+
auth_local_webserver : boolean (default False)
1169+
Use the [local webserver flow] instead of the [console flow]
1170+
when getting user credentials.
1171+
1172+
.. [local webserver flow]
1173+
http://google-auth-oauthlib.readthedocs.io/en/latest/reference/google_auth_oauthlib.flow.html#google_auth_oauthlib.flow.InstalledAppFlow.run_local_server
1174+
.. [console flow]
1175+
http://google-auth-oauthlib.readthedocs.io/en/latest/reference/google_auth_oauthlib.flow.html#google_auth_oauthlib.flow.InstalledAppFlow.run_console
1176+
1177+
*New in version 0.2.0 of pandas-gbq*.
1178+
table_schema : list of dicts (optional)
1179+
List of BigQuery table fields to which according DataFrame
1180+
columns conform to, e.g. `[{'name': 'col1', 'type':
1181+
'STRING'},...]`. If schema is not provided, it will be
1182+
generated according to dtypes of DataFrame columns. See
1183+
BigQuery API documentation on available names of a field.
1184+
1185+
*New in version 0.3.1 of pandas-gbq*.
11851186
11861187
See Also
11871188
--------
1188-
pandas_gbq.to_gbq
1189+
pandas_gbq.to_gbq : This function in the pandas-gbq library.
11891190
"""
11901191
from pandas.io import gbq
11911192
return gbq.to_gbq(
11921193
self, destination_table, project_id, chunksize=chunksize,
11931194
verbose=verbose, reauth=reauth, if_exists=if_exists,
1194-
private_key=private_key, **kwargs)
1195+
private_key=private_key, auth_local_webserver=auth_local_webserver,
1196+
table_schema=table_schema)
11951197

11961198

11971199
@classmethod

pandas/io/gbq.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ def read_gbq(
8888
8989
See Also
9090
--------
91-
pandas_gbq.read_gbq
91+
pandas_gbq.read_gbq : This function in the pandas-gbq library.
9292
"""
9393
pandas_gbq = _try_import()
9494
return pandas_gbq.read_gbq(
@@ -103,9 +103,10 @@ def read_gbq(
103103
def to_gbq(
104104
dataframe, destination_table, project_id, chunksize=10000,
105105
verbose=True, reauth=False, if_exists='fail', private_key=None,
106-
**kwargs):
106+
auth_local_webserver=False, table_schema=None):
107107
pandas_gbq = _try_import()
108-
pandas_gbq.to_gbq(
108+
return pandas_gbq.to_gbq(
109109
dataframe, destination_table, project_id, chunksize=chunksize,
110110
verbose=verbose, reauth=reauth, if_exists=if_exists,
111-
private_key=private_key, **kwargs)
111+
private_key=private_key, auth_local_webserver=auth_local_webserver,
112+
table_schema=table_schema)

0 commit comments

Comments
 (0)