Problem/Motivation

There are certain types of dynamic migrations that may need access to the original data values in order to prepare source data. Examples include:

  • Dynamically identifying some source properties based on the values of other source properties.
  • Dynamically setting the value of some source properties based on original values that do not need migration.

In my case, I have a very custom migration which is deriving the node bundle based on a property of the entity, which means I need the original values on the data so I can dynamically set which fields I will be supporting based on the destination bundle definition.

Proposed resolution

Add a flag to Data Parser plugins to support a new include_raw_data configuration of the source plugin. When present, the full set of original values for the row will be included as a "raw" element of the Row object. By defaulting this to not happen we minimize the memory impact for the majority of use cases that will not need this functionality.

Remaining tasks

A patch with an implementation for the data_parser is forthcoming. A generic treatment of this that can live in DataParserPluginBase would be ideal.

User interface changes

N/A

API changes

None.

Data model changes

Configuration addition.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Grayside created an issue. See original summary.

Grayside’s picture

Status: Active » Needs work
FileSize
1.73 KB

Attached patch provides initial working support for the JSON data parser as mentioned in the description. Since this seems like it should cover all data parsers instead of just a single plugin I'm setting this to Needs Work.

Grayside’s picture

Title: Add support for original data values with data_parser plugins » Add support for original data values with JSON data_parser plugin
Status: Needs work » Needs review

Since #2792765: Allow XML elements to pass through as field values to process plugins was acceptable for a specific format, let's recast this one as JSON-specific

  • mikeryan committed e128c1a on 8.x-2.x authored by Grayside
    Issue #2780965 by Grayside: Add support for original data values with...
mikeryan’s picture

Status: Needs review » Fixed

Looks good - if we decide we want to support this pattern for XML (in addition to the automated this-is-not-a-string-so-pass-it-through), we can do that when the need arises.

  • mikeryan committed e128c1a on 8.x-3.x authored by Grayside
    Issue #2780965 by Grayside: Add support for original data values with...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.