You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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'.
The text was updated successfully, but these errors were encountered:
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
Problem Statement
Currently, the functions in
databricks/sdk/service/files.py
accept onlystr
for arguments that are paths. This can lead to confusing behavior for end-users when passing in aPath
object. For example, when callingwhere
x
has typePath
, users will get an error on that line;Proposed Solution
Since the argument is called
path
, I think it will be common that users pass an object of typePath
. Ideally, the functions take both astr
orPath
as input. This can be achieved by adding e.g.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'
.The text was updated successfully, but these errors were encountered: