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
But if fails because the SQL code outputted tries to create a normal function, instead of an aggregate one, and I couldn't find any references on how to create aggregate functions
[SQL: CREATE FUNCTION "public"."array_accum"(anyarray) (
sfunc = array_cat,
stype = anyarray,
initcond = '{}'
)]
(Background on this error at: http://sqlalche.me/e/13/f405)
So what would be the right way to do this?
Thanks in advance, and thanks for making this library, is great to have things much cleaner
The text was updated successfully, but these errors were encountered:
The create statements are pretty similar, which makes it look like it'd be a small change to add, but aggregate functions' properties are stored in a different view, pg_aggregate vs pg_function, and the properties are significantly different.
Due to those differences, it needs its own class to correctly detect when a replace operation is needed.
I don't currently have a plan to implement them but would consider a PR that doesn't reduce coverage
That functions definition isn't likely to change much so you could consider creating it using raw sql in the migration. Since it won't be registered with the pg_function view, alembic_utils wont attempt to drop it in subsequent revisions that use --autogenerate.
Alternatively, you could avoid needing a custom aggregate by unpacking the arrays and using array_agg
I'm trying to create an aggregate function to concat arrays even if they're empty, as described here
Running this directly on Postgres works
But I don't know how to (or if it's even possible) do that with alembic_utils.
I tried adding this to my
functions.py
file:But if fails because the SQL code outputted tries to create a normal function, instead of an aggregate one, and I couldn't find any references on how to create aggregate functions
So what would be the right way to do this?
Thanks in advance, and thanks for making this library, is great to have things much cleaner
The text was updated successfully, but these errors were encountered: