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! 
 

Join 100K+ Data Experts: Register Now & Grow with Us!

Excited to expand your horizons with us? Click here to Register and begin your journey to success!

Already a member? Login and join your local regional user group! If there isn’t one near you, fill out this form and we’ll create one for you to join!