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
I found that flyway cannot create an external table because it does not recognise it must be run in a transaction. I have forked flyway and believe I have made the necessary addition here gareth625@f6b404d. My Java isn't good enough to find and add a unit tests but I have built the JAR and tested against a Redshift cluster.
Unfortunately I haven't tested the migrations I have included as I'm having trouble accessing my company's AWS resources externally. I wanted to get the ball rolling though and the changes into a commitable state.
What version of Flyway are you using?
Which client are you using? (Command-line, Java API, Maven plugin, Gradle plugin, SBT plugin, ANT tasks)
What database are you using (type & version)?
What operating system are you using?
What did you do?
(Please include the content causing the issue, any relevant configuration settings, and the command you ran)
Ran a migration to create an external schema on a Redshift cluster using Athena catalogue which succeeds:
CREATE EXTERNAL SCHEMA IF NOT EXISTS external_schema
FROM DATA CATALOG
CREATE EXTERNAL DATABASE IF NOT EXISTS;
then tried to create an external table in the schema, for example:
This has now been fixed. For DROP TABLE when used with an external table the following limitation and workaround has been added to the docs:
Due to Redshift limitations DROP TABLE for external tables cannot run within a transaction, yet Flyway doesn't autodetect this. You can work around this limitation and successfully execute such a statement by including a VACUUM statement in the same SQL file as this will force Flyway to run the entire migration without a transaction.
Thanks, but it is a bit of a clunky work-around since I can't actually vacuum the external table I'm altering. It will have to be a vacuum on some other physical table that is unrelated to the migration...