Skip to content

Rich Dictionary Schema

Ravi Kiran Pagidi edited this page Jun 28, 2026 · 1 revision

Rich Dictionary Schema

Status

Partially supported. Inline field metadata is planned. Equivalent business rules are supported today through a separate custom_rules mapping.

What it is

A schema where every field carries its type and generation constraints.

When to use it

This shape is useful for reusable data contracts and business-rule-heavy lower environments. Until inline metadata is implemented, split types and rules.

Supported approach today

from great_generator import generate_from_schema

schema = {
    "customer_id": "string",
    "customer_name": "string",
    "age": "int",
    "balance": "float",
    "status": "string",
}

rules = {
    "customer_id": {"prefix": "CUST"},
    "customer_name": {"type": "full_name"},
    "age": {"min": 18, "max": 85},
    "balance": {"min": 0, "max": 100000},
    "status": {"values": ["Active", "Inactive", "Pending"]},
}

df = generate_from_schema(schema, rows=1000, custom_rules=rules)
print(df.head())
df.to_parquet("customers.parquet", index=False)

Sample output

customer_id  customer_name  age  balance   status
CUST000001   Ava Johnson    34   4812.37   Active

Future inline shape

# Planned, not runnable today
schema = {"age": {"type": "int", "min": 18, "max": 85}}

Notes and limitations

Do not pass nested field metadata as the schema value today. It will be interpreted as a dtype string rather than metadata.

Clone this wiki locally