Skip to content

Commit

Permalink
Merge commit 'refs/pull/920/head' of github.com:googleapis/python-big…
Browse files Browse the repository at this point in the history
…query-sqlalchemy into migration-coverage
  • Loading branch information
kiraksi committed Jan 22, 2024
2 parents b06dabf + 03fb7f7 commit aca9ee4
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 35 deletions.
6 changes: 3 additions & 3 deletions .github/.OwlBot.lock.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2023 Google LLC
# Copyright 2024 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -13,5 +13,5 @@
# limitations under the License.
docker:
image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest
digest: sha256:230f7fe8a0d2ed81a519cfc15c6bb11c5b46b9fb449b8b1219b3771bcb520ad2
# created: 2023-12-09T15:16:25.430769578Z
digest: sha256:5ea6d0ab82c956b50962f91d94e206d3921537ae5fe1549ec5326381d8905cfa
# created: 2024-01-15T16:32:08.142785673Z
6 changes: 3 additions & 3 deletions .kokoro/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -263,9 +263,9 @@ jeepney==0.8.0 \
# via
# keyring
# secretstorage
jinja2==3.1.2 \
--hash=sha256:31351a702a408a9e7595a8fc6150fc3f43bb6bf7e319770cbc0db9df9437e852 \
--hash=sha256:6088930bfe239f0e6710546ab9c19c9ef35e29792895fed6e6e31a023a182a61
jinja2==3.1.3 \
--hash=sha256:7d6d50dd97d52cbc355597bd845fabfbac3f551e1f99619e39a35ce8c370b5fa \
--hash=sha256:ac8bd6544d4bb2c9792bf3a159e80bba8fda7f07e81bc3aed565432d5925ba90
# via gcp-releasetool
keyring==24.2.0 \
--hash=sha256:4901caaf597bfd3bbd78c9a0c7c4c29fcd8310dab2cffefe749e916b6527acd6 \
Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ In order to use this library, you first need to go through the following steps:

.. note::
This library is a prerelease to gauge compatiblity with SQLAlchemy
versions >= 2.0.0
versions >= 1.4.16 and < 2.1

Installation
------------
Expand Down
35 changes: 24 additions & 11 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,6 @@ def default(session, install_extras=True):
install_target = "."
session.install("-e", install_target, "-c", constraints_path)

session.run("python", "-m", "pip", "freeze")

