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/samples/snippets/requirements.txt b/samples/snippets/requirements.txt index b66a8135..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.0 +google-api-core[grpc]==2.7.0 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 +google-resumable-media==2.3.2 googleapis-common-protos==1.55.0 greenlet==1.1.2 grpcio==1.44.0 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/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" 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 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 d311a134..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( @@ -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_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 641677a4..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, @@ -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`" 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