DocumentDB
DocumentDB is a JSON document-oriented database built on top of SQLite. It offers a simple and efficient way to store, retrieve, and manage JSON documents using the robust and widely-used SQLite as its storage backend. DocumentDB provides a flexible and schema-less data model, allowing for easy integration and usage in various applications.
Features
- JSON Document Storage: Store JSON documents in a schema-less database.
- SQLite Backend: Leverage the reliability and performance of SQLite.
- Simple API: Intuitive and easy-to-use API for managing documents.
- Flexible Querying: Support for complex queries on JSON data.
- Lightweight: Minimal dependencies and lightweight installation.
- Transactional: Support for ACID transactions through SQLite.
Installation
To install DocumentDB, you can use pip:
pip install documentdb
Usage & Examples
Creating a Store
A Store is a container for Collections.
To create a Store, you can simply instantiate it with a path to where the store should be written on disk (this path is the underlying SQLite path)
from documentdb import Store
store = Store("path/to/store.db")
Creating a Collection
A Collection is a group of Documents. To create a Collection, you can use the create_collection method on the Store instance.
collection = await store.create_collection("animals")
Inserting a Document
A Document is any JSON serializable object. That can be a dictionary, list, string, number, etc, it just must be JSON serializable.
Example:
document = {
"name": "Blueberry",
"type": "dog",
"breed": "Maltese",
"age": 4
}
await collection.insert(document)
Inserting Multiple Documents (Bulk Insert)
You can insert multiple documents at once using the insert_many method.
Example:
This is a small list for brevity when in reality you would likely have a much larger list of documents to insert.
documents = [
{
"name": "Blueberry",
"type": "dog",
"breed": "Maltese",
"age": 4
},
{
"name": "Luna",
"type": "dog",
"breed": "Corgi",
"age": 2
}
]
await collection.insert_many(documents)
Metadata
Release files for documentdb 0.0.5
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 |
|---|---|---|---|---|
| documentdb-0.0.5.tar.gz | 6.5 kB | Without provenance | Details for documentdb-0.0.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| documentdb-0.0.5-py3-none-any.whl | Python 3 | none | any | Details for documentdb-0.0.5-py3-none-any.whl |
Total release size: 13.4 kB
Release files / documentdb-0.0.5.tar.gz
| Download URL | documentdb-0.0.5.tar.gz |
|---|---|
| Size | 6.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e256e1d8dbf340e9d72504969cadf1e12342404cf343a87cabf41ee1e708ecce
|
|
BLAKE2b-256 checksum How to use checksums |
c92bad05229580356a9796d0826ef2d8ae749ad0b789964d9d69f77597cebc71
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.9.19
|
Release files / documentdb-0.0.5-py3-none-any.whl
| Download URL | documentdb-0.0.5-py3-none-any.whl |
|---|---|
| Size | 6.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e42d38a51a1c297697bd2d7b4029ed6c3bddf29aad9a94754e69cec73dd5e106
|
|
BLAKE2b-256 checksum How to use checksums |
b33844c96c04a46d17cfc9434267e6cc15a76275be3c62102a613fee7c28f112
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.9.19
|
Security for documentdb 0.0.5
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.