Package: databricks-rocket
Databricks-RocketDatabricks-Rocket (short db-rockets), keeps your local Python scripts installed and synchronized with a Databricks notebook. Every change on your local machine
is automatically reflected in the notebook. This shortens the feedback loop for developing git-based projects and
eliminates the need to set up a local development environment.InstallationInstalldatabricks-rocketusing pip:pipinstalldatabricks-rocketSetupEnsure you've created a personal access token in
Databricks (offical documentation). Afterward, set up the
Databricks CLI by executing:databricksconfigure--tokenAlternatively, you can set the Databricks token and host in your environment variables:exportDATABRICKS_HOST="mydatabrickshost"exportDATABRICKS_TOKEN="mydatabrickstoken"If your project isn't already a pip package, you'll need to convert it into one. Use dbrocket for this:rocketsetupWill create a setup.py for you.UsageTo Sync Your ProjectBy default,databricks-rocketsyncs your project to DBFS automatically. This allows you to update your code and have
those changes reflected in your Databricks notebook without restarting the Python kernel. Simply execute:rocketlaunchYou'll then receive the exact command to run in your notebook. Example:stevenmi@MacBookdb-rocket%rocketlaunch--watch=False
>>Watchactivated.Uploadedyourprojecttodatabricks.Installyourprojectinyourdatabricksnotebookbyrunning:
>>%pipinstall--upgradepip
>>%pipinstall-r/dbfs/temp/stevenmi/db-rocket/requirements.txt
>>%pipinstall--no-deps-e/dbfs/temp/stevenmi/db-rocket

andfollowinginanewPythoncell:
>>%load_extautoreload
>>%autoreload2Finally, add the content in you databricks notebook:Include non-python filesUpload all root level json files:rocketlaunch--glob_path="*,json"On top also upload all env files:rocketlaunch--glob_path="[\"*.json\", \".env*\"]"When specifying lists, be mindful about the formatting of the parameter string.To Upload Your Python PackageIf you've disabled the watch feature,databricks-rocketwill only upload your project as a wheel to DBFS:rocketlaunch--watch=FalseExample:stevenmi@MacBookdb-rocket%rocketlaunch--watch=False
>>Watchisdisabled.Buildingcreatingapythonwheelfromyourproject
>>Foundsetup.py.Buildingpythonlibrary
>>Uploaded./dist/databricks_rocket-2.0.0-py3-none-any.whltodbfs:/temp/stevenmi/db-rocket/dist/databricks_rocket-2.0.0-py3-none-any.whl
>>Uploadedwheeltodatabricks.Installyourlibraryinyourdatabricksnotebookbyrunning:
>>%pipinstall--upgradepip
>>%pipinstall/dbfs/temp/stevenmi/db-rocket/databricks_rocket-2.0.0-py3-none-any.whl--force-reinstallBlogpostsDBrocket 2.0: A summary of the big improvements we made to the tool in the new release.DB Rocket 1.0post also gives more details about the rationale around dbrocket.SupportDatabricks: >=7Python: >=3.7Tested on Platform: Linux, MacOs. Windows will probably not work but contributions are welcomed!AcknowledgmentsThanks Leon Poli for the Logo :)Thanks Stephane Leonard for source-code and documentation improvements :)Thanks Malachi Soord for the CICD setup and README improvementsContributions are welcomed!SecurityFor security issues please contactsecurity@getyourguide.com.Legaldb-rocket is licensed under the Apache License, Version 2.0. SeeLICENSEfor the full text.