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 ofcursor.execute("INSERT INTO people VALUES ('John Doe')") - Rows are returned as
OrderedDictobjects instead of tuples. - Helper methods to simplify common patterns, e.g.
get_or_create.
- e.g.,
- Easy schema changes: adding, removing, altering and reordering columns.
- Support for
decimal.Decimal,datetime.timeandbooldatabase 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
sqlite3library 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)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| isqlite-0.1.tar.gz | 6.4 kB | Without provenance | Details for isqlite-0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| isqlite-0.1-py3-none-any.whl | Python 3 | none | any | Details for isqlite-0.1-py3-none-any.whl |
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
|
Security for isqlite 0.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.