Bullet point 2 suggests using toDate to convert 29/02/2004:
INSERT INTO rates_monthly
SELECT
toDate(date) AS month, # <~~~~~~~~~~~~~~~~ WRONG ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
variable,
fixed,
bank
FROM s3(
'https://learnclickhouse.s3.us-east-2.amazonaws.com/datasets/mortgage_rates.csv',
'CSVWithNames');
When I run it, my table gets seeded with only 1 record (instead of the expected 220):
The dataset from https://learnclickhouse.s3.us-east-2.amazonaws.com/datasets/mortgage_rates.csv has the following format:
Bullet point 2 suggests using
toDate
to convert29/02/2004
:When I run it, my table gets seeded with only 1 record (instead of the expected 220):
The problem is that
toDate
doesn't know how to parse29/02/2004
.The solution is also wrong: https://github.com/ClickHouse/clickhouse-academy/blob/a73fa2bfdc266b4894b40f59fe64fd5dcb27ceec/developer/10_deleting_and_updating_data/lab_10.1.sql#L12-L20
Instead, I used
parseDateTime(date, '%d/%m/%Y')
to parse the date correctly.ClickHouse v24.3.2