Skip to content

fix: port job database code to SQLAlchemy 2.0 - #1

Merged
ThHanke merged 2 commits into
mainfrom
fix/sqlalchemy-2-db
Nov 17, 2026
Merged

ThHanke merged 2 commits into
mainfrom
fix/sqlalchemy-2-db

Conversation

@ThHanke

@ThHanke ThHanke commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

CKAN 2.12 ships SQLAlchemy 2.x, which removed APIs this module still used (the same code was copied into ckanext-fuseki, where queuing a job failed with "Invalid argument(s) 'convert_unicode' sent to create_engine()").

  • create_engine: drop convert_unicode.
  • MetaData(): no longer bound to an engine.
  • _update_job and the log handler wrote on a plain connection, which is no longer committed automatically; use engine.begin().
  • Rows no longer support string indexing or dict(row); use row._mapping.
  • Log handler: only swallow Exception instead of a bare except.

Verified with SQLAlchemy 2.0.51 against SQLite: add job, metadata, log records, complete/error/failed-to-post and lookup.

Thomas Hanke added 2 commits November 16, 2026 14:38
CKAN 2.12 ships SQLAlchemy 2.x, which removed APIs this module still used
(the same code was copied into ckanext-fuseki, where queuing a job failed
with "Invalid argument(s) 'convert_unicode' sent to create_engine()").

- create_engine: drop convert_unicode.
- MetaData(): no longer bound to an engine.
- _update_job and the log handler wrote on a plain connection, which is
  no longer committed automatically; use engine.begin().
- Rows no longer support string indexing or dict(row); use row._mapping.
- Log handler: only swallow Exception instead of a bare except.

Verified with SQLAlchemy 2.0.51 against SQLite: add job, metadata, log
records, complete/error/failed-to-post and lookup.
Resolve StoringHandler.emit: keep engine.begin() (SQLAlchemy 2 does not
autocommit, so main's connect()/execute() never persisted log records) and
keep main's stderr report when the write fails.
@ThHanke
ThHanke merged commit 4d3675b into main Nov 17, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant