diff options
| author | CoprDistGit <infra@openeuler.org> | 2023-04-12 05:39:26 +0000 |
|---|---|---|
| committer | CoprDistGit <infra@openeuler.org> | 2023-04-12 05:39:26 +0000 |
| commit | bd7a04fea9527b787bc5b687584e69948485db71 (patch) | |
| tree | 3285b57c20e78ed26d1d0be02dde927c360ee334 | |
| parent | 237536de8aeb5760f8723a4204fa239bde68cec5 (diff) | |
automatic import of python-pyion2json
| -rw-r--r-- | .gitignore | 1 | ||||
| -rw-r--r-- | python-pyion2json.spec | 264 | ||||
| -rw-r--r-- | sources | 1 |
3 files changed, 266 insertions, 0 deletions
@@ -0,0 +1 @@ +/pyion2json-0.0.2.tar.gz diff --git a/python-pyion2json.spec b/python-pyion2json.spec new file mode 100644 index 0000000..8c0891e --- /dev/null +++ b/python-pyion2json.spec @@ -0,0 +1,264 @@ +%global _empty_manifest_terminate_build 0 +Name: python-pyion2json +Version: 0.0.2 +Release: 1 +Summary: Convert an Amazon Ion document(s) to JSON +License: MIT +URL: https://github.com/crouchcd/pyion2json +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/67/5f/35055a528b0e761bbec5e7de6a59311c1b10124cbe7f0652854855339753/pyion2json-0.0.2.tar.gz +BuildArch: noarch + + +%description +# pyion2json + +Convert an [Amazon Ion](http://amzn.github.io/ion-docs/) document(s) to JSON + +## Install + +``` +pip install pyion2json +``` + +## Usage + +### Convert individual Ion values + +``` +import json +import amazon.ion.simpleion as ion +from pyion2json import ion_to_json + +ion_doc = ion.loads('{ first: "Tom" , last: "Riddle" }') +json_doc = ion_to_json(ion_doc) +print(json.dumps(json_doc, indent=' ')) + +``` + +> Outputs: + +``` +{ + "first": "Tom", + "last": "Riddle" +} +``` + +### Convert a cursor from QLDB + +``` +from pyion2json import ion_cursor_to_json + +with create_qldb_session() as qldb_session: + qldb_cursor = qldb_session.execute_statement('SELECT first,last FROM Users') + json_rows = ion_cursor_to_json(qldb_cursor) + print(json.dumps(json_rows, indent=' ')) + +``` + +> Outputs: + +``` +[ + { + "first": "Harry", + "last": "Potter" + }, + { + "first": "Tom", + "last": "Riddle" + } +] +``` + +## TODO: + +1. Verify BLOB conversion meets expectations +2. Verify CLOB conversion meets expectations + +%package -n python3-pyion2json +Summary: Convert an Amazon Ion document(s) to JSON +Provides: python-pyion2json +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-pyion2json +# pyion2json + +Convert an [Amazon Ion](http://amzn.github.io/ion-docs/) document(s) to JSON + +## Install + +``` +pip install pyion2json +``` + +## Usage + +### Convert individual Ion values + +``` +import json +import amazon.ion.simpleion as ion +from pyion2json import ion_to_json + +ion_doc = ion.loads('{ first: "Tom" , last: "Riddle" }') +json_doc = ion_to_json(ion_doc) +print(json.dumps(json_doc, indent=' ')) + +``` + +> Outputs: + +``` +{ + "first": "Tom", + "last": "Riddle" +} +``` + +### Convert a cursor from QLDB + +``` +from pyion2json import ion_cursor_to_json + +with create_qldb_session() as qldb_session: + qldb_cursor = qldb_session.execute_statement('SELECT first,last FROM Users') + json_rows = ion_cursor_to_json(qldb_cursor) + print(json.dumps(json_rows, indent=' ')) + +``` + +> Outputs: + +``` +[ + { + "first": "Harry", + "last": "Potter" + }, + { + "first": "Tom", + "last": "Riddle" + } +] +``` + +## TODO: + +1. Verify BLOB conversion meets expectations +2. Verify CLOB conversion meets expectations + +%package help +Summary: Development documents and examples for pyion2json +Provides: python3-pyion2json-doc +%description help +# pyion2json + +Convert an [Amazon Ion](http://amzn.github.io/ion-docs/) document(s) to JSON + +## Install + +``` +pip install pyion2json +``` + +## Usage + +### Convert individual Ion values + +``` +import json +import amazon.ion.simpleion as ion +from pyion2json import ion_to_json + +ion_doc = ion.loads('{ first: "Tom" , last: "Riddle" }') +json_doc = ion_to_json(ion_doc) +print(json.dumps(json_doc, indent=' ')) + +``` + +> Outputs: + +``` +{ + "first": "Tom", + "last": "Riddle" +} +``` + +### Convert a cursor from QLDB + +``` +from pyion2json import ion_cursor_to_json + +with create_qldb_session() as qldb_session: + qldb_cursor = qldb_session.execute_statement('SELECT first,last FROM Users') + json_rows = ion_cursor_to_json(qldb_cursor) + print(json.dumps(json_rows, indent=' ')) + +``` + +> Outputs: + +``` +[ + { + "first": "Harry", + "last": "Potter" + }, + { + "first": "Tom", + "last": "Riddle" + } +] +``` + +## TODO: + +1. Verify BLOB conversion meets expectations +2. Verify CLOB conversion meets expectations + +%prep +%autosetup -n pyion2json-0.0.2 + +%build +%py3_build + +%install +%py3_install +install -d -m755 %{buildroot}/%{_pkgdocdir} +if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi +if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi +if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi +if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi +pushd %{buildroot} +if [ -d usr/lib ]; then + find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/lib64 ]; then + find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/bin ]; then + find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/sbin ]; then + find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst +fi +touch doclist.lst +if [ -d usr/share/man ]; then + find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst +fi +popd +mv %{buildroot}/filelist.lst . +mv %{buildroot}/doclist.lst . + +%files -n python3-pyion2json -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Wed Apr 12 2023 Python_Bot <Python_Bot@openeuler.org> - 0.0.2-1 +- Package Spec generated @@ -0,0 +1 @@ +4405594aebfc3ee8a728ad0dea1c505a pyion2json-0.0.2.tar.gz |
