Skip to content

Commit 398e75e

Browse files
authored
Release 0.8.0 (#236)
* Release 0.8.0 * Update changelog. * Add Python 3.7 to supported versions in the package. * Fix docstrings in new Context class to match pandas-style. * Document new context class in authentication and API docs. * Add issue number for `credentials` parameter change.
1 parent 40480ea commit 398e75e

File tree

6 files changed

+77
-33
lines changed

6 files changed

+77
-33
lines changed

docs/source/api.rst

+4
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ API Reference
1818
Context
1919

2020
.. autofunction:: read_gbq
21+
2122
.. autofunction:: to_gbq
23+
2224
.. autodata:: context
25+
2326
.. autoclass:: Context
27+
:members:

docs/source/changelog.rst

+11-3
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ Changelog
33

44
.. _changelog-0.8.0:
55

6-
0.8.0 / unreleased
7-
--------------------
6+
0.8.0 / 2018-11-12
7+
------------------
88

99
Breaking changes
1010
~~~~~~~~~~~~~~~~
@@ -16,12 +16,20 @@ Breaking changes
1616
or
1717
:func:`google.oauth2.service_account.Credentials.from_service_account_file`.
1818
See the :doc:`authentication how-to guide <howto/authentication>` for
19-
examples. (:issue:`161`, :issue:`TODO`)
19+
examples. (:issue:`161`, :issue:`231`)
2020

2121
Enhancements
2222
~~~~~~~~~~~~
2323

2424
- Allow newlines in data passed to ``to_gbq``. (:issue:`180`)
25+
- Add :attr:`pandas_gbq.context.dialect` to allow overriding the default SQL
26+
syntax dialect. (:issue:`195`, :issue:`235`)
27+
- Support Python 3.7. (:issue:`197`, :issue:`232`)
28+
29+
Internal changes
30+
~~~~~~~~~~~~~~~~
31+
32+
- Migrate tests to CircleCI. (:issue:`228`, :issue:`232`)
2533

2634
.. _changelog-0.7.0:
2735

docs/source/contributing.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ run gbq integration tests on a forked repository:
321321
- ``GBQ_PROJECT_ID`` with the value being the ID of your BigQuery project.
322322

323323
- ``SERVICE_ACCOUNT_KEY`` with the value being the base64-encoded
324-
*contents* of the JSON key that you downloaded for your service account.
324+
*contents* of the JSON key that you downloaded for your service account.
325325

326326
Keep the contents of these variables confidential. These variables contain
327327
sensitive data and you do not want their contents being exposed in build

docs/source/howto/authentication.rst

+8-4
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,14 @@ more information on service accounts.
5858
Default Authentication Methods
5959
------------------------------
6060

61-
If the ``private_key`` parameter is ``None``, pandas-gbq tries the following
62-
authentication methods:
61+
If the ``credentials`` parameter (or the deprecated ``private_key``
62+
parameter) is ``None``, pandas-gbq tries the following authentication
63+
methods:
6364

64-
1. Application Default Credentials via the :func:`google.auth.default`
65+
1. In-memory, cached credentials at ``pandas_gbq.context.credentials``. See
66+
:attr:`pandas_gbq.Context.credentials` for details.
67+
68+
2. Application Default Credentials via the :func:`google.auth.default`
6569
function.
6670

6771
.. note::
@@ -74,7 +78,7 @@ authentication methods:
7478
Compute Engine is that the VM does not have sufficient scopes to query
7579
BigQuery.
7680

77-
2. User account credentials.
81+
3. User account credentials.
7882

7983
pandas-gbq loads cached credentials from a hidden user folder on the
8084
operating system. Override the location of the cached user credentials

pandas_gbq/gbq.py

+52-25
Original file line numberDiff line numberDiff line change
@@ -175,27 +175,34 @@ def __init__(self):
175175

176176
@property
177177
def credentials(self):
178-
"""google.auth.credentials.Credentials: Credentials to use for Google
179-
APIs.
180-
181-
Note:
182-
These credentials are automatically cached in memory by calls to
183-
:func:`pandas_gbq.read_gbq` and :func:`pandas_gbq.to_gbq`. To
184-
manually set the credentials, construct an
185-
:class:`google.auth.credentials.Credentials` object and set it as
186-
the context credentials as demonstrated in the example below. See
187-
`auth docs`_ for more information on obtaining credentials.
188-
189-
Example:
190-
Manually setting the context credentials:
191-
>>> import pandas_gbq
192-
>>> from google.oauth2 import service_account
193-
>>> credentials = (service_account
194-
... .Credentials.from_service_account_file(
195-
... '/path/to/key.json'))
196-
>>> pandas_gbq.context.credentials = credentials
178+
"""
179+
Credentials to use for Google APIs.
180+
181+
These credentials are automatically cached in memory by calls to
182+
:func:`pandas_gbq.read_gbq` and :func:`pandas_gbq.to_gbq`. To
183+
manually set the credentials, construct an
184+
:class:`google.auth.credentials.Credentials` object and set it as
185+
the context credentials as demonstrated in the example below. See
186+
`auth docs`_ for more information on obtaining credentials.
187+
197188
.. _auth docs: http://google-auth.readthedocs.io
198189
/en/latest/user-guide.html#obtaining-credentials
190+
191+
Returns
192+
-------
193+
google.auth.credentials.Credentials
194+
195+
Examples
196+
--------
197+
198+
Manually setting the context credentials:
199+
200+
>>> import pandas_gbq
201+
>>> from google.oauth2 import service_account
202+
>>> credentials = service_account.Credentials.from_service_account_file(
203+
... '/path/to/key.json',
204+
... )
205+
>>> pandas_gbq.context.credentials = credentials
199206
"""
200207
return self._credentials
201208

@@ -205,12 +212,19 @@ def credentials(self, value):
205212

206213
@property
207214
def project(self):
208-
"""str: Default project to use for calls to Google APIs.
215+
"""Default project to use for calls to Google APIs.
209216
210-
Example:
211-
Manually setting the context project:
212-
>>> import pandas_gbq
213-
>>> pandas_gbq.context.project = 'my-project'
217+
Returns
218+
-------
219+
str
220+
221+
Examples
222+
--------
223+
224+
Manually setting the context project:
225+
226+
>>> import pandas_gbq
227+
>>> pandas_gbq.context.project = 'my-project'
214228
"""
215229
return self._project
216230

@@ -220,7 +234,8 @@ def project(self, value):
220234

221235
@property
222236
def dialect(self):
223-
"""str: Default dialect to use in :func:`pandas_gbq.read_gbq`.
237+
"""
238+
Default dialect to use in :func:`pandas_gbq.read_gbq`.
224239
225240
Allowed values for the BigQuery SQL syntax dialect:
226241
@@ -233,6 +248,18 @@ def dialect(self):
233248
compliant with the SQL 2011 standard. For more information
234249
see `BigQuery Standard SQL Reference
235250
<https://cloud.google.com/bigquery/docs/reference/standard-sql/>`__.
251+
252+
Returns
253+
-------
254+
str
255+
256+
Examples
257+
--------
258+
259+
Setting the default syntax to standard:
260+
261+
>>> import pandas_gbq
262+
>>> pandas_gbq.context.dialect = 'standard'
236263
"""
237264
return self._dialect
238265

setup.py

+1
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ def readme():
4747
"Programming Language :: Python :: 3",
4848
"Programming Language :: Python :: 3.5",
4949
"Programming Language :: Python :: 3.6",
50+
"Programming Language :: Python :: 3.7",
5051
"Topic :: Scientific/Engineering",
5152
],
5253
keywords="data",

0 commit comments

Comments
 (0)