Skip to main content

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. Step by step guide on medium.

How to use

Follow below steps to run the utility. I am open to your suggestions, please add comments or mail me your suggestions.

Note: Data Types are case insensitive

Inputs

It accept valid json schema files only with supported data types: "STRING","INT","INTEGER","NUMBER","FLOAT","DATE","BOOLEAN","BOOL","TIMESTAMP","ADDRESS","CITY","COUNTRY","COUNTRY_CODE","POSTCODE","LICENSE_PLATE","SWIFT","COMPANY","COMPANY_SUFFIX","CREDIT_CARD","CREDIT_CARD_PROVIDER","CREDIT_CARD_NUMBER","CURRENCY","DAY_NUM","DAY_NAME","MONTH_NUM","MONTH_NAME","YEAR","COORDINATE","LATITUDE","LONGITUDE","EMAIL","HOSTNAME","IPV4","IPV6","URI","URL","JOB","TEXT","PASSWORD","SHA1","SHA256","UUID","PASSPORT_NUMBER","NAME","LANGUAGE_NAME","LAST_NAME","FIRST_NAME","PHONE_NUMBER","SSN"

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>",
  "number_of_rows": "<positive number>",
  "properties": {
    "<column_name>": { "type": "<data_type>" },
    "<column_name>": { "type": "<data_type>" }
  }
}

The sample json schema file would look like below.

{
  "type": "object",
  "number_of_rows": "<positive number>",
  "properties": {
    "price": { "type": "number" },
    "name": { "type": "name" },
    "location": { "type": "COORDINATE" },
    "flt": { "type": "float" },
    "email_id": { "type": "EMAIL" },
    "dt": { "type": "date" },
    "ts": { "type": "timestamp" },
    "is_valid": { "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.

Pre-requisites

  1. Python ^3.10

Steps to execute the utility

  1. pip install mock-data-generator
  2. specify the parameters mentioned above
  3. 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.

Metadata

Release files for mock-data-generator 1.2.9

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mock-data-generator 1.2.9
File Size Uploaded Provenance Actions
mock_data_generator-1.2.9.tar.gz 8.7 kB Without provenance Details for mock_data_generator-1.2.9.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for mock-data-generator 1.2.9
File Interpreter ABI Platform Actions
mock_data_generator-1.2.9-py3-none-any.whl Python 3 none any Details for mock_data_generator-1.2.9-py3-none-any.whl

Total release size: 20.1 kB

Release files / mock_data_generator-1.2.9.tar.gz

Download URL mock_data_generator-1.2.9.tar.gz
Size 8.7 kB
Tags Source
SHA-256 checksum
How to use checksums
ebbdf60b9ed5abf39f1f0ef9f6d6a3dccc279d482888ef42fe1dbb1e48dbe665
BLAKE2b-256 checksum
How to use checksums
3b495d00d2dfd86023b6552171086fbea207d789a6c4be5eca51e414a3fdc24c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.4.2 CPython/3.7.7 Darwin/22.2.0

Release files / mock_data_generator-1.2.9-py3-none-any.whl

Download URL mock_data_generator-1.2.9-py3-none-any.whl
Size 11.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a47afa50fed911e83d73aeef1732688f4aeea8b08ae4669b62fb371381cc07e8
BLAKE2b-256 checksum
How to use checksums
2e12f1789ccb2a2925ebdfd575e02f52879f6718657bf00a5cf5a628d32f487a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.4.2 CPython/3.7.7 Darwin/22.2.0

Security for mock-data-generator 1.2.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page