Links: 9-29-2006

Bulk import of email addresses into Movable Type notifications

One of the blogs on my Movable Type installation is actually using the notifications feature built into Movable Type (which gives you the ability to let people subscribe to a blog via email) and needed to do a bulk import of email addresses that he already had in csv format. Unfortunately, Six Apart doesn’t provide a way to do a bulk import so I dug into google. Because the install is backed by MySQL, the solution was to use the LOAD DATA INFILE command, which reads a csv file from disk and loads the data into a table you specify. In case someone else ever needs to do this with Movable Type, the syntax I ended up using looked like this:

LOAD DATA LOCAL INFILE 'contacts.csv' 
INTO TABLE mt_notification 
FIELDS TERMINATED BY ',' 
LINES TERMINATED BY '\n' 
(notification_email,notification_blog_id,notification_name)

and my contacts.csv file looked like this:

ajohnson@cephas.net,10,Aaron Johnson
...

Also interesting to note that according to the MySQL documentation, the LOAD DATA INFILE command is usually 20 times faster (!) than using separate INSERT INTO statements.

Links: 9-21-2006

Links: 9-13-2006

Links: 9-8-2006