Prelude : covid, zoom, and all that - today's protocol.
First : let's discuss the homework. Anything you'd like to go over about SQL - concepts or how it works?
Second : a look at how to use SQL from python.
Here are some of the concepts
The overview in the python docs gives a nice summary.
It is often important to handle transactions correctly - the data exists both in memory and in the database, and if you're not careful the two can get out of sync.
As your project gets bigger, it can make sense to put in an abstraction layer between the database SQL code and your top-level program code - that is typically done with an "ORM" library. There are both advantages and disadvantages, as per this ORM for Python discussion.
Django, another python web back end, has its own built-in ORM.
Two other popular ones are
Our next (and last) technology is flask, which we'll discuss next week, and in the following weeks use to build a web project that incorporates as many of the ideas we've been discussing as we can cram in. ;)
Flask has much better debugging tools than the backend-only stuff we've been doing, at the cost of some complexity in managing both a local development and remote deployed environment.
This digital ocean tutorial is a good walkthrough of a flask app - including the virtual environment.
For next week, please work through that example. I will start during class if there's time.
I've attached a few of the python files we used in class.
And you can find a link to a video recording of today's class on the videos page.