From cfae9c2eaf0020be8d8acbe104cb693e0fee0796 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Wed, 26 Aug 2015 15:15:45 -0400 Subject: - Added support for the SQL-standard function :class:`.array_agg`, which automatically returns an :class:`.Array` of the correct type and supports index / slice operations. As arrays are only supported on Postgresql at the moment, only actually works on Postgresql. fixes #3132 --- test/sql/test_functions.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'test/sql') diff --git a/test/sql/test_functions.py b/test/sql/test_functions.py index ccc9b2dcd..f080046ff 100644 --- a/test/sql/test_functions.py +++ b/test/sql/test_functions.py @@ -1,8 +1,8 @@ -from sqlalchemy.testing import eq_ +from sqlalchemy.testing import eq_, is_ import datetime from sqlalchemy import func, select, Integer, literal, DateTime, Table, \ Column, Sequence, MetaData, extract, Date, String, bindparam, \ - literal_column + literal_column, Array from sqlalchemy.sql import table, column from sqlalchemy import sql, util from sqlalchemy.sql.compiler import BIND_TEMPLATES @@ -489,6 +489,14 @@ class CompileTest(fixtures.TestBase, AssertsCompiledSQL): MissingType().compile ) + def test_array_agg(self): + m = MetaData() + t = Table('t', m, Column('data', Integer)) + expr = func.array_agg(t.c.data) + is_(expr.type._type_affinity, Array) + is_(expr.type.item_type._type_affinity, Integer) + + class ExecuteTest(fixtures.TestBase): -- cgit v1.2.1