Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ISSUE] Recursive workspace listing #222

Closed
mattfysh opened this issue Jul 8, 2023 · 3 comments
Closed

[ISSUE] Recursive workspace listing #222

mattfysh opened this issue Jul 8, 2023 · 3 comments
Labels
Bug The issue is a bug. documentation Improvements or additions to documentation

Comments

@mattfysh
Copy link

mattfysh commented Jul 8, 2023

Description
A recursive kwarg is documented for workspace.list, but does not exist: https://databricks-sdk-py.readthedocs.io/en/latest/workspace/workspace.html

Reproduction
Testing exists for it:

def test_workspace_recursive_list(w, random):
names = []
for i in w.workspace.list(f'/Users/{w.current_user.me().user_name}', recursive=True):
names.append(i.path)
assert len(names) > 0

But it does not exist in the source code:

def list(self,
path: str,
*,
notebooks_modified_after: Optional[int] = None,
**kwargs) -> Iterator[ObjectInfo]:
"""List contents.
Lists the contents of a directory, or the object if it is not a directory. If the input path does not
exist, this call returns an error `RESOURCE_DOES_NOT_EXIST`.
:param path: str
The absolute path of the notebook or directory.
:param notebooks_modified_after: int (optional)
UTC timestamp in milliseconds
:returns: Iterator over :class:`ObjectInfo`
"""
request = kwargs.get('request', None)
if not request: # request is not given through keyed args
request = ListWorkspaceRequest(notebooks_modified_after=notebooks_modified_after, path=path)
query = {}
if notebooks_modified_after: query['notebooks_modified_after'] = request.notebooks_modified_after
if path: query['path'] = request.path
json = self._api.do('GET', '/api/2.0/workspace/list', query=query)
return [ObjectInfo.from_dict(v) for v in json.get('objects', [])]

Expected behavior
Recursively list notebooks at the given path

@nfx nfx added the documentation Improvements or additions to documentation label Jul 10, 2023
@nfx
Copy link
Contributor

nfx commented Jul 10, 2023

@mattfysh it's defined in https://github.com/databricks/databricks-sdk-py/blob/v0.1.12/databricks/sdk/mixins/workspace.py#L15-L36 - e.g. if something is integration tested - then it definitely works ;)

this is a bug in https://github.com/databricks/databricks-sdk-py/blob/main/docs/gen-client-docs.py, thanks for pointing it out.

@nfx nfx added the Bug The issue is a bug. label Jul 10, 2023
@neilbest-db
Copy link

Perhaps this is resolved by #193?

@mgyucht
Copy link
Contributor

mgyucht commented Dec 4, 2023

I think this is just a misunderstanding: the parameter does exist, but the WorkspaceExt replaces the implementation in WorkspaceAPI for users. There was a recent refactoring to the docs pages that does include WorkspaceExt as well as our other mixins, so it should match the SDK exactly.

@mgyucht mgyucht closed this as completed Dec 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug The issue is a bug. documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

4 participants