On 4/27/15 5:56 AM, Adrian wrote:
In my user have I have an association proxy so I can access all email addresses of the user via User.all_emails. For a simple exact search I simply .filter(User.all_emails.contains('[email protected]')).

Is it also possible to use e.g. a LIKE match (besides manually joining the Emails table and using Email.email.like(...))?

the has() / any()  operators can allow this:


User.all_emails.any(Email.email.like('%foo%'))


it will produce an EXISTS subquery expression, which is not as efficient in SQL as a regular JOIN.




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

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