Skip to main content
The SQLite release is a compressed database file, not a SQL script. Open the extracted file directly; do not use .read or execute it as SQL.
These instructions use v5.2.0-export.1, published 3 November 2026. Its core tables contain 250 countries, 5,327 states and 156,169 city records. API data and installed package snapshots can differ. Check the latest release before choosing another version.

Download the release

Run these POSIX-shell commands in a new directory. Downloads are compressed; extract them before opening or importing.

Open and verify the database

At the SQLite prompt:
For this release, integrity checking returns ok, foreign-key checking returns no rows, and the three counts are 250, 5,327 and 156,169. Use .quit to leave the client.

Read it with Python

The standard-library sqlite3 module is sufficient. Read-only mode fails if the file is missing instead of creating an empty database.

Query the hierarchy

Names of parent places are joined from their tables. cities does not store country_name or state_name; use a left join for nullable state links.

Troubleshooting

  • Confirm that you selected the export for your database engine; SQL dialects are not interchangeable.
  • Check the release tag and source files when counts differ. Counts from an API or a package can describe another snapshot.
  • Inspect the actual table definitions before selecting columns. See the schema reference.
Back up your database before replacing data or changing its schema. Keep release and source notices with distributed data; review the ODbL licence. See the SQLite command-line documentation and Python sqlite3 reference for backups, transactions and application integration.