I'm looking to migrate an existing site to Drupal. I have a a content type on the new Drupal site that will eventually hold some 1500 nodes. Of course, I don't want to enter each one in the form on the admin side; I'd like to input them programmatically, from a script.

What I'm wondering is if I can do plain old SQL INSERTS into the node and related tables, and have my nodes ready to use. Assuming I do the inserts correctly, will the nodes just be there when I fire up Drupal? Or will I need to touch some other parts of the site?

Or is there another way, like a module for batch importing?

This is for Drupal 7.

2 Answers 2


There are two routes you can take.

One uses the Migrate module usually in conjunction with Table Wizard. This gives you a web front end for doing an import with field mapping, and other nicities. EDIT: just saw that TW doesn't have a D7 version.

The other is a custom import script. The script does the Drupal bootstrap process, queries the remote database, creates a $node and then does a node_save. This is a little more complex, but not that hard.

I have been doing the later on new projects, and is easy to adapt to XML, CSV, or other data sources.

  • Can you elaborate further on your method for doing the custom import script? I have an external database that I need to turn into Nodes, the only difference is that I also need to be able to run an "update" every now and then if the database changes. How does one make a module to query a remote db, create nodes, add menu items, etc?
    – oranges13
    Aug 26, 2011 at 13:46
  • 1
    The script dpes the bootstrap process just like index.php or cron.php, then does the database connection and query. You then create nodes and do node_save(). Here is a start: acquia.com/blog/migrating-drupal-way-part-i-creating-node
    – mpdonadio
    Aug 27, 2011 at 0:09

There is Node Export which would probably do and of course Feeds. I'd recommend using a module rather than plain SQL because of all the small things Drupal does when creating a node. It's just easier really.

  • I'm not coming from another Drupal installation, but just a plain old LAMP website. Would Node Export help me?
    – user1359
    Jun 8, 2011 at 20:53
  • 1
    Well then no, Node Export probably wouldn't work. Feeds however with Feeds XPath parser (drupal.org/project/feeds_xpathparser) would be what I would do. Jun 8, 2011 at 20:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.