On Thu, Jul 13, 2017 at 4:37 PM, Shane Carey <shanecare...@gmail.com> wrote:
> When I have single table inheritance, how can I use the new 'inline'
> polymorphic_load feature to only query a subset of child classes?

'inline' polymorphic load is only about using fewer SQL queries to
load attributes on the objects you've already queried for.

>
> for c in s.query(Parent).all():
> print(c)
>
> I've tried adding and removing 'with_polymorphic': '*' from the parent
> class, but it always queries ChildTwo as well
>
> I feel like I need to set something on ChildTwo to tell it not to load, but
> nothing like this is documented

you'd query for ChildOne:

for c in s.query(ChildOne):
  # ...

docs:

http://docs.sqlalchemy.org/en/latest/orm/inheritance_loading.html#loading-single-inheritance



>
> --
> 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 post to this group, send email to sqlalchemy@googlegroups.com.
> Visit this group at https://groups.google.com/group/sqlalchemy.
> For more options, visit https://groups.google.com/d/optout.

-- 
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 post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to