Skip to content

Commit

Permalink
CLN: Warn that default dialect is changing to "standard" (#196)
Browse files Browse the repository at this point in the history
* CLN: Warn that default dialect is changing to "standard"

Towards issue #195

* Increment stacklevel so line where read_gbq is called is highlighted.

* Update pyenv

* Try Python 2.7.15 via Travis build instead of pyenv

* Add to changelog

* Remove unused TRAVIS_PYTHON_VERSION env var.
  • Loading branch information
tswast authored Aug 15, 2018
1 parent 993fe55 commit d6b7507
Show file tree
Hide file tree
Showing 5 changed files with 154 additions and 90 deletions.
24 changes: 14 additions & 10 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,26 @@
sudo: false

language: python

matrix:
include:
- os: linux
python: 2.7
env: PYTHON=2.7 PANDAS=0.19.2 COVERAGE='false' LINT='true'
- os: linux
python: 3.5
env: PYTHON=3.5 PANDAS=0.18.1 COVERAGE='true' LINT='false'
- os: linux
python: 3.6
env: PYTHON=3.6 PANDAS=0.20.1 COVERAGE='false' LINT='false'
- os: linux
python: 3.6
env: PYTHON=3.6 PANDAS=MASTER COVERAGE='false' LINT='true'
env:
- PYTHON=2.7 PANDAS=0.19.2 COVERAGE='false' LINT='true' PYENV_VERSION=2.7.14
- PYTHON=3.5 PANDAS=0.18.1 COVERAGE='true' LINT='false' PYENV_VERSION=3.5.4
- PYTHON=3.6 PANDAS=0.20.1 COVERAGE='false' LINT='false' PYENV_VERSION=3.6.1
- PYTHON=3.6 PANDAS=MASTER COVERAGE='false' LINT='true' PYENV_VERSION=3.6.1

before_install:
- echo "before_install"
- source ci/travis_process_gbq_encryption.sh

install:
# work around https://github.com/travis-ci/travis-ci/issues/8363
# https://github.com/pre-commit/pre-commit/commit/e3ab8902692e896da9ded42bd4d76ea4e1de359d
- pyenv install -s $PYENV_VERSION
- pyenv global system $PYENV_VERSION
# Upgrade setuptools and pip to work around
# https://github.com/pypa/setuptools/issues/885
- pip install --upgrade setuptools
Expand Down
7 changes: 5 additions & 2 deletions docs/source/changelog.rst
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
Changelog
=========

.. _changelog-0.5.1:
.. _changelog-0.6.0:

0.5.1 / (Unreleased)
0.6.0 / 2018-08-15
--------------------

- Warn when ``dialect`` is not passed in to ``read_gbq``. The default dialect
will be changing from 'legacy' to 'standard' in a future version.
(:issue:`195`)
- Use general float with 15 decimal digit precision when writing to local
CSV buffer in ``to_gbq``. This prevents numerical overflow in certain
edge cases. (:issue:`192`)
Expand Down
13 changes: 11 additions & 2 deletions pandas_gbq/gbq.py
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ def _parse_data(schema, rows):

def read_gbq(query, project_id=None, index_col=None, col_order=None,
reauth=False, private_key=None, auth_local_webserver=False,
dialect='legacy', location=None, configuration=None,
dialect=None, location=None, configuration=None,
verbose=None):
r"""Load data from Google BigQuery using google-cloud-python
Expand Down Expand Up @@ -515,6 +515,8 @@ def read_gbq(query, project_id=None, index_col=None, col_order=None,
.. versionadded:: 0.2.0
dialect : str, default 'legacy'
Note: The default value is changing to 'standard' in a future verion.
SQL syntax dialect to use. Value can be one of:
``'legacy'``
Expand Down Expand Up @@ -552,14 +554,21 @@ def read_gbq(query, project_id=None, index_col=None, col_order=None,
df: DataFrame
DataFrame representing results of query.
"""
if dialect is None:
dialect = 'legacy'
warnings.warn(
'The default value for dialect is changing to "standard" in a '
'future version. Pass in dialect="legacy" to disable this '
'warning.',
FutureWarning, stacklevel=2)

_test_google_api_imports()

if verbose is not None and SHOW_VERBOSE_DEPRECATION:
warnings.warn(
"verbose is deprecated and will be removed in "
"a future version. Set logging level in order to vary "
"verbosity", FutureWarning, stacklevel=1)
"verbosity", FutureWarning, stacklevel=2)

if dialect not in ('legacy', 'standard'):
raise ValueError("'{0}' is not valid for dialect".format(dialect))
Expand Down
Loading

0 comments on commit d6b7507

Please sign in to comment.