Skip to content

Table Customization

customize() lets you tune generated data while keeping the rest of the schema generation automatic.

from hypothesis import strategies as st
proof.customize(
"products",
price=st.decimals(min_value="0.01", max_value="9999.99", places=2),
sku=st.from_regex(r"^[A-Z]{2}-\d{4}$", fullmatch=True),
)

FK Distribution Strategies

Control how child rows pick parent rows:

proof.customize(
"orders",
fk_distribution={"customer_id": "zipf"},
)
StrategyBehavior
uniformEqual probability per parent
zipfA few parents receive most child rows
adversarialFirst, middle, and last parents only
singleAll children point to one parent
custom callableReturn any Hypothesis strategy per FK

Custom FK distribution callables receive the available parent primary keys and a draw context, and must return a Hypothesis strategy so values still shrink.