On 8/16/15 8:57 AM, c.bu...@posteo.jp wrote:
I want to use `alembic revision --autogenerate` with my own model
classes. Because of that I need to import them in
`myproject/alembic/env.py` as [described in the docs][1]. But this
doesn't work even if I tried a lot of variations.

I am not sure in which context (don't know if this is the correct word)
does alembic run the `env.py`. Maybe that causes some errors.

This is the directory and file structure I use.

     myproject/
         common/
             __init__.py
             model.py
         alembic/
             env.py

The error is kind of that

         from .common import model
     SystemError: Parent module '' not loaded, cannot perform relative
         import

`myproject` itself is just a repository/working directory. It is not
*installed* into the system (with `pip3`, `apt-get`, `easyinstall` or
anything else).
If you aren't using a virtualenv, then set PYTHONPATH to point to where "myproject" starts so that you can use a fully-qualified import, e.g. "import myproject.common.model".







   [1]: http://alembic.readthedocs.org/en/latest/autogenerate.html


--
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to