diff options
Diffstat (limited to 'lib/sqlalchemy/dialects/postgresql')
-rw-r--r-- | lib/sqlalchemy/dialects/postgresql/array.py | 8 | ||||
-rw-r--r-- | lib/sqlalchemy/dialects/postgresql/base.py | 14 | ||||
-rw-r--r-- | lib/sqlalchemy/dialects/postgresql/ext.py | 4 | ||||
-rw-r--r-- | lib/sqlalchemy/dialects/postgresql/hstore.py | 16 | ||||
-rw-r--r-- | lib/sqlalchemy/dialects/postgresql/json.py | 2 |
5 files changed, 20 insertions, 24 deletions
diff --git a/lib/sqlalchemy/dialects/postgresql/array.py b/lib/sqlalchemy/dialects/postgresql/array.py index 7fd271d52..dacf1e2c2 100644 --- a/lib/sqlalchemy/dialects/postgresql/array.py +++ b/lib/sqlalchemy/dialects/postgresql/array.py @@ -53,9 +53,7 @@ class array(expression.ClauseList, expression.ColumnElement): from sqlalchemy.dialects import postgresql from sqlalchemy import select, func - stmt = select([ - array([1,2]) + array([3,4,5]) - ]) + stmt = select(array([1,2]) + array([3,4,5])) print(stmt.compile(dialect=postgresql.dialect())) @@ -76,11 +74,11 @@ class array(expression.ClauseList, expression.ColumnElement): recursively adding the dimensions of the inner :class:`_types.ARRAY` type:: - stmt = select([ + stmt = select( array([ array([1, 2]), array([3, 4]), array([column('q'), column('x')]) ]) - ]) + ) print(stmt.compile(dialect=postgresql.dialect())) Produces:: 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:: diff --git a/lib/sqlalchemy/dialects/postgresql/ext.py b/lib/sqlalchemy/dialects/postgresql/ext.py index e64920719..7acab0a0a 100644 --- a/lib/sqlalchemy/dialects/postgresql/ext.py +++ b/lib/sqlalchemy/dialects/postgresql/ext.py @@ -22,7 +22,7 @@ class aggregate_order_by(expression.ColumnElement): from sqlalchemy.dialects.postgresql import aggregate_order_by expr = func.array_agg(aggregate_order_by(table.c.a, table.c.b.desc())) - stmt = select([expr]) + stmt = select(expr) would represent the expression:: @@ -34,7 +34,7 @@ class aggregate_order_by(expression.ColumnElement): table.c.a, aggregate_order_by(literal_column("','"), table.c.a) ) - stmt = select([expr]) + stmt = select(expr) Would represent:: diff --git a/lib/sqlalchemy/dialects/postgresql/hstore.py b/lib/sqlalchemy/dialects/postgresql/hstore.py index 4e048feb0..cb89f7c5f 100644 --- a/lib/sqlalchemy/dialects/postgresql/hstore.py +++ b/lib/sqlalchemy/dialects/postgresql/hstore.py @@ -278,14 +278,14 @@ class hstore(sqlfunc.GenericFunction): from sqlalchemy.dialects.postgresql import array, hstore - select([hstore('key1', 'value1')]) - - select([ - hstore( - array(['key1', 'key2', 'key3']), - array(['value1', 'value2', 'value3']) - ) - ]) + select(hstore('key1', 'value1')) + + select( + hstore( + array(['key1', 'key2', 'key3']), + array(['value1', 'value2', 'value3']) + ) + ) .. seealso:: diff --git a/lib/sqlalchemy/dialects/postgresql/json.py b/lib/sqlalchemy/dialects/postgresql/json.py index fbf61dd5f..9ffe9cfe8 100644 --- a/lib/sqlalchemy/dialects/postgresql/json.py +++ b/lib/sqlalchemy/dialects/postgresql/json.py @@ -219,7 +219,7 @@ class JSON(sqltypes.JSON): E.g.:: - select([data_table.c.data['some key'].astext]) + select(data_table.c.data['some key'].astext) .. seealso:: |