The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
I have notebook named NB_Orchestrate with the below call to another another notebook.
Solved! Go to Solution.
Hi All,
Thank you for the suggestions. I did more exploration based on all the recommendations and got this worked.
The changes made
1. Made use of notebookutils to do nested notebook calls and lakehouse file operations.
2. File path was changed to Relative path for Spark starting from File/ in all notebookutils methods.
3. Changed file related operations with spark commands like
spark.read.format("xml").option("rowTag","data").load(filepath)
df.write.format("parquet").load(save file)
Hi All,
Thank you for the suggestions. I did more exploration based on all the recommendations and got this worked.
The changes made
1. Made use of notebookutils to do nested notebook calls and lakehouse file operations.
2. File path was changed to Relative path for Spark starting from File/ in all notebookutils methods.
3. Changed file related operations with spark commands like
spark.read.format("xml").option("rowTag","data").load(filepath)
df.write.format("parquet").load(save file)
Thank you OungiNeils
I have made the below changes
if notebookutils.fs.exists(xml_data_path):
Hi @prathijp ,
Thanks for using Microsoft Fabric Community,
Thanks for the update.
Just a quick clarification on the usage of notebookutils.notebook.run(): when passing parameters, please make sure to provide them as a single dictionary object. The syntax you're currently using is interpreted incorrectly and can result in empty values being passed to the child notebook, which leads to the IllegalArgumentException you're seeing.
Corrected syntax:
notebookutils.notebook.run(
NB_xmlToParquet,
300,
{
"xml_data_path": dataRef,
"xml_struct": dataParseCodeRef,
"saveParsedFile": saveParsedFile
}
)
Also, ensure that you're reading the parameters in the child notebook using:
xml_data_path = notebookutils.notebook.get_context().notebook_param("xml_data_path")
This should help ensure the file path is passed and recognized correctly during execution.
Let us know if you’re still seeing issues after updating the syntax.
Also thanks to @ObungiNiels for your valuable response.
Hope this helps. Please reach out for further assistance.
If this post helps, then please consider to Accept as the solution to help the other members find it more quickly and a kudos would be appreciated.
Thank you.
Thank you for the reply.
I tried using the below to retrieve the parameters.
xml_data_pathRef: Files/Landing/CTC_SM.xml
[Errno 2] No such file or directory: 'Files/Landing/CTC_SM.xml' ---------------------------------------------------------------------------FileNotFoundError Traceback (most recent call last)Cell In[5], line 13 10 saveParsedFile = saveParquetFile.replace(removeFolderHeader,"") 12 if xml_struct == "xml_struct_01": ---> 13 xml_struct_01(xml_data_pathRef,saveParsedFile) Cell In[4], line 11, in xml_struct_01(xml_data_pathRef, saveParsedFile) 7 notebookutils.fs.head(xml_data_pathRef, 3000) 8 # Read the XML file content ---> 11 with open(xml_data_pathRef, "r", encoding="utf-8") as file: 12 xml_data = file.read() 14 # Parse XML 15 #root = ET.fromstring(xml_data)Hi @prathijp ,
my guess would be that the functions from os library used for interacting with the file system in Fabric do not work when running the notebook from a separate one.
I'd advice to use the notebookutils library instead of os to achieve the same. Here's the documentation . You will see that all functions you need are available in the library as well, for instance notebookutils.fs.mkdirs instead of os.makedirs.
Addtionally, I'd use df.write.format("parquet").load(file_destination) instead. However, the error seems to occur with the directory, therefore the above would be the first thing I'd try to amend.
Hope this helps! 🙂