it says to set the login as : {“token”: “”, “host”:""}
I not sure what to export… does anyone have a clue?? I have the token etc… but what is the export statement?
Thanks for reaching out here, @bclipp770 ! It’s good to hear you’re looking to store a Databricks connection in an Env Var - that will be lighter on your Postgres Database. A few guidelines below.
1. Identify Connection Values
To store your databricks connection as an Environment variable, you need to generate an Airflow Connection URI for it. To do so, collect the values you need for it first:
conn_id=databricks_default (this is the name of your connection)
You shouldn’t need values for Port and Schema. For more info, there’s an example near the bottom of Integrating Apache Airflow with Databricks (a Databricks blog post).
Note: If you already have this connection in the Airflow UI and want to pull out the Conn URI from it, you can run $ airflow connections get from the Airflow CLI.
3. Set your Env Var
Now, put that Connection URI into an Environment Variable format:
the databricks guide shows installing pip install “apache-airflow[databricks]”
uses a access token.
the guide you shared uses the apache-airflow-providers-databricks pypi provider.
I think if possible I would rather use the token, that would be the better route if possible for production.
if I throw apache-airflow[databricks] in the requirements file I assume it’s going to not like that.
If needed I can settle for username and password but I would prefer a token.
I just noticed you have the token for the username I don’t think that will work. I will test and update.
On the token thing, take a look at the Databricks Operator source code - you actually should be able to set login to token and then throw your token in the extras field of the Connection instead (and just adjust the Conn URI accordingly). In any case, give all of this a shot and let me know if it works
@bclipp770 Actually, looks like a team member at Astro just added some instructions around the Databricks connection to Airflow Docs! PR here. From the looks of it, that should be what you need to complete step 1 above. I’ll update my post with that info
Since I got the UI connection working, I used the following command to display the URI airflow connections get databricks_default after bashing into the container. I noticed it’s replacing non-alphanumeric characters. That was throwing me off I think.