Database Applications with Python

Summary

This course takes the lessons of LS180 and introduces the concept of working with databases from your applications. We'll build a simple command-line application, then move on to a more advanced database-backed Todo application that uses a high-level relational abstraction library. We'll also talk about how to optimize SQL queries from within your applications.

Major Topics

  • Executing SQL From Python
  • The psycopg2 PostgreSQL Adapter
  • Handling Parameters Safely
  • Code Structure
  • Creating Database Schema Automatically
  • Session Persistence
  • Designing a Schema
  • Interacting with a Database from Python
  • Deploying PG Applications to Render
  • Optimization
  • Optional Projects

Phase

Programming and Back-end Development

Prerequisites

Detailed Syllabus

Introduction

  • The psycopg2 PostgreSQL database adapter
  • Executing SQL Statements from Python

Interacting with a Database in Code

  • Getting Started
  • Project Overview
  • Project Setup
  • Database Design
  • Listing Expenses
  • Displaying Help
  • Adding Expenses
  • Handling Parameters Safely
  • Code Structure
  • Searching Expenses
  • Deleting Expenses
  • Clearing Expenses
  • Counting and Totaling Expenses
  • Creating the Schema Automatically

Database-backed Web Applications

  • Getting Started
  • Project Overview
  • Session Persistence Module
  • Updating and Deleting Lists
  • Moving Todo Actions to SessionPersistence
  • Designing a Schema
  • Setting up a Database Connection
  • Executing and Logging Database Queries
  • Loading Records From the Database
  • Working with Lists
  • Working with Todos
  • Setting Up Schema Automatically
  • Deploying PG Applications to Render

Optimization

Optimizing N + 1 Queries Pushing Down Operations to the Database Optional Projects