PyStoreDB
PyStoreDB is a simple NoSQL database greatly inspired by the Firebase Firestore, Django Filters, and LiteJsonDB. It is a JSON-based database that allows you to store and retrieve data in a simple and easy way.
Key Features
- Simple and easy to use: PyStoreDB is designed to be simple and easy to use.
- NoSQL database: PyStoreDB is a NoSQL database.
- JSON-based: PyStoreDB is a JSON-based database.
- Subcollections: PyStoreDB supports subcollections.
- Document CRUD operations: PyStoreDB supports document CRUD operations.
- Collection Querying operations: PyStoreDB supports collection querying operations. and where clause is inspired by Django Filters.
- Firebase Firestore-like: PyStoreDB is greatly inspired by the Firebase Firestore.
Installation
package is not yet available on PyPI, but you can install it from the source code:
git clone https://github.com/Wilfried-Tech/PyStoreDB
cd PyStoreDB
python setup.py install
Usage
Initialize the database
from PyStoreDB import PyStoreDB
from PyStoreDB.conf import PyStoreDBSettings
from PyStoreDB.engines import PyStoreDBRawEngine
# Initialize the database
# engine_class is optional, default is PyStoreDBRawEngine
# store_dir can be '' for in-memory storage
PyStoreDB.settings = PyStoreDBSettings(store_dir="data", engine_class=PyStoreDBRawEngine)
PyStoreDB.initialize()
store = PyStoreDB.get_instance(name="my_store") # name is optional
Create a document in a collection
# Create a document
user1 = store.collection("users").add({"name": "John Doe", "age": 25}) # auto-generate id
user2 = store.collection("users").doc().set({"name": "Jane Doe", "age": 22}) # auto-generate id
user3 = store.collection("users").doc("user3").set({"name": "Alice Doe", "age": 30})
Working with documents
# Get a document reference by id
user = store.collection("users").doc('ID')
# replace the document with a new one
user.set({"name": "John Doe", "age": 26})
# update the document
user.update({"age": 27}) or user.update(age=27)
# delete the document
user.delete() # note that delete document does not delete subcollections
Working with collections
# Get a collection reference
users = store.collection("users")
# Get all documents in a collection
all_users = users.get()
Working with subcollections
# Get a document reference
user = store.collection("users").doc('ID')
# Get a subcollection reference
posts = user.collection("posts")
# Add a document to the subcollection
post1 = posts.add({"title": "My first post", "content": "Hello, World!"})
Querying
# Get all documents in a collection with order by age
users = store.collection("users").order_by("age").get()
# Get all documents in a collection with age greater than 25
users = store.collection("users").where(age__gt=25).get()
...
Features
- Simple and easy to use
- NoSQL database
- JSON-based
- Subcollections
- Document CRUD operations
- Collection Querying operations
- Indexing
- Transactions
- multi-threading support
- multi-engine support (partially implemented)
Disclaimer
This project is still in development and should not be used in production.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Contributing
Contributions are welcome! Feel free to contribute to this project.
Metadata
Release files for PyStoreDB 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pystoredb-0.1.0.tar.gz | 29.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pystoredb-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 61.4 kB
Release files / pystoredb-0.1.0.tar.gz
| Download URL | pystoredb-0.1.0.tar.gz |
|---|---|
| Size | 29.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
13b6227add1663f4a2f503747179679998c95d9e1e71945bb5b37a03b17e05db
|
|
BLAKE2b-256 checksum How to use checksums |
0974fadf09fdd61876b6f935fd4f286ed9ce5428fbaf5e89ae1c6a9cfd6b51cc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.2
|
Release files / pystoredb-0.1.0-py3-none-any.whl
| Download URL | pystoredb-0.1.0-py3-none-any.whl |
|---|---|
| Size | 31.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c1ed83853dd90130fab32e17c600fc9efacbe9bef4c05d6ed199da3313439100
|
|
BLAKE2b-256 checksum How to use checksums |
2e87b81fdb2f182fe1961dfa6cd80956d104ab1c039d7670903e9044a075ae4d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.2
|