SimpleBase is a lightweight JSON based serverless database with improved performance on key operations
The strength of document-oriented NoSQL database is their natural simplicity, but they are usually not very fast (unless they are serious server databases like MongoDB). SimpleBase solves performance issues in critical areas
Instant addition of new records to collections, regardless of the size of the collection due to a special storage architecture
Faster work with operations, due to the fact that it is not required to encode / decode the entire collection (which can be very large)
Collections are always stored in RAM with concurrency change tracking: data is re-read from disk only if it has been changed by another process
ACID for multi-user and multi-threading
Two types of indexes for key types of queries - a hash index and a special B-tree for full-text search
Support for transactions (sessions)
MongoDB-like syntax, incl. 100% similar query language
Written in pure python, only about 1800 lines
Why SimpleBase?
It was written for situations where you need to organize a local database without a server with a JSON-oriented interface. But at the same time, increased performance requirements: for large collections (1000000+ documents in the collection), fast, almost instantaneous execution of some operations is required:
Add a new document to the collection with 1000000 documents - 0.007 seconds, with 2000000 documents - also 0.0007 seconds - ie. operation time does not depend on the size of the table
Find an element by equality in a collection with 1000000+ entries in 1-2 microseconds
Organize real-time search by occurrence of a string across a large collection without friezes
from pysimplebase import SimpleBase,DBSession
#creatig database
db = SimpleBase("samples_db")
#inserting documents into collection
id = db['goods'].insert({"name":"coffee", "price":15}) #insert one document
print(db['goods'].get(id))
inserted = db['goods'].insert([{"name":"apple", "price":2},{"name":"apple", "price":3}]) #insert dataset
#insert or update (upsert)
db['goods'].insert({"name":"coffee", "price":16,"_id":id},upsert=True)
print(db['goods'].get(id))
#transaction
with DBSession(db) as s:
inserted = db['income'].insert({"product_id":id} , session=s)
inserted = db['outgoing'].insert({"product_id":id} , session=s)
#updating
db['goods'].update(inserted,{"updated":True})
print(db['goods'].all())
#simple search without index
result = db['goods'].find({"name":"apple"})
#building complex queries
result = db['goods'].find({"$and":[
{"price":{"$gt":1}},
{"price":{"$lte":10}}
]}
)
print(result)
#hash indexes for unique values
db['goods'].register_hash_index("hash_dynamic","name", dynamic=True) #there are dynamic and stored indexes
db['goods'].reindex_hash("hash_dynamic")
r = db['goods'].get_by_index(db["hash_dynamic"],"apple")
#text indexes
db['goods'].register_text_index("fts","name", dynamic=True) #there are dynamic and stored indexes
db['goods'].reindex_text("fts")
r = db['goods'].search_text_index("appl")
#delete
db['goods'].delete(id)
db['goods'].delete(inserted)
#clear
db['goods'].clear()
Metadata
Release files for pysimplebase 0.0.8
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 |
|---|---|---|---|---|
| pysimplebase-0.0.8.tar.gz | 27.6 kB | Without provenance | Details for pysimplebase-0.0.8.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pysimplebase-0.0.8-py3-none-any.whl | Python 3 | none | any | Details for pysimplebase-0.0.8-py3-none-any.whl |
Total release size: 53.9 kB
Release files / pysimplebase-0.0.8.tar.gz
| Download URL | pysimplebase-0.0.8.tar.gz |
|---|---|
| Size | 27.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9e3bc3db424b8b4ac86c3167b3dde27be924bc86017b8fe83ceedb9833ad1144
|
|
BLAKE2b-256 checksum How to use checksums |
597b81ddb78fd7ec90132026ad21c886d8509236b83af4b1c78ad40031b4ab16
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.1
|
Release files / pysimplebase-0.0.8-py3-none-any.whl
| Download URL | pysimplebase-0.0.8-py3-none-any.whl |
|---|---|
| Size | 26.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3cd37019b6e9a9a44811b11628768cea6fb810358498400a5494e946cb549fbc
|
|
BLAKE2b-256 checksum How to use checksums |
56190e3a30de4b823f2f6b704897b187e23a691083bb5f625b1809b787679808
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.1
|
Security for pysimplebase 0.0.8
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.