Importing partial data into MySQL from CSV

I have a CSV that is a partial projection of an origin table. I have the same table structure in my DB.

I would like to import only those columns into my DB, given that no additional NOT NULL constraints are in place (I explicitly disabled some of them). I don't know how to import them.

I have tried the following: from MySQL Workbench, right click on table and then Edit table data, then on the screen I tried the "Import records from an external file" button, loaded the CSV file but I got the following error:

[Window Title]
MySQL Workbench

[Main Instruction]
Error importing recordset

error calling Python module function SQLIDEUtils.importRecordsetDataFromFile


The column names are the same as in the DB but these are partial (not all columns as DB). The table is currently empty.

What can I do to import the data into MySQL?


It turns out that is the error that tool gives for ANY problems importing CSV data. They have opened a bug for more descriptive error responses.

For me it turned out that it can not work with non-Windows line breaks. So if your file came from Unix/Linux or Mac it will not work. You can just open it in Excel though and re-save it as an MS-DOS CSV and then it works. Other things that can make it throw up are any use of ";".

Also the tool has NO column mapping options so you have to have your import file matched to the table setup perfectly. If you have columns mis-matched or data types mis-matched it will also throw-up.

I got the same question and error when I was importing a csv file into MAC Mysqlworkbench.

I restored my file as windows comma separated (.csv). This works for me.

  1. Check do you have permissions to import (on insert), and if you import clearing old data check do you have permissions on delete.
  2. If it won't help, create a new table with least restrictions which has absolutely identical columns as in CSV file, try to import to it. If ok - just update/insert into your target table
  3. If it won't help, try to import on another database.
  4. If it won't help, check CSV file - is all contents is ok? (may be it should try first)

Need Your Help

In Django admin, how can I set a blog post to only validate if it isn't a draft?

django django-models django-admin django-validation

I'm working on a blog for Django, and I would like to use the Django admin's built in validation. However, I would like some way to disable validation if the blog post status is set to "draft".

C#: Is there any way to easily find/update all references to an object?

c# .net reference garbage-collection

I've been reading Rockford Lhotka's "Expert C# 2008 Business Objects", where there is such a thing as a data portal which nicely abstracts where the data comes from. When using the

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.