cancel
Showing results for 
Search instead for 
Did you mean: 
Community Platform Discussions
Connect with fellow community members to discuss general topics related to the Databricks platform, industry trends, and best practices. Share experiences, ask questions, and foster collaboration within the community.
cancel
Showing results for 
Search instead for 
Did you mean: 

Translating XMLNAMESPACE in SQL Databricks

TinaN
New Contributor III

We are loading a data source that contains XML. I am translating their queries to create views in Databricks. They use 'XMLNAMESPACES' to construct/parse XML.  Below is an example.  What is best practice for translating 'XMLNAMESPACES' in Databricks?  

CREATE OR REPLACE VIEW source_vw 
AS WITH XMLNAMESPACES('uuid:ee2fbfd9-47a5-4dc8-a9eb-42d9995802ab' as REM)
SELECT...

 

1 ACCEPTED SOLUTION

Accepted Solutions

TinaN
New Contributor III

Hello Kaniz_Fatma,

Thanks for the quick response. We are experimenting with from_xml to parse the data.  I appreciate your input.

Best,

Tina

View solution in original post

2 REPLIES 2

Retired_mod
Esteemed Contributor III

Hi @TinaN, To handle XMLNAMESPACES in Databricks, use the from_xml function for parsing XML data, where you can define namespaces within your parsing logic. Start by reading the XML data using spark.read.format("xml"), then apply the from_xml function, specifying the necessary namespaces. This allows you to effectively translate SQL queries involving XML namespaces into Databricks code. If you have any specific details or additional requirements, feel free to share them!

TinaN
New Contributor III

Hello Kaniz_Fatma,

Thanks for the quick response. We are experimenting with from_xml to parse the data.  I appreciate your input.

Best,

Tina

Join Us as a Local Community Builder!

Passionate about hosting events and connecting people? Help us grow a vibrant local community—sign up today to get started!

Sign Up Now