I have a table with only an id column
CREATE TABLE daily_weather (id int NOT NULL AUTO_INCREMENT, PRIMARY KEY (ID));
I am using the mysqlimport utility to import data into this table.
mysqlimport --ignore-lines=1 --fields-terminated-by=, --local -u adminuser -plearnml fast daily_weather.csv
The CSV has around 20 columns, and it will be mighty tedious to create the column on the daily_weather manually.
Is there an option I can use on mysqlimport to create columns from the csv?
CREATE TABLEis a one-time task. That involves picking column names, datatypes, NULLness, etc. In the long run it is worth the effort to pick the datatypes carefully. Once you have created the table, load new data into each day.Assuming that the data source never changes the CSV format, no further action should be needed (other than the "import").