Skip to main content

Parse any SQLite database into plain Python dicts table::rows maps or fully detailed schema/rows/stats output.

Features

  • Two output modes: flat dict keyed by table name, or full detail with schema, stats, views, and indexes
  • Plain dicts: no result objects to unwrap; output is JSON-ready (BLOBs stringified safely by json.dumps(..., default=str))
  • Option passthrough: every dumpb engine option (tables, row_limit, strict_mode, …) works directly on parse()
  • Strict validation: unknown options and bad option types raise immediately with the list of valid keys
  • Typed: ships py.typed; fully annotated API
  • Single-table helper: parse_table() for one-table extracts

Installation

pip install sqldump

Requires Python 3.8+.

Quickstart

import sqldump

# Flat mode (default): table name -> list of row dicts
data = sqldump.parse("app.db")
data["users"]        # [{'id': 1, 'name': 'alice', 'score': 9.5}, ...]
data["orders"]       # [{'id': 1, 'user_id': 1, 'total': 42.0}, ...]

Detail mode

data = sqldump.parse("app.db", detail=True)
data["database"]     # 'app.db'
data["stats"]        # {'tables': 3, 'rows': 128, 'views': 1, 'indexes': 2}
data["views"]        # ['user_emails']
data["indexes"]      # ['idx_users_name']
data["errors"]       # non-fatal issues collected during the parse

data["tables"]["users"]
# {'schema': 'CREATE TABLE users (...)', 'rows': [...],
#  'row_count': 3, 'truncated': False}

Single table

sqldump.parse_table("app.db", "users")
# {'schema': ..., 'rows': [...], 'row_count': 3, 'truncated': False}

Raises sqldump.ParseError if the table does not exist.

Options passthrough

sqldump.parse("app.db", tables=["users", "orders"], row_limit=100, strict_mode=True)

All dumpb engine keys are accepted (everything in dumpb.DEFAULT_CONFIG except tables, which is parse()'s own keyword).

Error handling

SqldumpError            # base error: unknown options, bad values, bad paths
└── ParseError          # dump/parse failures (wraps dumpb.DumpbError),
                        # missing tables, strict-mode issues
import sqldump
from sqldump import SqldumpError, ParseError

try:
    data = sqldump.parse("missing.db")
except ParseError as exc:
    print("parse failed:", exc)

try:
    sqldump.parse("app.db", bogus=1)
except SqldumpError as exc:
    print(exc)  # unknown parse option 'bogus': valid options are ...

Behavior notes

  • Internal sqlite_* objects (sqlite_sequence, autoindexes, …) are excluded.
  • Views and indexes appear only in detail mode as name lists.
  • tables=[] (empty list) parses no tables; None (default) parses all.
  • Missing tables under tables=[...] are recorded in detail['errors'] (flat mode silently skips them) unless strict_mode=True.
  • The bytes values of BLOB columns are preserved in dicts; use json.dumps(data, default=str) for JSON serialization.

API reference

API Description
parse(db, detail=False, tables=None, **options) Database as dict (flat or detail)
parse_table(db, name, **options) Single table as dict
DEFAULT_OPTIONS Default engine options (mirrors dumpb.DEFAULT_CONFIG minus tables)
SqldumpError Base error
ParseError Parse failures, missing tables
Module Exports
sqldump parse, parse_table, SqldumpError, ParseError, DEFAULT_OPTIONS
sqldump.parser parse, parse_table, DEFAULT_OPTIONS
sqldump.errors SqldumpError, ParseError

License

MIT

Metadata

Release files for sqldump 2.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sqldump 2.1.1
File Size Uploaded Provenance Actions
sqldump-2.1.1.tar.gz 16.2 kB Without provenance Details for sqldump-2.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for sqldump 2.1.1
File Interpreter ABI Platform Actions
sqldump-2.1.1-py3-none-any.whl Python 3 none any Details for sqldump-2.1.1-py3-none-any.whl

Total release size: 30.9 kB

Release files / sqldump-2.1.1.tar.gz

Download URL sqldump-2.1.1.tar.gz
Size 16.2 kB
Tags Source
SHA-256 checksum
How to use checksums
e118a65546a08a4d37946fcd2b59f3ca7ae4edd8675476dd54b814f77143bce5
BLAKE2b-256 checksum
How to use checksums
9faa214f1aae6205a3f5ccb6112b40b03c8091f1b8ce52791d888296b5c5aac2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.7

Release files / sqldump-2.1.1-py3-none-any.whl

Download URL sqldump-2.1.1-py3-none-any.whl
Size 14.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f7b318bb8088bfea909db5ef6df7f7d54a06180746e1a601ec72c5ff671067ca
BLAKE2b-256 checksum
How to use checksums
d7e8f19f2ce592ff8e0461b863e3de775b67e2a052e2437bc26e4bbed9c3f122
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.7

Security for sqldump 2.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

2.1.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page