Generate mock data using json schema supplied.
Project description
Data Generator - WIP
Overview
During every data project I came across a very basic common problem where we have to wait for the test data. For fewer columns it's quite easy to generate the data using online utilities but those have certain limitations on the number of columns and rows. To solve this, I’ve built a utility to generate the mock data based on the supplied json schema. This utility is using Python Faker module to randomly generate the test data.
How to use
Follow below steps to run the utility. I am open to your suggestions, please add comments or mail me your suggestions.
Inputs
It accept valid json schema files only with supported data types: "STRING","INT","INTEGER","NUMBER","FLOAT","DATE","BOOLEAN","BOOL","TIMESTAMP"
Supported Input Parameters
- --input_json_schema_path: Provide absolute path of the json schema file/folder. It accepts folders(that contains valid json schema files) or absolute path of a json schema file.
Json schema file format.
{
"type": "<object/record,etc>",
"properties": {
"<column_name>": { "type": "<data_type>" },
"<column_name>": { "type": "<data_type>" }
}
}
The sample json schema file would look like below.
{
"type": "object",
"properties": {
"price": { "type": "number" },
"name": { "type": "string" },
"a": { "type": "integer" },
"b": { "type": "float" },
"c": { "type": "boolean" },
"dt": { "type": "date" },
"ts": { "type": "timestamp" },
"e": { "type": "boolean" }
}
}
The generator will skip the current json schema file if an error occurred. Mock data would get generated for rest of the valid schema files.
-
--output_file_format: The output file format should be one of the
"CSV","JSON","XML","EXCEL","PARQUET","ORC"
-
--output_path: Absolute path to store the generated mock dataset. If an output path does not exists, it will create it and store the data inside the directory into data. file.
-
--number_of_rows: Number of output rows to be generated
Pre-requisites
- Python ^3.10
Steps to execute the utility
- pip install mock-data-generator
- specify the parameters mentioned above
- Sample command:
generate --input_json_schema_path=resources/schema.json --output_file_format=csv --output_path=output_data --number_of_rows=10
:
Licensing
Distributed under the MIT license. See LICENSE
for more information.
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
Hashes for mock_data_generator-1.2.4.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2c9ace3cb618e405b477506dac095f9291ca0ff07f9d7f5aad98b09701cc55b0 |
|
MD5 | b0bd5e170d389e8a030e85b8057874ab |
|
BLAKE2b-256 | 43b92c640fc2fb8d222602585b6c3cdc35645cea50fc2f9dd0a851bd17650c23 |
Hashes for mock_data_generator-1.2.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a67d3ddc1cfbf3483fde556d239ca3d029b768382faf33388d9fc083e2637e41 |
|
MD5 | 19e215710ce874f1c2e8c4186e8b88f9 |
|
BLAKE2b-256 | c9d8a71f74915e8cb9f2ae9399008162ce4701289bee1b4ccaf302b931a328cb |