[Sqlalchemy-tickets] Issue #3487: Multi-dimensional ARRAY in Postgres aren't correctly supported by
Brought to you by:
zzzeek
|
From: Andrey S. <iss...@bi...> - 2015-07-15 14:41:59
|
New issue 3487: Multi-dimensional ARRAY in Postgres aren't correctly supported by ORM's query builders https://bitbucket.org/zzzeek/sqlalchemy/issues/3487/multi-dimensional-array-in-postgres-arent Andrey Semenov: Here's just an example: ``` #!python weights = Column(ARRAY(DECIMAL(precision=2, asdecimal=False), dimensions=2), nullable=False, default=[]) ``` then in query: ``` #!python CallServiceCampaign.weights[ func.idx(CallServiceCampaign.goods_ids, literal(goods_id)) ][1] != None, ``` produces: ``` #!text NotImplementedError: Operator 'getitem' is not supported on this expression ``` I think this is because https://bitbucket.org/zzzeek/sqlalchemy/src/447ee0af1d2fbb95f2f1244de301f2fe4a87a72f/lib/sqlalchemy/dialects/postgresql/base.py?at=rel_1_0_6#cl-911 doesn't handle `dimensions` parameter and always returns the underlying array's class on the first non-sliced reference. |