From 5f99f71641ab14ab0e173ce164864ead6952c91f Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Tue, 8 Mar 2022 18:30:17 +0100 Subject: [PATCH 1/6] chore(deps): update all dependencies (#423) * chore(deps): update all dependencies * revert * revert * revert * revert Co-authored-by: Anthonios Partheniou --- samples/snippets/requirements.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/samples/snippets/requirements.txt b/samples/snippets/requirements.txt index b66a8135..3914de13 100644 --- a/samples/snippets/requirements.txt +++ b/samples/snippets/requirements.txt @@ -3,10 +3,10 @@ certifi==2021.10.8 charset-normalizer==2.0.12 future==0.18.2 geoalchemy2==0.11.1 -google-api-core[grpc]==2.6.0 +google-api-core[grpc]==2.6.1 google-auth==2.6.0 -google-cloud-bigquery==2.34.1 -google-cloud-core==2.2.2 +google-cloud-bigquery==2.34.2 +google-cloud-core==2.2.3 google-crc32c==1.3.0 google-resumable-media==2.3.1 googleapis-common-protos==1.55.0 From 934e25f705fd9f226e438d075c7e00e495cce04e Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Wed, 9 Mar 2022 12:46:18 +0100 Subject: [PATCH 2/6] chore(deps): update all dependencies (#424) * chore(deps): update all dependencies * revert * revert * revert * revert Co-authored-by: Anthonios Partheniou --- samples/snippets/requirements.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/samples/snippets/requirements.txt b/samples/snippets/requirements.txt index 3914de13..4266837c 100644 --- a/samples/snippets/requirements.txt +++ b/samples/snippets/requirements.txt @@ -3,12 +3,12 @@ certifi==2021.10.8 charset-normalizer==2.0.12 future==0.18.2 geoalchemy2==0.11.1 -google-api-core[grpc]==2.6.1 +google-api-core[grpc]==2.7.0 google-auth==2.6.0 google-cloud-bigquery==2.34.2 google-cloud-core==2.2.3 google-crc32c==1.3.0 -google-resumable-media==2.3.1 +google-resumable-media==2.3.2 googleapis-common-protos==1.55.0 greenlet==1.1.2 grpcio==1.44.0 From 275506f0c9b7ac0e67410dbd7ceab8c9f593a259 Mon Sep 17 00:00:00 2001 From: Walt Askew Date: Mon, 21 Mar 2022 15:24:11 -0700 Subject: [PATCH 3/6] fix: use faux_conn rather than engine in unit tests (#431) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove the engine fixture from unit tests and use faux_conn instead. Creating an engine requires credentials, which prevents these tests from being pure unit tests and running in any environment. Fixes #430 🦕 --- tests/unit/conftest.py | 5 ----- tests/unit/test__struct.py | 16 ++++++++-------- tests/unit/test_select.py | 4 ++-- 3 files changed, 10 insertions(+), 15 deletions(-) diff --git a/tests/unit/conftest.py b/tests/unit/conftest.py index d311a134..886e9aee 100644 --- a/tests/unit/conftest.py +++ b/tests/unit/conftest.py @@ -42,11 +42,6 @@ ) -@pytest.fixture() -def engine(): - return sqlalchemy.create_engine("bigquery://myproject/mydataset") - - @pytest.fixture() def faux_conn(): test_data = dict(execute=[]) diff --git a/tests/unit/test__struct.py b/tests/unit/test__struct.py index ee096fb5..26ccec54 100644 --- a/tests/unit/test__struct.py +++ b/tests/unit/test__struct.py @@ -80,9 +80,9 @@ def _col(): ), ], ) -def test_struct_traversal_project(engine, expr, sql): +def test_struct_traversal_project(faux_conn, expr, sql): sql = f"SELECT {sql} AS `anon_1` \nFROM `t`" - assert str(sqlalchemy.select([expr]).compile(engine)) == sql + assert str(sqlalchemy.select([expr]).compile(faux_conn.engine)) == sql @pytest.mark.parametrize( @@ -113,13 +113,13 @@ def test_struct_traversal_project(engine, expr, sql): ), ], ) -def test_struct_traversal_filter(engine, expr, sql, param=1): +def test_struct_traversal_filter(faux_conn, expr, sql, param=1): want = f"SELECT `t`.`person` \nFROM `t`, `t` \nWHERE {sql}" - got = str(sqlalchemy.select([_col()]).where(expr).compile(engine)) + got = str(sqlalchemy.select([_col()]).where(expr).compile(faux_conn.engine)) assert got == want -def test_struct_insert_type_info(engine, metadata): +def test_struct_insert_type_info(faux_conn, metadata): t = sqlalchemy.Table("t", metadata, sqlalchemy.Column("person", _test_struct())) got = str( t.insert() @@ -129,7 +129,7 @@ def test_struct_insert_type_info(engine, metadata): children=[dict(name="billy", bdate=datetime.date(2020, 1, 1))], ) ) - .compile(engine) + .compile(faux_conn.engine) ) assert got == ( @@ -139,7 +139,7 @@ def test_struct_insert_type_info(engine, metadata): ) -def test_struct_non_string_field_access(engine): +def test_struct_non_string_field_access(faux_conn): with pytest.raises( TypeError, match="STRUCT fields can only be accessed with strings field names, not 42", @@ -147,6 +147,6 @@ def test_struct_non_string_field_access(engine): _col()[42] -def test_struct_bad_name(engine): +def test_struct_bad_name(faux_conn): with pytest.raises(KeyError, match="42"): _col()["42"] diff --git a/tests/unit/test_select.py b/tests/unit/test_select.py index 641677a4..58713985 100644 --- a/tests/unit/test_select.py +++ b/tests/unit/test_select.py @@ -433,9 +433,9 @@ def test_unnest_w_no_table_references(faux_conn, alias): ) -def test_array_indexing(engine, metadata): +def test_array_indexing(faux_conn, metadata): t = sqlalchemy.Table( "t", metadata, sqlalchemy.Column("a", sqlalchemy.ARRAY(sqlalchemy.String)), ) - got = str(sqlalchemy.select([t.c.a[0]]).compile(engine)) + got = str(sqlalchemy.select([t.c.a[0]]).compile(faux_conn.engine)) assert got == "SELECT `t`.`a`[OFFSET(%(a_1:INT64)s)] AS `anon_1` \nFROM `t`" From ca20d3d20939b780abe49dfc833375eecd31ae04 Mon Sep 17 00:00:00 2001 From: Walt Askew Date: Mon, 21 Mar 2022 15:46:11 -0700 Subject: [PATCH 4/6] fix: use explicit rather than implicit relative imports (#433) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit use explicit rather than implicit relative imports Fixes #432 🦕 --- tests/__init__.py | 0 tests/unit/__init__.py | 0 tests/unit/conftest.py | 2 +- tests/unit/test_comments.py | 2 +- tests/unit/test_compiler.py | 4 ++-- tests/unit/test_compliance.py | 2 +- tests/unit/test_geography.py | 2 +- tests/unit/test_select.py | 2 +- tests/unit/test_sqlalchemy_bigquery.py | 2 +- 9 files changed, 8 insertions(+), 8 deletions(-) create mode 100644 tests/__init__.py create mode 100644 tests/unit/__init__.py diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/unit/__init__.py b/tests/unit/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/unit/conftest.py b/tests/unit/conftest.py index 886e9aee..f808b380 100644 --- a/tests/unit/conftest.py +++ b/tests/unit/conftest.py @@ -25,7 +25,7 @@ import pytest import sqlalchemy -import fauxdbi +from . import fauxdbi sqlalchemy_version = packaging.version.parse(sqlalchemy.__version__) sqlalchemy_1_3_or_higher = pytest.mark.skipif( diff --git a/tests/unit/test_comments.py b/tests/unit/test_comments.py index c0657f0d..df7f07a3 100644 --- a/tests/unit/test_comments.py +++ b/tests/unit/test_comments.py @@ -19,7 +19,7 @@ import sqlalchemy -from conftest import setup_table +from .conftest import setup_table def test_inline_comments(faux_conn): diff --git a/tests/unit/test_compiler.py b/tests/unit/test_compiler.py index 889ad63d..84a93508 100644 --- a/tests/unit/test_compiler.py +++ b/tests/unit/test_compiler.py @@ -20,8 +20,8 @@ import pytest import sqlalchemy.exc -from conftest import setup_table -from conftest import sqlalchemy_1_4_or_higher +from .conftest import setup_table +from .conftest import sqlalchemy_1_4_or_higher def test_constraints_are_ignored(faux_conn, metadata): diff --git a/tests/unit/test_compliance.py b/tests/unit/test_compliance.py index 9ba27cf6..fd1fbb83 100644 --- a/tests/unit/test_compliance.py +++ b/tests/unit/test_compliance.py @@ -27,7 +27,7 @@ from sqlalchemy import Column, Integer, literal_column, select, String, Table, union from sqlalchemy.testing.assertions import eq_, in_ -from conftest import setup_table, sqlalchemy_1_3_or_higher +from .conftest import setup_table, sqlalchemy_1_3_or_higher def assert_result(connection, sel, expected, params=()): diff --git a/tests/unit/test_geography.py b/tests/unit/test_geography.py index 3ee2cce6..fafc0a80 100644 --- a/tests/unit/test_geography.py +++ b/tests/unit/test_geography.py @@ -19,7 +19,7 @@ import pytest -from conftest import setup_table +from .conftest import setup_table geoalchemy2 = pytest.importorskip("geoalchemy2") diff --git a/tests/unit/test_select.py b/tests/unit/test_select.py index 58713985..33c657f7 100644 --- a/tests/unit/test_select.py +++ b/tests/unit/test_select.py @@ -26,7 +26,7 @@ import sqlalchemy_bigquery -from conftest import ( +from .conftest import ( setup_table, sqlalchemy_version, sqlalchemy_1_3_or_higher, diff --git a/tests/unit/test_sqlalchemy_bigquery.py b/tests/unit/test_sqlalchemy_bigquery.py index e97b15ff..53c49bf5 100644 --- a/tests/unit/test_sqlalchemy_bigquery.py +++ b/tests/unit/test_sqlalchemy_bigquery.py @@ -14,7 +14,7 @@ import pytest import sqlalchemy -from conftest import setup_table +from .conftest import setup_table @pytest.fixture From ff3273feacfa1f34bb9090f28f11c2ac470759fc Mon Sep 17 00:00:00 2001 From: Tim Swast Date: Tue, 22 Mar 2022 09:34:25 -0500 Subject: [PATCH 5/6] deps: require google-cloud-bigquery-storage to avoid performance warning (#414) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The wrapped DB-API uses google-cloud-bigquery-storage to download query results by default. It raises a warning and falls back to the REST API if google-cloud-bigquery-storage is not installed. The google-cloud-bigquery version 3.x library is tested in #401 and it does not include any breaking changes that should affect the SQLAlchemy connector. deps: allow google-cloud-bigquery version 3.x Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly: - [ ] Make sure to open an issue as a [bug/issue](https://github.com/googleapis/python-bigquery-sqlalchemy/issues/new/choose) before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea - [ ] Ensure the tests and linter pass - [ ] Code coverage does not decrease (if any source code was changed) - [ ] Appropriate docs were updated (if necessary) Fixes # 🦕 --- setup.py | 4 +++- testing/constraints-3.6.txt | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 31840e81..7a3fe9ce 100644 --- a/setup.py +++ b/setup.py @@ -84,7 +84,9 @@ def readme(): # Until this issue is closed # https://github.com/googleapis/google-cloud-python/issues/10566 "google-auth>=1.25.0,<3.0.0dev", # Work around pip wack. - "google-cloud-bigquery>=2.25.2,<3.0.0dev", + "google-cloud-bigquery>=2.25.2,<4.0.0dev", + "google-cloud-bigquery-storage>=2.0.0,<3.0.0dev", + "pyarrow>=3.0.0,<7.0dev", # Temporarily set maximimum sqlalchemy to a known-working version while # we debug failing compliance tests. See: # https://github.com/googleapis/python-bigquery-sqlalchemy/issues/386 diff --git a/testing/constraints-3.6.txt b/testing/constraints-3.6.txt index f65bd213..9d2df4fe 100644 --- a/testing/constraints-3.6.txt +++ b/testing/constraints-3.6.txt @@ -7,4 +7,6 @@ sqlalchemy==1.2.0 google-auth==1.25.0 google-cloud-bigquery==2.25.2 +google-cloud-bigquery-storage==2.0.0 google-api-core==1.31.5 +pyarrow==3.0.0 From eb8f3f856600d1e30e2fca9af4fb0e4510997c57 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Tue, 22 Mar 2022 11:05:35 -0500 Subject: [PATCH 6/6] chore(main): release 1.4.2 (#434) Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> --- CHANGELOG.md | 13 +++++++++++++ sqlalchemy_bigquery/version.py | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d8e095bb..252669b9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,19 @@ Older versions of this project were distributed as [pybigquery][0]. [2]: https://pypi.org/project/pybigquery/#history +### [1.4.2](https://github.com/googleapis/python-bigquery-sqlalchemy/compare/v1.4.1...v1.4.2) (2022-03-22) + + +### Bug Fixes + +* use explicit rather than implicit relative imports ([#433](https://github.com/googleapis/python-bigquery-sqlalchemy/issues/433)) ([ca20d3d](https://github.com/googleapis/python-bigquery-sqlalchemy/commit/ca20d3d20939b780abe49dfc833375eecd31ae04)) +* use faux_conn rather than engine in unit tests ([#431](https://github.com/googleapis/python-bigquery-sqlalchemy/issues/431)) ([275506f](https://github.com/googleapis/python-bigquery-sqlalchemy/commit/275506f0c9b7ac0e67410dbd7ceab8c9f593a259)) + + +### Dependencies + +* require google-cloud-bigquery-storage to avoid performance warning ([#414](https://github.com/googleapis/python-bigquery-sqlalchemy/issues/414)) ([ff3273f](https://github.com/googleapis/python-bigquery-sqlalchemy/commit/ff3273feacfa1f34bb9090f28f11c2ac470759fc)) + ### [1.4.1](https://github.com/googleapis/python-bigquery-sqlalchemy/compare/v1.4.0...v1.4.1) (2022-03-07) diff --git a/sqlalchemy_bigquery/version.py b/sqlalchemy_bigquery/version.py index 0b8f4279..e8c65ca0 100644 --- a/sqlalchemy_bigquery/version.py +++ b/sqlalchemy_bigquery/version.py @@ -17,4 +17,4 @@ # IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -__version__ = "1.4.1" +__version__ = "1.4.2"