From 12e40daf61c548ff678cf291a974ac723278c809 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 5 Jan 2026 13:53:43 +0000 Subject: [PATCH 1/2] Initial plan From 8a5a79cd10f991aa94aa6faece92115e148ad327 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 5 Jan 2026 13:59:10 +0000 Subject: [PATCH 2/2] Address PR review comments: fix parameter names, decorators, and exception handling Co-authored-by: ajha-ss <214951400+ajha-ss@users.noreply.github.com> --- singlestoredb/fusion/handlers/files.py | 4 ++-- singlestoredb/management/files.py | 4 +--- singlestoredb/management/workspace.py | 2 ++ 3 files changed, 5 insertions(+), 5 deletions(-) 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.