[consulting] Database migration script or copy/paste?

Victor Kane victorkane at gmail.com
Tue Apr 20 10:01:45 UTC 2010


You will save a great deal of time with the mis-named "Node Export" module:
drupal.org/project/node_export
It also handles bulk export, import, and I have used it to import thousands
of nodes stored in a CSV format.
But, as Khalid says, there are no pictures or node references; from the
project page:

"Since the bulk export feature has been added, a lot of people have assumed
this module will allow you to export the structure of a whole site and keep
things like menu links, authors, node references, book hierarchy, etc.. BUT
NO IT DOESN'T. The reason is that the ID values that are used to identify
the connections between things like that get changed around during an
import. There are hooks that allow manipulation of nodes during
imports/exports that could allow a programmer to add support for these
features by tracking additional data to be able to fix the nodes afterwards,
but nobody has gone to the trouble of doing that yet."

It is indeed amazing that no-one has gone to that trouble, or has shared
solutions. For complex data structures, there is the migration module and
the table wizard, which were designed for huge sites, and which the makers
chose to share.

The node_import module might be of use also, or roll your own script based
on many snippets in the Drupal handbook and around the web.

This discussion on drupal.org sums the "state of the art" perfectly:

drupal.org/node/762022#comment-2806388 and refers you to the discussion
where there are some examples: drupal.org/node/178506 (creating a node
programmatically).

Also: acquia.com/blog/migrating-drupal-way-part-i-creating-node

The import_html module is an option, but it brings a lot of overhead into
the site in my opinion.

A script to import static HTML would work by iterating over the files in a
directory and then using common PHP functions to read in the text, and then
extracting the body and sticking it into the body of the Drupal node. You
can use a regular expression for that, or, this module is very interesting:
drupal.org/project/querypath
Based on a "scraper" kind of program, It allows an "xpath" like approach for
common html files. Check it out.

Any of these approaches are better than copying and pasting. A developer
needs to shun copying and pasting. Even if you spend more time automating
the process than brute force, you will have reusable tools.

Victor Kane
http://awebfactory.com.ar
http://projectflowandtracker.com

On Tue, Apr 20, 2010 at 2:17 AM, Holly Ferree <hferree at gmail.com> wrote:

> Hi Bob,
>
> Thanks for the input. I'm not web to scripts... I just didn't know what
> else
> to call them... I just want to know if there is a better way to insert a
> lot
> of content without so much clicking and copying/pasting. :)
>
> I am so thrilled to know about all these modules that I can try!
>
> I was curious if Excel could be used (it's all tables anyways)... Would you
> export it was a .csv?
>
> Thanks,
> Holly
>
>
> On 4/20/10 12:12 AM, "Bob Schmitt" <bobschmitt at xinsys.net> wrote:
>
> > I've had pretty good luck with the Import/Export module
> > (http://drupal.org/project/import_export_tool) and the Node Export
> module
> > (http://drupal.org/project/node_export). I can't remember which one is
> the
> > best, but I have used them to dump/import more than 30K nodes organized
> in in
> > 7 cck node types. It worked pretty well except for importing multiple
> taxonomy
> > terms per node.
> >
> > I've also used these modules to migrate content from other sites into
> Drupal
> > sites using Excel and FilemakerPro as intermediary platforms to massage
> the
> > data into the correct formats prior to the migration.
> >
> > Strictly speaking, neither of these are database migration scripts, but
> the
> > get the job done.
> >
> > bob
> >
> > On Apr 19, 2010, at 9:11 PM, Holly Ferree wrote:
> >
> > Hi All,
> >
> > What is the most efficient way of transferring a site's content of 10
> pages
> > or more into drupal? (basically past the realm that you would want to
> copy
> > and paste all the content to where another option would be easier to add
> a
> > good amount of content would be the way to go)
> >
> > I have done the copy/paste of hundreds of lines of content from Word and
> > done the whole create content > page, paste and format content, save
> page,
> > repeat process till I thought I would die of boredom...
> >
> > Please tell me there is a better way! (these sites have been from scratch
> or
> > have not used a database previously. )
> >
> > Thanks,
> >
> > Holly Ferree, Graphic Designer, BFA
> > hferree at gmail.com
> > http://www.designbyholly.com/
> >
> >
> > PS I would also prefer to do it myself and not hire someone who doesn't
> mind
> > repetitive work... :)
> >
> >
> > _______________________________________________
> > consulting mailing list
> > consulting at drupal.org
> > http://lists.drupal.org/mailman/listinfo/consulting
> >
> > Bob Schmitt
> > 432 Harrison Ave.
> > Helena, MT 59601
> > Voice: +1.406.459.6537
> > Skype: captbobalou
> >
> >
> >
> > _______________________________________________
> > consulting mailing list
> > consulting at drupal.org
> > http://lists.drupal.org/mailman/listinfo/consulting
>
> Holly Ferree, Graphic Designer, BFA
> hferree at gmail.com
> http://www.designbyholly.com/
>
>
> _______________________________________________
> consulting mailing list
> consulting at drupal.org
> http://lists.drupal.org/mailman/listinfo/consulting
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/consulting/attachments/20100420/8b3b4b38/attachment-0001.html 


More information about the consulting mailing list