changes to make dash app work

This commit is contained in:
Jake Pullen
2024-08-27 15:12:44 +01:00
parent 173c0594a8
commit 7b80b52998
4 changed files with 126 additions and 34 deletions
+12
View File
@@ -191,6 +191,18 @@ class DimDate(Dimensions):
except Exception as e:
logging.error(f"Failed to create a new column to indicate if the date is a weekday or weekend: {e}")
return
# Create a primary key by concatenating year, month, and day with no separators
try:
dates_df = dates_df.with_columns([
(pl.col('year').cast(pl.Utf8) +
pl.col('month').cast(pl.Utf8).str.zfill(2) +
pl.col('day').cast(pl.Utf8).str.zfill(2)
).alias('date_id')
])
except Exception as e:
logging.error(f"Failed to create the primary key column: {e}")
return
# Write the DataFrame to a new parquet file
logging.info("Writing the transformed dates DataFrame to parquet file")
try: