Skip to content

Commit 0675b1e

Browse files
fix: Avoid sqlalchemy20 (#736)
* Sets cache support to false, removes upper req limit * fix: sets upper limit to exclude sqlalchemy 2.0 (a breaking dependency) * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * fix: sets upper limit to exclude rc and dev branches * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * add comment for testing purposes * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * add sqlalchemy 20 to prerelease deps section * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * remove prerelease entirely * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * remove prerelease configs * removes prerelease nox session * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * testing changes to noxfile * testing changes to noxfile * testing noxfiles redux * testing noxfiles triplex * testing noxfiles quadruplex * testing noxfiles again * fixes linting * Adds warning suppression constant * Adds warning suppression constant to os.environ * Change variable setting from integer to string * Fixed linting * alternate attempt at including an env var * updates to owlbot and noxfile * clean up owlbot * more revisions to owlbot * testing a quirk in owlbot * testing a quirk in owlbot again * more testing of owlbot revisions * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * updated readme and files with potential upper bounds * update incorrect lower bound --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent 7aa6696 commit 0675b1e

File tree

7 files changed

+38
-164
lines changed

7 files changed

+38
-164
lines changed

.kokoro/continuous/prerelease.cfg

Lines changed: 0 additions & 7 deletions
This file was deleted.

.kokoro/presubmit/prerelease.cfg

Lines changed: 0 additions & 7 deletions
This file was deleted.

README.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ In order to use this library, you first need to go through the following steps:
3434
.. _Enable the BigQuery Storage API.: https://console.cloud.google.com/apis/library/bigquery.googleapis.com
3535
.. _Setup Authentication.: https://googleapis.dev/python/google-api-core/latest/auth.html
3636

37+
.. note::
38+
This library is only compatible with SQLAlchemy versions < 2.0.0
39+
3740
Installation
3841
------------
3942

dev_requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
sqlalchemy>=1.1.9
1+
sqlalchemy>=1.1.9,<2.0.0
22
google-cloud-bigquery>=1.6.0
33
future==0.18.2
44
pytest===6.2.5

noxfile.py

Lines changed: 8 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -283,76 +283,6 @@ def system(session):
283283
)
284284

285285

286-
@nox.session(python=DEFAULT_PYTHON_VERSION)
287-
def prerelease(session):
288-
session.install(
289-
"--prefer-binary",
290-
"--pre",
291-
"--upgrade",
292-
"alembic",
293-
"geoalchemy2",
294-
"google-api-core",
295-
"google-cloud-bigquery",
296-
"google-cloud-bigquery-storage",
297-
"sqlalchemy",
298-
"shapely",
299-
# These are transitive dependencies, but we'd still like to know if a
300-
# change in a prerelease there breaks this connector.
301-
"google-cloud-core",
302-
"grpcio",
303-
)
304-
session.install(
305-
"freezegun",
306-
"google-cloud-testutils",
307-
"mock",
308-
"psutil",
309-
"pytest",
310-
"pytest-cov",
311-
"pytz",
312-
)
313-
314-
# Because we test minimum dependency versions on the minimum Python
315-
# version, the first version we test with in the unit tests sessions has a
316-
# constraints file containing all dependencies and extras.
317-
with open(
318-
CURRENT_DIRECTORY
319-
/ "testing"
320-
/ f"constraints-{UNIT_TEST_PYTHON_VERSIONS[0]}.txt",
321-
encoding="utf-8",
322-
) as constraints_file:
323-
constraints_text = constraints_file.read()
324-
325-
# Ignore leading whitespace and comment lines.
326-
deps = [
327-
match.group(1)
328-
for match in re.finditer(
329-
r"^\s*(\S+)(?===\S+)", constraints_text, flags=re.MULTILINE
330-
)
331-
]
332-
333-
# We use --no-deps to ensure that pre-release versions aren't overwritten
334-
# by the version ranges in setup.py.
335-
session.install(*deps)
336-
session.install("--no-deps", "-e", ".")
337-
338-
# Print out prerelease package versions.
339-
session.run("python", "-m", "pip", "freeze")
340-
341-
# Run all tests, except a few samples tests which require extra dependencies.
342-
session.run(
343-
"py.test",
344-
"--quiet",
345-
f"--junitxml=prerelease_unit_{session.python}_sponge_log.xml",
346-
os.path.join("tests", "unit"),
347-
)
348-
session.run(
349-
"py.test",
350-
"--quiet",
351-
f"--junitxml=prerelease_system_{session.python}_sponge_log.xml",
352-
os.path.join("tests", "system"),
353-
)
354-
355-
356286
@nox.session(python=SYSTEM_TEST_PYTHON_VERSIONS[-1])
357287
def compliance(session):
358288
"""Run the SQLAlchemy dialect-compliance system tests"""
@@ -369,7 +299,7 @@ def compliance(session):
369299
session.skip("Compliance tests were not found")
370300

371301
session.install("--pre", "grpcio")
372-
302+
session.install("--pre", "--no-deps", "--upgrade", "sqlalchemy<2.0.0")
373303
session.install(
374304
"mock",
375305
# TODO: Allow latest version of pytest once SQLAlchemy 1.4.28+ is supported.
@@ -400,6 +330,11 @@ def compliance(session):
400330
"--only-rerun=400 Cannot execute DML over a non-existent table",
401331
system_test_folder_path,
402332
*session.posargs,
333+
# To suppress the "Deprecated API features detected!" warning when
334+
# features not compatible with 2.0 are detected, use a value of "1"
335+
env={
336+
"SQLALCHEMY_SILENCE_UBER_WARNING": "1",
337+
},
403338
)
404339

405340

