MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / like

Method like

lib/sqlalchemy/sql/operators.py:898–924  ·  view source on GitHub ↗

r"""Implement the ``like`` operator. In a column context, produces the expression: .. sourcecode:: sql a LIKE other E.g.:: stmt = select(sometable).where(sometable.c.column.like("%foobar%")) :param other: expression to be compared

(
        self, other: Any, escape: Optional[str] = None
    )

Source from the content-addressed store, hash-verified

896 return self.reverse_operate(concat_op, other)
897
898 def like(
899 self, other: Any, escape: Optional[str] = None
900 ) -> ColumnOperators:
901 r"""Implement the ``like`` operator.
902
903 In a column context, produces the expression:
904
905 .. sourcecode:: sql
906
907 a LIKE other
908
909 E.g.::
910
911 stmt = select(sometable).where(sometable.c.column.like("%foobar%"))
912
913 :param other: expression to be compared
914 :param escape: optional escape character, renders the ``ESCAPE``
915 keyword, e.g.::
916
917 somecolumn.like("foo/%bar", escape="/")
918
919 .. seealso::
920
921 :meth:`.ColumnOperators.ilike`
922
923 """
924 return self.operate(like_op, other, escape=escape)
925
926 def ilike(
927 self, other: Any, escape: Optional[str] = None

Callers 15

like_opFunction · 0.45
test_invalid_opMethod · 0.45
test_add_in_classesMethod · 0.45
test_like_1Method · 0.45
test_like_2Method · 0.45
test_like_3Method · 0.45
test_like_4Method · 0.45
test_likeMethod · 0.45

Calls 1

operateMethod · 0.95

Tested by 15

test_invalid_opMethod · 0.36
test_add_in_classesMethod · 0.36
test_like_1Method · 0.36
test_like_2Method · 0.36
test_like_3Method · 0.36
test_like_4Method · 0.36
test_likeMethod · 0.36
test_like_escapeMethod · 0.36