Cyrillic problem in func.lower in SQLAlechemy

In Cyrillic, func.lower is processed in SQLAlchemy with an error.

Sample code:

category_in_db = db.sessionquery(Category)filter_by(user_id=user_id)
filter(func.lower(, type_=String) == category_name.lower())first()

Two expressions are compared. Let’s say there is a value in the database Dream… If it is of such a plan, when capital letters are saved in the database, then when comparing Sleep == sleep… They will not be equal to each other.

What to do? Enter with a lowercase letter if comparisons in Cyrillic are required. I did not find any other options. You can of course make super-crutches and compare with all values, but this is crazy.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *