Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to write Notebook to Databricks using API?

I am able to write data files to Databricks using the APIs documented here:

https://docs.databricks.com/dev-tools/api/latest/index.html

https://docs.databricks.com/dev-tools/api/latest/dbfs.html

I have several Notebooks I would like to write to a Databricks instance. I'm not seeing how to do this in the API documentation. Is there a way to write a Notebook to a Databricks instance using a Rest API? Where is this documented?

like image 314
John Avatar asked Apr 17 '26 04:04

John


1 Answers

You need to use Workspace API instead, specifically the Import call. For example, with curl (example from documentation):

curl -n -F path=/Users/[email protected]/project/ScalaExampleNotebook  \
  -F language=SCALA -F [email protected] \
  https://<databricks-instance>/api/2.0/workspace/import

If you don't use API directly, the better way would be to use workspace subcommand of Databricks CLI (import or import_dir), or use Databricks Terraform provider

like image 135
Alex Ott Avatar answered Apr 21 '26 04:04

Alex Ott



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!