MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / collate

Function collate

lib/sqlalchemy/sql/_elements_constructors.py:368–392  ·  view source on GitHub ↗

Return the clause ``expression COLLATE collation``. e.g.:: collate(mycolumn, "utf8_bin") produces: .. sourcecode:: sql mycolumn COLLATE utf8_bin The collation expression is also quoted if it is a case sensitive identifier, e.g. contains uppercase characters.

(
    expression: _ColumnExpressionArgument[str], collation: str
)

Source from the content-addressed store, hash-verified

366
367
368def collate(
369 expression: _ColumnExpressionArgument[str], collation: str
370) -> BinaryExpression[str]:
371 """Return the clause ``expression COLLATE collation``.
372
373 e.g.::
374
375 collate(mycolumn, "utf8_bin")
376
377 produces:
378
379 .. sourcecode:: sql
380
381 mycolumn COLLATE utf8_bin
382
383 The collation expression is also quoted if it is a case sensitive
384 identifier, e.g. contains uppercase characters.
385
386 """
387 if isinstance(expression, operators.ColumnOperators):
388 return expression.collate(collation) # type: ignore
389 else:
390 return CollationClause._create_collation_expression(
391 expression, collation
392 )
393
394
395def between(

Callers

nothing calls this directly

Calls 2

collateMethod · 0.45

Tested by

no test coverage detected