Last active
December 19, 2015 13:29
-
-
Save briandilley/5962081 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
subquery = query.subquery() | |
unnest_expr = expr.select(columns=[distinct(func.unnest(subquery.c.attribute_ids))], from_obj=subquery) | |
array_expr = expr.select(columns=[func.array(unnest_expr)]) | |
generates: | |
SELECT array((SELECT DISTINCT unnest(anon_1.attribute_ids) | |
FROM (SELECT product.attribute_ids AS attribute_ids | |
FROM product) AS anon_1)) AS array_1 | |
FROM (SELECT DISTINCT unnest(anon_1.attribute_ids) | |
FROM (SELECT product.attribute_ids AS attribute_ids | |
FROM product) AS anon_1) | |
I want: | |
SELECT array((SELECT DISTINCT unnest(anon_1.attribute_ids) | |
FROM (SELECT product.attribute_ids AS attribute_ids | |
FROM product) AS anon_1)) AS array_1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment