Skip to content

Commit

Permalink
Set cache_ok=True for CIText type
Browse files Browse the repository at this point in the history
Fixes mahmoudimus#25, an SAWarning when performing queries with CIText columns
  • Loading branch information
evrys authored Jun 1, 2022
1 parent ac2215c commit 02e37ed
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions citext/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@


class CIText(types.Concatenable, types.UserDefinedType):
# Tell SQLAlchemy that CIText strings are safe to use as cache keys (like regular strings)
# https://docs.sqlalchemy.org/en/14/core/custom_types.html#sqlalchemy.types.TypeDecorator.cache_ok
cache_ok = True

# This is copied from the `literal_processor` of sqlalchemy's own `String`
# type.
def literal_processor(self, dialect):
Expand Down

0 comments on commit 02e37ed

Please sign in to comment.