How to use the pypika.terms.BasicCriterion function in PyPika

To help you get started, we’ve selected a few PyPika examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github kayak / pypika / pypika / terms.py View on Github external
def __ne__(self, other):
        return BasicCriterion(Equality.ne, self, self.wrap_constant(other))
github kayak / pypika / pypika / terms.py View on Github external
def __le__(self, other):
        return BasicCriterion(Equality.lte, self, self.wrap_constant(other))
github kayak / pypika / pypika / terms.py View on Github external
def __lt__(self, other):
        return BasicCriterion(Equality.lt, self, self.wrap_constant(other))
github kayak / pypika / pypika / terms.py View on Github external
def has_any_keys(self, other: Iterable):
        return BasicCriterion(JSONOperators.HAS_ANY_KEYS, self, Array(*other))
github kayak / pypika / pypika / terms.py View on Github external
def __gt__(self, other):
        return BasicCriterion(Equality.gt, self, self.wrap_constant(other))
github kayak / pypika / pypika / terms.py View on Github external
def not_ilike(self, expr):
        return BasicCriterion(Matching.not_ilike, self, self.wrap_constant(expr))
github kayak / pypika / pypika / terms.py View on Github external
def __ge__(self, other):
        return BasicCriterion(Equality.gte, self, self.wrap_constant(other))
github tortoise / tortoise-orm / tortoise / filters.py View on Github external
value = self.value.replace(quote_char, quote_char * 2)
        if dialect == "mysql":
            value = value.replace("\\", "\\\\")
        return format_quotes(value, quote_char)
    if isinstance(self.value, bool):
        return str.lower(str(self.value))
    if self.value is None:
        return "null"
    return str(self.value)


ValueWrapper.get_value_sql = get_value_sql
##############################################################################


class Like(BasicCriterion):  # type: ignore
    def __init__(self, left, right, alias=None, escape=" ESCAPE '\\'") -> None:
        """
        A Like that supports an ESCAPE clause
        """
        super().__init__(" LIKE ", left, right, alias=alias)
        self.escape = escape

    def get_sql(self, quote_char='"', with_alias=False, **kwargs):
        sql = "{left}{comparator}{right}{escape}".format(
            comparator=self.comparator,
            left=self.left.get_sql(quote_char=quote_char, **kwargs),
            right=self.right.get_sql(quote_char=quote_char, **kwargs),
            escape=self.escape,
        )
        if with_alias and self.alias:  # pragma: nocoverage
            return '{sql} "{alias}"'.format(sql=sql, alias=self.alias)
github kayak / pypika / pypika / terms.py View on Github external
def has_keys(self, other: Iterable):
        return BasicCriterion(JSONOperators.HAS_KEYS, self, Array(*other))
github kayak / pypika / pypika / terms.py View on Github external
def __eq__(self, other):
        return BasicCriterion(Equality.eq, self, self.wrap_constant(other))