Closed
Description
Describe the use case
The existing documentation for these methods only has examples using strings. The examples are not applicable to VARBINARY columns where the queries fail.
- ColumnOperators.contains()
- ColumnOperators.endswith()
- ColumnOperators.like()
- ColumnOperators.startswith()
Databases / Backends / Drivers targeted
N/A
Example Use
The respective sections of documentation should be updated with edited text equivalent to the suggestions below:
- When byte strings are stored in the database columns (eg. VARBINARY), you should use standard SQL wildcards with the
like()
method to represent.contains()
:
stmt = select(sometable).where(
sometable.like(func.concat(func.concat('%', 'foobar'.encode()), '%'))
)
Using .contains()
with the same concatenations will produce an equivalent result.
- When byte strings are stored in the database columns (eg. VARBINARY), you should use standard SQL wildcards with the
like()
method to represent.startswith()
:
stmt = select(sometable).where(
sometable.like(func.concat(func.concat('foobar'.encode()), '%'))
)
Using .startswith()
with the same concatenations will produce an equivalent result.
- When byte strings are stored in the database columns (eg. VARBINARY), you should use standard SQL wildcards with the
like()
method to represent.endswith()
:
stmt = select(sometable).where(
sometable.like(func.concat(func.concat('%', 'foobar'.encode())))
)
Using .endswith()
with the same concatenations will produce an equivalent result.
Additional context
N/A