olirice / alembic_utils

An alembic/sqlalchemy extension for migrating sql views, functions, triggers, and policies
https://olirice.github.io/alembic_utils
MIT License
211 stars 43 forks source link

alembic_utils does not work with Redshift Dialect. #123

Closed mfdickerson closed 8 months ago

mfdickerson commented 8 months ago

alembic_utils does not appear to work with the Redshift dialect, and attempts a number of operations that are not supported by Redshift.

[SQL: ROLLBACK TO SAVEPOINT sa_savepoint_2] (Background on this error at: https://sqlalche.me/e/14/tw8g)


because savepoints are not supported by Redshift.

- Additionally, after manually crafting a revision, the upgrade failed with because it attempted to add `WITH DATA` to the end of the materialized view SQL. I don't believe that syntax is supported by Redshift.
olirice commented 8 months ago

Redshift was forked from postgres in version ~8 and hasn't kept pace with the dialect or feature support due to differing goals.

alembic_utils makes heavy use of modern postgres features that aren't supported by redshift (like savepoints). for that reason, there's no clear path to support redshift and it isn't an intended goal of the project.

if you'd like to continue using this project for your redshift migrations I'd suggest using postgres locally to create the migrations. even then, you may run into cases where the rendered migration is not supported in redshift though, so milage may vary