Glue ETL Job Error (An error occurred while calling WriteDynamicFrame. MONTH)

Hi @danial

The error arises because Athena (and by extension, Quick Sight and AWS Glue) does not handle the 0000-00-00 value well, as it is an invalid date format.

Replace 0000-00-00 with a valid dummy placeholder date. Ex: 1900-01-01 or NULL

If you’re using Glue with a JDBC connection, modify the SQL query in your Glue job.

Example:

SELECT *, 
       CASE WHEN date_column = '0000-00-00' THEN '1900-01-01' ELSE date_column END AS date_column
FROM table_name;

If you’ve already imported the raw data into Athena, create a view to handle the transformation.

Example:

CREATE OR REPLACE VIEW transformed_table AS
SELECT *, 
       CASE WHEN date_column = '0000-00-00' THEN '1900-01-01' ELSE date_column END AS date_column
FROM raw_table_name;

Use this view instead of the raw table in Quick Sight. This ensures that Quick Sight pulls clean, transformed data.