On 02/10/2017 12:41 PM, Alexander Peletz wrote:
Great thank you for the quick response! I actually found this morning
that I can put the class definition in alembic/ddl/impl.py and it works
(seemed like a logical module for it?).

Next issue is the CREATE TABLE statement used to create the
alembic_version table uses keywords that are not valid HiveQL keywords.
I assume somewhere in the HiveImpl class I could override the contents
of this statement, but I couldn't figure out where/how to do that.


for CREATE TABLE assuming you've written a whole SQLAlchemy dialect, you'll want to look into your DDLCompiler in the visit_create_table method. This is on the SQLAlchemy side, not Alembic.

However, usually you don't need to override visit_create_table as a whole, I'd imagine you're needing to deal with something special about columns, datatypes, or constraints. There are individual methods that deal with those things, I'd take a look at some of the existing SQLAlchemy dialects to see how those things get set up.






Thanks,
Alexander

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
    <javascript:>
    > <mailto:sqlalchemy-alembic+unsubscr...@googlegroups.com
    <javascript:>>.
    > For more options, visit https://groups.google.com/d/optout
    <https://groups.google.com/d/optout>.

--
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
<mailto:sqlalchemy-alembic+unsubscr...@googlegroups.com>.
For more options, visit https://groups.google.com/d/optout.

--
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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to