Loading Makefile 0 → 100644 +10 −0 Original line number Diff line number Diff line default: build upload clean: rm -rf dist/* build: clean python3 -m build test-upload: python3 -m twine upload --repository testpypi dist/* upload: python3 -m twine upload dist/* .PHONY: default clean build upload README.rst +31 −3 Original line number Diff line number Diff line Loading @@ -2,7 +2,7 @@ redis-export ============================ Export redis keys with a given prefix or pattern, which later can be imported to another redis server. to another redis server. To export all keys, use '*' as pattern. Installation ------------ Loading @@ -20,16 +20,18 @@ Quick Start .. code-block:: bash redis-export PATTERN OUTPUT_FILE redis-export PREFIX_OR_PATTERN OUTPUT_FILE redis-import INPUT_FILE For example, .. code-block:: bash # prefix based export redis-export 'phonebook:' ~/d/t1.json # pattern based export # redis-export 'phonebook:*:name:*' ~/d/t1.json redis-export ~/d/t1.json redis-import --host redis.example.com ~/d/t1.json For more usage help, run the command with --help option. Loading @@ -52,9 +54,35 @@ Exported file is a json list, each list item is of form (key, dump_value). The redis key and dump value is encoded in base64 in order to fit in regular json. License ---------- Copyright (C) 2022 Yuanle Song <sylecn@gmail.com> This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. ChangeLog --------- * v0.2.0 2022-09-24 - update README.rst, applied license, distributed on PyPI. * v0.1.2 2022-09-18 - bugfix: when pattern contains '*' should not error * v0.1.0 2021-11-21 - initial release redisexport/__init__.py +1 −1 Original line number Diff line number Diff line Loading @@ -5,4 +5,4 @@ """ __version__ = "0.1.2" __version__ = "0.2.0" redisexport/main.py +20 −1 Original line number Diff line number Diff line #!/usr/bin/env python3 # coding=utf-8 # # Copyright (C) 2022 Yuanle Song <sylecn@gmail.com> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # """Export redis keys with a given prefix. Loading @@ -12,6 +28,8 @@ import json import redis from redisexport import __version__ logger = logging.getLogger(__name__) Loading Loading @@ -71,7 +89,8 @@ def create_shared_parser(): """ parser = argparse.ArgumentParser( description='redis db selective export and import tool') description='redis db selective export and import tool' ' v%s' % (__version__, )) parser.add_argument('--host', default='localhost', help='redis host') parser.add_argument('-p', '--port', default=6379, help='redis port') parser.add_argument('-n', '--num', help='redis database number') Loading requirements.txtdeleted 100644 → 0 +0 −1 Original line number Diff line number Diff line redis Loading
Makefile 0 → 100644 +10 −0 Original line number Diff line number Diff line default: build upload clean: rm -rf dist/* build: clean python3 -m build test-upload: python3 -m twine upload --repository testpypi dist/* upload: python3 -m twine upload dist/* .PHONY: default clean build upload
README.rst +31 −3 Original line number Diff line number Diff line Loading @@ -2,7 +2,7 @@ redis-export ============================ Export redis keys with a given prefix or pattern, which later can be imported to another redis server. to another redis server. To export all keys, use '*' as pattern. Installation ------------ Loading @@ -20,16 +20,18 @@ Quick Start .. code-block:: bash redis-export PATTERN OUTPUT_FILE redis-export PREFIX_OR_PATTERN OUTPUT_FILE redis-import INPUT_FILE For example, .. code-block:: bash # prefix based export redis-export 'phonebook:' ~/d/t1.json # pattern based export # redis-export 'phonebook:*:name:*' ~/d/t1.json redis-export ~/d/t1.json redis-import --host redis.example.com ~/d/t1.json For more usage help, run the command with --help option. Loading @@ -52,9 +54,35 @@ Exported file is a json list, each list item is of form (key, dump_value). The redis key and dump value is encoded in base64 in order to fit in regular json. License ---------- Copyright (C) 2022 Yuanle Song <sylecn@gmail.com> This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. ChangeLog --------- * v0.2.0 2022-09-24 - update README.rst, applied license, distributed on PyPI. * v0.1.2 2022-09-18 - bugfix: when pattern contains '*' should not error * v0.1.0 2021-11-21 - initial release
redisexport/__init__.py +1 −1 Original line number Diff line number Diff line Loading @@ -5,4 +5,4 @@ """ __version__ = "0.1.2" __version__ = "0.2.0"
redisexport/main.py +20 −1 Original line number Diff line number Diff line #!/usr/bin/env python3 # coding=utf-8 # # Copyright (C) 2022 Yuanle Song <sylecn@gmail.com> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # """Export redis keys with a given prefix. Loading @@ -12,6 +28,8 @@ import json import redis from redisexport import __version__ logger = logging.getLogger(__name__) Loading Loading @@ -71,7 +89,8 @@ def create_shared_parser(): """ parser = argparse.ArgumentParser( description='redis db selective export and import tool') description='redis db selective export and import tool' ' v%s' % (__version__, )) parser.add_argument('--host', default='localhost', help='redis host') parser.add_argument('-p', '--port', default=6379, help='redis port') parser.add_argument('-n', '--num', help='redis database number') Loading