Skip to content

The save_resource for demo datasets should be able to handle filepaths (not just filenames) #2917

Description

@npatki

Problem Description

The save_resource function is a generic function that will allow a user to save any information that is associated with a given demo dataset. This function indexes into a particular dataset (for a given modality), and then retrieves files within that dataset's folder.

The problem is that it only retrieves single files for that dataset (eg. README.txt). But if a file is nested inside a folder, then it wouldn't work (eg. examples/other_file.txt).

Expected Behavior

We should deprecate the current resource_filename parameter and replace it with a resource_filepath parameter. This new parameter should be able accept both filenames and filepaths. It is assumed that the user is already indexed into the dataset, so the filename/filepath would be read from that dataset.

from sdv.datasets.demo import save_resource

save_source(
    modality='multi_table',
    dataset_name='Bupa',
    resource_filepath='examples/other_file.txt', # file is nested in a folder
    output_filepath='example_file.txt'
)

save_source(
    modality='multi_table',
    dataset_name='Bupa',
    resource_filepath='README.txt', # file is in the top-level space for the dataset
    output_filepath='README.txt'
)

Additional context

The older resource_filename parameter should be backwards compatible and emit a FutureWarning if used.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions