hello,
I've tried quite a few things but can't seem to get alembic to find my
classes:
*my_project/models.py:*
from sqlalchemy import Column, ForeignKey, Integer, String
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import create_engine
Base = declarative_base()
class Address(Base):
__tablename__ = 'address'
id = Column(Integer, primary_key=True)
street_name = Column(String(250))
street_number = Column(String(250))
city_name = Column(String(250))
state = Column(String(10))
post_code = Column(String(250), nullable=False)
engine = create_engine('sqlite:///test.db'))
Base.metadata.create_all(engine)
This runs fine - creates DB with Address table
from within my_project folder I run alembic init alembic
which makes all alembic folder etc...
I edit the alembic.ini file: sqlalchemy.url = sqlite:///test.db
I then add 'account' to Address:
class Address(Base):
__tablename__ = 'address'
id = Column(Integer, primary_key=True)
street_name = Column(String(250))
street_number = Column(String(250))
city_name = Column(String(250))
state = Column(String(10))
post_code = Column(String(250), nullable=False)
account = Column(String(50))
then run:
alembic revision -m'added account to case'
alembic upgrade head
It only produces these migration scripts:
"""added account to case
Revision ID: 84b06ca2703c
Revises:
Create Date: 2018-09-17 16:53:47.985670
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '84b06ca2703c'
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
pass
def downgrade():
pass
Please help - why wont it find my classes/models?
--
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.