Relative Content

Tag Archive for pythonsqlalchemyorm

How to use SQLAlchemy hybrid_property in where or filter method?

I’m using SQLAlchemy v2 and have two models: User and Transaction. Here, Transaction refers to money transactions between users, not database transactions. I have defined a hybrid property in the User model that calculates the balance for each user based on their incoming and outgoing money transactions. However, I am encountering issues when trying to use this hybrid property in where or filter for querying users based on there balances.