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.
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | 907202-feedsmultidataprocessor.patch | 11.38 KB | infojunkie |
| feedsmultidataprocessor.patch | 11.45 KB | infojunkie |
Comments
Comment #1
alex_b commentedInteresting ... so the tables you map to are not joined to each other, right? They can be completely unrelated?
Comment #2
infojunkieThe 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.
Comment #3
alex_b commented[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.
Comment #4
infojunkieUpdated to latest dev.
Comment #5
infojunkieReleased this bit as part of Feeds Hacks to avoid burdening the Feeds team with new code.