python object database
Project description
podb
(p)ython (o)bject (d)ata(b)ase
thread safe, file based, redis style database for python objects
reasons not to use this
- you want a database cluster
- you have multiple millions or billions of database entries and limited storage space
- you need relationships / multiple tables
reasons to use this
- pure python
- cross-platform (Tested: Windows & Linux)
- thread safe
- stores python objects
- filters, see below
- inserting 200 objects takes ~0.0003 seconds (i7-4702MQ)
- size of db with 800 objects is ~600kB
- ~180 loc
- no extra package dependencies
- tested (Ryzen 7 2700X)
- 8-8.3k inserts per second
- 1000000 entry db is 672MB
- 1000000 entries in 2:04 minutes
notes
functions
- find
- find_one
- find_after
- find_before
- find_by_uuid
- find_contains
- find_startswith
- find_endswith
- insert
- insert_many
- update
- update_many
- upsert
- upsert_many
- size
- contains
- columns
- drop
- remove / delete
- remove_by_uuid / delete_by_uuid
- delete_before
example
from podb import DB, DBEntry
class Company(DBEntry):
def __init__(self, name: str):
DBEntry.__init__(self)
self.name = name
class Customer(DBEntry):
def __init__(self, first_name: str, last_name: str, age: int,
height: float, companies: list[DBEntry]):
DBEntry.__init__(self)
self.first_name = first_name
self.last_name = last_name
self.age = age
self.height = height
self.companies = companies
db = DB("customers")
c0 = Customer("Jeff", "Bezoz", 42, 1.69,
[Company("Whole Foods"), Company("Zappos"),
Company("Ring"), Company("twitch")])
db.insert(c0)
c0 = db.find_one({
"first_name": "Jeff",
"last_name": "Bezoz"
})
c0.companies.append(Company("Audible"))
db.update(c0)
installation
pip3 install podb
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
podb-1.44.tar.gz
(5.8 kB
view details)
File details
Details for the file podb-1.44.tar.gz
.
File metadata
- Download URL: podb-1.44.tar.gz
- Upload date:
- Size: 5.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 00d6fbbfa1c9282582157b19fb2ee5a72504a09823be1bfd2f694bdb4a1f9fdf |
|
MD5 | 2784664c450b8a9f862a3670aaa933e6 |
|
BLAKE2b-256 | 43d7b32f8190f585918c76b91b1bb8c9be7733cdde520e8aa68d82cd388c0ddb |