Module 21
Python Database Communication
Learn how Python communicates with databases and how database queries are organized.
01
Database Communication
Learn why a Python program uses a database table, and the six steps from import and connect through the cursor, the query, and close.
02
DDL Queries
Create a Python SQLite table, add a column with ALTER TABLE, and remove the table with DROP TABLE. These are the data definition queries.
03
DML Queries
Insert, update, and delete SQLite rows from Python, then commit the change or roll it back. Values stay outside the SQL text.
04
Select Queries
Read SQLite rows with SELECT, then take one row, a limited batch, or every remaining row using fetchone, fetchmany, and fetchall.
05
Query Metadata
Read SQLite column names from cursor.description after SELECT, then print each row under those names without hard-coding the header.