Last active
September 12, 2020 20:58
-
-
Save nescobar/f751a9d49308d63351935601f3ac0143 to your computer and use it in GitHub Desktop.
Exports Databricks notebook
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Databricks access credentials | |
DOMAIN = 'ACCOUNT.cloud.databricks.com' | |
TOKEN = dbutils.secrets.get(scope="databricks", key="token") | |
BASE_URL = 'https://%s/api/2.0/jobs/runs/export?run_id=' % (DOMAIN) | |
# Exports notebook with given run id as a JSON object | |
def export_notebook(run_id): | |
views_to_export = '&views_to_export=DASHBOARDS' | |
response = requests.get( | |
BASE_URL + str(run_id) + views_to_export, | |
headers={'Authorization': 'Bearer %s' % TOKEN} | |
) | |
return response.json() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment