cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Processing Notebook in python

Avinash_Narala
Contributor

Hi,

I exported notebook from my workspace into my local machine and want to read it in my python code .

Is there a way to read the content of my notebook programmatically and make necessary changes and save as dbc/html notebook.

 

2 REPLIES 2

ossinova
Contributor II

Not sure what you are trying to accomplish here. If you want to export a notebook as python to do manual editing locally, and then import it back into your workspace why not use repos and connect to it using VSCode etc? You can export the notebook as a python file. Just don't delete the top # Databricks notebook source line. Otherwise you can also use DBConnect and the VSCode Databricks Extension to run the code locally using your Databricks custer. 

I want to automate the refactoring, so using DBConnect and VScode extension I can develop my code.

But I want to modify already written code.

Like, Example: if in my old_notebook whereever there is table1 i need to replace with table2.

For these I need to read notebook and replace the content programmatically. 

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you wonโ€™t want to miss the chance to attend and share knowledge.

If there isnโ€™t a group near you, start one and help create a community that brings people together.

Request a New Group