Skip to main content

Simple data storages package

Project description

pyStorages

Simple data storages written in Python

Currently supported storage types:

  • JSON
  • Pickle
  • Redis

Installation

pip install pyStorages
# or
pip install git+https://github.com/Cub11k/pyStorages.git

For RedisStorage use extras:

pip install pyStorages[redis]
# or, for async version
pip install pyStorages[aioredis]

Getting started

pyStorages is the simplest way to interact with different types of storages, where data is stored and treated as a dictionary, in terms of python - dict.

Storage class interface is pretty convenient and is described below:

Set data

[async] def set_data(**kwargs)

This method allows you to update data according to key-value pairs. Existing key-values pairs not covered by passed keys won't be affected.

Parameters

kwargs - key-value pairs, according to which, the data will be updated

Returns - None

Delete data

[async] def delete_data(*keys)

This method allows you to delete values by keys.

Parameters

keys - list of keys, which will be deleted, if present

Raises KeyError - in case of receiving a non-existing key

Returns - None

Reset data

[async] def reset_data()

This method allows you to delete all data.

Returns - None

Get data

[async] def get_data(*keys)

This method allows you to get values by keys. For nested keys use list.

Note: if no keys are passed, all data will be returned.

>>> get_data('key1', 'key2', 'key3')
(data['key1'], data['key2'], data['key3'])

>>> get_data(['key1', 'key2'])
(data['key1']['key2'],)

>>> get_data([])
(data,)

>>> get_data()
(data,)

Parameters

keys - list of keys, which values will be returned, if present

Raises KeyError - in case of non-existing key

Returns - tuple

Examples

Coming soon...

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyStorages-0.0.3.tar.gz (17.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyStorages-0.0.3-py3-none-any.whl (21.6 kB view details)

Uploaded Python 3

File details

Details for the file pyStorages-0.0.3.tar.gz.

File metadata

  • Download URL: pyStorages-0.0.3.tar.gz
  • Upload date:
  • Size: 17.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.9

File hashes

Hashes for pyStorages-0.0.3.tar.gz
Algorithm Hash digest
SHA256 e0e2f19eb0b171778f3cdca843220087a44b1a870af51ed41895ace25013f5af
MD5 93a71c0b37fccaca2cb6d979281d445a
BLAKE2b-256 f323263065e94ac9b29ecd8ac331ce461a2fbe87464455c88a575ac3a8859f4f

See more details on using hashes here.

File details

Details for the file pyStorages-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: pyStorages-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 21.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.9

File hashes

Hashes for pyStorages-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 b60e100433d36b3abf2f7cfea6a805920aa651c3cd5f5139786e86a1101ab598
MD5 2a6d287db806ae9db2750251e0a43912
BLAKE2b-256 1973630a785b75fb90df7d202138c571cadbb096931467687a1087b97d4ed0b0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page