Hi, does anyone know of a simple way to apply a (SQL) function to each and 
every query in an ORM model? For example, this article[0] suggests building 
a lower()-based index for emails in order to normalise them, and then using 
lower() every time you search for an email: select * from users where 
lower(email) = lower('person5...@example.com').

Is there a way to define a SA model to be able to do that automatically, 
i.e. to wrap both sides in a function when doing basic queries like get, 
filter and filter_by? Thanks!

Berislav


[0] 
https://hashrocket.com/blog/posts/working-with-email-addresses-in-postgresql

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sqlalchemy/fd8628c5-4f3a-4003-9cb6-56d5da96794d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to