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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

imclean’s picture

FileSize
1.82 KB

Should probably add a notification.

imclean’s picture

This leads to some interface issues, "Purge existing records" will override "Replace existing records". Would a comment along those lines be enough?

imclean’s picture

Status: Needs review » Reviewed & tested by the community

It wasn't particularly hard to review.

math-hew’s picture

Beautiful. This just saved me more headaches than you know.

math-hew’s picture

It doesn't look like this patch made it into beta11 - will it be included in future versions?

imclean’s picture

Good 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.

imclean’s picture

I'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?

imclean’s picture

twistor’s picture

Status: Reviewed & tested by the community » Needs work

I 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.

PatchRanger’s picture

Status: Needs work » Fixed

Purging 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.

imclean’s picture

Status: Fixed » Needs review
FileSize
2.42 KB

The 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.

imclean’s picture

Removed "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.

twistor’s picture

Issue summary: View changes
Status: Needs review » Closed (outdated)