An Apache Spark-based analytics platform optimized for Azure.
Hi @Anshal ,
Thankyou for using Microsoft Q&A platform and posting your query.
As I understand your query, it looks to me like you have two notebooks , in first notebook you have a variable which holds some count value(int). You want to pass this variable value into another notebook. Please let me know if my understanding is wrong.
You can make use of mssparkutils.notebook.exit("value string") command in pyspark which helps to exit a notebook with a value.
Please refer to the following article for more details: Exit a notebook
I tried to repro your scenario using Azure Synapse analytics. Same can be done in even databricks.
In Notebook1 :
- I created a dataframe with two rows.
- Got the count of rows in variable called 'var1'
- Exited the notebook with value 'var1'
In Notebook2:
- Running Notebook 1 using mssparkutils.notebook.run("Notebook name") . Please refer to : Reference a Notebook
- Using the variable from Notebook 1 inside Notebook 2
Hope this will help. Please let us know if any further queries.
------------------------------
- Please don't forget to click on
or upvote
button whenever the information provided helps you.
Original posters help the community find answers faster by identifying the correct answer. Here is how - Want a reminder to come back and check responses? Here is how to subscribe to a notification
- If you are interested in joining the VM program and help shape the future of Q&A: Here is how you can be part of Q&A Volunteer Moderators