Name | odsynth JSON |
Version |
0.0.4
JSON |
| download |
home_page | None |
Summary | None |
upload_time | 2024-07-19 00:10:30 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.10 |
license | MIT License Copyright (c) 2024 Kofi Baafi Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
keywords |
data
data synthesis
faker
etl
test data
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
ODSynth generates samples of synthetic data, based on the expected schema of your data. This project may be used for generating data for:
- Seeding your ETL applications
- Benchmarking of ETL applications
- Producing data in various formats (json, delimited text, xml, etc) on disc
With the plugin system, developers can use their own providers, formatters and writers locally in their own applications.
`Read the full documentation here <https://odsynth.readthedocs.io/>`_
Installation
-------------
``pip install odsynth``
Basic Usage
------------
Once installed you can use ``synth`` to generate synthetic data in the console or ``publish`` to generate data to a medium such as on local disc.
Using synth to generate json data
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
``synth --schema-spec-file=../schema.yaml --format=json --num-samples=3``
Using synth to generate csv data
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
``synth --schema-spec-file=../flat_schema.yaml --format=txt --num-samples=3 --formatter-arg delimiter=comma``
The delimiter may be one of 'comma', 'tab' or 'pipe'
Using ODSynth in your own code
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
::
from odsynth.schema import Schema
def generate_data():
num_samples=3
batch_size=5 # Batch size can be greater than num_samples
format="txt" # Format can be json,xml,txt,pandas
formatter_args=["delimiter=comma"] # Depending on formatter, args may need to be provided. Default is None
schema_spec_file="./sample_schema/flat_schema.yaml" # CSV formatter expects a tabular schema.
# XML, JSON, Pandas and Base Formatters can accept
# hierarchical data
generator = Schema(schema_file=schema_spec_file).build_generator(
num_examples=num_samples,
batch_size=batch_size,
format=format,
formatter_args=formatter_args,
)
data = generator.get_data()
# Prints generated data in csv format
print(data)
Use 'publish' to load synthetic data to local disc in XML format
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Publish 100 samples of schema specified in ``flat_schema.yaml``, 10 examples per batch.
``publish --schema-spec-file=../flat_schema.yaml --format=xml --writer=local_disc --writer-arg output_dir=../odsynth_out --num-samples=100 --batch-size=10``
For more on the data generator and the data publisher, see the help pages for synth and publish
``publish --help`` or ``synth --help``
For the following schema: ::
fields:
parent_firstname:
provider: first_name
parent_lastname:
provider: last_name
children:
fields:
firstname:
provider: first_name
lastname:
provider: last_name
max_count: 5
is_array: true
parent_age:
provider: random_int
provider_args:
min: 25
max: 55
parent_ssn:
provider: ssn
The following output is expected: ::
{
"parent_first_name": "Christopher", "parent_lastname": "Villegas",
"children": [
{"firstname": "Jason", "lastname": "Rogers"},
{"firstname": "Andrea", "lastname": "Young"},
{"firstname": "Michelle", "lastname": "Kaiser"}
],
"parent_age": 43,
"parent_ssn": "269-11-8507"
}
License
-------
ODSynth is released under the MIT License. See `LICENSE`_ for details.
Credits
-------
- `Faker`_
.. _Faker: https://github.com/joke2k/faker
.. _LICENSE: https://github.com/duapa/odsynth/blob/main/LICENSE
.. _documentation: https://odsynth.readthedocs.io/
Raw data
{
"_id": null,
"home_page": null,
"name": "odsynth",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": "Kofi Baafi <kbaafi@gmail.com>",
"keywords": "data, data synthesis, faker, ETL, test data",
"author": null,
"author_email": "Kofi Baafi <kbaafi@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/d5/e2/a3011f0a7a3fb0ac338e99dc2609ca296fb6deea9467882db74fdc290ac4/odsynth-0.0.4.tar.gz",
"platform": null,
"description": "ODSynth generates samples of synthetic data, based on the expected schema of your data. This project may be used for generating data for:\n\n- Seeding your ETL applications\n- Benchmarking of ETL applications\n- Producing data in various formats (json, delimited text, xml, etc) on disc\n\nWith the plugin system, developers can use their own providers, formatters and writers locally in their own applications.\n\n`Read the full documentation here <https://odsynth.readthedocs.io/>`_ \n\n\nInstallation\n-------------\n``pip install odsynth``\n\nBasic Usage\n------------\n\nOnce installed you can use ``synth`` to generate synthetic data in the console or ``publish`` to generate data to a medium such as on local disc.\n\nUsing synth to generate json data\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n``synth --schema-spec-file=../schema.yaml --format=json --num-samples=3``\n\nUsing synth to generate csv data\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n``synth --schema-spec-file=../flat_schema.yaml --format=txt --num-samples=3 --formatter-arg delimiter=comma``\n\nThe delimiter may be one of 'comma', 'tab' or 'pipe'\n\nUsing ODSynth in your own code\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ \n\n::\n\n from odsynth.schema import Schema\n\n def generate_data():\n num_samples=3\n batch_size=5 # Batch size can be greater than num_samples\n format=\"txt\" # Format can be json,xml,txt,pandas\n formatter_args=[\"delimiter=comma\"] # Depending on formatter, args may need to be provided. Default is None\n schema_spec_file=\"./sample_schema/flat_schema.yaml\" # CSV formatter expects a tabular schema.\n # XML, JSON, Pandas and Base Formatters can accept\n # hierarchical data\n\n generator = Schema(schema_file=schema_spec_file).build_generator(\n num_examples=num_samples,\n batch_size=batch_size,\n format=format,\n formatter_args=formatter_args,\n )\n data = generator.get_data()\n\n # Prints generated data in csv format\n print(data)\n\nUse 'publish' to load synthetic data to local disc in XML format\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nPublish 100 samples of schema specified in ``flat_schema.yaml``, 10 examples per batch.\n\n``publish --schema-spec-file=../flat_schema.yaml --format=xml --writer=local_disc --writer-arg output_dir=../odsynth_out --num-samples=100 --batch-size=10``\n\nFor more on the data generator and the data publisher, see the help pages for synth and publish\n``publish --help`` or ``synth --help``\n\nFor the following schema: ::\n\n fields:\n parent_firstname:\n provider: first_name\n parent_lastname:\n provider: last_name\n children:\n fields:\n firstname:\n provider: first_name\n lastname:\n provider: last_name\n max_count: 5\n is_array: true\n parent_age:\n provider: random_int\n provider_args:\n min: 25\n max: 55\n parent_ssn:\n provider: ssn\n\n\n\nThe following output is expected: ::\n\n {\n \"parent_first_name\": \"Christopher\", \"parent_lastname\": \"Villegas\",\n \"children\": [\n {\"firstname\": \"Jason\", \"lastname\": \"Rogers\"},\n {\"firstname\": \"Andrea\", \"lastname\": \"Young\"},\n {\"firstname\": \"Michelle\", \"lastname\": \"Kaiser\"}\n ],\n \"parent_age\": 43,\n \"parent_ssn\": \"269-11-8507\"\n }\n\nLicense\n-------\n\nODSynth is released under the MIT License. See `LICENSE`_ for details.\n\nCredits\n-------\n\n- `Faker`_\n\n\n.. _Faker: https://github.com/joke2k/faker\n.. _LICENSE: https://github.com/duapa/odsynth/blob/main/LICENSE\n.. _documentation: https://odsynth.readthedocs.io/\n",
"bugtrack_url": null,
"license": "MIT License Copyright (c) 2024 Kofi Baafi Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
"summary": null,
"version": "0.0.4",
"project_urls": {
"Documentation": "https://odsynth.readthedocs.io/",
"Homepage": "https://odsynth.readthedocs.io/",
"Repository": "https://github.com/duapa/odsynth.git"
},
"split_keywords": [
"data",
" data synthesis",
" faker",
" etl",
" test data"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "28a5c78d357ad75dd2d9ae27de5e6b928243e872335c46ae16283291e6382c7b",
"md5": "65abd187e30dff893b8c9d24b5ec4bd7",
"sha256": "ee7427156a546530770032cd08b8ffe473dee5fb45928e2a99d1bf1b2cada37f"
},
"downloads": -1,
"filename": "odsynth-0.0.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "65abd187e30dff893b8c9d24b5ec4bd7",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 24541,
"upload_time": "2024-07-19T00:10:28",
"upload_time_iso_8601": "2024-07-19T00:10:28.986421Z",
"url": "https://files.pythonhosted.org/packages/28/a5/c78d357ad75dd2d9ae27de5e6b928243e872335c46ae16283291e6382c7b/odsynth-0.0.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "d5e2a3011f0a7a3fb0ac338e99dc2609ca296fb6deea9467882db74fdc290ac4",
"md5": "8eb2a60606315c5516984f6f8d3d1f02",
"sha256": "15e62293a27b6bd31b18d19bfd0cf487f51059515ebca60e129215384a9ac90b"
},
"downloads": -1,
"filename": "odsynth-0.0.4.tar.gz",
"has_sig": false,
"md5_digest": "8eb2a60606315c5516984f6f8d3d1f02",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 16662,
"upload_time": "2024-07-19T00:10:30",
"upload_time_iso_8601": "2024-07-19T00:10:30.027946Z",
"url": "https://files.pythonhosted.org/packages/d5/e2/a3011f0a7a3fb0ac338e99dc2609ca296fb6deea9467882db74fdc290ac4/odsynth-0.0.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-07-19 00:10:30",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "duapa",
"github_project": "odsynth",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"tox": true,
"lcname": "odsynth"
}