Skip to content

Commit

Permalink
reformat and add exception
Browse files Browse the repository at this point in the history
  • Loading branch information
GiaJordan committed Nov 22, 2024
1 parent 65dcc35 commit f9d037d
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions schematic/store/synapse.py
Original file line number Diff line number Diff line change
Expand Up @@ -706,11 +706,21 @@ def getFilesInStorageDataset(
"""
file_list = []

# Get path to dataset folder from fileview to avoid building a new fileview and walking to determine folders and files within
# Get path to dataset folder by using childern to avoid cases where the dataset is the scope of the view
child_path = self.storageFileviewTable.loc[
self.storageFileviewTable["parentId"] == datasetId, "path"
][0]
parent = child_path.split("/")[0]
]
if child_path.empty:
raise LookupError(
f"Dataset {datasetId} could not be found in fileview {self.storageFileview}."
)
child_path = child_path.iloc[0]

# Get the dataset path by eliminating the child's portion of the path to account for nested datasets
parent = child_path.split("/")[:-1]
parent = "/".join(parent)

# Format dataset path to be used in table query
dataset_path = f"'{parent}/%'"

# When querying, only include files to exclude entity files and subdirectories
Expand Down

0 comments on commit f9d037d

Please sign in to comment.