Skip to content

Commit

Permalink
LLCAXCHZF-61/handles cases where CKAN type guessing is disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
TomeCirun committed Oct 10, 2024
1 parent abc2dd7 commit 8ca2f3a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions ckanext/charts/fetchers.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,9 @@ def fetch_data(self) -> pd.DataFrame:
df[non_datetime_cols] = df[non_datetime_cols].apply(pd.to_numeric, errors='ignore').fillna(0)

if "date_time" in df.columns:
# Convert the 'date_time' column to string format in ISO 8601
df['date_time'] = df['date_time'].dt.strftime("%Y-%m-%dT%H:%M:%S")
# Ensure datetime type consistency and format to ISO 8601
# Handles cases where CKAN type guessing is disabled
df['date_time'] = pd.to_datetime(df['date_time']).dt.strftime("%Y-%m-%dT%H:%M:%S")

except (ProgrammingError, UndefinedTable) as e:
raise exception.DataFetchError(
Expand Down

0 comments on commit 8ca2f3a

Please sign in to comment.