MCPcopy Create free account
hub / github.com/sqlalchemy/sqlalchemy / like

Method like

lib/sqlalchemy/sql/operators.py:698–724  ·  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

696 return self.reverse_operate(concat_op, other)
697
698 def like(
699 self, other: Any, escape: Optional[str] = None
700 ) -> ColumnOperators:
701 r"""Implement the ``like`` operator.
702
703 In a column context, produces the expression:
704
705 .. sourcecode:: sql
706
707 a LIKE other
708
709 E.g.::
710
711 stmt = select(sometable).where(sometable.c.column.like("%foobar%"))
712
713 :param other: expression to be compared
714 :param escape: optional escape character, renders the ``ESCAPE``
715 keyword, e.g.::
716
717 somecolumn.like("foo/%bar", escape="/")
718
719 .. seealso::
720
721 :meth:`.ColumnOperators.ilike`
722
723 """
724 return self.operate(like_op, other, escape=escape)
725
726 def ilike(
727 self, other: Any, escape: Optional[str] = None

Callers 15

like_opFunction · 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
test_like_escapeMethod · 0.45
test_ilikeMethod · 0.45

Calls 1

operateMethod · 0.95

Tested by 15

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
test_ilikeMethod · 0.36