Initial data for Flask/Sqlalchemy Initial data for Flask/Sqlalchemy flask flask

Initial data for Flask/Sqlalchemy


No, there's not. You have to use the tools of the used database. Especially PostgreSQLs utilities for this are very versatile, much more than Django's.

However, If your real question is just "How do I get some initial data into the database", e.g. while developing, then you can do something like this:

def init_db():    if db_session.query(User).count() == 0:        admin = User("admin", "admin")        db_session.add(admin)        db_session.commit()