Skip to content

Commit

Permalink
misc fix
Browse files Browse the repository at this point in the history
  • Loading branch information
coufon committed Jan 17, 2024
1 parent 691cc92 commit 1fad13f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions python/src/space/catalogs/directory.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def create_dataset(self, name: str, schema: pa.Schema,
record_fields: List[str]) -> Dataset:
# TODO: should disallow overwriting an entry point file, to avoid creating
# two datasets at the same location.
return Dataset.create(self._dataset_name(name), schema, primary_keys,
return Dataset.create(self._dataset_location(name), schema, primary_keys,
record_fields)

def delete_dataset(self, name: str) -> None:
Expand All @@ -50,17 +50,17 @@ def delete_dataset(self, name: str) -> None:
def dataset(self, name: str) -> Union[Dataset, MaterializedView]:
# TODO: to catch file not found and re-throw a DatasetNotFoundError.
# TODO: to support loading a materialized view.
return Dataset.load(self._dataset_name(name))
return Dataset.load(self._dataset_location(name))

def datasets(self) -> List[DatasetInfo]:
results = []
for ds_name in os.listdir(self._location):
ds_location = self._dataset_name(ds_name)
ds_location = self._dataset_location(ds_name)
if os.path.isdir(ds_location) and os.path.isfile(
paths.entry_point_path(ds_location)):
results.append(DatasetInfo(ds_name, ds_location))

return results

def _dataset_name(self, name: str) -> str:
def _dataset_location(self, name: str) -> str:
return os.path.join(self._location, name)

0 comments on commit 1fad13f

Please sign in to comment.