Re: [sqlalchemy] Apply a function to every query

2019-06-14 Thread Berislav Lopac
Thank you Mike! You're right -- I had in mind the latter but used the terminology more suited to the former. Berislav -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper http://www.sqlalchemy.org/ To post example code, please provide an MCVE: Minimal, Complete, and

Re: [sqlalchemy] Apply a function to every query

2019-06-14 Thread Mike Bayer
On Fri, Jun 14, 2019, at 12:30 PM, Jonathan Vanasco wrote: > > > On Friday, June 14, 2019 at 9:33:49 AM UTC-4, Mike Bayer wrote: >> docs for this general idea are at >> https://docs.sqlalchemy.org/en/13/core/custom_types.html#redefining-and-creating-new-operators >> but this is likely a good

Re: [sqlalchemy] Apply a function to every query

2019-06-14 Thread Jonathan Vanasco
On Friday, June 14, 2019 at 9:33:49 AM UTC-4, Mike Bayer wrote: > > docs for this general idea are at > https://docs.sqlalchemy.org/en/13/core/custom_types.html#redefining-and-creating-new-operators > > but this is likely a good example to add > Mike- This is actually a great example to add,

Re: [sqlalchemy] Apply a function to every query

2019-06-14 Thread Mike Bayer
On Fri, Jun 14, 2019, at 6:22 AM, Berislav Lopac wrote: > 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 >

[sqlalchemy] Apply a function to every query

2019-06-14 Thread Berislav Lopac
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