{ "info": { "author": "Christopher H. Todd", "author_email": "Christopher.Hayden.Todd@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "Natural Language :: English", "Programming Language :: Python", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8" ], "description": "\n\n# Christopher H. Todd's Python Lib for AVRO/AVSC\n\nThe ctodd-python-lib-avro project is responsible for interacting with [Apache AVRO](https://avro.apache.org/docs/1.8.2/gettingstartedpython.html). This includes converting to byte arrays and from byte arrays, writing and reading .avro files, writing and reading .avsc files, and other minor quality of life wrappers.\n\nThe library relies on Python's avro-python3 package, and is wrapped with custom/specific exception handling, simpler interactions, and a more functional style to reduce code in projects dealing with AVRO\n\n## Table of Contents\n\n- [Dependencies](#dependencies)\n- [Libraries](#libraries)\n- [Example Scripts](#example-scripts)\n- [Notes](#notes)\n- [TODO](#todo)\n\n## Dependencies\n\n### Python Packages\n\n- avro-python3>=1.8.2\n- simplejson>=3.16.0\n\n## Libraries\n\n### [avro_converter_helpers.py](https://github.com/ChristopherHaydenTodd/ctodd-python-lib-avro/blob/master/avro_helpers/avro_converter_helpers.py)\n\nThis library is used to convert avro to other formats (first .json)\n\nFunctions:\n\n```\ndef convert_avro_file_to_json(avro_filename, json_filename=None):\n \"\"\"\n Purpose:\n Convert an .avro file into a .json file\n Args:\n avro_filename (String): Path/filename of the .avro file to convert to .json\n json_filename (String): Path/filename of the .json file to generate. if none\n is specified, just use the same .avro path and change the extension\n Yields:\n json_filename (String): Path/filename of the .json file generated\n \"\"\"\n```\n\n### [avro_exceptions.py](https://github.com/ChristopherHaydenTodd/ctodd-python-lib-avro/blob/master/avro_helpers/avro_exceptions.py)\n\nFile for holding custom exception types that will be generated by the avro_helpers libraries\n\nException Types:\n\n```\nclass AvroTestException(Exception):\n \"\"\"\n Purpose:\n The AvscInvalid will be raised when reading the .avsc raises an exception\n \"\"\"\n```\n\n```\nclass AvscInvalid(Exception):\n \"\"\"\n Purpose:\n The AvscInvalid will be raised when reading the .avsc raises an exception\n \"\"\"\n```\n\n```\nclass AvscNotFound(Exception):\n \"\"\"\n Purpose:\n The AvscNotFound will be raised when trying to Read a .avsc file\n that cannot be found.\n \"\"\"\n```\n\n```\nclass AvroNotFound(Exception):\n \"\"\"\n Purpose:\n The AvroNotFound will be raised when trying to Read a .avro file\n that cannot be found.\n \"\"\"\n```\n\n\n### [avro_general_helpers.py](https://github.com/ChristopherHaydenTodd/ctodd-python-lib-avro/blob/master/avro_helpers/avro_general_helpers.py)\n\nAvro General Helpers. This library is used to interact with .avro files not specificlly related to reading or writing them.\n\nFunctions:\n\n*N/A*\n\n### [avro_reading_helpers.py](https://github.com/ChristopherHaydenTodd/ctodd-python-lib-avro/blob/master/avro_helpers/avro_reading_helpers.py)\n\nAvro Reading Helpers. This library is used to aid in the task of reading .avro files\n\nFunctions:\n\n```\ndef get_record_from_avro_generator(avro_filename):\n \"\"\"\n Purpose:\n Generator of records from a .avro filename (with path in the filename)\n Args:\n avro_filename (String): Path/filename of the .avro file to get records from\n Yields:\n avro_record (Record Obj from .avro): Record read from the .avro file\n \"\"\"\n```\n\n```\ndef get_record_from_avro_buffered(avro_filename):\n \"\"\"\n Purpose:\n Buffered Get records from a .avro filename (with path in the filename)\n Args:\n avro_filename (String): Path/filename of the .avro file to get records from\n Returns:\n avro_records (List of Record Objs from .avro): List of Records read from\n the .avro file\n \"\"\"\n```\n\n### [avro_schema_helpers.py](https://github.com/ChristopherHaydenTodd/ctodd-python-lib-avro/blob/master/avro_helpers/avro_schema_helpers.py)\n\nAvro Schema Helpers. This library is used to interact with .avsc files\n\nFunctions:\n\n```\ndef get_schema_from_avsc_file(avsc_filename):\n \"\"\"\n Purpose:\n Get the file schema from an .avsc filename (with path in the filename)\n Args:\n avsc_filename (String): Path/filename of the .avsc file to get the schema from\n Return:\n avro_schema (AVRO Schema Object): Schema object from the avro library\n \"\"\"\n```\n\n### [avro_writing_helpers.py](https://github.com/ChristopherHaydenTodd/ctodd-python-lib-avro/blob/master/avro_helpers/avro_writing_helpers.py)\n\nAvro Writing Helpers. This library is used to aid in the task of writing .avro files\n\nFunctions:\n\n```\ndef write_raw_records_to_avro(raw_records, avro_filename, avro_schema):\n \"\"\"\n Purpose:\n Write Records to .avro File\n Args:\n raw_records (List of Dicts): List of Recrods to Write to AVRO as Bytes\n avro_filename (String): Filename and path of .avro to write\n avro_schema (AVRO Schema Object): Schema object from the avro library\n Returns:\n N/A\n \"\"\"\n```\n\n```\ndef serialize_data(raw_records, avro_schema):\n \"\"\"\n Purpose:\n Serialize a record as bytes\n Args:\n raw_records (List of Dicts): List of Records to Serialize\n avro_schema (AVRO Schema Object): Schema object from the avro library\n Return:\n serialized_records (List of Byte Array): Records Serialized into Byte-Array\n \"\"\"\n```\n\n## Example Scripts\n\nExample executable Python scripts/modules for testing and interacting with the library. These show example use-cases for the libraries and can be used as templates for developing with the libraries or to use as one-off development efforts.\n\n### [read_avro_file.py](https://github.com/ChristopherHaydenTodd/ctodd-python-lib-avro/blob/master/example_usage/read_avro_file.py)\n\n```\n Purpose:\n Read an .avro File\n\n Steps:\n - Either\n - Read .avro File as Buffered List\n - Read .avro File as Generator\n\n function call:\n python3 read_avsc_file.py {--avro=avro_filename}\n\n example call:\n python3 read_avsc_file.py --avro=\"./data/test_data.avro\"\n```\n\n### [read_avsc_file.py](https://github.com/ChristopherHaydenTodd/ctodd-python-lib-avro/blob/master/example_usage/read_avsc_file.py)\n\n```\n Purpose:\n Read an .avsc File to get the schema\n\n Steps:\n - Read .avsc Schema\n\n function call:\n python3 read_avsc_file.py {--avsc=avsc_filename}\n\n example call:\n python3 read_avsc_file.py --avsc=\"./avsc/test_schema.avsc\"\n```\n\n\n### [write_avro_file.py](https://github.com/ChristopherHaydenTodd/ctodd-python-lib-avro/blob/master/example_usage/write_avro_file.py)\n\n```\n Purpose:\n Write an .avro File\n\n Steps:\n - Either\n - Write .avro File\n\n function call:\n python3.6 write_avro_file.py {--avro=avro_filename} \\\n {--avsc=avsc_filename}\n\n example call:\n python3.6 write_avro_file.py --avro=\"./data/generated_data.avro\" \\\n --avsc=\"./avsc/test_schema.avsc\"\n```\n\n## Notes\n\n - Relies on f-string notation, which is limited to Python3.6. A refactor to remove these could allow for development with Python3.0.x through 3.5.x\n\n## TODO\n\n - Unittest framework in place, but lacking tests\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/ChristopherHaydenTodd/ctodd-python-lib-avro", "keywords": "python,libraries,avro,avsc", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "ctodd-python-lib-avro", "package_url": "https://pypi.org/project/ctodd-python-lib-avro/", "platform": "", "project_url": "https://pypi.org/project/ctodd-python-lib-avro/", "project_urls": { "Homepage": "https://github.com/ChristopherHaydenTodd/ctodd-python-lib-avro" }, "release_url": "https://pypi.org/project/ctodd-python-lib-avro/1.0.5/", "requires_dist": [ "avro-python3 (>=1.8.2)", "simplejson (>=3.16.0)" ], "requires_python": ">3.6", "summary": "Python utilities used for interacting with .avro/.avsc files", "version": "1.0.5" }, "last_serial": 5103648, "releases": { "1.0.2": [ { "comment_text": "", "digests": { "md5": "0fe35c774b17e660f5d1d6a9aec4cd82", "sha256": "5b186c425b18a8f685d964838b5cbd87571bdf5dffe18b36ae5efd87eb716488" }, "downloads": -1, "filename": "ctodd_python_lib_avro-1.0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "0fe35c774b17e660f5d1d6a9aec4cd82", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 9094, "upload_time": "2019-04-04T20:22:45", "url": "https://files.pythonhosted.org/packages/b8/e3/9e6955049637ae61ff82485318884cf6f05bb19b755a51faec3014e56f4f/ctodd_python_lib_avro-1.0.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "f1bede68c470dcaafe4c9da745d29673", "sha256": "081718d2e9582c9f4064205ffe3e94c4471a134821f3eb018467b1a17caf0a88" }, "downloads": -1, "filename": "ctodd-python-lib-avro-1.0.2.tar.gz", "has_sig": false, "md5_digest": "f1bede68c470dcaafe4c9da745d29673", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4463, "upload_time": "2019-04-04T19:53:06", "url": "https://files.pythonhosted.org/packages/4a/b6/514a916d48c45442fbed9f2bfc4d4215391544dcae07759d11d7bd0d3096/ctodd-python-lib-avro-1.0.2.tar.gz" } ], "1.0.3": [ { "comment_text": "", "digests": { "md5": "3923bc2087983029cf94935c8a53a704", "sha256": "2db4e5baf78976cd3921477f68075b43d0d27011a916de304b79f84e18624cf5" }, "downloads": -1, "filename": "ctodd_python_lib_avro-1.0.3-py3-none-any.whl", "has_sig": false, "md5_digest": "3923bc2087983029cf94935c8a53a704", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">3.0", "size": 9093, "upload_time": "2019-04-04T20:23:33", "url": "https://files.pythonhosted.org/packages/06/cf/957518404ec595fee63ef451b17599de869d08f8294d1d5ba5adeee6baff/ctodd_python_lib_avro-1.0.3-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "0a51b4ee972e549f50c46f06dccba31a", "sha256": "3e70a2b52fdbb5f740843f0e044a96fbd96f447baaef941ea7cc8819bc0aa837" }, "downloads": -1, "filename": "ctodd-python-lib-avro-1.0.3.tar.gz", "has_sig": false, "md5_digest": "0a51b4ee972e549f50c46f06dccba31a", "packagetype": "sdist", "python_version": "source", "requires_python": ">3.0", "size": 5506, "upload_time": "2019-04-04T20:23:34", "url": "https://files.pythonhosted.org/packages/43/7d/b85608619a000cfb6931036720f98fd8dfce6d6e673ddfc220cbc0d727b7/ctodd-python-lib-avro-1.0.3.tar.gz" } ], "1.0.4": [ { "comment_text": "", "digests": { "md5": "fc133c4c4f2138d1e9b9b5463f52e0aa", "sha256": "6fa1679e01ef72587c01ca2ed03cceceb897c508a2961260913a0bb0457b7f88" }, "downloads": -1, "filename": "ctodd_python_lib_avro-1.0.4-py3-none-any.whl", "has_sig": false, "md5_digest": "fc133c4c4f2138d1e9b9b5463f52e0aa", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">3.0", "size": 9124, "upload_time": "2019-04-04T20:31:31", "url": "https://files.pythonhosted.org/packages/e0/b8/a4bca9f3cb2c34601441697661633a82c88f65d2106414170afc0bc2eb28/ctodd_python_lib_avro-1.0.4-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "4c5e3ff0b27a22732f3425566e990257", "sha256": "44e67ebe8d6a06f11e1e38398949fc98223cc59ea38355178434549046e50e2b" }, "downloads": -1, "filename": "ctodd-python-lib-avro-1.0.4.tar.gz", "has_sig": false, "md5_digest": "4c5e3ff0b27a22732f3425566e990257", "packagetype": "sdist", "python_version": "source", "requires_python": ">3.0", "size": 5492, "upload_time": "2019-04-04T20:31:33", "url": "https://files.pythonhosted.org/packages/f4/6a/16458585dc67ea315eee997d3c72efc847ddc87398281a84b038c137d88e/ctodd-python-lib-avro-1.0.4.tar.gz" } ], "1.0.5": [ { "comment_text": "", "digests": { "md5": "3e020a96765cee34dc4c97f05adc7794", "sha256": "8ee1c2cc64ac9b62f02b4dc0f0e208720d5bdcfb6023ed4a62351bf892df3706" }, "downloads": -1, "filename": "ctodd_python_lib_avro-1.0.5-py3-none-any.whl", "has_sig": false, "md5_digest": "3e020a96765cee34dc4c97f05adc7794", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">3.6", "size": 10827, "upload_time": "2019-04-05T13:14:35", "url": "https://files.pythonhosted.org/packages/d5/2e/ec6804c3698cdcf9f8bdcfc0abea782fe972ff7f15acaa6f01b1e66e83f8/ctodd_python_lib_avro-1.0.5-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "363ecb10e5c4e9cc60f67bf5a35964a2", "sha256": "4b7ae261395c8d231328d28771edea5934c19f1305089699c75a51c7f80467d6" }, "downloads": -1, "filename": "ctodd-python-lib-avro-1.0.5.tar.gz", "has_sig": false, "md5_digest": "363ecb10e5c4e9cc60f67bf5a35964a2", "packagetype": "sdist", "python_version": "source", "requires_python": ">3.6", "size": 7074, "upload_time": "2019-04-05T13:14:36", "url": "https://files.pythonhosted.org/packages/f0/6d/aa1c9e60d8c3d0b62a0a7d65a3c908bc613e83aac2412c703428ff079b14/ctodd-python-lib-avro-1.0.5.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "3e020a96765cee34dc4c97f05adc7794", "sha256": "8ee1c2cc64ac9b62f02b4dc0f0e208720d5bdcfb6023ed4a62351bf892df3706" }, "downloads": -1, "filename": "ctodd_python_lib_avro-1.0.5-py3-none-any.whl", "has_sig": false, "md5_digest": "3e020a96765cee34dc4c97f05adc7794", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">3.6", "size": 10827, "upload_time": "2019-04-05T13:14:35", "url": "https://files.pythonhosted.org/packages/d5/2e/ec6804c3698cdcf9f8bdcfc0abea782fe972ff7f15acaa6f01b1e66e83f8/ctodd_python_lib_avro-1.0.5-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "363ecb10e5c4e9cc60f67bf5a35964a2", "sha256": "4b7ae261395c8d231328d28771edea5934c19f1305089699c75a51c7f80467d6" }, "downloads": -1, "filename": "ctodd-python-lib-avro-1.0.5.tar.gz", "has_sig": false, "md5_digest": "363ecb10e5c4e9cc60f67bf5a35964a2", "packagetype": "sdist", "python_version": "source", "requires_python": ">3.6", "size": 7074, "upload_time": "2019-04-05T13:14:36", "url": "https://files.pythonhosted.org/packages/f0/6d/aa1c9e60d8c3d0b62a0a7d65a3c908bc613e83aac2412c703428ff079b14/ctodd-python-lib-avro-1.0.5.tar.gz" } ] }