- π©π°Denmark ressa Copenhagen
Great thread, it really helped me a lot. I was looking for a way to import multiple CSV-files, sharing a unique nid. I wanted to run multiple migrations, populating different fields of a content type. I really wanted to avoid concatenating all the CSV-files into a single CSV-file.
The key was to also map the nid, as outlined by @mikeryan:
process: nid: nid_to_update
Where "nid_to_update" is a column in your CSV of the nids you're updating.
That was all that was needed. No need to add extra overwrite_properties parameters.
- π«π·France arnaud-brugnon
#23 is problably the closest solution.
Use entity_lookup plugin is probably the best solution (nid_to_update is problably the uggliest solution)
One precision to make entity_lookup works like a charm : Don't miss one import key (otherwise entity lookup will fail).
It means you will have to set entity_type, bundle, bundle_key and value_key.
bundle_key may seems overkill but you have to define it.Full migration file here
id: tax_classification_import label: Import tax classifications migration_group: product_import source: plugin: import_tax_classification data_fetcher_plugin: http data_parser_plugin: json verify: FALSE fields: - name: code label: 'Code' selector: productTaxClassification/code - name: taxRate label: 'Tax rate' selector: tax/taxRate ids: code: type: string request_options: verify: false process: tid: plugin: entity_lookup source: code entity_type: taxonomy_term bundle: tax_classification bundle_key: vid value_key: field_code ignore_case: true access_check: 0 vid: plugin: default_value default_value: tax_classification name: code field_code: code status: plugin: default_value default_value: 1 field_rate: taxRate destination: plugin: 'entity:taxonomy_term' overwrite_properties: - field_rate
I've tried to update already existing commerce products, but I had an error - "Duplicate entry '1045' for key 'PRIMARY': INSERT INTO "commerce_product"
process: product_id: plugin: entity_lookup source: Nr entity_type: commerce_product bundle_key: type bundle: course value_key: field_course_nr_ ignore_case: true access_check: 0
What should I do here?