Environment Details
Please indicate the following details about the environment in which you found the bug:
- SDV version: 1.37.3
- Python version: 3.14.6
- Operating System: macOS 26.4.1
Error Description
Using the utility function get_random_subset, I got the following error AttributeError: 'DataFrame' object has no attribute 'unique'. I expect that this error is getting raised because the primary key of one of the child tables is a composite key, which makes the data a pandas DataFrame instead of Series.
Snapshot of the traceback:
File ~/miniconda3/envs/sdgym/lib/python3.14/site-packages/sdv/multi_table/utils.py:522, in _get_primary_keys_referenced(data, metadata)
520 child_table = relationship['child_table_name']
521 foreign_key = relationship['child_foreign_key']
--> 522 primary_keys_referenced[parent_table].update(set(data[child_table][foreign_key].unique()))
524 return primary_keys_referenced
File ~/miniconda3/envs/sdgym/lib/python3.14/site-packages/pandas/core/generic.py:6321, in NDFrame.__getattr__(self, name)
6317 and name not in self._accessors
6318 and self._info_axis._can_hold_identifiers_and_holds_name(name)
6319 ):
6320 return self[name]
-> 6321 return object.__getattribute__(self, name)
AttributeError: 'DataFrame' object has no attribute 'unique'
Steps to reproduce
from sdv.datasets.demo import download_demo
from sdv.utils.poc import get_random_subset
data, metadata = download_demo('multi_table', 'credit_card_transactions')
get_random_subset(data, metadata, "sd254_cards", 100)
Environment Details
Please indicate the following details about the environment in which you found the bug:
Error Description
Using the utility function
get_random_subset, I got the following errorAttributeError: 'DataFrame' object has no attribute 'unique'. I expect that this error is getting raised because the primary key of one of the child tables is a composite key, which makes the data a pandas DataFrame instead of Series.Snapshot of the traceback:
Steps to reproduce