summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/dialects/postgresql/base.py
diff options
context:
space:
mode:
authorFederico Caselli <cfederico87@gmail.com>2020-09-02 23:46:06 +0200
committerMike Bayer <mike_mp@zzzcomputing.com>2020-09-08 17:13:48 -0400
commite8600608669d90c4a6385b312d271aed63eb5854 (patch)
treeef984a01c536b2c81d2283b3ca5d9f4395f41dd0 /lib/sqlalchemy/dialects/postgresql/base.py
parent0d56a62f721ee6c91d8a8b6a407b959c9215b3b6 (diff)
downloadsqlalchemy-e8600608669d90c4a6385b312d271aed63eb5854.tar.gz
Update select usage to use the new 1.4 format
This change includes mainly that the bracketed use within select() is moved to positional, and keyword arguments are removed from calls to the select() function. it does not yet fully address other issues such as keyword arguments passed to the table.select(). Additionally, allows False / None to both be considered as "disable" for all of select.correlate(), select.correlate_except(), query.correlate(), which establishes consistency with passing of ``False`` for the legact select(correlate=False) argument. Change-Id: Ie6c6e6abfbd3d75d4c8de504c0cf0159e6999108
Diffstat (limited to 'lib/sqlalchemy/dialects/postgresql/base.py')
-rw-r--r--lib/sqlalchemy/dialects/postgresql/base.py14
1 files changed, 6 insertions, 8 deletions
diff --git a/lib/sqlalchemy/dialects/postgresql/base.py b/lib/sqlalchemy/dialects/postgresql/base.py
index 84247d046..e40a730c5 100644
--- a/lib/sqlalchemy/dialects/postgresql/base.py
+++ b/lib/sqlalchemy/dialects/postgresql/base.py
@@ -572,7 +572,7 @@ SQLAlchemy makes available the PostgreSQL ``@@`` operator via the
method on any textual column expression.
On a PostgreSQL dialect, an expression like the following::
- select([sometable.c.text.match("search string")])
+ select(sometable.c.text.match("search string"))
will emit to the database::
@@ -582,9 +582,7 @@ The PostgreSQL text search functions such as ``to_tsquery()``
and ``to_tsvector()`` are available
explicitly using the standard :data:`.func` construct. For example::
- select([
- func.to_tsvector('fat cats ate rats').match('cat & rat')
- ])
+ select(func.to_tsvector('fat cats ate rats').match('cat & rat'))
Emits the equivalent of::
@@ -594,7 +592,7 @@ The :class:`_postgresql.TSVECTOR` type can provide for explicit CAST::
from sqlalchemy.dialects.postgresql import TSVECTOR
from sqlalchemy import select, cast
- select([cast("some text", TSVECTOR)])
+ select(cast("some text", TSVECTOR))
produces a statement equivalent to::
@@ -615,7 +613,7 @@ In order to provide for this explicit query planning, or to use different
search strategies, the ``match`` method accepts a ``postgresql_regconfig``
keyword argument::
- select([mytable.c.id]).where(
+ select(mytable.c.id).where(
mytable.c.title.match('somestring', postgresql_regconfig='english')
)
@@ -627,7 +625,7 @@ Emits the equivalent of::
One can also specifically pass in a `'regconfig'` value to the
``to_tsvector()`` command as the initial argument::
- select([mytable.c.id]).where(
+ select(mytable.c.id).where(
func.to_tsvector('english', mytable.c.title )\
.match('somestring', postgresql_regconfig='english')
)
@@ -927,7 +925,7 @@ is not available yet in sqlalchemy, however the
:func:`_expression.literal_column` function with the name of the table may be
used in its place::
- select(['*']).select_from(func.my_function(literal_column('my_table')))
+ select('*').select_from(func.my_function(literal_column('my_table')))
Will generate the SQL::