# Run py.test against the unit tests.
session.run(
"py.test",
Expand Down Expand Up @@ -396,10 +394,11 @@ def compliance(session):
f"--junitxml=compliance_{session.python}_sponge_log.xml",
"--reruns=3",
"--reruns-delay=60",
"--only-rerun=403 Exceeded rate limits",
"--only-rerun=409 Already Exists",
"--only-rerun=404 Not found",
"--only-rerun=400 Cannot execute DML over a non-existent table",
"--only-rerun=Exceeded rate limits",
"--only-rerun=Already Exists",
"--only-rerun=Not found",
"--only-rerun=Cannot execute DML over a non-existent table",
"--only-rerun=Job exceeded rate limits",
system_test_folder_path,
*session.posargs,
# To suppress the "Deprecated API features detected!" warning when
Expand All @@ -418,9 +417,6 @@ def cover(session):
test runs (not system test runs), and then erases coverage data.
"""
session.install("coverage", "pytest-cov")

session.run("python", "-m", "pip", "freeze")

session.run("coverage", "report", "--show-missing", "--fail-under=100")

session.run("coverage", "erase")
Expand All @@ -432,7 +428,16 @@ def docs(session):

session.install("-e", ".")
session.install(
"sphinx==4.0.1",
# We need to pin to specific versions of the `sphinxcontrib-*` packages
# which still support sphinx 4.x.
# See https://github.com/googleapis/sphinx-docfx-yaml/issues/344
# and https://github.com/googleapis/sphinx-docfx-yaml/issues/345.
"sphinxcontrib-applehelp==1.0.4",
"sphinxcontrib-devhelp==1.0.2",
"sphinxcontrib-htmlhelp==2.0.1",
"sphinxcontrib-qthelp==1.0.3",
"sphinxcontrib-serializinghtml==1.1.5",
"sphinx==4.5.0",
"alabaster",
"geoalchemy2",
"shapely",
Expand Down Expand Up @@ -460,6 +465,15 @@ def docfx(session):

session.install("-e", ".")
session.install(
# We need to pin to specific versions of the `sphinxcontrib-*` packages
# which still support sphinx 4.x.
# See https://github.com/googleapis/sphinx-docfx-yaml/issues/344
# and https://github.com/googleapis/sphinx-docfx-yaml/issues/345.
"sphinxcontrib-applehelp==1.0.4",
"sphinxcontrib-devhelp==1.0.2",
"sphinxcontrib-htmlhelp==2.0.1",
"sphinxcontrib-qthelp==1.0.3",
"sphinxcontrib-serializinghtml==1.1.5",
"gcp-sphinx-docfx-yaml",
"alabaster",
"geoalchemy2",
Expand Down Expand Up @@ -552,7 +566,6 @@ def prerelease_deps(session):
"requests",
]
session.install(*other_deps)
session.run("python", "-m", "pip", "freeze")

# Print out prerelease package versions
session.run(
Expand Down
9 changes: 5 additions & 4 deletions owlbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,10 +192,11 @@ def compliance(session):
f"--junitxml=compliance_{session.python}_sponge_log.xml",
"--reruns=3",
"--reruns-delay=60",
"--only-rerun=403 Exceeded rate limits",
"--only-rerun=409 Already Exists",
"--only-rerun=404 Not found",
"--only-rerun=400 Cannot execute DML over a non-existent table",
"--only-rerun=Exceeded rate limits",
"--only-rerun=Already Exists",
"--only-rerun=Not found",
"--only-rerun=Cannot execute DML over a non-existent table",
"--only-rerun=Job exceeded rate limits",
system_test_folder_path,
*session.posargs,
# To suppress the "Deprecated API features detected!" warning when
Expand Down
2 changes: 1 addition & 1 deletion samples/snippets/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ requests==2.31.0
rsa==4.9
shapely==2.0.2
six==1.16.0
sqlalchemy===1.4.15
sqlalchemy==1.4.16
typing-extensions==4.9.0
urllib3==2.1.0
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,6 @@ def literal(value, type_=None):
if type_ is not None:
assert type_ is self.datatype

import sqlalchemy.sql.sqltypes

return sqlalchemy.sql.elements.literal(value, self.datatype)

with mock.patch("sqlalchemy.testing.suite.test_types.literal", literal):
Expand Down Expand Up @@ -124,10 +122,9 @@ class SimpleUpdateDeleteTest(_SimpleUpdateDeleteTest):
def test_update(self):
t = self.tables.plain_pk
connection = config.db.connect()
# Had to pass in data as a dict object in 2.0
# In SQLAlchemy 2.0, the datatype changed to dict in the following function.
r = connection.execute(t.update().where(t.c.id == 2), dict(data="d2_new"))
assert not r.is_insert
# assert not r.returns_rows

eq_(
connection.execute(t.select().order_by(t.c.id)).fetchall(),
Expand All @@ -139,7 +136,6 @@ def test_delete(self):
connection = config.db.connect()
r = connection.execute(t.delete().where(t.c.id == 2))
assert not r.is_insert
# assert not r.returns_rows
eq_(
connection.execute(t.select().order_by(t.c.id)).fetchall(),
[(1, "d1"), (3, "d3")],
Expand Down Expand Up @@ -601,7 +597,6 @@ def test_update(self):
t = self.tables.plain_pk
r = config.db.execute(t.update().where(t.c.id == 2), data="d2_new")
assert not r.is_insert
# assert not r.returns_rows

eq_(
config.db.execute(t.select().order_by(t.c.id)).fetchall(),
Expand All @@ -612,7 +607,6 @@ def test_delete(self):
t = self.tables.plain_pk
r = config.db.execute(t.delete().where(t.c.id == 2))
assert not r.is_insert
# assert not r.returns_rows
eq_(
config.db.execute(t.select().order_by(t.c.id)).fetchall(),
[(1, "d1"), (3, "d3")],
Expand Down
5 changes: 0 additions & 5 deletions tests/system/test_sqlalchemy_bigquery.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,11 +286,6 @@ def test_reflect_select(table, engine_using_test_dataset, table_using_test_datas
assert isinstance(table.c["nested_record.record.name"].type, types.String)
assert isinstance(table.c.array.type, types.ARRAY)

# Force unique column labels using `use_labels` below to deal
# with BQ sometimes complaining about duplicate column names
# when a destination table is specified, even though no
# destination table is specified. When this test was written,
# `use_labels` was forced by the dialect.
with engine_using_test_dataset.connect() as conn:
rows = conn.execute(
table.select().set_label_style(
Expand Down

0 comments on commit aca9ee4

Please sign in to comment.