r/mysql • u/Dependent_Host_8908 • Jan 19 '25
question Trouble with Importing Data set for the longest time..... PLEASE HELP
Hi GUYS I have been trying to import a simple csv into mysql for the longest fking time...... and it's being such a bitch. This is the Dataset im using.
I keep getting errors when importing and that 0 records are importing even though it said the process was successful in importing wtf........ I even tried to change the file from csv to json already but to no avail???????
I dont know if it has got to do with the field types of the column names but at this point im so tired of trying already....
Can anyone please try and let me know if you managed to do it! I've been using the data import wizard way.. I know about the load data in file method but im not too keen on typing out all the column names one by one when creating the table LOL
1
u/user_5359 Jan 19 '25
Two pieces of information are missing: What does the table into which you want to import look like and which command are you using?
1
u/Outdoor_Releaf Jan 19 '25
I normally import all the columns with type text, and then clean the data. SQL will give you errors for anything that does not match the data type of a column when you change the type in an existing table. The MySQL Workbench Data Import Wizard and, under certain circumstances, the LOAD DATA command will fail silently.
1
u/BdR76 Jan 23 '25
The only problem I can see with that
games.csvfile, is that the very first column (with the line index numbers) has no column name. All other columns have a name "Title", "Release Date", "Team" etc. except for the fist one.So I would change the first line from
to
and then try again.
Also, you could try the CSV Lint plug-in for Notepad++ to convert csv files to an SQL script, it can generate a script with
CREATE TABLEandINSERTstatements. Although that plugin also expects column names to not be empty.2
u/bchambers01961 Jan 19 '25
I’d learn the LOAD INFILE command and then try with a smaller dataset first
1
u/mrocral Jan 19 '25
You could also try Sling. It auto creates the table for you and loads the data.
Somethins like this:
1
u/pceimpulsive Jan 19 '25
Looking at the data set it has array columns, MySQL doesn't support arrays, you will not be able to directly import this data set from the CSV without some pre formatting work.