Skip to main content

LiteCrate

Documentation

LiteCrate is a small Python library for working with SQLite. It lets you create tables, insert and update records using keyword arguments, and search using SQL conditions.

If records have different sets of fields, additional values can be stored as JSON without changing the table schema.

Installation

LiteCrate requires Python 3.13 or newer. No third-party dependencies are required to use the library.

python -m pip install litecrate

Your first table

from litecrate import Database

db = Database(":memory:")

with db:
    db.create_table(
        "players",
        ("p", "id", int),
        ("un", "login", str),
        (0, "level", int),
    )

    player_id = db.insert("players", login="ada", level=3)
    db.update("players", "id = ?", player_id, level=4)

print(db.select_one("players", "login = ?", "ada"))
# {'id': 1, 'login': 'ada', 'level': 4}

db.close()

Here, create_table() creates a table with three columns. The p flag defines a primary key, while un defines a required, unique value. insert() adds a row, update() changes it using a condition, and select_one() returns the matching row as a dictionary.

with db: groups operations into a transaction: changes are committed if the block completes successfully and rolled back if an exception occurs. The block does not close the connection; call db.close() to close it.

Storing data in a file

The example uses ":memory:" - an in-memory database that disappears when the connection is closed. To preserve data between runs, pass a file path:

db = Database("players.sqlite3")

If the file does not exist, SQLite creates it automatically.

License

LiteCrate is licensed under the GNU Affero General Public License v3.0 (AGPL-3.0).

See the LICENCE file for the full license text.

Metadata

Release files for litecrate 0.2.0

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

Source distribution (sdist)

Source distribution for litecrate 0.2.0
File Size Uploaded Provenance Actions
litecrate-0.2.0.tar.gz 31.9 kB With provenance Details for litecrate-0.2.0.tar.gz

Built distribution (wheel)

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

Total release size: 57.5 kB

Release files / litecrate-0.2.0.tar.gz

Download URL litecrate-0.2.0.tar.gz
Size 31.9 kB
Tags Source
SHA-256 checksum
How to use checksums
c35f6ad7d72c3ae639d22b4826437191a2c7686de110c9c87eb1c6d7dce664e1
BLAKE2b-256 checksum
How to use checksums
b335a2158ee6bf4612496813b4b57bedb2b3d4d56d8e577317e9bc542eba489c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 22, 2026.

Transparency log

Release files / litecrate-0.2.0-py3-none-any.whl

Download URL litecrate-0.2.0-py3-none-any.whl
Size 25.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
30382c4fb379163bf23a70acf299f1632b5557e5e9ccf227d3bb2bfeefbdbed7
BLAKE2b-256 checksum
How to use checksums
62b7705930d1b1d54303b732ba62859576c78966bf11b53845db29ece2b3c54b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 22, 2026.

Transparency log

Security for litecrate 0.2.0

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for litecrate-0.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 22, 2026.

Transparency log

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

0.2.0 This release

2 release files Full 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