Skip to content

Commit a325590

Browse files
authored
Upgrade SQLAlchemy to version 2 (#3734)
This is part of supporting Python 3.13 (PR #3646), as a prereq to upgrading pandas. # Changed Behaviour Development environments (which have the requirements in `test-requirements.txt` installed) will break and need `pip uninstall sqlalchemy2-stubs` - sqlalchemy packaging does not express a negative/removal requirement against that transitional package. non-parsl user code which happens to use the parsl-installed sqlalchemy might break - for example, see API changes in the test suite in this PR ## Type of change - Code maintenance/cleanup
1 parent ed80dad commit a325590

File tree

5 files changed

+9
-8
lines changed

5 files changed

+9
-8
lines changed

parsl/monitoring/db_manager.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def __init__(self,
7878

7979
def _get_mapper(self, table_obj: Table) -> Mapper:
8080
all_mappers: Set[Mapper] = set()
81-
for mapper_registry in mapperlib._all_registries(): # type: ignore[attr-defined]
81+
for mapper_registry in mapperlib._all_registries():
8282
all_mappers.update(mapper_registry.mappers)
8383
mapper_gen = (
8484
mapper for mapper in all_mappers

parsl/tests/test_monitoring/test_app_names.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def test_app_name(get_app, expected_name, expected_result, tmpd_cwd):
6767
with engine.begin() as connection:
6868

6969
def count_rows(table: str):
70-
result = connection.execute(f"SELECT COUNT(*) FROM {table}")
70+
result = connection.execute(sqlalchemy.text(f"SELECT COUNT(*) FROM {table}"))
7171
(c, ) = result.first()
7272
return c
7373

@@ -81,6 +81,6 @@ def count_rows(table: str):
8181
assert count_rows("try") == 1
8282

8383
# ... and has the expected name.
84-
result = connection.execute("SELECT task_func_name FROM task")
84+
result = connection.execute(sqlalchemy.text("SELECT task_func_name FROM task"))
8585
(c, ) = result.first()
8686
assert c == expected_name

parsl/tests/test_monitoring/test_stdouterr.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ def test_stdstream_to_monitoring(stdx, expected_stdx, stream, tmpd_cwd, caplog):
106106
with engine.begin() as connection:
107107

108108
def count_rows(table: str):
109-
result = connection.execute(f"SELECT COUNT(*) FROM {table}")
109+
result = connection.execute(sqlalchemy.text(f"SELECT COUNT(*) FROM {table}"))
110110
(c, ) = result.first()
111111
return c
112112

@@ -120,7 +120,7 @@ def count_rows(table: str):
120120
assert count_rows("try") == 1
121121

122122
# ... and has the expected name.
123-
result = connection.execute(f"SELECT task_{stream} FROM task")
123+
result = connection.execute(sqlalchemy.text(f"SELECT task_{stream} FROM task"))
124124
(c, ) = result.first()
125125

126126
if isinstance(expected_stdx, str):

setup.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88

99
extras_require = {
1010
'monitoring' : [
11-
'sqlalchemy>=1.4,<2'
11+
# sqlalchemy does not use semantic versioning.
12+
# see https://github.com/sqlalchemy/sqlalchemy/discussions/11391#discussioncomment-9472033
13+
'sqlalchemy>=2,<2.1'
1214
],
1315
'visualization' : [
1416
# this pydot bound is copied from networkx's pyproject.toml,

test-requirements.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@ mpi4py
1414
# sqlalchemy is needed for typechecking, so it's here
1515
# as well as at runtime for optional monitoring execution
1616
# (where it's specified in setup.py)
17-
sqlalchemy>=1.4,<2
18-
sqlalchemy2-stubs
17+
sqlalchemy>=2,<2.1
1918

2019
Sphinx==4.5.0
2120
twine

0 commit comments

Comments
 (0)