Skip to content

Update sqlalchemy version to 2.x#468

Open
ahsentekd wants to merge 1 commit intoRhinoSecurityLabs:masterfrom
ahsentekd:master
Open

Update sqlalchemy version to 2.x#468
ahsentekd wants to merge 1 commit intoRhinoSecurityLabs:masterfrom
ahsentekd:master

Conversation

@ahsentekd
Copy link

Hello, the sqlalchemy version is outdated so i need to keep update.

@nobodynate
Copy link
Contributor

Thank you for this PR! After reviewing the codebase, here's what needs to be done for a complete SQLAlchemy 2.0 upgrade:

Required changes:

  1. Update pyproject.toml - Change SQLAlchemy = "~1.3.0" to SQLAlchemy = "^2.0.0"

  2. Run poetry lock - Regenerate the lock file (don't manually edit requirements.txt)

  3. Migrate legacy query() API - SQLAlchemy 2.0 deprecates the query API. Need to update 14 occurrences:

    • session.query(Model).filter(...).all()session.scalars(select(Model).where(...)).all()
    • session.query(Model).scalar()session.scalars(select(Model)).first()
    • Add select import: from sqlalchemy import select
  4. Rebase onto current master - Resolve conflicts with recently merged PRs

Files to update:

  • pyproject.toml (SQLAlchemy version)
  • pacu/main.py (9 query calls + add select import)
  • pacu/core/models.py (3 query calls + add select import)
  • tests/test_pacu_session.py (1 query call)
  • conftest.py (1 query call)

The codebase doesn't use other deprecated features (autocommit, engine.execute), so the migration is straightforward. Let us know if you'd like help with the migration!

@nobodynate nobodynate added help wanted Extra attention is needed dependencies Pull requests that update a dependency file labels Feb 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file help wanted Extra attention is needed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants