Program Your Own Constraint
Last updated
Last updated
If the predefined constraints don't meet your needs, you can program your own constraint with the logic that you need.
Compatibility: Any type of column except for primary and foreign keys
Programming your own constraint is a last resort. Programming a constraint requires you to specify and maintain your own logic. The SDV team does not offer debugging support to SDV Community users for their programmed logic.
In many cases, it's possible to achieve your result more easily with existing constraints. Please browse the to see if your logic is captured by the list.
If you have any questions, please reach out to us on or and we'll be happy to point you in the right direction.
In most cases, your business rules can be achieved by pre-processing your data before using SDV, and post-processing the data after getting the synthetic data. Programmable constraints allow you to input that pre- and post-processing logic directly into your synthesizer, so you do not have to worry about maintaining a separate script.
Learn how to program your own constraint using the tutorial below.
Download the example constraint code used in the tutorial using the link below.
Below, you will find a template code for programming a single table constraint (to be used within a single table of your dataset) and a multi-table constraint (to be used within different tables of your dataset). Select the file you need and fill out the relevant code.
Unfortunately, the SDV team is unable to offer individualized support for this to SDV Community users. For SDV Enterprise users, we offer help with debugging and may prioritize creating a new, predefined constraint related to your logic. To learn more, visit our page about .