You'll need to run that .sql file inside whatever instance of the PostgreSQL database is running so the data is loaded in. After the PostgreSQL databa

How to retrieve data using PostgreSQL in Flask?

submited by
Style Pass
2021-05-20 14:51:29

You'll need to run that .sql file inside whatever instance of the PostgreSQL database is running so the data is loaded in. After the PostgreSQL database is running and you verified that it has data and is accessible to your Flask app, then it's a simple matter of using the flask-sqlalchemy library in Python. As long as Flask is given the correct uri and has access to the database, it should be reasonably plug and play.

Technically no, but it is a really good idea to make classes in Python that exactly match your database models. In practice, you could have Flask run any arbitrary SQL command including writing a new entry to the db so it isn't explicitly necessary to make models in Python. However, it will make your life much easier if you front-load a little here and get comfortable with using the classes.

Use of this site constitutes acceptance of our User Agreement and Privacy Policy. © 2021 reddit inc. All rights reserved.

Leave a Comment