alembic/env.py target_metadata = metadata "No module name al_test.models"
alembic
Solution
This might be a bit late, and you may have already figured out the issue, but my guess the problem is that your alembic/ directory is not part of the system path. I.e. you need to do something like:
import sys
sys.path.append(path/to/al_test)
from al_test.models import metadata
Problem
When I use alembic to control the version of my project's database,part of codes in env.py like: ``` # add your model's MetaData object here # for 'autogenerate' support # from myapp import mymodel # target_metadata = mymodel.Base.metadata from al_test.models import metadata target_metadata = metadata ``` when I run 'alembic revision --autogenerate -m "Added user table"', I get an error : File "alembic/env.py", line 18, in from al_test.models import metadata ImportError: No module named al_test.models so how to solve the question? thanks!