MySQL Forums
Forum List  »  MySQL Workbench

Importing from csv, no primary key in csv, auto increment not working
Posted by: chuck snell
Date: February 23, 2017 11:01AM

Hello,

I am new to MYSQL workbench.

I have a csv file I am trying to import.

I have had it successfully import (sort of)

My data has lots of duplicate data and no one field by itself can serve as a primary key (I can combine some fields if we can't get this working)

I created a field a_id and checked PK, NN, and AI.

I am almost certain I saw the auto-increment work once, but as I am setting things up I have deleted and data and change things and go again -

Now I am getting an error:

ERROR 1366: Incorrect integer value: '' for column 'averaged_historical_forecasts_a_id' at row 1

SQL Statement:

here is "a" workbench generated statement:

INSERT INTO `temperature_forecasts`.`averaged_historical_forecasts_a` (`Read_Date`, `Read_Time`, `Forecast__Date`, `_Forecast_Time_`, `Start_Hour`, `End_Hour`, `Columbia_ACCU-Weather`, `Columbia__NOAA`, `Lewisburg_ACCU-Weather`, `Lewisburg_NOAA`, `Shelbyville_ACCU-Weather`, `Shelbyville_NOAA`, `Manchester_ACCU-Weather`, `Manchester_NOAA`, `Decherd_ACCU-Weather`, `Decherd_NOAA`, `averaged_historical_forecasts_a_id`) VALUES ('2015-02-05', '7:55', '2015-02-05', ' 8:00 - 9:00', ' 8:00', '9:00', '27.5', '26.5', '27.5', '27', '27.5', '28', '27.5', '28', '29.5', '30', '');

I would have thought the INSERT statement would not include the id and notice the comma at the end before the closing parentheses.

Bottom line - I am trying to import from a csv file some data and not have to create a primary key by combine data within the csv and use the auto-increment but I am doing all of this within the workbench environment

Thanks

Options: ReplyQuote


Subject
Views
Written By
Posted
Importing from csv, no primary key in csv, auto increment not working
1118
February 23, 2017 11:01AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.