In many cases, we import data that needs to be normalized in the Drupal database. Here's the case that motivated this patch: while importing Twitter messages, I wanted to insert both message and user records, which are stored in two separate data tables.

The attached patch achieves this, for Data tables. It provides a new FeedsMultiDataProcessor plugin that behaves like FeedsDataProcessor except for the following differences:

* It allows to select multiple tables that will act as recipients of the import process
* It only shows fields from the selected tables
* It creates a new record in each specified table per imported item - and applies the uniqueness check for each table
* It also allows to check uniqueness per feed_nid (as per other processors) or globally - which is not possible in other processors

Of course, this plugin needs tests but I'd be grateful if some brave souls could try it out first :-) I'm currently using it on a production site.

Comments

alex_b’s picture

Interesting ... so the tables you map to are not joined to each other, right? They can be completely unrelated?

infojunkie’s picture

The tables need not be joined as far as I can tell. In the case where they are joined, I map the joining column (in my Twitter example, user_id) once for each table.

alex_b’s picture

[I see - that is the same as in FeedsDataProcessor.inc then - which also exposes joined tables as mapping targets - right?]

Edit: Sorry, disregard this comment please.

infojunkie’s picture

StatusFileSize
new11.38 KB

Updated to latest dev.

infojunkie’s picture

Status: Needs review » Closed (fixed)

Released this bit as part of Feeds Hacks to avoid burdening the Feeds team with new code.