diff options
author | Federico Caselli <cfederico87@gmail.com> | 2022-09-17 13:12:35 +0200 |
---|---|---|
committer | Federico Caselli <cfederico87@gmail.com> | 2022-09-17 13:12:35 +0200 |
commit | 02fe382d6bfc5e8ccab6e2024a5241379a02b7e0 (patch) | |
tree | 71be66e11aec5224f77f8e4e4e62ad9bd3fb6491 /lib/sqlalchemy/sql | |
parent | f582618afe1a5b112a1a22ddd0cbfcc8b97c8f09 (diff) | |
download | sqlalchemy-02fe382d6bfc5e8ccab6e2024a5241379a02b7e0.tar.gz |
Improve array_agg and Array processing
The :class:`_functions.array_agg` will now set the array dimensions to 1.
Improved :class:`_types.ARRAY` processing to accept ``None`` values as
value of a multi-array.
Fixes: #7083
Change-Id: Iafec4f77fde9719ccc7c8535bf6235dbfbc62102
Diffstat (limited to 'lib/sqlalchemy/sql')
-rw-r--r-- | lib/sqlalchemy/sql/functions.py | 4 | ||||
-rw-r--r-- | lib/sqlalchemy/sql/sqltypes.py | 2 |
2 files changed, 5 insertions, 1 deletions
diff --git a/lib/sqlalchemy/sql/functions.py b/lib/sqlalchemy/sql/functions.py index a028e7fed..c04f5fa1d 100644 --- a/lib/sqlalchemy/sql/functions.py +++ b/lib/sqlalchemy/sql/functions.py @@ -1407,7 +1407,9 @@ class array_agg(GenericFunction[_T]): if isinstance(type_from_args, sqltypes.ARRAY): kwargs["type_"] = type_from_args else: - kwargs["type_"] = default_array_type(type_from_args) + kwargs["type_"] = default_array_type( + type_from_args, dimensions=1 + ) kwargs["_parsed_args"] = fn_args super(array_agg, self).__init__(*fn_args, **kwargs) diff --git a/lib/sqlalchemy/sql/sqltypes.py b/lib/sqlalchemy/sql/sqltypes.py index fd52ec6ea..414ff03c3 100644 --- a/lib/sqlalchemy/sql/sqltypes.py +++ b/lib/sqlalchemy/sql/sqltypes.py @@ -3065,6 +3065,8 @@ class ARRAY( dim - 1 if dim is not None else None, collection_callable, ) + if x is not None + else None for x in arr ) |