You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
support direct mult-dimensional ARRAY access based on explicit dimensions #3487
see also #3499, where we have similar issues with JSON. We need to determine for indexable types a clear picture for what type the return values should be. For ARRAY it is fairly simple. For a JSON, perhaps some option to specify a schema, though that seems quite ominous.
The Postgresql :class:.postgresql.ARRAY type now supports multidimensional
indexed access, e.g. expressions such as somecol[5][6] without
any need for explicit casts or type coercions, provided
that the :paramref:.postgresql.ARRAY.dimensions parameter is set to the
desired number of dimensions. fixes support direct mult-dimensional ARRAY access based on explicit dimensions #3487
The return type for the :class:.postgresql.JSON and :class:.postgresql.JSONB
when using indexed access has been fixed to work like Postgresql itself,
and returns an expression that itself is of type :class:.postgresql.JSON
or :class:.postgresql.JSONB. Previously, the accessor would return
:class:.NullType which disallowed subsequent JSON-like operators to be
used. part of fixes add full control for return type under PG ARRAY, HSTORE, JSON, JSONB indexed (element) access #3503
The :class:.postgresql.JSON, :class:.postgresql.JSONB and
:class:.postgresql.HSTORE datatypes now allow full control over the
return type from an indexed textual access operation, either column[someindex].astext
for a JSON type or column[someindex] for an HSTORE type,
via the :paramref:.postgresql.JSON.astext_type and
:paramref:.postgresql.HSTORE.text_type parameters. also part of fixes add full control for return type under PG ARRAY, HSTORE, JSON, JSONB indexed (element) access #3503
The :attr:.postgresql.JSON.Comparator.astext modifier no longer
calls upon :meth:.ColumnElement.cast implicitly, as PG's JSON/JSONB
types allow cross-casting between each other as well. Code that
makes use of :meth:.ColumnElement.cast on JSON indexed access,
e.g. col[someindex].cast(Integer), will need to be changed
to call :attr:.postgresql.JSON.Comparator.astext explicitly. This is
part of the refactor in references add full control for return type under PG ARRAY, HSTORE, JSON, JSONB indexed (element) access #3503 for consistency in operator
use.
Activity
sqlalchemy-bot commentedon Jul 15, 2015
Michael Bayer (@zzzeek) wrote:
Note that a pg ARRAY with no explicit dimensions is N-dimensional, and I'm not sure if that can be handled without explicit casts.
Below, please use the ARRAY_D workaround for now.
sqlalchemy-bot commentedon Jul 15, 2015
Changes by Michael Bayer (@zzzeek):
sqlalchemy-bot commentedon Jul 15, 2015
Changes by Michael Bayer (@zzzeek):
sqlalchemy-bot commentedon Jul 15, 2015
Changes by Michael Bayer (@zzzeek):
sqlalchemy-bot commentedon Jul 15, 2015
Michael Bayer (@zzzeek) wrote:
→ eed8bce
sqlalchemy-bot commentedon Jul 24, 2015
Michael Bayer (@zzzeek) wrote:
see also #3499, where we have similar issues with JSON. We need to determine for indexable types a clear picture for what type the return values should be. For ARRAY it is fairly simple. For a JSON, perhaps some option to specify a schema, though that seems quite ominous.
sqlalchemy-bot commentedon Aug 11, 2015
Michael Bayer (@zzzeek) wrote:
all of the above is working as of https://bitbucket.org/zzzeek/sqlalchemy/src/39adada25d71ac33d2a468cc19eb61c0fdfa9280/?at=ticket_3499, not merged yet
sqlalchemy-bot commentedon Aug 17, 2015
Michael Bayer (@zzzeek) wrote:
.postgresql.ARRAY,:class:
.postgresql.JSONand :class:.postgresql.HSTOREis nowset to False, which allows these types to be fetchable in ORM
queries that include entities within the row. fixes flip off the "hashable" flag for PG unhashable types: JSON, JSONB (already has it), ARRAY. also NULLTYPE, add/test type_coerce as well as cast() to indexed access #3499
.postgresql.ARRAYtype now supports multidimensionalindexed access, e.g. expressions such as
somecol[5][6]withoutany need for explicit casts or type coercions, provided
that the :paramref:
.postgresql.ARRAY.dimensionsparameter is set to thedesired number of dimensions. fixes support direct mult-dimensional ARRAY access based on explicit dimensions #3487
.postgresql.JSONand :class:.postgresql.JSONBwhen using indexed access has been fixed to work like Postgresql itself,
and returns an expression that itself is of type :class:
.postgresql.JSONor :class:
.postgresql.JSONB. Previously, the accessor would return:class:
.NullTypewhich disallowed subsequent JSON-like operators to beused. part of fixes add full control for return type under PG ARRAY, HSTORE, JSON, JSONB indexed (element) access #3503
.postgresql.JSON, :class:.postgresql.JSONBand:class:
.postgresql.HSTOREdatatypes now allow full control over thereturn type from an indexed textual access operation, either
column[someindex].astextfor a JSON type or
column[someindex]for an HSTORE type,via the :paramref:
.postgresql.JSON.astext_typeand:paramref:
.postgresql.HSTORE.text_typeparameters. also part of fixes add full control for return type under PG ARRAY, HSTORE, JSON, JSONB indexed (element) access #3503.postgresql.JSON.Comparator.astextmodifier no longercalls upon :meth:
.ColumnElement.castimplicitly, as PG's JSON/JSONBtypes allow cross-casting between each other as well. Code that
makes use of :meth:
.ColumnElement.caston JSON indexed access,e.g.
col[someindex].cast(Integer), will need to be changedto call :attr:
.postgresql.JSON.Comparator.astextexplicitly. This ispart of the refactor in references add full control for return type under PG ARRAY, HSTORE, JSON, JSONB indexed (element) access #3503 for consistency in operator
use.
→ ceeb033
sqlalchemy-bot commentedon Aug 17, 2015
Changes by Michael Bayer (@zzzeek):