diff --git a/singlestoredb/fusion/handlers/files.py b/singlestoredb/fusion/handlers/files.py index b657b8a4..7f848611 100644 --- a/singlestoredb/fusion/handlers/files.py +++ b/singlestoredb/fusion/handlers/files.py @@ -32,7 +32,7 @@ def run(self, params: Dict[str, Any]) -> Optional[FusionSQLResult]: for x in file_space.listdir( params['at_path'] or '/', recursive=params['recursive'], - return_meta=False, + return_objects=False, ): info = file_space.info(x) files.append( @@ -48,7 +48,7 @@ def run(self, params: Dict[str, Any]) -> Optional[FusionSQLResult]: res.set_rows([(x,) for x in file_space.listdir( params['at_path'] or '/', recursive=params['recursive'], - return_meta=False, + return_objects=False, )]) if params['like']: diff --git a/singlestoredb/management/files.py b/singlestoredb/management/files.py index f66bf3a9..593f7e39 100644 --- a/singlestoredb/management/files.py +++ b/singlestoredb/management/files.py @@ -425,7 +425,6 @@ def is_file(self, path: PathLike) -> bool: pass @overload - @abstractmethod def listdir( self, path: PathLike = '/', @@ -436,7 +435,6 @@ def listdir( pass @overload - @abstractmethod def listdir( self, path: PathLike = '/', @@ -1028,7 +1026,7 @@ def listdir( # Validate via listing GET; if response lacks 'content', it's not a directory try: out = self._listdir(path, recursive=recursive, return_objects=return_objects) - except Exception as exc: + except (ManagementError, KeyError) as exc: # If the path doesn't exist or isn't a directory, _listdir will fail raise NotADirectoryError(f'path is not a directory: {path}') from exc diff --git a/singlestoredb/management/workspace.py b/singlestoredb/management/workspace.py index fd543dce..1b5d7c27 100644 --- a/singlestoredb/management/workspace.py +++ b/singlestoredb/management/workspace.py @@ -529,6 +529,8 @@ def listdir( ---------- stage_path : Path or str, optional Path to the stage location + recursive : bool, optional + If True, recursively list all files and folders return_objects : bool, optional If True, return list of FilesObject instances. Otherwise just paths.