Loading data into Drupal
Migrating content of any kind into a different system is almost always an inevitable headache. A process of auditing the previous system, normalizing who-knows-how-long's amount of data, and bringing all of that together in a harmonious flow from old to new. In the past we have discussed: the procedures you might take to prepare your data, custom PHP coding that could facilitate a specific import case, and also leveraging existing Drupal community modules (migration module, and the services module) in order to connect the disparate systems. More recently, however, I have been able to make use of a new set of community modules in order to make the transition from a legacy content system into Drupal a little less painful. The modules used this time around were:
- Feeds - enables one-off or periodic imports of data. This process is highly configurable from both a source perspective (RSS, CSV, direct database connection, etc) and from a mapping perspective, into Drupal. While a few initial migrations had been done via project specific PHP code and even manual entry, eventual use of an appropriate Feeds importer was a far more elegant and maintainable solution.
- Feeds SQL - provided critical additional functionality in the importer process, adding direct database queries as sources for migration into Drupal.
- Feeds Tamper - implements a hook that allows additional rules and various input manipulations to take place prior to committing data into Drupal.
For example, parsing a many to one relationship. If a comma seperated value row indicated:
User, Favorite Birds Sally, blue jay|oriole|sparrow
Using Feeds Tamper you would be able to specify the secondary parse of the pipe delimited list in the second field.
- Feeds Entity Reference - Within the content architecture I was building I found it necessary to relate one complex content type with another. While in Drupal, this association is handled with the Entity Reference module, I needed a way to impose this relationship on incoming data, thus this module solved that headache.
- Feeds Image Grabber - this gem provides a mechanism for the importer to wander off and fetch any given image specified from the importer, whether it is a URL or drupal path, the image is fetched and attached properly to the end-point content type.
Where in the past it was fairly common to start coding a project specific fix for these types of data loading issues, re-inventing the wheel is not as necessary with the presence of these Drupal community modules to alleviate some of the pains of the migration process.