Skip to content

dbutils.fs.mount generates wrong proxy call #112

@jensweigele

Description

@jensweigele

When calling "dbutils.fs.mount" the proxy call towards the cluster is using the wrong dictionary names for the parameters.
The generated code looks like this:

        import json
        (args, kwargs) = json.loads('[[], {"source": "<someUrl>", "mountPoint": "/mnt/<myMountPoint", "encryptionType": "", "owner": "", "extraConfigs": null}]')
        result = dbutils.fs.mount(*args, **kwargs)
        dbutils.notebook.exit(json.dumps(result))

When this is executed in the cluster, the following error is thrown:
TypeError: DBUtils.FSHandler.mount() got an unexpected keyword argument 'mountPoint'
Further more this error is not proxied back - instead you get TypeError: the JSON object must be str, bytes or bytearray, not NoneType (dbutils.py:245)

The actual problem are the wrong parameter names in the Method-Signatur of "mount".
The original DataBricks-API expects the parameters with underscores instead of camelCase (see https://docs.databricks.com/dbfs/mounts.html):

dbutils.fs.mount(
  source: str,
  mount_point: str,
  encryption_type: Optional[str] = "",
  extra_configs: Optional[dict[str:str]] = None
)

Same probably applies to the other Mount-Methods.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions