Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
This patch adds an option to the Data processor to clear all existing records when importing new data.
From discussions in issue #661314: "Sync" or "cache" mode.
Comment | File | Size | Author |
---|---|---|---|
#12 | feeds_purge_data-1022102-12.patch | 2.41 KB | imclean |
#11 | feeds_purge_data-1022102-11.patch | 2.42 KB | imclean |
#1 | feeds-1022102.patch | 1.82 KB | imclean |
feeds_data_purge.patch | 1.5 KB | imclean | |
Comments
Comment #1
imclean CreditAttribution: imclean commentedShould probably add a notification.
Comment #2
imclean CreditAttribution: imclean commentedThis leads to some interface issues, "Purge existing records" will override "Replace existing records". Would a comment along those lines be enough?
Comment #3
imclean CreditAttribution: imclean commentedIt wasn't particularly hard to review.
Comment #4
math-hew CreditAttribution: math-hew commentedBeautiful. This just saved me more headaches than you know.
Comment #5
math-hew CreditAttribution: math-hew commentedIt doesn't look like this patch made it into beta11 - will it be included in future versions?
Comment #6
imclean CreditAttribution: imclean commentedGood question. Given that only 2 of us have posted in this issue I guess it isn't really a priority for others. NicolasH has expressed support in another issue: http://drupal.org/node/661314#comment-3914908
New features are probably being added to the 7 version then backported if required.
Comment #7
imclean CreditAttribution: imclean commentedI'm just wondering if it's worth pursuing this in its current form. We make extensive use of this function and it isn't ideal patching after each update.
The data module hasn't been ported to Drupal 7 yet and may never be. Is this feature ever likely to be considered for Feeds?
Comment #8
imclean CreditAttribution: imclean commentedData module out for D7: http://drupal.org/project/data
See also: #1420490: Data Processor for 7.x
Comment #9
twistor CreditAttribution: twistor commentedI wouldn't hold this issue up by requiring a FeedsDataProcessor for 7.x.
But, as noted in #2, this configuration option will interfere with updating/replacing existing records. It seems to me that it should be another option in that select.
Is this only a feature that makes sense for data.module? I think that may be the case, since we can't really truncate drupal tables at will. But, I would like to confirm this.
Comment #10
PatchRanger CreditAttribution: PatchRanger commentedPurging existing data (or any other action you like) before import could be done by another way : using "Before import" event and the power of Rules module. See #1744570: Invoke Before import event before start import for more details.
I think it is more generic (and it means reusable) way to achieve your goal rather than implementing new special option for this special case, what do you think?
Marking this as fixed if nobody would mind.
Comment #11
imclean CreditAttribution: imclean commentedThe Rules addition sounds useful and flexible.
In this case, I think creating a rule for such simple, basic feature when it can be easily factored in to the current code and UI is overkill.
Also, despite the wording of the issue "Purge existing Data before import" , the purge actually happens after the data has been imported but before it has been saved. This keeps the old records in the event the import fails.
Along the lines of the node processor settings, this patch changes the "Replace existing" option to be radios and adds the "Purge existing" option.
Comment #12
imclean CreditAttribution: imclean commentedRemoved "before import" from the patch.
@twistor, this does only seem to make sense for the Data module. For nodes things get a bit more complicated. The synch/cache issue has some good discussion but seems to be a bit all over the place.
Comment #13
twistor CreditAttribution: twistor as a volunteer commented