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: 

Azure Databricks: leading zeros in decimal integer literals are not permitted

gopikrsna925
New Contributor

Hey team,

Need your help.

I am trying to run the below python code in a data bricks notebook, which is part of parsing an XML file, exploding the element. This works great for all the other elements with no numbers and elements not starting with a zero but anything that starts with a 0 in the second part of the string is where it's failing. 

Code:
56:.withColumn(
'OcrnInfo_Bond-102005', explode_outer(col('OcrnInfo').Bond-102005)) \
57:.withColumn('OcrnInfo_Bond-052009', explode_outer(col('OcrnInfo').Bond-052009)) \

Error:
leading zeros in decimal integer literals are not permitted; use an 0o prefix for octal integers (, line 57)
.withColumn('OcrnInfo_Bond-052009', explode_outer(col('OcrnInfo').Bond-052009)) \ 
                                                                                                                                ^
Bond-052009 is a structfield in XML definition of arraytype which in turn has a structype for the attributes it holds. I have tried single/double quotes, all sorts of brackets around the string but just keeps failing with the same error. If I delete this line it fails on the next one which is 
Bnkrpt-052009 so definitely the second part of the string is failing. I am unable to change these names.

Any advice is greatly appreciated.
0 REPLIES 0

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