Issues

Issue #69 resolved

KeyError on connecting to DB

Anonymous created an issue

I have build my own SQLAlchemy Dialect for a DB. Dialect works and is tested. I try to run a simple migration (create table) against DB (schema exists). If I use a non-existing schema in the connection string I get a DB error ("Schema does not exist). So basic connectivity seems to be fine.

When using the correct schema, I get the following error in alembic:

alembic/ddl/impl.py", line 50, in get_by_dialect return _impls[dialect.name] KeyError: 'mydb'

I briefly looked at the code. Which part of alembic is responsible for filling the _impls dict? How can my dialect end up there? Do I have to announce my dialect to alembic?

Comments (3)

  1. Mike Bayer repo owner

    you need to make an Alembic impl:

    from alembic.ddl.impl import DefaultImpl
    
    class MyDBImpl(DefaultImpl):
        __dialect__ = 'mydb'
        transactional_ddl = <True|False>
    
        # ... other methods
    

    the DefaultImpl includes a metaclass which populates the _impl dictionary.

  2. Log in to comment