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

[FEATURE] Allow the path argument in the functions and classes databricks/sdk/service/files.py to also accept Path type #762

Open
fpgmaas opened this issue Sep 16, 2024 · 0 comments

Comments

@fpgmaas
Copy link

fpgmaas commented Sep 16, 2024

Problem Statement

Currently, the functions in databricks/sdk/service/files.py accept only str for arguments that are paths. This can lead to confusing behavior for end-users when passing in a Path object. For example, when calling

workspace_client.files.upload(path=x, ...)

where x has type Path, users will get an error on that line;

TypeError: quote_from_bytes() expected bytes

Proposed Solution

Since the argument is called path, I think it will be common that users pass an object of type Path. Ideally, the functions take both a str or Path as input. This can be achieved by adding e.g.

    def __post_init__(self):
        self.path = str(self.path)

See also this PR. Alternatively, it would be nice if the functions would throw a clearer error, e.g. TypeError: Expected 'str' but got 'Path'.

@fpgmaas fpgmaas changed the title [FEATURE] [FEATURE] Allow the path argument in the functions and classes databricks/sdk/service/files.py to also accept Path type Sep 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant