databricks / databricks-sql-go

Golang database/sql driver for Databricks SQL.
Apache License 2.0
34 stars 37 forks source link

Request failed while connecting to Azure Databricks using usql #230

Open calebeaires opened 1 month ago

calebeaires commented 1 month ago

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

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.

kravets-levko commented 1 month ago

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

calebeaires commented 1 month ago

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 commented 1 month ago

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 commented 1 month ago

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

kravets-levko commented 1 month ago

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

calebeaires commented 1 month ago

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

kravets-levko commented 1 month ago

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

calebeaires commented 1 month ago

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

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

Thanks