Python Dict Schema

Import your own schema structure — useful when you already have a dict representation of your tables (e.g. from an ORM introspection or a JSON schema).

import misata

schema = misata.from_dict_schema({
    "customers": {
        "id":    {"type": "integer", "primary_key": True},
        "email": {"type": "email"},
        "plan":  {"type": "string", "enum": ["free", "pro", "enterprise"]},
        "mrr":   {"type": "float", "min": 0.0, "max": 2400.0},
    },
    "orders": {
        "id":          {"type": "integer", "primary_key": True},
        "customer_id": {
            "type": "integer",
            "foreign_key": {"table": "customers", "column": "id"},
        },
        "amount": {"type": "float", "min": 1.0, "max": 999.0},
    },
}, row_count=5_000)

tables = misata.generate_from_schema(schema)

Type mapping

Dict typeMisata type
integer, intint
float, number, decimalfloat
string, str, text, email, urltext
boolean, boolboolean
date, datetime, timestampdate
enum (with enum key)categorical