Questions tagged [load-data-infile]

A mySQL function for loading external data directly into the database.

LOAD DATA INFILE is a mySQL function for loading external data directly into the database.

More information available from the mySQL manual: http://dev.mysql.com/doc/refman/5.1/en/load-data.html

642 questions
20
votes
2 answers

mysql load data infile where clause

I need to update existing rows in table with load data infile based on some condition, is this possible? load data infile 'E:/xxx.csv' into table tld_tod @aaa, @xxx_date, @ccc fields terminated by ',' LINES TERMINATED BY '\r\n' set xxx =…
user157195
20
votes
3 answers

Import CSV to MySQL

I have created a database and a table. I have also created all the fields I will be needing. I have created 46 fields including one that is my ID for the row. The CSV doesn't contain the ID field, nor does it contain the headers for the columns. I…
404error
  • 575
  • 2
  • 4
  • 16
20
votes
2 answers

Mysql permission errors with 'load data'

I am running into a permission error when trying to load data from a flat file database dump into a new table. I know that the schema of the file and my table is the same and I tried tweaking the permissions. What else should I try? mysql> load data…
sutee
  • 12,568
  • 13
  • 49
  • 61
19
votes
2 answers

Trying to do LOAD DATA INFILE with REPLACE and AUTO_INCREMENT

I am trying to load a file onto a MySQL database, having the primary key auto_incremented and I would like the data to be updated if i find any duplicate rows. However, the REPLACE keywords only works on primary key, which is auto generated so i'm…
jonasMcFerreira
  • 281
  • 1
  • 2
  • 9
18
votes
2 answers

MySQL LOAD DATA LOCAL INFILE example in python?

I am looking for a syntax definition, example, sample code, wiki, etc. for executing a LOAD DATA LOCAL INFILE command from python. I believe I can use mysqlimport as well if that is available, so any feedback (and code snippet) on which is the…
David Perron
  • 217
  • 1
  • 4
  • 7
17
votes
2 answers

How to change string date to MySQL date format at time of import of CSV using MySQL's LOAD DATA LOCAL INFILE

I'm using MySQL's LOAD DATA LOCAL INFILE SQL statement to load data from a CSV file into an existing database table. Here is an example SQL statement: LOAD DATA LOCAL INFILE 'file.csv' INTO TABLE my_table FIELDS TERMINATED BY ',' ENCLOSED BY…
Camsoft
  • 11,718
  • 19
  • 83
  • 120
16
votes
5 answers

mysql LOAD DATA INFILE with auto-increment primary key

I am trying to load a data file into mysql table using "LOAD DATA LOCAL INFILE 'filename' INTO TABLE 'tablename'". The problem is the source data file contains data of every fields but the primary key is missing ('id' column). I add a unique id…
biomed
  • 679
  • 2
  • 9
  • 25
16
votes
2 answers

PHP - Import CSV file to mysql database Using LOAD DATA INFILE

I have a .csv file data like that Date,Name,Call Type,Number,Duration,Address,PostalCode,City,State,Country,Latitude,Longitude "Sep-18-2013 01:53:45 PM","Unknown","outgoing call",'123456',"0…
chimbu
  • 786
  • 5
  • 16
  • 36
15
votes
2 answers

Is it not possible to show warnings when using mysqlimport?

This article: http://www.linuxask.com/questions/how-to-show-the-warnings-during-mysqlimport says it is not possible to show warnings when using mysqlimport: When you use mysqlimport to import data from text file, the number of warnings will be…
jerrygarciuh
  • 21,158
  • 26
  • 82
  • 139
15
votes
5 answers

MYSQL: Display Skipped records after LOAD DATA INFILE?

In MySQL I've used LOAD DATA LOCAL INFILE which works fine. At the end I get a message like: Records: 460377 Deleted: 0 Skipped: 145280 Warnings: 0 How can I view the line number of the records that were skipped? SHOW warnings doesn't…
Nate Murray
  • 3,841
  • 5
  • 32
  • 33
15
votes
1 answer

LOAD DATA from CSV file where doublequote was used as the escape character

I have a bunch of CSV data that I need to load into a MySQL database. Well, CSV-ish, perhaps. (edit: actually, it looks like the stuff described in RFC 4180) Each row is a list of comma-separated doublequoted strings. To escape any doublequotes…
rampion
  • 87,131
  • 49
  • 199
  • 315
13
votes
7 answers

Program for working with large CSV Files

Are there any good programs for dealing with reading large CSV files? Some of the datafiles I deal with are in the 1 GB range. They have too many lines for Excel to even deal with. Using Access can be a little slow, as you have to actually import…
Kibbee
  • 65,369
  • 27
  • 142
  • 182
13
votes
2 answers

MySQL infile ignore header row

Trying to get MySQL to ignore a specific row when importing through an INFILE command. Essentially, it's the "header" row in the CSV file. LOAD DATA LOCAL INFILE 'C:\myfile.txt' REPLACE INTO TABLE my_db.my_table; I've looked in to the ignore…
Plummer
  • 6,522
  • 13
  • 47
  • 75
12
votes
1 answer

MySQL LOAD DATA INFILE - Loading a file with no primary key

I was trying to load a data file into mysql table using "LOAD DATA LOCAL INFILE 'filename' INTO TABLE 'tablename'". The problem is the source data file contains data of every fields but the primary key is missing ('id' column). I have to add a…
jack
  • 17,261
  • 37
  • 100
  • 125
12
votes
8 answers

What is the fastest way to load an XML file into MySQL using C#?

Question What is the fastest way to dump a large (> 1GB) XML file into a MySQL database? Data The data in question is the StackOverflow Creative Commons Data Dump. Purpose This will be used in an offline StackOverflow viewer I am building, since I…
AgentConundrum
  • 20,288
  • 6
  • 64
  • 99
1
2
3
42 43