Is it possible to use Alembic to migrate to a different database type? #876
Unanswered
FredericoCoelhoNunes
asked this question in
Usage Questions
Replies: 1 comment 1 reply
-
I dont know that you'd necessarily use alembic migrations for this, you can do the transfer at once by reflecting all the tables from one database and recreating them in the other. for the issue of datatypes, use the approach documented at https://docs.sqlalchemy.org/en/14/core/reflection.html#reflecting-with-database-agnostic-types to convert database types on the fly to agnostic datatypes. you could use the same approach within the alembic migration also since you are passing it a MetaData object, just assign a column_reflect listener that does the datatype conversions you want. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi everyone,
is it possible to use Alembic to migrate a currently existing database to a different database type? I have an Oracle database and would like to recreate all currently existing tables in an empty MariaDB database. The problem is there are several Oracle options/types that don't exist in MariaDB, so when I autogenerate the migration, specifying my MariaDB metadata as target and my Oracle database as source, the models that Alembic generates use Oracle types.
Is there a way to convert between different dialects when autogenerating?
Beta Was this translation helpful? Give feedback.
All reactions