databricks-sql-cli icon indicating copy to clipboard operation
databricks-sql-cli copied to clipboard

Support for staging_allowed_local_path

Open jkoppelm opened this issue 1 year ago • 1 comments

In order to upload a local file to a Volume (via PUT) and access the associated data (via read_files), it is necessary to pass set staging_allowed_local_path when initiating sql.connect()

https://docs.databricks.com/en/dev-tools/python-sql-connector.html

jkoppelm avatar Dec 25 '24 05:12 jkoppelm

As I test, I updated sqlexecute.py to hardcode a path on my local (windows) machine:

        conn = dbsql.connect(
            server_hostname=self.hostname,
            http_path=self.http_path,
            access_token=self.access_token,
            schema=database,
            _user_agent_entry=USER_AGENT_STRING,
            staging_allowed_local_path = 'c:\\',
            **oauth_params,
        )

This allowed me to successfully PUT files (and LIST them) where previously I saw the error:

You must provide at least one staging_allowed_local_path when initialising a connection to perform ingestion commands

jkoppelm avatar Dec 25 '24 06:12 jkoppelm