dbx icon indicating copy to clipboard operation
dbx copied to clipboard

question

Open Arnold1 opened this issue 2 years ago • 6 comments
trafficstars

hi,

I have a python file of a tasks is called update.py - which is called by dbx. the python file calls the databricks api - which requires a DATABRICKS_TOKEN. how can I pass the DATABRICKS_TOKEN to the python file - which is part of a task of a workflow?

I already checked the docs - but was not able to find anything.

thanks

Arnold1 avatar Jan 08 '23 21:01 Arnold1

Well dbx is CLI tool, u export databricks token as environment variable export DATABRICKS_TOKEN= or configure it within .databrickscfg. https://docs.databricks.com/dev-tools/cli/index.html

ptabandzelic avatar Jan 09 '23 10:01 ptabandzelic

@ptabandzelic ok that sounds like a plan - at what stage to call the export DATABRICKS_TOKEN= ? before I call dbx deploy? what happens if the python file is called by the scheduler - is that env var still available? -> https://dbx.readthedocs.io/en/latest/reference/deployment/?h=or#scheduling-workflows

Arnold1 avatar Jan 09 '23 13:01 Arnold1

I think another way would be that jinja support? https://dbx.readthedocs.io/en/latest/features/jinja_support/

Arnold1 avatar Jan 09 '23 14:01 Arnold1

Bro i think u are confused.

ptaban avatar Jan 09 '23 19:01 ptaban

hi @Arnold1 ,

Could you please explain a bit more in detail what you're doing?

Do I understand correctly that:

  1. You have a task in Databricks, the code of this task is in some_pkg/update.py
  2. Inside this task you would like to access the DATABRICKS_HOST and DATABRICKS_TOKEN variables to call specific Databricks APIs?

renardeinside avatar Jan 09 '23 22:01 renardeinside

hi @renardeinside

I want to create a one time run. I create a schedule for a specific time if the job runs I want to delete it.

Arnold1 avatar Jan 20 '23 10:01 Arnold1