I ran Glue crawler on a dataset which has 2 million rows. One of the columns has a mix of numbers , string and alphanumeric values ( example values - 22, 50, AA, AB, N3, B4 etc). The crawler is classifying this column as INT (instead of string). This is causing my ETL to break.
I think this is happening because the crawler only reads first 1000 records or 1mb of data (According to the AWS Glue docs). The first few thousand rows indeed just contains numerical values.
Is there any way to force crawler to read the whole data instead of first 1000 records ? Or is there any other suggestions/solutions which seems feasible ?
I am using boto3 to create my ETLs and using the schema detection feature of Glue crawler to create DDL statements programmatically. However, this incorrect classification is breaking my ETL. Due to the nature of data, the solution should ideally NOT involve manually entry.
Any help is appreciated 
Related discussions:
You’ll have to add a custom classifier to your crawler based upon the file format and schema. The in built classifiers of crawlers tend be fine for more things but they’re not bullet proof.
https://docs.aws.amazon.com/glue/latest/dg/custom-classifier.html
I have checked custom classifiers(for csv files) but it also doesn’t have any functionality for correcting data types. I have gone through the link you provided but it doesn’t have any info on changing/correcting data types. Am I missing anything?
Not really, I was just hoping you were using grok. You can manually change the data type in the glue console through the schema though that won’t be suitable long term like you said. Let me think about it
will I just be this table that the crawler works on? We could manually set it once and then change the configuration to ignore the change and don’t update the table in the data catalog.
Can I use the grok classifier with csv ? I can do that if that works. Unfortunately, manually changing the data type in the console is not an option for us because our whole purpose of creating this ETL is to automate this process of data load.
The problem with manually changing the data type in configuration is that in our organization a new dataset comes in every two weeks or so. So we would have to manually change the config for every new dataset.
Did you ever find a solution for this?
Nope, it turned out that the crawler just worked that way and that’s why aws glue has not been adopted by many organizations. It’s just not reliable enough.
Disappointing. I really need a solution like Glue to keep a frequently-modified data source up to date, but it keeps miscategorizing data that should be double as int based on the values it samples. So I end up using it to set up the tables initially and then stop running it after I have gotten the fields I need categorized correctly.
https://docs.aws.amazon.com/glue/latest/dg/custom-classifier.html
I am having exactly the same issue as it constantly miscategorizing data that should be double as int and it failed in athena.