Skip to main content

Yet another PickleDB (thread-safe!)

Features • Usage • Installation • License •


ya-pickledb (Yet Another PickleDB) is a an open-source key-value store for Python using the msgpack module. It is heavily inspired by pickledb, but also provides new features (like thread-safety using safer).

The new feature additions are inspired by elara; but since it cannot serialize complex data structure to filesystem I decided to take the best of both worlds and create a new package.

⚡ Features

  • Manipulate different data structures (strings, lists, dictionaries and so on)
  • Fast and flexible
  • Thread-safe!
  • Choose between manual and auto commits
  • Cache simple data structures

📚 Usage

import ya_pickledb

db = ya_pickledb.load('kvstore.db', True)

db.set('foo', 'bar')
value = db.get('foo')

print(value)

This is the full list of all functions available to the user:

  • commit(): manually save the data to file storage.
  • set(key, value, max_age=None): set the value of a key.
  • get(key): get the value of a key.
  • getall(): get a list of all keys.
  • exists(key): get wheter a key exists or not.
  • rem(key): remove a key.
  • totalkeys(): get a total number of keys inside the db.
  • lcreate(key): create a list.
  • lpush(key, value): add a value to a list.
  • lgetall(key): return all values in a list.
  • lget(key, value, pos): return the value in a specific position of a list.
  • lremlist(key): remove a list.
  • lremvalue(key, value): remove a value from a list.
  • lpop(key, pos): remove ne value in a list.
  • llen(key): return the length of a list.
  • lexists(key, value): determine if a value exists in a list.
  • hcreate(key): create a dict.
  • hset(key, dict_key, value): add a key-value pair to a dict.
  • hget(key, dict_key): get the value for a key in a dict.
  • hgetall(key): get all the key-value pairs from a dict.
  • hrem(key): remove a dict.
  • hpop(key, dict_key): remove one key-value pair fro a dict.
  • hkeys(key): get all the keys for a dict.
  • hvals(key): get all the values for a dict.
  • hexists(key, dict_key): determine if a key exists in a dict.

All the functions should return None if something goes wrong (e.g. the key accessed is missing). Errors are raised when the input type is wrong (e.g. setting a bool as key).

🚀 Installation

Run the following command to install the latest version:

pip install ya_pickledb

🪪 License

ya_pickledb is made with 🖤 by the thelicato and released under the MIT LICENSE.

Metadata

Release files for ya_pickledb 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ya_pickledb 0.2.0
File Size Uploaded
ya_pickledb-0.2.0.tar.gz 5.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ya_pickledb 0.2.0
File Interpreter ABI Platform
ya_pickledb-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 13.0 kB

Release files / ya_pickledb-0.2.0.tar.gz

Download URL ya_pickledb-0.2.0.tar.gz
Size 5.9 kB
Tags Source
SHA-256 checksum
How to use checksums
9d819a701bc7adeac59060c836dac2850b2c26bbcae2ceee5646e39021557345
BLAKE2b-256 checksum
How to use checksums
572b3cc01d8a211c00af870bc959537ece9603bee84d2449c03be8876ff3a6dc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.7.1 CPython/3.11.0 Linux/6.2.0-1018-azure

Release files / ya_pickledb-0.2.0-py3-none-any.whl

Download URL ya_pickledb-0.2.0-py3-none-any.whl
Size 7.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a811f45bcde45ef02ffcbf133f472f6e463728eb5c0a5401c11b8e8feea5e292
BLAKE2b-256 checksum
How to use checksums
ba501f5348356d1de779f535d21329883a964b74b61484bab0be39a6a5b4810b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.7.1 CPython/3.11.0 Linux/6.2.0-1018-azure

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page