liveBook · Manning

Sqlite3

As explained in Practices of the Python Pro

sqlite3 is the Python standard library module that provides access to SQLite databases.

sqlite3 is Python’s standard-library interface to SQLite. It opens a connection to a database file, creating the file when it does not exist, and supports executing queries and iterating over results. section 6.3.1

A persistence layer can wrap sqlite3 in a DatabaseManager so storage details stay separate from higher-level application concerns. The connection supplies the foundation for table creation and CRUD operations. section 6.3.1

A small sqlite3-backed manager can provide:

  • Table creation, filtering, sorting, and record counting for application data. section 6.3.1

Opening a database

import sqlite3 class DatabaseManager: def __init__(self, database_filename): self.connection = sqlite3.connect(database_filename)

How Practices of the Python Pro covers it

How deep it goes
Explains connections, cursors, execution, parameterized CRUD queries, and table creation, without descending into SQLite internals.
Examples
Demonstrates a bookmarks table, DatabaseManager connection, parameterized inserts and deletes, and filtered or ordered selections.
What it assumes
Introduces database connections and persistence-layer tasks while requiring familiarity with Python and basic SQL statements.
What you can do after
Operate SQLite storage through Python by opening connections and implementing table, insert, delete, and select operations.
How it connects
Connects sqlite3 with SQLite databases, SQL, persistence layers, DatabaseManager classes, and CRUD operations.

Also explained in

Compare how 3 books explain sqlite3 →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Practices of the Python Pro. The section links point to the parts of the book it draws on.