Key-Value Model for Detabase
Project description
Key-Value Model for Detabase
API
constructor
class KVModel(dict)
example:
from kv_deta import KVModel
class Example(KVModel):
class Config:
deta_key = DETA_BASE_KEY
# or
deta = Deta(DETA_BASE_KEY)
table_name = "my_kv_table" # optional
kv = Example({"key":"value"})
update
kv.update({"k2":42})
like for dictionary
save
kv.save()
commit all data to detabase
get
mixed dict.get(key), deta.get(key), dict.setdefault(key, default)
kv.get(key="some key"[, default="newer data"])
returns value from deta.get(key)
or update it by default
if deta.get() returned None
incr, decr
uses Deta.Base.Util.incremental()
kv.incr(key="counter"[, quantity=1])
returns incremental value for key
.
if detabase have not specific key
, creates it and value=quantity
News
incr()
rewritten with Deta.Base.Util.incremental()incr(key: str, quantity=1)
,decr(key: str, quantity=1): return incr(key, -quantity)
get()
fixget(key, default)
save()
License
- It's opensource and free software, see the LICENSE for more details
similar projects
TODO
- save() refactor
- set, get, del
-
rename(key, new_key)
-
query()
get list - TTL
-
incr()
,decr()
-
get(key)
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 Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
kv_deta-0.1.12a0-py3-none-any.whl
(15.6 kB
view hashes)
Close
Hashes for kv_deta-0.1.12a0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 26490a44de09479eb6b1b342850096f72f42e58b1d6d832908e7b9c93ae15faf |
|
MD5 | 41240ceb8bd2958996897a8a1d6a547f |
|
BLAKE2b-256 | 7f244a212f14c1a1fa2e4a7f6d154b4b5b0c68ce48ff1d1ce3e4a3ea337bb251 |