Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Relationship between primary keys crashes HMASynthesizer #1232

Closed
fealho opened this issue Feb 5, 2023 · 1 comment
Closed

Relationship between primary keys crashes HMASynthesizer #1232

fealho opened this issue Feb 5, 2023 · 1 comment
Labels
bug Something isn't working resolution:WAI The software is working as intended

Comments

@fealho
Copy link
Member

fealho commented Feb 5, 2023

Creating a relationship between two primary keys crashes the HMASynthesizer. @Neha I'm unsure if that's the expected behavior? If so, the error message should be improved.

    table = pd.DataFrame({'pk': list(range(100)), 'col1': np.random.random(100), 'col2': np.random.choice(['a', 'b', 'c'], 100)})
    data = {'table': table, 'table2': table}
    metadata = MultiTableMetadata()
    metadata.detect_table_from_dataframe('table', table)
    metadata.set_primary_key('table', 'pk')
    metadata.detect_table_from_dataframe('table2', table)
    metadata.set_primary_key('table2', 'pk')
    metadata.add_relationship('table', 'table2', 'pk', 'pk')
    synthesizer = HMASynthesizer(metadata)
    synthesizer.fit(data)

The above crashes with a KeyError: pk.

@fealho fealho added the new Automatic label applied to new issues label Feb 5, 2023
@npatki
Copy link
Contributor

npatki commented Feb 6, 2023

Relationships between primary keys are not supported. If you have a column that refers to another table, the column must e a foreign key, by definition.

Let's validate this in #1236 and close this issue off.

@npatki npatki closed this as completed Feb 6, 2023
@npatki npatki added bug Something isn't working resolution:WAI The software is working as intended and removed new Automatic label applied to new issues labels Feb 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working resolution:WAI The software is working as intended
Projects
None yet
Development

No branches or pull requests

2 participants