An open API service indexing awesome lists of open source software.

https://github.com/demoskp/flask-sqlalchemy-tutorial


https://github.com/demoskp/flask-sqlalchemy-tutorial

Last synced: 4 months ago
JSON representation

Awesome Lists containing this project

README

        

## Populating the database with users
- First open a Flask shell session by running `flask shell` in your terminal
- Import the `db` object by running `from app import db`
- Import the sql script by running `sql = open("users.sql", "r")`
- Get the sql statement by running `statement = sql.read()`
- Import the `text` function from sqlalchemy by running `from sqlalchemy import text`
- Run the sql statement by running `db.session.execute(text(statement))`
- Finally, commit the transaction by running `db.session.commit()`