I have this CSV I'm making migration from. It contains an ID and content for hierarchical taxonomy terms. The taxonomy migration process goes OK and creates the terms correctly but I get these errors when the flow gets null value in a field:
[error] SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'name' cannot be null: INSERT INTO {taxonomy_term_field_data} (tid, vid, langcode, name, description__value, description__format, weight, changed, default_langcode) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6, :db_insert_placeholder_7, :db_insert_placeholder_8); Array
(
[:db_insert_placeholder_0] => 2571
[:db_insert_placeholder_1] => location
[:db_insert_placeholder_2] => en
[:db_insert_placeholder_3] =>
[:db_insert_placeholder_4] =>
[:db_insert_placeholder_5] =>
[:db_insert_placeholder_6] => 0
[:db_insert_placeholder_7] => 1531773648
[:db_insert_placeholder_8] => 1
)
(/home/ci/broll/docroot/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php:829)
I'm aware the error pops when "name" is null. What I'm trying to do is to skip migration on that row if "name" is null and not getting the error message in the shell . I've tried the skip_on_empty plugin but it imports the terms without hierarchy.
The migration YML:
id: locations
label: "Import location taxonomy terms"
destination:
plugin: entity:taxonomy_term
default_bundle: location
source:
plugin: csv
track_changes: true
path: 'private://upload_video/video.csv'
header_row_count: 1
keys:
- Sublocation
data_rows:
-
term_id: 1
name: Sublocation
process:
parent:
-
plugin: migration_lookup
migration: locations
source: Location
name: Sublocation
#weight: weight
-
plugin: default_value
default_value: 0
Thanks for any help you cand provide me!.
Comments
Comment #2
gabriel.nunez commentedComment #3
gabriel.nunez commentedComment #4
heddnCore has a skip_on_empty process plugin. Use it to skip the row, not just the process.