@@ -493,9 +428,7 @@ def prerelease_deps(session):
493428
unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES
494429
session.install(*unit_deps_all)
495430
system_deps_all = (
496-
SYSTEM_TEST_STANDARD_DEPENDENCIES
497-
+ SYSTEM_TEST_EXTERNAL_DEPENDENCIES
498-
+ SYSTEM_TEST_EXTRAS
431+
SYSTEM_TEST_STANDARD_DEPENDENCIES + SYSTEM_TEST_EXTERNAL_DEPENDENCIES
499432
)
500433
session.install(*system_deps_all)
501434

@@ -522,6 +455,7 @@ def prerelease_deps(session):
522455

523456
prerel_deps = [
524457
"protobuf",
458+
"sqlalchemy<2.0.0",
525459
# dependency of grpc
526460
"six",
527461
"googleapis-common-protos",

owlbot.py

Lines changed: 25 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,28 @@
7272
"import re\nimport shutil",
7373
)
7474

75+
7576
s.replace(
7677
["noxfile.py"], "--cov=google", "--cov=sqlalchemy_bigquery",
7778
)
7879

80+
81+
s.replace(
82+
["noxfile.py"],
83+
"\+ SYSTEM_TEST_EXTRAS",
84+
"",
85+
)
86+
87+
88+
s.replace(
89+
["noxfile.py"],
90+
'''"protobuf",
91+
# dependency of grpc''',
92+
'''"protobuf",
93+
"sqlalchemy<2.0.0",
94+
# dependency of grpc''',
95+
)
96+
7997
def place_before(path, text, *before_text, escape=None):
8098
replacement = "\n".join(before_text) + "\n" + text
8199
if escape:
@@ -96,78 +114,6 @@ def place_before(path, text, *before_text, escape=None):
96114
"nox.options.stop_on_first_error = True",
97115
)
98116

99-
prerelease = r'''
100-
@nox.session(python=DEFAULT_PYTHON_VERSION)
101-
def prerelease(session):
102-
session.install(
103-
"--prefer-binary",
104-
"--pre",
105-
"--upgrade",
106-
"alembic",
107-
"geoalchemy2",
108-
"google-api-core",
109-
"google-cloud-bigquery",
110-
"google-cloud-bigquery-storage",
111-
"sqlalchemy",
112-
"shapely",
113-
# These are transitive dependencies, but we'd still like to know if a
114-
# change in a prerelease there breaks this connector.
115-
"google-cloud-core",
116-
"grpcio",
117-
)
118-
session.install(
119-
"freezegun",
120-
"google-cloud-testutils",
121-
"mock",
122-
"psutil",
123-
"pytest",
124-
"pytest-cov",
125-
"pytz",
126-
)
127-
128-
# Because we test minimum dependency versions on the minimum Python
129-
# version, the first version we test with in the unit tests sessions has a
130-
# constraints file containing all dependencies and extras.
131-
with open(
132-
CURRENT_DIRECTORY
133-
/ "testing"
134-
/ f"constraints-{UNIT_TEST_PYTHON_VERSIONS[0]}.txt",
135-
encoding="utf-8",
136-
) as constraints_file:
137-
constraints_text = constraints_file.read()
138-
139-
# Ignore leading whitespace and comment lines.
140-
deps = [
141-
match.group(1)
142-
for match in re.finditer(
143-
r"^\\s*(\\S+)(?===\\S+)", constraints_text, flags=re.MULTILINE
144-
)
145-
]
146-
147-
# We use --no-deps to ensure that pre-release versions aren't overwritten
148-
# by the version ranges in setup.py.
149-
session.install(*deps)
150-
session.install("--no-deps", "-e", ".")
151-
152-
# Print out prerelease package versions.
153-
session.run("python", "-m", "pip", "freeze")
154-
155-
# Run all tests, except a few samples tests which require extra dependencies.
156-
session.run(
157-
"py.test",
158-
"--quiet",
159-
f"--junitxml=prerelease_unit_{session.python}_sponge_log.xml",
160-
os.path.join("tests", "unit"),
161-
)
162-
session.run(
163-
"py.test",
164-
"--quiet",
165-
f"--junitxml=prerelease_system_{session.python}_sponge_log.xml",
166-
os.path.join("tests", "system"),
167-
)
168-
169-
170-
'''
171117

172118
# Maybe we can get rid of this when we don't need pytest-rerunfailures,
173119
# which we won't need when BQ retries itself:
@@ -189,7 +135,7 @@ def compliance(session):
189135
session.skip("Compliance tests were not found")
190136
191137
session.install("--pre", "grpcio")
192-
138+
session.install("--pre", "--no-deps", "--upgrade", "sqlalchemy<2.0.0")
193139
session.install(
194140
"mock",
195141
# TODO: Allow latest version of pytest once SQLAlchemy 1.4.28+ is supported.
@@ -220,6 +166,11 @@ def compliance(session):
220166
"--only-rerun=400 Cannot execute DML over a non-existent table",
221167
system_test_folder_path,
222168
*session.posargs,
169+
# To suppress the "Deprecated API features detected!" warning when
170+
# features not compatible with 2.0 are detected, use a value of "1"
171+
env={
172+
"SQLALCHEMY_SILENCE_UBER_WARNING": "1",
173+
},
223174
)
224175
225176
@@ -229,7 +180,7 @@ def compliance(session):
229180
"noxfile.py",
230181
"@nox.session(python=DEFAULT_PYTHON_VERSION)\n"
231182
"def cover(session):",
232-
prerelease + compliance,
183+
compliance,
233184
escape="()",
234185
)
235186

testing/constraints-3.9.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
sqlalchemy>=1.4.13
1+
sqlalchemy>=1.4.13,<2.0.0

0 commit comments

Comments
 (0)