davinavarro commented on issue #23982:
URL: https://github.com/apache/superset/issues/23982#issuecomment-1551430633

   Just in case someone googles this bug, I was able to fix it. It is not 
pretty but it works. The bug is in the file 
`superset/db_engine_specs/presto.py` in the definition of the method 
`latest_partition()`. In my case, my datetime partition column is named 
`dl_date` so when I receive this column I change the type from datetime.date to 
string and recreate the dataframe. 
   ```
       def latest_partition(
           cls,
           table_name: str,
           schema: Optional[str],
           database: Database,
           show_first: bool = False,
       ) -> Tuple[List[str], Optional[List[str]]]:
                                    .
                                    .
                                    .
                                    .
           column_names = indexes[0]["column_names"]
           part_fields = [(column_name, True) for column_name in column_names]
           sql = cls._partition_query(table_name, database, 1, part_fields)
           df = database.get_df(sql, schema)
   
          #========== MY UGLY FIX  ==========#
           if "dl_date" in column_names:
               lat_df = cls._latest_partition_from_df(df)
               dl_date: date = lat_df[2]
               return column_names, [lat_df[0], lat_df[1], 
dl_date.strftime("%Y-%m-%d")]
           else:
               return column_names, cls._latest_partition_from_df(df)
           #========== MY UGLY FIX  ==========#
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to