AWS Glue - Retain leading zeros while processing XML files

Viewed 168

I have XML files stored in s3 bucket and crawler runs to generate schema in catalog tables. Catalog tables are generated but when i check the output in AWS Glue Studio, I could see the data that starts with zeros are getting eliminated. eg: 00034325 => 34325 Even conversion of catalog table schema datatype from int to string doesn't resolve this issue.

Kindly let me know how to resolve this issue.

1 Answers

This is a crawler bug. Nothing to do with the mapping in the glue. Crawler infers the type first, glue job only consumes the result of that. As far as I know there is no way to change the incoming type which crawler came up with - quite an annoying issue. The only option I can think of is to pre-process data before it gets to the bucket and escape the value to be a string before crawler get's to crawl it.

Related