Skip to content

Quick Start with generate_from_schema

Ravi Kiran Pagidi edited this page Jun 28, 2026 · 2 revisions

Quick Start with generate_from_schema

Install

pip install great-generator

Generate a Pandas DataFrame

from great_generator import generate_from_schema

schema = {
    "customer_id": "string",
    "customer_name": "string",
    "email": "string",
    "age": "int",
    "balance": "double",
    "created_at": "timestamp",
    "account_status": "string",
}

df = generate_from_schema(schema, rows=1000)
print(df.head())

Next: Generate related tables

from great_generator import generate_relational

data = generate_relational(
    tables={
        "customers": {
            "schema": "customer_id int primary key, customer_name string",
            "rows": 1000,
        },
        "orders": {
            "schema": "order_id int primary key, customer_id int references customers.customer_id, order_amount double",
            "rows": 5000,
        },
    }
)

customers_df = data["customers"]
orders_df = data["orders"]

The returned dictionary keeps every table as a DataFrame while preserving declared relationships.

Add business rules

df = generate_from_schema(
    schema,
    rows=1000,
    custom_rules={
        "customer_id": {"prefix": "CUST"},
        "age": {"min": 18, "max": 85},
        "balance": {"min": 0, "max": 100000},
        "account_status": {"values": ["Active", "Inactive", "Pending"]},
    },
)

Write it

df.to_csv("customers.csv", index=False)
df.to_parquet("customers.parquet", index=False)

Next: Relationship-Aware Data Generation, then Supported Schema Input Types.

Clone this wiki locally