Skip to main content

Fundamentals of CockroachDB with Python SQLAlchemy

Learn CockroachDB by building a sample Python app with SQLAlchemy

  • Course Number

  • Self-Paced

  • Estimated Effort

    2 hrs/week

About This Course

In this course, you will build a full-stack ride-sharing application in Python using the popular SQLAlchemy ORM. You will start with a simple version that manages a fleet of scooters and their current positions. You will add features one by one as the course progresses until you have a highly functional application that is ready to track multiple vehicle types and users at scale.

In this course, you'll learn how to:

  • Create and modify a table in the SQL shell
  • Model your data's schema in SQLAlchemy
  • Perform transactions using SQLAlchemy

For this course, you’ll be using CockroachDB Serverless, which is our database-as-a-service offering.


Before taking this course, you should have experience with Python and application development.

It is helpful but not required to be familiar with SQL.

If you’ve never used CockroachDB Serverless before, we would also suggest taking our “Introduction to Serverless Databases and CockroachDB Serverless” course first.

Detailed course outline

  • Welcome
  • Installation and Setup
    • Lab: Install CockroachDB
    • Lab: Install MovR Dependencies
    • Get Started with CockroachDB Serverless
    • Lab: Create and Populate a Table
  • Chapter 1: Basic Operations
    • Getting Started with the MovR Labs
    • MovR Application Architecture
    • Lab: Start MovR
    • Modeling, Reading, and Writing Data
    • Database Operations in SQLAlchemy
    • Lab: Add Vehicles in the MovR Application
    • Lab: Delete Vehicles in the MovR Application
    • Viewing MovR's SQL Queries
    • Lab: View MovR's SQL Queries
  • Chapter 2: Adding Features
    • MovR Application Architecture
      • Lab: Configure and start MovR
    • Entity Models and CRUD Operations
      • Modeling, reading and writing data
      • Implementing Service Methods
      • Lab: Add Vehicles in the MovR Application
      • Lab: Delete Vehicles in the MovR Application
    • Table and Entity Relationships
      • Creating Tables and Relationships in the SQL Shell
      • Defining Entity Relationships
      • Lab: Track Location History
    • Creating and Altering Tables
      • Using Arrays and Altering Tables in the SQL Shell
      • Lab: Create Database Tables for Users and Rides
      • Lab: Add Users and Rides to the MovR Application
  • Final Exam
  • Wrapping up

Course Staff

Will Cross
Will Cross
Staff Curriculum Developer @ Cockroach Labs

Frequently Asked Questions

What web browser should I use?

The Open edX platform works best with current versions of Chrome, Edge, Firefox, Internet Explorer, or Safari.

See our list of supported browsers for the most up-to-date information.