Help - Search - Members - Calendar
Full Version: Help: Command Line Import Of Mt 3.2 Entries To Mt 4.01
Movable Type Community Forum > Installing and Upgrading > Importing and Exporting
RichardLee
Hi guys,

i have a huge MT 3.2 database and I need to import roughly 3,400 entries from one of my blogs into my new MT 4.01 installation. Seems like the Linux command line is the only way to go because phpMyAdmin times out with such a large amt of data..i was wondering if someone could show me how to do this?

I know i need to do the below, but not sure on the commands i would need to use

1. SELECT * FROM mt_entries WHERE blog_entry_id = 4
2. Export this result set...
3. Convert this data to 4.01 entry
4. Insert into MT 4.01 mt_entries table

Cheers!
Kevin Aylward
QUOTE (RichardLee @ Dec 5 2007, 04:22 AM) *
Hi guys,

i have a huge MT 3.2 database and I need to import roughly 3,400 entries from one of my blogs into my new MT 4.01 installation. Seems like the Linux command line is the only way to go because phpMyAdmin times out with such a large amt of data..i was wondering if someone could show me how to do this?

I know i need to do the below, but not sure on the commands i would need to use

1. SELECT * FROM mt_entries WHERE blog_entry_id = 4
2. Export this result set...
3. Convert this data to 4.01 entry
4. Insert into MT 4.01 mt_entries table

Cheers!


Make a template on blog 4 to publish a new archive in import format. You could also have it publish a series of SQL statements... Jay Allen had some code like this once I'll have to look around for...
RichardLee
QUOTE (kaylward @ Dec 5 2007, 11:34 AM) *
Make a template on blog 4 to publish a new archive in import format. You could also have it publish a series of SQL statements... Jay Allen had some code like this once I'll have to look around for...


Hmm thanks, but im not sure you understand what im trying to achieve. Im not talking about updating the actual static entries. Essentially i want to update the database entries i.e. for blog_id 4 entries to have a new blog_id of 8, then import this data into the new MT 4.01 installation. Make sense?
Kevin Aylward
QUOTE (RichardLee @ Dec 6 2007, 12:07 AM) *
QUOTE (kaylward @ Dec 5 2007, 11:34 AM) *
Make a template on blog 4 to publish a new archive in import format. You could also have it publish a series of SQL statements... Jay Allen had some code like this once I'll have to look around for...


Hmm thanks, but im not sure you understand what im trying to achieve. Im not talking about updating the actual static entries. Essentially i want to update the database entries i.e. for blog_id 4 entries to have a new blog_id of 8, then import this data into the new MT 4.01 installation. Make sense?


I don't think you can do what you want (and have it work) exactly as you describe it.

Changing the blog_id is possible via SQL. You'd have to go through every table an look for columns with blog_id in the name then use code such as this:

UPDATE "mt_entry"
SET "entry_blog_id" = 8
WHERE "entry_blog_id" = 4

That blog_id is in lots of tables and you'd have to fix them all or you'd dork things up very bad.

Trying to import those entries into another MT installation via SQL probably won't work because the entry_id is an auto-increment value and there's no way to assure that you can import one of the entry_id's in your dataset without it colliding with an existing entry in the destination blog.

I'm not sure why you couldn't export blog_id 4's entries, make a new blog (blog_id 8) on the MT4 site, then import the entries. The entry_id's would be different, but as I showed above they probably would be anyway. In the export/import file you can specify the basenames so those would be the same.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.