cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Data Engineering
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Not able to use _metadata to retrieve file name while reading xml files

NirmalaSathiya
New Contributor

We are trying to retrieve xml file name using _metadata but not working. 
we are not able to use input _file_name() also as we are using shared cluster.

we are reading the xml files using com.datadricks.spark.xml library

 

 

2 REPLIES 2

Kaniz
Community Manager
Community Manager

Hi @NirmalaSathiya, To retrieve the file name using _metadata, you can use the file_name field from the _metadata column. The _metadata column is a hidden column and is available for all input file formats. To include the _metadata column in the returned DataFrame, you must explicitly reference it in your ...

 

I hope this helps! If you have any more questions or need further clarification, feel free to ask.

Kaniz
Community Manager
Community Manager

Thank you for posting your question in our community! We are happy to assist you.

To help us provide you with the most accurate information, could you please take a moment to review the responses and select the one that best answers your question?

This will also help other community members who may have similar questions in the future. Thank you for your participation and let us know if you need any further assistance! 
 

Welcome to Databricks Community: Lets learn, network and celebrate together

Join our fast-growing data practitioner and expert community of 80K+ members, ready to discover, help and collaborate together while making meaningful connections. 

Click here to register and join today! 

Engage in exciting technical discussions, join a group with your peers and meet our Featured Members.