Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Our developers have added more columns to our CSV files. This cause the script to crash due to the fact that the new columns are missing in older csv files.
Is there a way to check if the column exist or can I ignore columns before a certain date somehow?
I need the data in the new columns, but I want to load the old data as well.
Niklas
Niklas
You may be able to solve your problem using column numbers rather than headings in your script.
Something like:
LOAD
@1 AS Id,
@2 AS Name,
@3 AS Date
FROM DataFile.csv;
This should get nulls for columns that do not exist. This does assume that the columns were added to the end of the csv. If they were added in the middle, then you will need a more complex approach.
Jonathan