How to initialize the database by directly executing the SQL script using Flask-SQLAlchemy?

problem description

I want to execute the SQL script directly to initialize the database when initializing the flask application.
the database is Postgresql.

the environmental background of the problems and what methods you have tried

flask tutorials use the sqlite database and the SQLAlchemy package, so you can run SQL statements directly.
flask-sqlalchemy tutorials all talk about DML operations from the perspective of ORM, and there is no description of database DDL operations.

what result do you expect? What is the error message actually seen?

how can I just call flask-sqlalchemy, to perform DDL operations according to SQL scripts?
extra thought: why does the flask-sqlalchemy tutorial cover how to define objects on the program side?
is the function of flask-sqlalchemy to do the work of DBA on the program side again?
shouldn"t flask-sqlalchemy be convenient for the program side to get database objects and then perform CURD operations?


Why no one answered.

Menu