Skip to main content

isqlite is a wrapper around Python's SQLite library.

WARNING: isqlite is in beta. Make sure to back up your data before using it with isqlite.

from isqlite import Database, Table, columns

# Note that in addition to the columns declared explicitly, isqlite will automatically
# create `id`, `created_at` and `last_updated_at` columns.
schema = [
  Table("teams", [
    columns.Text("name", required=True),
  ]),
  Table("employees", [
    columns.Text("name", required=True),
    columns.Integer("age", required=False),
    columns.ForeignKey("team", "teams", required=False),
  ]),
]

with Database(schema, "db.sqlite3") as db:
    # Create a new row in the database.
    pk = db.create("people", {"name": "John Doe", "age": 30})

    # Retrieve the row as an OrderedDict.
    person = db.get("people", pk)
    print(person["name"], person["age"])

    # Update the row.
    db.update("people", pk, {"age": 35})

    # Delete the row.
    db.delete("people", pk)

    # Filter rows with a query.
    people = db.list("people", q.Like("name", "John%") and q.GreaterThan("age", 40))

    # Use raw SQL if necessary.
    pairs = db.sql(
        """
        SELECT
          teams.name, employees.name
        FROM
          employees
        INNER JOIN
          teams
        ON
          employees.team = teams.id
        """
    )

Features

  • A more convenient API.
    • e.g., db.create("people", {"name": "John Doe"}) instead of cursor.execute("INSERT INTO people VALUES ('John Doe')")
    • Rows are returned as OrderedDict objects instead of tuples.
    • Helper methods to simplify common patterns, e.g. get_or_create.
  • Easy schema changes: adding, removing, altering and reordering columns.
  • Support for decimal.Decimal, datetime.time and bool database columns.
  • A command-line interface.

What isqlite is not

  • isqlite is not an ORM. It does not map database rows to native objects. It just returns them as ordered dictionaries.
  • isqlite is not a high-performance database engine. If you need maximal SQLite performance, you should use Python's built-in sqlite3 library instead as isqlite imposes some overhead on top of it.
  • isqlite is not a generic database wrapper. It only supports and will only ever support SQLite as the underlying database engine.

isqlite is highly suitable for applications that use SQLite as an application file format. It is less suitable for circumstances in which traditional database engines are used, because if you eventually decide that you need to migrate from SQLite to a full-scale RDMS like MySQL or Postgres, you will have to rewrite all the code that uses isqlite.

API documentation

TODO

Metadata

Release files for isqlite 0.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 isqlite 0.1
File Size Uploaded
isqlite-0.1.tar.gz 6.4 kB Details

Built distribution (wheel)

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

Total release size: 13.4 kB

Release files / isqlite-0.1.tar.gz

Download URL isqlite-0.1.tar.gz
Size 6.4 kB
Tags Source
SHA-256 checksum
How to use checksums
647b6a3f342d707abff877c94c9a03da311107feaead3445435650d154f4db97
BLAKE2b-256 checksum
How to use checksums
90c0c4c2843e5676a0317a4f68ae9955e87e47ebabbfca55bbc4b884688923c3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.22.0 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.9

Release files / isqlite-0.1-py3-none-any.whl

Download URL isqlite-0.1-py3-none-any.whl
Size 7.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
941b15f11dd4a596e81413fbb03fb5adf62387ec0b0ecaea350e2ba836804708
BLAKE2b-256 checksum
How to use checksums
217c2aae8ade9d9c6922456036002d974fb90a5c2fc99711d8b91fbfe37da689
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.22.0 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.9

Release history Release notifications | RSS feed

1.6.0

2 release files

1.5.1

2 release files

1.5.0

2 release files

1.4.0

2 release files

1.3.0

2 release files

1.2.0

2 release files

1.1.0

2 release files

1.0.0

2 release files

0.13.1

2 release files

0.13

2 release files

0.12.1

2 release files

0.12

2 release files

0.11

2 release files

0.10.1

2 release files

0.10

2 release files

0.9.2

2 release files

0.9.1

2 release files

0.9

2 release files

0.8.2

2 release files

0.8.1

2 release files

0.8

2 release files

0.7

2 release files

0.6.1

2 release files

0.6

2 release files

0.5.2

2 release files

0.5.1

2 release files

0.5

2 release files

0.4.7

2 release files

0.4.6

2 release files

0.4.5

2 release files

0.4.4

2 release files

0.4.3

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3

2 release files

0.2

3 release files

This release

0.1 This release

2 release files

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