Skip to content

Commit d6b7507

Browse files
authored
CLN: Warn that default dialect is changing to "standard" (#196)
* 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.
1 parent 993fe55 commit d6b7507

File tree

5 files changed

+154
-90
lines changed

5 files changed

+154
-90
lines changed

.travis.yml

+14-10
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,26 @@
1-
sudo: false
2-
31
language: python
42

3+
matrix:
4+
include:
5+
- os: linux
6+
python: 2.7
7+
env: PYTHON=2.7 PANDAS=0.19.2 COVERAGE='false' LINT='true'
8+
- os: linux
9+
python: 3.5
10+
env: PYTHON=3.5 PANDAS=0.18.1 COVERAGE='true' LINT='false'
11+
- os: linux
12+
python: 3.6
13+
env: PYTHON=3.6 PANDAS=0.20.1 COVERAGE='false' LINT='false'
14+
- os: linux
15+
python: 3.6
16+
env: PYTHON=3.6 PANDAS=MASTER COVERAGE='false' LINT='true'
517
env:
6-
- PYTHON=2.7 PANDAS=0.19.2 COVERAGE='false' LINT='true' PYENV_VERSION=2.7.14
7-
- PYTHON=3.5 PANDAS=0.18.1 COVERAGE='true' LINT='false' PYENV_VERSION=3.5.4
8-
- PYTHON=3.6 PANDAS=0.20.1 COVERAGE='false' LINT='false' PYENV_VERSION=3.6.1
9-
- PYTHON=3.6 PANDAS=MASTER COVERAGE='false' LINT='true' PYENV_VERSION=3.6.1
1018

1119
before_install:
1220
- echo "before_install"
1321
- source ci/travis_process_gbq_encryption.sh
1422

1523
install:
16-
# work around https://github.com/travis-ci/travis-ci/issues/8363
17-
# https://github.com/pre-commit/pre-commit/commit/e3ab8902692e896da9ded42bd4d76ea4e1de359d
18-
- pyenv install -s $PYENV_VERSION
19-
- pyenv global system $PYENV_VERSION
2024
# Upgrade setuptools and pip to work around
2125
# https://github.com/pypa/setuptools/issues/885
2226
- pip install --upgrade setuptools

docs/source/changelog.rst

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
Changelog
22
=========
33

4-
.. _changelog-0.5.1:
4+
.. _changelog-0.6.0:
55

6-
0.5.1 / (Unreleased)
6+
0.6.0 / 2018-08-15
77
--------------------
88

9+
- Warn when ``dialect`` is not passed in to ``read_gbq``. The default dialect
10+
will be changing from 'legacy' to 'standard' in a future version.
11+
(:issue:`195`)
912
- Use general float with 15 decimal digit precision when writing to local
1013
CSV buffer in ``to_gbq``. This prevents numerical overflow in certain
1114
edge cases. (:issue:`192`)

pandas_gbq/gbq.py

+11-2
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,7 @@ def _parse_data(schema, rows):
471471

472472
def read_gbq(query, project_id=None, index_col=None, col_order=None,
473473
reauth=False, private_key=None, auth_local_webserver=False,
474-
dialect='legacy', location=None, configuration=None,
474+
dialect=None, location=None, configuration=None,
475475
verbose=None):
476476
r"""Load data from Google BigQuery using google-cloud-python
477477
@@ -515,6 +515,8 @@ def read_gbq(query, project_id=None, index_col=None, col_order=None,
515515
516516
.. versionadded:: 0.2.0
517517
dialect : str, default 'legacy'
518+
Note: The default value is changing to 'standard' in a future verion.
519+
518520
SQL syntax dialect to use. Value can be one of:
519521
520522
``'legacy'``
@@ -552,14 +554,21 @@ def read_gbq(query, project_id=None, index_col=None, col_order=None,
552554
df: DataFrame
553555
DataFrame representing results of query.
554556
"""
557+
if dialect is None:
558+
dialect = 'legacy'
559+
warnings.warn(
560+
'The default value for dialect is changing to "standard" in a '
561+
'future version. Pass in dialect="legacy" to disable this '
562+
'warning.',
563+
FutureWarning, stacklevel=2)
555564

556565
_test_google_api_imports()
557566

558567
if verbose is not None and SHOW_VERBOSE_DEPRECATION:
559568
warnings.warn(
560569
"verbose is deprecated and will be removed in "
561570
"a future version. Set logging level in order to vary "
562-
"verbosity", FutureWarning, stacklevel=1)
571+
"verbosity", FutureWarning, stacklevel=2)
563572

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

0 commit comments

Comments
 (0)