Create new workbooks with code
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-14-2023 03:40 AM
Is is possible to create new notebooks from a notevbook in databricks?
I have tried this code. But all of them are generic files, not notebooks.
notebook_str = """# Databricks notebook source
import pyspark.sql.functions as F
import numpy as np
# COMMAND ----------
# A test notebook
np.__version__
"""
with open("./notebook.ipynb","w") as f:
f.write(notebook_str)
with open("./notebook.py","w") as f:
f.write(notebook_str)
with open("./notebook","w") as f:
f.write(notebook_str)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-15-2023 01:01 AM
Unfortunaly %run does not help me since I can't %run a .py file. I still need my code in notebooks.
I am transpiling propriatary code to python using jinja templates. I would like to have the output as notebooks since those are most convenient to edit in databricks.
Perhaps calling the workspace API is a possible way forward then? Can i call this from a databrick notebook?
Import a workspace object | Workspace API | REST API reference | Databricks on AWS

