I have an ASP.NET website using MySQL. 1 table('books') holds more than 1000 books, each record has unique ID, name, writer etc. I want to import those books into Drupal. I'm planning to create Custom Fields(name, writer etc) for a New Content Type.

Is it possible to create Nodes like this from SQL file?


Possible, yes. Recommended, no. I do a lot of importing from outside sources, and would never entertain using direct SQL INSERT statements.

I would export your existing database in another format, and pursue one of standard approaches.

The easiest is probably Feeds. In your case, I would export as CSV, and then use the CVS imported built into feeds. Based on your description, it sounds like you have a one-to-one mapping, and the CSV importer is good for this.

The Migrate module can also handle moving data from one source into Drupal.

A more robust solution would be to create a custom importer, build up a $node, and then use node_save. There are a lot of nuances with this, and this is not a good approach unless you are familiar with the Drupal API already.

  • +1 for the Migrate module. It works beautifully with many SQL implementations. – Citricguy Jul 2 '12 at 3:44
  • I have used Feeds module before, that was for the Ecommerce products Bulk insert. I guess it works the same idea, if that doesnt work then I go with Migrate module, thx – wallace740 Jul 2 '12 at 9:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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