On Fri, Jan 24, 2020, at 1:56 PM, Ke Zhu wrote: > Just discovered this post when trying to do exact same thing (besides > planning to support one more dialect). > > > Anywhere in your hive dialect, simply put the above code that you have > > (using the correct imports of course). > > 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. there's a github issue to add support for real entrypoints but it hasn't been that critical. > > If not, 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 > > PS: I raised this question > <https://stackoverflow.com/questions/59887588/how-to-add-new-dialect-to-alembic-besides-built-in-dialects> > in stackoverflow but raised this group is a better place to get help. > > > On Friday, February 10, 2017 at 9:45:38 AM UTC-5, mike bayer wrote: >> >> >> On 02/10/2017 07:41 AM, Alexander Peletz wrote: >> > Hello, >> > >> > I would like to use Alembic to manage my Hive Metastore. I have >> > installed, PyHive, SqlAlchemy, and Alembic. I am able to create a >> > functional engine object using the 'hive' dialect in sqlalchemy, however >> > I cannot get Alembic to recognize this dialect. The problem appears to >> > be a lack of a HiveImpl class in the Alembic package. I attempted to >> > resolve this by creating an alembic/ddl/hive.py module and pasting the >> > following code into that module: >> > >> > >> > from .impl import DefaultImpl >> > >> > class HiveImpl(DefaultImpl): >> > __dialect__ = 'hive' >> >> >> >> you don't actually have to create a "hive.py" file. Anywhere in your >> hive dialect, simply put the above code that you have (using the correct >> imports of course). The DefaultImpl uses a metaclass that will allow >> the "hive" name to be available to alembic as a result of this class >> being created. >> >> >> > >> > >> > >> > >> > I simply want to be able to execute raw SQL against a Hive instance (no >> > ORM implementation needed) and I was hoping to use Alembic to manage the >> > minimum upgrade/downgrade functionality. Are there any simple edits I >> > can make to the Alembic source code to allow me to achieve this goal? >> > >> > >> > >> > Thanks, >> > >> > Alexander >> > >> > -- > > -- > You received this message because you are subscribed to the Google Groups > "sqlalchemy-alembic" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to sqlalchemy-alembic+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/sqlalchemy-alembic/59b308d9-7a9f-4038-bb52-f578c2c9cb69%40googlegroups.com > > <https://groups.google.com/d/msgid/sqlalchemy-alembic/59b308d9-7a9f-4038-bb52-f578c2c9cb69%40googlegroups.com?utm_medium=email&utm_source=footer>. -- You received this message because you are subscribed to the Google Groups "sqlalchemy-alembic" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy-alembic+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/sqlalchemy-alembic/6679dd74-dbba-4371-9094-82b5bde48012%40www.fastmail.com.