Hi  thanks for your answer

Without filter i did not expect any big difference between query(Keyword) 
or a  hypothetical query(User.keywords)
but I  was thinking it will be nice to   do  something like this session.
query(User.keywords).filter(User ==4)
without joins..

My goal was to have a simple query that return a structure like the 
following
with user and user.keywords 

from sqlalchemy import func
myquery = session.query(UserKeyword.user_id, 
func.array_agg(UserKeyword.keyword_id)).group_by(UserKeyword.user_id).all()

myquery result [(4, [3, 4]), (3, [1, 2])] 

I was thinking associationproxy  could help to simplify the ORM statement 
but it seems I  have to join  

Regards
g


Am Montag, 22. Februar 2016 12:51:55 UTC+1 schrieb gio:
>
> Hi  
> I was trying to use the  associationproxy feature like explained 
> in  the basic example  
> http://docs.sqlalchemy.org/en/latest/orm/extensions/associationproxy.html
> Now my question is:
> Is it possible to do a query like and have as result an array of array of 
> keywords?
>
> session.query(User.keywords) 
>
> Regards
> g
>
>
>
>
>

-- 
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