Start here
The safe first move
Replace session.query(Model).get(primary_key) with session.get(Model, primary_key).
Stop before automation when: Query chains before .get(...). Non-primary-key lookups.
Target shape
user = session.get(User, user_id)
SQLAlchemy Migration Guides
Replace Query.get warnings with Session.get in the safe primary-key lookup subset.
Start here
Replace session.query(Model).get(primary_key) with session.get(Model, primary_key).
Stop before automation when: Query chains before .get(...). Non-primary-key lookups.
user = session.get(User, user_id)
Repo fit check
Run the matching scanner locally first. Read the free findings and manual alternatives; consider paid cleanup only if supported patterns repeat enough to justify the price.
Example scan summary
supported_findings: 38
manual_review_findings: 6
files_uploaded: 0
confidence: reviewable
Why this page exists
Query.get is a low-risk cleanup when the call is a direct primary-key lookup.
Direct answer
Replace session.query(Model).get(primary_key) with session.get(Model, primary_key).
Example
user = session.query(User).get(user_id)
user = session.get(User, user_id)
Decision path
Start with the free scan, inspect the report, and only move to the cleanup pack if the repo has repeated supported patterns that are still expensive to fix by hand.
Before checkout
Price: $299.99 per team.
Use the exact-problem guides as a triage layer, then decide whether the repo is inside the supported subset.
FAQ
Replace session.query(Model).get(primary_key) with session.get(Model, primary_key).
Automate only the supported subset: Direct Query.get primary-key lookup rewrites. Warning cleanup that keeps result shape stable. Report entries for unsupported chained Query.get cases. Keep these cases in manual review: Query chains before .get(...). Non-primary-key lookups. Custom query properties or session wrappers.
Use SQLAlchemy 1.4 to 2.0 Migration Cleanup Pack only when this pattern repeats across enough files that manual cleanup is still costly. Use the free report and upstream guide to evaluate fit. Buy only if repeated supported edits justify the price; no paid assessment is required.
Purchase fit
One matching page is not enough by itself. Run the local scan, then buy only when the same supported pattern appears often enough to matter.
Replace session.query(...).get(...), Session.query migration guide, Fix engine.execute(...) removal, Clean up joinedload_all(...), Fix select([..]) list syntax, Replace string join paths, Replace string loader options, Move sqlalchemy.ext.declarative imports to sqlalchemy.orm
View all SQLAlchemy 1.4 to 2.0 Migration Cleanup Pack guides