python object database
Project description
thread safe mongo style database for python objects (it’s a sqlite db)
indexed types
str
int
float
bytes
bool
complex
procedure
saves supported data types as columns
pickles the actual object and saves that as a string
when select matches, the object is unpickled and returned
functions
get_by
get_by_uuid
contains
insert
insert_many
update
upsert
upsert_many
size
requirements
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")
tbl = "customers"
c0 = Customer("Jeff", "Bezoz", 42, 1.69,
[Company("Whole Foods"), Company("Zappos"),
Company("Ring"), Company("twitch")])
db.insert(tbl, c0)
c0 = db.get_by(tbl, {
"first_name": "Jeff",
"last_name": "Bezoz"
})
c0.companies.append(Company("Audible"))
db.update(tbl, c0)
installation
pip3 install git+https://github.com/nbdy/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-0.42.tar.gz
(3.7 kB
view details)
File details
Details for the file podb-0.42.tar.gz
.
File metadata
- Download URL: podb-0.42.tar.gz
- Upload date:
- Size: 3.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/51.1.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a7ac36f53c655c4d40b17b88727e1a95551370f407be547fc74ca4003b6c1080 |
|
MD5 | 35136b71591f25cb1030ed41707c3e13 |
|
BLAKE2b-256 | c7430a91805459dda2e41bb4c800c9c87ea287c77b4f8a1399f9ad3f578a9d50 |