@@ -22,34 +22,26 @@ def _try_import():
22
22
23
23
24
24
def read_gbq (query , project_id = None , index_col = None , col_order = None ,
25
- reauth = False , verbose = None , private_key = None , dialect = 'legacy' ,
26
- ** kwargs ):
25
+ reauth = False , private_key = None , auth_local_webserver = False ,
26
+ dialect = 'legacy' , location = None , configuration = None ,
27
+ verbose = None ):
27
28
"""
28
29
Load data from Google BigQuery.
29
30
30
31
This function requires the `pandas-gbq package
31
32
<https://pandas-gbq.readthedocs.io>`__.
32
33
33
- Authentication to the Google BigQuery service is via OAuth 2.0.
34
-
35
- - If "private_key" is not provided:
36
-
37
- By default "application default credentials" are used.
38
-
39
- If default application credentials are not found or are restrictive,
40
- user account credentials are used. In this case, you will be asked to
41
- grant permissions for product name 'pandas GBQ'.
42
-
43
- - If "private_key" is provided:
44
-
45
- Service account credentials will be used to authenticate.
34
+ See the `How to authenticate with Google BigQuery
35
+ <https://pandas-gbq.readthedocs.io/en/latest/howto/authentication.html>`__
36
+ guide for authentication instructions.
46
37
47
38
Parameters
48
39
----------
49
40
query : str
50
41
SQL-Like Query to return data values.
51
- project_id : str
52
- Google BigQuery Account project ID.
42
+ project_id : str, optional
43
+ Google BigQuery Account project ID. Optional when available from
44
+ the environment.
53
45
index_col : str, optional
54
46
Name of result column to use for index in results DataFrame.
55
47
col_order : list(str), optional
@@ -62,6 +54,16 @@ def read_gbq(query, project_id=None, index_col=None, col_order=None,
62
54
Service account private key in JSON format. Can be file path
63
55
or string contents. This is useful for remote server
64
56
authentication (eg. Jupyter/IPython notebook on remote host).
57
+ auth_local_webserver : boolean, default False
58
+ Use the `local webserver flow`_ instead of the `console flow`_
59
+ when getting user credentials.
60
+
61
+ .. _local webserver flow:
62
+ http://google-auth-oauthlib.readthedocs.io/en/latest/reference/google_auth_oauthlib.flow.html#google_auth_oauthlib.flow.InstalledAppFlow.run_local_server
63
+ .. _console flow:
64
+ http://google-auth-oauthlib.readthedocs.io/en/latest/reference/google_auth_oauthlib.flow.html#google_auth_oauthlib.flow.InstalledAppFlow.run_console
65
+
66
+ *New in version 0.2.0 of pandas-gbq*.
65
67
dialect : str, default 'legacy'
66
68
SQL syntax dialect to use. Value can be one of:
67
69
@@ -74,19 +76,26 @@ def read_gbq(query, project_id=None, index_col=None, col_order=None,
74
76
compliant with the SQL 2011 standard. For more information
75
77
see `BigQuery Standard SQL Reference
76
78
<https://cloud.google.com/bigquery/docs/reference/standard-sql/>`__.
77
- verbose : boolean, deprecated
78
- *Deprecated in Pandas-GBQ 0.4.0.* Use the `logging module
79
- to adjust verbosity instead
80
- <https://pandas-gbq.readthedocs.io/en/latest/intro.html#logging>`__.
81
- kwargs : dict
82
- Arbitrary keyword arguments.
83
- configuration (dict): query config parameters for job processing.
79
+ location : str, optional
80
+ Location where the query job should run. See the `BigQuery locations
81
+ documentation
82
+ <https://cloud.google.com/bigquery/docs/dataset-locations>`__ for a
83
+ list of available locations. The location must match that of any
84
+ datasets used in the query.
85
+
86
+ *New in version 0.5.0 of pandas-gbq*.
87
+ configuration : dict, optional
88
+ Query config parameters for job processing.
84
89
For example:
85
90
86
91
configuration = {'query': {'useQueryCache': False}}
87
92
88
- For more information see `BigQuery SQL Reference
89
- <https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs#configuration.query>`__
93
+ For more information see `BigQuery REST API Reference
94
+ <https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs#configuration.query>`__.
95
+ verbose : None, deprecated
96
+ Deprecated in Pandas-GBQ 0.4.0. Use the `logging module
97
+ to adjust verbosity instead
98
+ <https://pandas-gbq.readthedocs.io/en/latest/intro.html#logging>`__.
90
99
91
100
Returns
92
101
-------
@@ -100,20 +109,21 @@ def read_gbq(query, project_id=None, index_col=None, col_order=None,
100
109
"""
101
110
pandas_gbq = _try_import ()
102
111
return pandas_gbq .read_gbq (
103
- query , project_id = project_id ,
104
- index_col = index_col , col_order = col_order ,
105
- reauth = reauth , verbose = verbose ,
106
- private_key = private_key ,
107
- dialect = dialect ,
108
- ** kwargs )
112
+ query , project_id = project_id , index_col = index_col ,
113
+ col_order = col_order , reauth = reauth , verbose = verbose ,
114
+ private_key = private_key , auth_local_webserver = auth_local_webserver ,
115
+ dialect = dialect , location = location , configuration = configuration )
109
116
110
117
111
- def to_gbq (dataframe , destination_table , project_id , chunksize = None ,
118
+ def to_gbq (dataframe , destination_table , project_id = None , chunksize = None ,
112
119
verbose = None , reauth = False , if_exists = 'fail' , private_key = None ,
113
- auth_local_webserver = False , table_schema = None ):
120
+ auth_local_webserver = False , table_schema = None , location = None ,
121
+ progress_bar = True ):
114
122
pandas_gbq = _try_import ()
115
123
return pandas_gbq .to_gbq (
116
- dataframe , destination_table , project_id , chunksize = chunksize ,
117
- verbose = verbose , reauth = reauth , if_exists = if_exists ,
118
- private_key = private_key , auth_local_webserver = auth_local_webserver ,
119
- table_schema = table_schema )
124
+ dataframe , destination_table , project_id = project_id ,
125
+ chunksize = chunksize , verbose = verbose , reauth = reauth ,
126
+ if_exists = if_exists , private_key = private_key ,
127
+ auth_local_webserver = auth_local_webserver ,
128
+ table_schema = table_schema , location = location ,
129
+ progress_bar = progress_bar )
0 commit comments