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

Request failed while connecting to Azure Databricks using usql

Open calebeaires opened this issue 1 year ago • 9 comments

I am facing an issue when trying to connect to Databricks using usql. Even when using the correct credentials, typing the command:

usql databricks://token:dapi*****@adb-*************.azuredatabricks.net:443/sql/protocolv1/o/*********/*******

The credentials and URL details have been omitted for security, but I assure you that the data is correct.

Error Logs:

CleanShot 2024-06-05 at 10 28 57@2x

What You Have Tried

  • Verified credentials and URLs.
  • Reinstalled usql.
  • Tried on different terminals and operating systems (MacOS and Linux).

Where it works

Using DBeaver and the same credentials, the connection works like a charm

Any help to resolve this issue would be highly appreciated.

Alternative question:

It seems to me that the driver redirects the Azure URL to the Databricks URL.

calebeaires avatar Jun 05 '24 13:06 calebeaires

Hi @calebeaires! It looks that at some point your connection URL get screwed up: the host part is substituted instead of endpoint, host part also looks wrong. Try to set DATABRICKS_LOG_LEVEL=debug env, run usql again and share a full log

kravets-levko avatar Jun 05 '24 15:06 kravets-levko

Thanks to follow this issue, here is the full log to:

DATABRICKS_LOG_LEVEL=debug usql databricks://token:********@URL.3.azuredatabricks.net:443/sql/protocolv1/o/******/****-******-******

4:28PM INF setting log level to debug
4:28PM DBG client.OpenSession connId= corrId= queryId=
4:28PM DBG performing request
4:28PM DBG RoundTrip elapsed time: 39.36604ms
4:28PM ERR request failed
4:28PM DBG retrying request
4:28PM DBG RoundTrip elapsed time: 14.030828ms
4:28PM ERR request failed
4:28PM DBG retrying request
4:28PM DBG RoundTrip elapsed time: 14.194331ms
4:28PM ERR request failed
4:28PM DBG retrying request
4:28PM DBG RoundTrip elapsed time: 31.649215ms
4:28PM ERR request failed
4:28PM DBG retrying request
4:29PM DBG RoundTrip elapsed time: 32.321025ms
4:29PM ERR request failed

calebeaires avatar Jun 05 '24 19:06 calebeaires

And here is where I've got the credentials

CleanShot 2024-06-05 at 16 33 14@2x

And where I've got the token

CleanShot 2024-06-05 at 16 35 48@2x

calebeaires avatar Jun 05 '24 19:06 calebeaires

I just changed it to URL to hide the complete azure url. It becames something like "adb-numeric-id.3.azuredatabricks.net"

calebeaires avatar Jun 05 '24 19:06 calebeaires

Thank you! TBH I have no idea what's going on. I need some time to try it myself. Will get back to you when I have more info on this

kravets-levko avatar Jun 05 '24 19:06 kravets-levko

The server we created there is a testing environment. If you need I can send you the connection credentials.

calebeaires avatar Jun 05 '24 19:06 calebeaires

I already have access to some test servers, will try them first. If you can connect to your server using different driver - most likely it's an issue with either this library or usql

kravets-levko avatar Jun 05 '24 20:06 kravets-levko

Yes, I can. Using DBeaver, the connection goes ok

CleanShot 2024-06-05 at 17 04 50@2x

Thanks

calebeaires avatar Jun 05 '24 20:06 calebeaires

same issue here, the parameters get messed up as shown in the error message. Any news?

dmorel avatar Jan 30 '25 18:01 dmorel