Program Your Own Constraint
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 Predefined Constraints list to see if your logic is captured by the list.
If you have any questions, please reach out to us on Slack or GitHub and we'll be happy to point you in the right direction.
How to Program Your Own Constraint
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.
Programmable Constraints Template
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.
FAQs
Last updated