Skip to content

Conversation

@spatel033
Copy link
Contributor

@spatel033 spatel033 commented Dec 5, 2025

Rob has already opened a PR query recording: also record bind_key of query in flask-sqlalchemy to test bind_key. This change is an alternative way to validate the bind_key in unit tests when we use db.bulk_session.

…uery

Replace flask_sqlalchemy's get_recorded_queries with SQLAlchemy event listeners that capture the bind_key for each engine. Add QueryInfo dataclass with statement, parameters, and bind_key fields. This enables tests to verify that queries are being routed to the correct database when using db.session_bulk.
This is an alternative to the existing PR pallets-eco/flask-sqlalchemy#1403 for flask-sqlalchemy.
@spatel033 spatel033 changed the title Add bindkey queryrecorder Add bindkey to queryrecorder Dec 5, 2025
Copy link
Member

@risicle risicle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes please

@spatel033 spatel033 merged commit a412bdd into main Dec 8, 2025
8 checks passed
@spatel033 spatel033 deleted the add-bindkey-queryrecorder branch December 8, 2025 13:39
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.

3 participants