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.6.tar.gz (17.1 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.6-py3-none-any.whl (21.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pyStorages-0.0.6.tar.gz
  • Upload date:
  • Size: 17.1 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.6.tar.gz
Algorithm Hash digest
SHA256 351f7344f5c072066e30c11ee25154f665e8003a88cb880d0eca013769d516fa
MD5 3351a4a2432affe8fce965622b0de6ef
BLAKE2b-256 711053e7a3da86040f0339d46bac2891973d69370c73efc193e99dbc097f26da

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pyStorages-0.0.6-py3-none-any.whl
  • Upload date:
  • Size: 21.4 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.6-py3-none-any.whl
Algorithm Hash digest
SHA256 338783a46ae64836f7a90cba02707adab5f51f69eb44a390205ca8137e0aadf1
MD5 222b22b3c1acb3bac1b48967808dd7a9
BLAKE2b-256 a3a4c17a1c3c63566d830e1c93785b4db9978e5b01c94d867e7f0e2e5c518330

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