Yes, 'number' is a column, as you surmised.  When I drop that from the path 
it works fine.  The only remaining problem is/was that this ends up loading 
in every field in the child_product table, and this includes a potentially 
massive BSON column (and more).

After looking into this, I've now learned about deferred, defer, undefer, 
loadonly, etc.  This seems to be the correct way to manage this, and it 
appears to be working fine:

q = q.options(sa.orm
              .joinedload("defined_items")
              .joinedload("child_product")
              .load_only("number")
              )

Thanks for pointing me in the right direction!  This page had the info I 
needed:
http://docs.sqlalchemy.org/en/latest/orm/loading_columns.html

Russ


On Thursday, May 21, 2015 at 4:01:16 PM UTC-4, Michael Bayer wrote:
>
>  
>
> On 5/21/15 3:56 PM, Russ wrote:
>  
>  nope.  I'd need a complete, self-contained and succinct example I can 
>> run, thanks
>>
>
>  Ok, thanks.  This is a beefy one so that will be extremely tricky to 
> extract.  I had hoped that the combo of lazy+joined would have been a clear 
> indicator since they are opposite loading strategies.
>  
>
> the word "lazy" there is the name of the field. It is the internal 
> equivalent to the "lazy" argument on relationship:  
>
>
> http://docs.sqlalchemy.org/en/rel_1_0/orm/relationship_api.html?highlight=relationship#sqlalchemy.orm.relationship.params.lazy
>
> that said, here is exactly what will cause your error.     Any of the 
> attribute names "defined_items", "child_product" or "number" are not in 
> fact bound to a relationship(), and instead refer to a Column-mapped 
> attribute.  Looks a lot like "number" here is a Column.  Is that the case?  
> You can't call joinedload for a column attribute.   
>
>
>  

-- 
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 http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to