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:ย 

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_Fatma
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_Fatma
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! 
 

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