Import data to alembic migrations

65 views
Skip to first unread message

Ilya Demidov

unread,
May 10, 2022, 5:34:06 AM5/10/22
to sqlalchemy-alembic
Hi!

I have some problem. I need to add new field in table and populate it by some default data. I can not hardcode it because it different in debug and production enviroment. I want to store data in some "config file". The problem is migration does not see my modules.

├───alembic │
    ├───versions │ 
        ├───first_migration.py │
        ├───second_migration.py │
    ├─── migration_data.py

If I import from alembic. migration_data  import SOME_DATA it throws import error while migrating. 

Any good pratice, how can I store migration data? Thanks for advices.

Mike Bayer

unread,
May 10, 2022, 8:54:22 AM5/10/22
to alembic sqlalchemy-alembic
yes, one particular approach to this issue is discussed here: https://alembic.sqlalchemy.org/en/latest/front.html#installation   start with that if nothing else is working (There are many ways to do this).
--
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 sqlalchemy-alem...@googlegroups.com.

Reply all
Reply to author
Forward
0 new messages