Queries KEYS from Redis and performans an efficient MGET. Helps with querying your Redis.
Project description
Redis Mass Get
Queries your Redis using KEYS and MGET to write the key/value to the stdout or a file. It supports the formats: text, json and csv.
Installation
Install from PIP:
pip install redis-mass-get
CLI usage
The project can be used as a CLI tool:
usage: redis-mass-get [-h] [-q] [-f {text,csv,json}] [-d DESTINATION] [-jd] [-c CHUNCKS] [-och] url key
Queries Redis using KEYS and MGET. This will efficiently retreive all keys and values. They can be stored/visualized in different modes: - text (default): odd lines are keys, even lines values. - csv: comma-separated format. - json: JSON-array. Use -jd to decode the JSON value.
positional arguments:
url Full Redis URL.
key The key to query on.
optional arguments:
-h, --help show this help message and exit
-q, --quiet Don't show information about the progress.
-f {text,csv,json}, --format {text,csv,json}
The format in which the keys of values should be.
-d DESTINATION, --destination DESTINATION
Writes the output to a file.
-jd, --json_decode Enables JSON decode when writing to JSON.
-c CHUNCKS, --chuncks CHUNCKS
How many keys should be queried at once? Default is 10,000.
-och, --omit_csv_header
Don't render a CSV header.
The alias rmg or redis_mass_get will work as well in the console.
API
The API can be used like this:
from redis_mass_get import RedisQuery
# pluralize will return the result or None
q = RedisQuery("redis://my.amazing.redis.url")
# query data
data = q.query("prefix*")
# data is returned as:
# [(key1, value1), (key2, value2)]
# write data to file
# TXT:
q.query_and_write_csv(self, "prefix*", "my.file.path.txt")
# CSV:
q.query_and_write_csv(self, "*postfix", "my.file.path.csv")
# JSON
q.query_and_write_csv(self, "*contains*", "my.file.path.csv", parse_value_as_json=True)
You could also write your own implementation of ProcessorBase and call query_with_processor.
Development
If you want to contribute to local development, please consult the local development page. More information on the reasoning behind this package can be found at this blog: Reading multiple key/values from Redis.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file redis-mass-get-0.0.11.tar.gz.
File metadata
- Download URL: redis-mass-get-0.0.11.tar.gz
- Upload date:
- Size: 6.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d084fef1e106ca18ec3049f05a8f4151017eca9bf6a92d45acb55619e11d9b93
|
|
| MD5 |
83f3f3938973b6b7e5cba29f5f8b5fb9
|
|
| BLAKE2b-256 |
a549381336e4d7dcd13665329a57e7f6876053ca3b0444ef32cdb0fb59710559
|
File details
Details for the file redis_mass_get-0.0.11-py3-none-any.whl.
File metadata
- Download URL: redis_mass_get-0.0.11-py3-none-any.whl
- Upload date:
- Size: 9.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a9344691dd3ec8d8c7e27c7f710f14f9ee8270e1184685efd5ee66efd16f62ce
|
|
| MD5 |
19754758e68121b34d09b4b5d9535f6a
|
|
| BLAKE2b-256 |
d603d7c59a687cb5bb9391fe0c2ba9cf999b8fed6799fdd2de96146a94648f0c
|