fix: wrap raw SQL in text() in test_history.py for SQLAlchemy 2.x - #10
Merged
Conversation
Three s.execute() calls passed raw strings directly instead of wrapping them in sqlalchemy.text(). SQLAlchemy 1.4 (installed locally) only warns about this; SQLAlchemy 2.x — which CI resolves to since pyproject.toml pins sqlalchemy to "*" — raises ArgumentError and fails the test. Verified against SQLAlchemy 2.0.51 in an isolated venv: these 3 tests plus the other 2 new test files (32 tests total) and the full 342-test suite all pass. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
leochong
force-pushed
the
fix/history-tests-sqlalchemy2-text
branch
from
August 8, 2026 20:53
9343cd8 to
27d16b1
Compare
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
main) failed withsqlalchemy.exc.ArgumentError: Textual SQL expression ... should be explicitly declared as text(...)on 2 tests intests/test_history.py.s.execute()calls passed raw Python strings instead of wrapping them insqlalchemy.text().pyproject.tomlpinssqlalchemy = "*"(unconstrained), so CI's plainpip installresolves to SQLAlchemy 2.x, which raisesArgumentErrorfor this. My local dev env had SQLAlchemy 1.4.54 installed, which only emits aRemovedIn20Warning— that's why this wasn't caught before merging Add migration state tracking (--status, --history, --promote, --record-rollback) #8.text(), matching the convention already used everywhere else in this file and in the sibling test files.Test plan
test_history.py— 17/17 passedtest_command_promote.py+test_command_rollback_tracking.py— 15/15 passedtests/, excluding characterization) — 342 passed, 2 skipped, no other SQLAlchemy 2.x issues found anywhere else in the codebase🤖 Generated with Claude Code