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.4.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.4-py3-none-any.whl (21.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pyStorages-0.0.4.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.4.tar.gz
Algorithm Hash digest
SHA256 b93271205902fa68bc6e1b2fd2cab44396d17bb6505922989cbdb24348a55046
MD5 65e43ec4cba287ffff9ee9cd39ee8e93
BLAKE2b-256 723450c3a9a2a3ca2b93356e06d7ce09f15d1ff8ac1164a80554491e0c91bfbe

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pyStorages-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 21.5 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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 e7e6e0be9078b8971c7d7c812f61b670011d04709648712cc2a171dfd67cf46c
MD5 531597e201284073fddf9fd1780b108c
BLAKE2b-256 7a472fda942a869d6d3fc47d2d4c78072547f1db9e001e29c9a533b59b0bef09

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