mate_query.string module¶
Module implementing an enhanced string column type for SQLAlchemy with a support for regular expression operators in Postgres and SQLite.
http://xion.io/post/code/sqlalchemy-regex-filters.html https://gist.github.com/Xion/204ddbd020f1a4275a53
- class mate_query.string.StringComparator(expression)¶
Bases:
sqlalchemy.ext.hybrid.ComparatorA custom comparator for strings supporting a
re_matchoperation.- operate(op: Any, other: Any, **_kwargs: Any) Any¶
Operate on an argument.
This is the lowest level of operation, raises
NotImplementedErrorby default.Overriding this on a subclass can allow common behavior to be applied to all operations. For example, overriding
ColumnOperatorsto applyfunc.lower()to the left and right side:class MyComparator(ColumnOperators): def operate(self, op, other): return op(func.lower(self), func.lower(other))
- prop¶
- property¶
- re_match(other: re.Pattern) mate_query.string._RegexMatchExpression¶
- Parameters
other (re.Pattern) –
- Return type
mate_query.string._RegexMatchExpression