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
)
| 366 | |
| 367 | |
| 368 | def 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 | |
| 395 | def between( |
nothing calls this directly
no test coverage detected