On Wednesday, June 10, 2015 at 9:00:13 PM UTC-7, Michael Bayer wrote:
>
>  
>
> On 6/10/15 10:32 PM, Eric Ogren wrote:
>  
> Hello, 
> <snip>
>
> Is there a good way to leverage the .any() filter in MySQL? I can sort of 
> work around this by doing something like: 
>
>  s.query(ThreadIdentifier).filter(ThreadIdentifier.identifier == 
> 'foo').one().thread
>  
>  but the code is much trickier to read.
>  
>
> To leverage any() in MySQL, not that I know of, unless the number of rows 
> being scanned is very small and/or MySQL/MariaDB eventually improves upon 
> this.  So much for SQL being "declarative".
>
> To get your JOIN, do that with the query.  Use a join():
>
> s.query(Thread).join(Thread.identifiers).filter(ThreadIdentifier.identifier 
> == 'foo')
>
>
>
>
Makes sense -- not sure why I didn't think of that. Thank you for the help!
 

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

Reply via email to