On Wed, Aug 28, 2019, at 12:18 PM, Jimmy Jia wrote: > I might just be missing something from the docs here, but is there a way to > raise on attempts to load deferred columns or column properties? > > I'm looking to get behavior equivalent to that of raiseload, to prevent > unintentional N+1 issues when using deferred columns, in the context of an > API server where e.g. endpoints generally only fetch subsets of columns from > the model, especially with regard to potentially complex column expressions. > I believe I can set things up to use load_only to only load the columns I > care about, but I'm concerned about the ergonomics around preventing > unintentional N+1 problems from lazy loading other columns.
Hmmmm, so you want a "raiseload" that works....for columns? What a crazy idea! I am being sarcastic. Unfortunately this very obvious idea is apparently not implemented right now and I even had to check. I've added https://github.com/sqlalchemy/sqlalchemy/issues/4826 for this. there's not really an easy way to do that right now though, sorry. > > Thanks, > Jimmy Jia > > -- > 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/deac3314-fb82-47da-8b78-bff40f633ab2%40googlegroups.com > > <https://groups.google.com/d/msgid/sqlalchemy/deac3314-fb82-47da-8b78-bff40f633ab2%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/86c84e66-18f0-46fe-86e8-ee16254a8434%40www.fastmail.com.