How to use the pypika.functions.Upper 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 tortoise / tortoise-orm / tortoise / backends / mysql / executor.py View on Github external
def mysql_insensitive_exact(field: Term, value: str) -> Criterion:
    return functions.Upper(functions.Cast(field, SqlTypes.CHAR)).eq(functions.Upper(str(value)))
github tortoise / tortoise-orm / tortoise / filters.py View on Github external
def insensitive_ends_with(field: Term, value: str) -> Criterion:
    return Like(Upper(field), field.wrap_constant(Upper(f"%{escape_like(value)}")))
github tortoise / tortoise-orm / tortoise / filters.py View on Github external
def insensitive_starts_with(field: Term, value: str) -> Criterion:
    return Like(Upper(field), field.wrap_constant(Upper(f"{escape_like(value)}%")))
github tortoise / tortoise-orm / tortoise / functions.py View on Github external
Converts text to lower case.

    :samp:`Lower("{FIELD_NAME}")`
    """

    database_func = functions.Lower


class Upper(Function):
    """
    Converts text to upper case.

    :samp:`Upper("{FIELD_NAME}")`
    """

    database_func = functions.Upper


##############################################################################
# Aggregate functions
##############################################################################


class Count(Aggregate):
    """
    Counts the no of entries for that column.

    :samp:`Count("{FIELD_NAME}")`
    """

    database_func = functions.Count
github tortoise / tortoise-orm / tortoise / backends / mysql / executor.py View on Github external
def mysql_insensitive_starts_with(field: Term, value: str) -> Criterion:
    return Like(
        functions.Upper(functions.Cast(field, SqlTypes.CHAR)),
        functions.Upper(StrWrapper(f"{escape_like(value)}%")),
        escape="",
    )
github tortoise / tortoise-orm / tortoise / filters.py View on Github external
def insensitive_exact(field: Term, value: str) -> Criterion:
    return Upper(field).eq(Upper(str(value)))