|
# sqlalchemy
|
|
# flask-sqlalchemy
|
|
|
|
|
|
In this lab we will implement SQLAlchemy in the mywits app. SQLAlchemy is an example of an ORM (Object Relational Mapper), which means we can deal with our data models & queries as python objects and attributes. Using sqlalchemy means we can abstract our code away from using sql directly, and leave sqlalchemy to do secure & efficient interactions with the database behind the scenes.
|
|
In this lab we will implement SQLAlchemy in the mywits app. SQLAlchemy is an example of an ORM (Object Relational Mapper), which means we can deal with our data models & queries as python objects and attributes. Using sqlalchemy means we can abstract our code away from using sql directly, and leave sqlalchemy to do secure & efficient interactions with the database behind the scenes.
|
|
|
|
|
|
This lab comes with full and annotated example code. However you are **strongly** encouraged to try each step for yourself as much as possible before resorting to the code in the repo.
|
|
This lab comes with [full and annotated example code](http://gitlab.doc.gold.ac.uk/data-networks-web/lab-exercises/tree/master/lab-18). However you are **strongly** encouraged to try each step for yourself as much as possible before resorting to the code in the repo.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## install flask-sqlalchemy
|
|
|
|
|
|
|
|
pip install --user flask-sqlalchemy
|
|
|
|
|
|
## setting up flask-sqlalchemy
|
|
## setting up flask-sqlalchemy
|
|
|
|
|
|
To set up flask-sqlalchemy we need to
|
|
To set up flask-sqlalchemy we need to
|
... | | ... | |