On Jun 21, 5:55 pm, Roy Hyunjin Han <starsareblueandfara...@gmail.com> wrote: > In the documentation you state that the Hybrid Value pattern is useful > for encrypted values.http://www.sqlalchemy.org/docs/orm/extensions/hybrid.html > Is it possible for you to provide an example of the Hybrid Value > pattern as applied to encrypted values? > > In my case, I want to enforce case-insensitive comparison for > encrypted email addresses. The email addresses are currently > encrypted model-side by overriding TypeDecorator to encrypt on the way > in and decrypt on the way out. > > I have tried applying a > column_property(comparator_factory=CaseInsensitiveComparator) but that > applies lower() to the encrypted value instead of the decrypted email > address. > > I thought the Hybrid Value pattern might apply in this case, but the > encrypt() and decrypt() functions I am using are strictly Python > without SQL equivalents. Is there a way to enforce case-insensitive > encrypted comparison from the model?
To answer my own question, I am going to guess that the Hybrid Value pattern for encrypted values refers specifically to database-provided encryption functions such as pgcrypto. If the encryption functions are pure Python, I don't think the Hybrid Value pattern applies. -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.