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.5.tar.gz (17.0 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.5-py3-none-any.whl (21.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pyStorages-0.0.5.tar.gz
  • Upload date:
  • Size: 17.0 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.5.tar.gz
Algorithm Hash digest
SHA256 0997e2a171015a826d3b8fa1ae0d70be591441115b527e494f5fc1193a48fe7b
MD5 23546491b68823679e3f60bfbc3d8594
BLAKE2b-256 9fc42ba0e6801efc852ef45efde0ec60cd9f0edef73667caa9cd12a413396b40

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pyStorages-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 21.3 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.5-py3-none-any.whl
Algorithm Hash digest
SHA256 2f78aa8e4f682fbc837e79c05e3b30a5e4ee17b6e1521e84269407e9d933af0b
MD5 7b6c32042cf7639ca88c10287fd8d9fb
BLAKE2b-256 108b7c87334262a0f27664708acf6a230cb955ebc4879712d8bd6bf249cb8edd

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