A tiny database for Python
Project description
shelfdb
Tiny LMDB-backed shelf database utilities.
Server
Run the protocol server:
shelfdb server
Run the protocol server on a custom address:
shelfdb server --url "tcp://0.0.0.0:17001" --db-path ./db
Client
Connect a client:
from shelfdb.client import Client
client = await Client.connect("tcp://127.0.0.1:31337")
Unix sockets also work:
from shelfdb.client import Client
client = await Client.connect("unix:///tmp/shelfdb.sock")
Example
from shelfdb.client import Client
client = await Client.connect("tcp://127.0.0.1:31337")
try:
async with client.transaction() as tx:
users = tx.shelf("users")
count = await users.count().query()
alice = await users.key("alice").item().query()
admins = await users.filter(
lambda item: item.value["role"] == "admin"
).sort(reverse=True).query()
async with client.transaction(write=True) as tx:
users = tx.shelf("users")
await users.put("eve", {"role": "user"}).query()
await users.key("eve").update(
lambda item: {**item.value, "role": "admin"}
).query()
finally:
await client.close()
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
shelfdb-2.1.0rc1.tar.gz
(18.9 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file shelfdb-2.1.0rc1.tar.gz.
File metadata
- Download URL: shelfdb-2.1.0rc1.tar.gz
- Upload date:
- Size: 18.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.12 {"installer":{"name":"uv","version":"0.10.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Fedora Linux","version":"43","id":"","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3865ef0a310004ddbbcc6c8b7798346918eb4c25cf9d7b3b1d38621f2ca1d0d8
|
|
| MD5 |
2a3fd50fe0a804a355eb60a5b212c50c
|
|
| BLAKE2b-256 |
3cc7a4f1a2728f3191a8f29f1a72cf96af936e60d7e786cc399cc35d766d9b62
|
File details
Details for the file shelfdb-2.1.0rc1-py3-none-any.whl.
File metadata
- Download URL: shelfdb-2.1.0rc1-py3-none-any.whl
- Upload date:
- Size: 31.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.12 {"installer":{"name":"uv","version":"0.10.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Fedora Linux","version":"43","id":"","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
005b4ef59a0f55ed4ce7801e596c7dde246599d32ffa359d663504e886ae183e
|
|
| MD5 |
a16a2d58bd34de116f29e798315ba3c3
|
|
| BLAKE2b-256 |
6151222f55996c999ff2087057cbcbbd1c590ef5f483e6224912c329285c9e1a
|