❖ PrimaryToPrimaryKey
Last updated
Last updated
Use the PrimaryToPrimaryKey constraint when you have an exact 1-to-1 connection between the primary keys of two or more tables.
This functionality is in Beta. At this time, select SDV Enterprise users have been invited to use this feature.
Create a PrimaryToPrimaryKey
constraint
Parameters:
(required) table_names
: A list of strings, representing the table names whose primary keys are all connected. You must provide two or more table names.
from sdv.cag import PrimaryToPrimaryKey
my_constraint = PrimaryToPrimaryKey(
table_names=['Users', 'Supplemental Info'])
Make sure that all the tables in you provide are in your Metadata, and have a primary key associated with them.
Apply the constraint to any SDV synthesizer. Then fit and sample as usual.
synthesizer = HSASynthesizer(metadata)
synthesizer.add_constraints([my_constraint])
synthesizer.fit(data)
synthetic_data = synthesizer.sample()
For more information about using predefined constraints, please see the Constraint-Augmented Generation tutorial.