The actual problem I'm trying to solve is that I'm using mkdocs/mkdocs-materials for my documentation. But that tool can't work with notebook type files.
So as a clumsy workaround I'm figuring is to have an intermediate step that creates a copy of the notebook content as a .py file, in the same workspace folder. Have mkdocs build off of those copies. Then delete the copies before pushing.
For example I've got a notebook type object in my workspace. Display looks like this:
%sql
select * from something
%sql
select * from something_else
def some_dummy_function():
print('dummy')
When you export a notebook as a source python file via the GUI, you get this with all the tagging for syntax.
# Databricks notebook source
# MAGIC %sql
# MAGIC select * from something
# COMMAND ----------
# MAGIC %sql
# MAGIC select * from something_else
def some_dummy_function():
print('dummy')
I want to get this programmatically, from a notebook in a workspace.
Or if you've got suggestions for the root problem at hand ... all ears.