Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error Connecting to Databricks from local machine

I am attempting to make a connection to Databricks from my Mac(Mojave).

I did a pip install -U databricks-connect==5.5.*

I start a spark-shell but when I try to query in spark I get the following error

Caused by: com.databricks.service.SparkServiceConnectionException: Invalid token

To connect to a Databricks cluster, you must specify an API token.
API Token: The API token used to confirm your identity to Databricks
  - Learn more about API tokens here: https://docs.databricks.com/api/latest/authentication.html#generate-a-token
  - Get current value: spark.conf.get("spark.databricks.service.token")
  - Set via conf: spark.conf.set("spark.databricks.service.token", <your API token>)
  - Set via environment variable: export DATABRICKS_API_TOKEN=<your API token>

I then run spark.conf.get("spark.databricks.service.token") and I get back the token I created. We tried using this token on a windows machine and it works.

like image 678
DataTx Avatar asked Oct 23 '25 15:10

DataTx


1 Answers

Run:

databricks-connect configure

Follow the steps on the command prompt. You will be asked to enter your Databricks Token, enter your token, follow remaining steps and it should be resolved.

PS: When you are asked to enter your Databricks Host: provide a generic hostname for the region followed by your org-id. For example:

https://westeurope.azuredatabricks.net/?o=xxxx instead of https://adb-xxxx.xy.azuredatabricks.net/?o=xxxx

like image 60
pprasad009 Avatar answered Oct 26 '25 09:10

pprasad009



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!