diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2022-05-18 16:06:29 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2022-05-22 15:25:58 -0400 |
commit | 719197dd9399b4436aeaba3e2f44761292036ad6 (patch) | |
tree | e96ab9de424d9faa5add9105260fd5471cdf6fa6 /test/ext/mypy/plain_files/sql_operations.py | |
parent | 0620614f95f62f35396e63c636cae98a0759f3ab (diff) | |
download | sqlalchemy-719197dd9399b4436aeaba3e2f44761292036ad6.tar.gz |
use plainto_tsquery for PG match
The :meth:`.Operators.match` operator now uses ``plainto_tsquery()`` for
PostgreSQL full text search, rather than ``to_tsquery()``. The rationale
for this change is to provide better cross-compatibility with match on
other database backends. Full support for all PostgreSQL full text
functions remains available through the use of :data:`.func` in
conjunction with :meth:`.Operators.bool_op` (an improved version of
:meth:`.Operators.op` for boolean operators).
Additional doc updates here apply to 1.4 so will backport these
out to a separate commit.
Fixes: #7086
Change-Id: I1946075daf5d9c558e85f73f1bf852604b3b1b8c
Diffstat (limited to 'test/ext/mypy/plain_files/sql_operations.py')
-rw-r--r-- | test/ext/mypy/plain_files/sql_operations.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/test/ext/mypy/plain_files/sql_operations.py b/test/ext/mypy/plain_files/sql_operations.py index 6b06535bf..b4d0bd006 100644 --- a/test/ext/mypy/plain_files/sql_operations.py +++ b/test/ext/mypy/plain_files/sql_operations.py @@ -2,6 +2,7 @@ import typing from sqlalchemy import Boolean from sqlalchemy import column +from sqlalchemy import func from sqlalchemy import Integer from sqlalchemy import select from sqlalchemy import String @@ -35,6 +36,9 @@ expr8 = c2 + 10 stmt = select(column("q")).where(lambda: column("g") > 5).where(c2 == 5) +expr9 = c1.bool_op("@@")(func.to_tsquery("some & query")) + + if typing.TYPE_CHECKING: # as far as if this is ColumnElement, BinaryElement, SQLCoreOperations, @@ -69,3 +73,6 @@ if typing.TYPE_CHECKING: # EXPECTED_RE_TYPE: sqlalchemy..*ColumnElement\[builtins.int.?\] reveal_type(expr8) + + # EXPECTED_TYPE: BinaryExpression[bool] + reveal_type(expr9) |