this is a major area of functionality that begins with the "with_loader_criteria" feature: https://docs.sqlalchemy.org/en/20/orm/queryguide/api.html#sqlalchemy.orm.with_loader_criteria
integration to make the criteria automatic follows at https://docs.sqlalchemy.org/en/20/orm/session_events.html#adding-global-where-on-criteria there's an example of this here: https://docs.sqlalchemy.org/en/20/_modules/examples/extending_query/filter_public.html On Mon, Jul 3, 2023, at 11:13 PM, Andrew Martin wrote: > Hello, > > I have a base class I tend to use that includes a Boolean is_deleted field so > that pretty much every object has that available. > > Is there a good pattern for setting a filter on these objects that > automatically adds a WHERE is_deleted = 'false'? > > Or does that just have to be added as a filter on every .query(...) statement? > > > Thanks, > > andrew > > > -- > SQLAlchemy - > The Python SQL Toolkit and Object Relational Mapper > > http://www.sqlalchemy.org/ > > To post example code, please provide an MCVE: Minimal, Complete, and > Verifiable Example. See http://stackoverflow.com/help/mcve for a full > description. > --- > You received this message because you are subscribed to the Google Groups > "sqlalchemy" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to sqlalchemy+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/sqlalchemy/08e50347-ebd9-47a4-b9f8-43b95ebe4e6bn%40googlegroups.com > > <https://groups.google.com/d/msgid/sqlalchemy/08e50347-ebd9-47a4-b9f8-43b95ebe4e6bn%40googlegroups.com?utm_medium=email&utm_source=footer>. -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper http://www.sqlalchemy.org/ To post example code, please provide an MCVE: Minimal, Complete, and Verifiable Example. See http://stackoverflow.com/help/mcve for a full description. --- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/sqlalchemy/7f628110-e543-492d-8acc-82bd577f1477%40app.fastmail.com.