Cannot complete Flask-Migration

后端 未结 8 2142
刺人心
刺人心 2021-02-02 13:27

I\'ve setup a local Postgres DB with SQLAlchemy and cannot commit my first entry. I keep on getting this error...

ProgrammingError: (ProgrammingError) relation          


        
相关标签:
8条回答
  • 2021-02-02 14:08

    Assuming that you have checked that the database exists using psql or pgAdmin, this error usually means exactly what it says. That can be due to either:

    • not connecting to the correct database instance (check your db url: host/port and db name)
    • not correctly configuring SQLAlchemy (see: SQLAlchemy create_all() does not create tables)
    0 讨论(0)
  • 2021-02-02 14:13

    I got the same error yesterday, for my case the revision number '39408d6b248d' is due to your previous migration upgrade actions, each time your ran upgrade script then an Alembic version will be generated and stored in data.sqlite.

    you must have done any upgrade which generated above '39408d6b248d', but then you deleted whole migrations/ directory and removed all upgrade scripts. The database e.g. data.sqlite still stores '39408d6b248d' but there aren't according migration script exists.

    for my solution I delete whole Alembic versions in database and did all upgrades from scratch.

    0 讨论(0)
提交回复
热议问题