Module 5: Databases and APIs

5. Module 5: Databases and APIs#

5.1. Objectives#

Introduce participants to querying relational databases and accessing web APIs using Python.

5.2. Learning Outcomes#

By the end of this module, participants will be able to:

  • Understand relational databases and write SQL queries.

  • Connect to databases with Python.

  • Access and extract data from APIs using requests.

  • Build and document basic REST APIs using FastAPI.

5.3. Topics#

  • SQL fundamentals: SELECT, WHERE, JOIN, GROUP BY

  • Python database libraries: sqlite3, SQLAlchemy, psycopg2

  • REST APIs: endpoints, requests, responses

  • Accessing APIs using requests

  • Use case: Pulling weather data from OpenWeather API

  • Creating APIs with FastAPI

  • Use case: Building a simple web app serving insights