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

auth_type parameter not optional

Open jlenczuk-ckd opened this issue 2 years ago • 3 comments

Hi,

I have updated databricks-sql-cli to version 0.3.0. Now my authentication details - host name, HTTP path and access token - fail when I pass them directly to the command line. I get the following error: image

It seems that there is one argument missing, mainly the auth_type. However, the following code suggests that in case credentials key cannot be found in the conf file, apply_credentials_from_cfg should return 3 values. In other cases, it returns 4 values. https://github.com/databricks/databricks-sql-cli/blob/345ca09bcf602b45755a6137af5e83f9e673272f/dbsqlcli/main.py#L61

DBSQLCli class on the other hand, always tries to unpack 4 values coming from the apply_credentials_from_cfg function. This fails in my case, as I don't pass the auth_type and therefore I only have 3 values returned by the function. https://github.com/databricks/databricks-sql-cli/blob/345ca09bcf602b45755a6137af5e83f9e673272f/dbsqlcli/main.py#L92

Did I understand it correctly and could you please provide any suggestions?

jlenczuk-ckd avatar Apr 03 '23 13:04 jlenczuk-ckd

Facing the same issue; any suggestions?

naveen-arumugam avatar May 19 '23 07:05 naveen-arumugam

It works if auth_type is added to the credentials check; not elegant, but works. Any suggestion?

https://github.com/databricks/databricks-sql-cli/blob/345ca09bcf602b45755a6137af5e83f9e673272f/dbsqlcli/main.py#LL67C24-L67C24 return hostname, http_path, access_token changing the above with auth_type makes the dbsqlcli to work return hostname, http_path, access_token, auth_type

Also, this fails (suggesting that this file ~/.dbsqlcli/dbsqlclirc is ignored?)

dbsqlcli -e "SELECT 1"
'NoneType' object has no attribute 'startswith'

This works

dbsqlcli -e "SELECT 1" \
--hostname "databricks_host" \
--http-path "databricks_http_path" \
--access-token "databricks_pat" 
1
1

naveen-arumugam avatar May 19 '23 07:05 naveen-arumugam

do we've plan to add "-f" flag for SQL files?

naveen-arumugam avatar May 19 '23 16:05 naveen-arumugam