On 6/17/15 2:38 PM, Reece Hart wrote:

    this line here:

      File "alembic/env.py", line 87, in run_migrations_online
        target_metadata=target_metadata.get(name)

    is part of something that was coded on your end, because it is in
    env.py.   The MetaData object doesn't have a get() method.   It
    does have a ".tables" dictionary from which you can call get(),
    however, but that would return a Table object, not a MetaData object.

    So you'd need to fix your env.py here.


I got here by following the alembic tutorial. Specifically, I did `alembic init alembic --template multidb`, which generated the env.py. Then, following along from https://alembic.readthedocs.org/en/latest/autogenerate.html, I added

    from myapp.mymodel import Base
    target_metadata = Base.metadata


The expression `target_metadata=target_metadata.get(name),` comes from the env.py provided during alembic init.

What am I missing?

The documentation assumes use of the default template, not the "multidb" template which is more of an example for specialized use cases. Consult the source code of env.py within multidb if you want to continue with that template. I've added a note clarifying this in the docs, however RTD is not managing to build it, so for now the note reads:

Note

The above example refers to the *generic alembic env.py template*, e.g. the one created by default when calling upon |alembic init|, and not the special-use templates such as |multidb|. Please consult the source code and comments within the |env.py| script directly for specific guidance on where and how the autogenerate metadata is established.






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

Reply via email to