Bulk loading into MySQL


Mysql bulk loadint is pretty cool to, the reference for this can be found here, as always though I just want the bit to get t working.

 

I am using Linux Centos 5.6 mysql version ?????

The text file needs to be stored in the schema directory, in this example I am uploading to the pentaho schema and therefore my path is /u10/mysql/pentaho/

The command is therefore as follows

 mysql -e schema_name -e “load data infile ‘name_of _file_to_import‘ into mysql_table fields terminated by ‘delimiter‘ ingnore number of lines lines”

The ignore number of lines is only needed if there is a header etc…

 

e.g.

 mysql pentaho -e “load data infile ‘fact_sales_history_statistics.txt’ replace into table fact_sales_history_statistics fields terminated by ‘;’ ignore 1 lines”

 

 

 

 

 

 

Advertisements


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s