Skip to content

Restore TicketingHandler support for SQLAlchemy engines - #743

Merged
RazerM merged 1 commit into
mainfrom
fix/sqlalchemy-engine
Nov 9, 2026
Merged

RazerM merged 1 commit into
mainfrom
fix/sqlalchemy-engine

Conversation

@RazerM

@RazerM RazerM commented Nov 9, 2026

Copy link
Copy Markdown
Collaborator

TicketingHandler accepts an existing SQLAlchemy Engine in place of a database URL, but since Logbook 0.11.0 a supplied engine could not record tickets. With SQLAlchemy 2 the engine was not recognised and was passed to create_engine(); with SQLAlchemy 1.4 the backend never created the session it writes tickets with, so the first ticket failed.

SQLAlchemyBackend now recognises Engine instances and writes each ticket in an engine.begin() block, as its other methods already do, so it no longer needs a session; the undocumented SQLAlchemyBackend.session attribute is removed. The ticketing documentation shows the engine form.

Since 2e7f183 (2015) only URLs got the session that tickets were
written with. Writing in engine.begin(), as the other methods do, needs
no session.
@RazerM
RazerM added this pull request to stack #745 November 9, 2026 23:25
@codspeed

codspeed Bot commented Nov 9, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

1 warning

⚠️ 3 benchmarks are dominated by system calls

System calls cannot be simulated consistently and are left out of the measure. The reported value understates the real cost. Switch to the Walltime instrument to measure them.

Learn more about system calls

See affected benchmarks

✅ 38 untouched benchmarks


Comparing fix/sqlalchemy-engine (fd8a0d9) with main (a661604)

Open in CodSpeed

@codecov

codecov Bot commented Nov 9, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.46%. Comparing base (a661604) to head (fd8a0d9).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #743      +/-   ##
==========================================
+ Coverage   91.40%   91.46%   +0.06%     
==========================================
  Files          49       49              
  Lines        7931     7936       +5     
  Branches      609      609              
==========================================
+ Hits         7249     7259      +10     
+ Misses        546      542       -4     
+ Partials      136      135       -1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@RazerM
RazerM enabled stacked auto-merge November 9, 2026 23:51
@RazerM
RazerM merged commit 44d326a into main Nov 9, 2026
52 checks passed
@RazerM
RazerM deleted the fix/sqlalchemy-engine branch November 9, 2026 23:59
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