2

Alembic support 5 built-in dialects only: https://github.com/sqlalchemy/alembic/tree/master/alembic/ddl

Now I want to manages schema in Apache Hive via alembic and noticed that PyHive supports SQLAlchemy interfaces so technically Alembic can support hive as a new dialect. So I've found this post Integrate PyHive and Alembic but it seems needs hacking alembic/ddl/impl.py within package alembic.

Is there any working way to do this? I don't mind contributing PRs to either alembic or pyHive but needs guidance.

shawnzhu
  • 7,233
  • 4
  • 35
  • 51

1 Answers1

0

I used this thread in the original email list to get enough information:

Does it mean it must introduce dependency to alembic (since it uses alembic.ddl.impl.DefaultImpl) in a package (.e.g, pyHive) that supports sqlalchemy interfaces?

well you have to put it in a try/except ImportError block so that if alembic isn't installed, it silently passes.

is there any guidance to support this at alembic level in a plug-gable way? E.g., declare a HiveImpl class in env.py of a project uses alembic?

you could put one in your env.py also but if you are the person working on the dialect you can have this built in, see the example in sqlalchemy-redshift: https://github.com/sqlalchemy-redshift/sqlalchemy-redshift/blob/master/sqlalchemy_redshift/dialect.py#L27

shawnzhu
  • 7,233
  • 4
  • 35
  • 51