0

I have created a yml configuration for migration from CSV source into drupal using composer. After running the "drush migrate:import mbe_book_paragharphs", I am getting the error as You must declare "ids" as a unique array of fields in your source settings.

I am using migrate_source_csv 8.x-3.1

id: mbe_book_paragharphs
migration_group: mbe_migrations
label: 'Import book paragraph'
source:
  plugin: csv
  path: '/var/www/html/drupal/author.csv'
  header_row_count: 1
  ids: [id]
process:
  field_mbe_title: Title
  field_mbe_author: Author
destination:
  plugin: 'entity_reference_revisions:paragraph'
  default_bundle: mbe_book
migration_dependencies: null

I need help on how to resolve this issue

paragraph yml

node yml

paragraph csv

professor csv

In the YML configuration file, instead of "ids", i was using "keys" before but was getting the same error

  • When you change the ID keys in a previsously installed migration file, the existing migration_map_XXXX database table no longer matches the migration definition. The worklow here is rollback -> uninstall -> drop old migration_map_xxx table -> update YML -> reinstall. – Hudri Jan 31 at 9:27
4

As the error message suggests, ids needs to be an array, e.g.

source:
  plugin: csv
  path: '/var/www/html/drupal/author.csv'
  header_row_count: 1
  ids: 
    id:
      type: integer

Do note that you're in a YML file here; it looks like you might have tried to use PHP array syntax.

| improve this answer | |
  • does not work. Issue persists. Getting same error message – Pranay Kumar Jan 31 at 6:39
  • You’ll need to provide some more information- the above pattern has always worked fine for me, there are examples of the same in core, and so on. – Clive Jan 31 at 7:40
  • I have added the code image as well as the csv image. Can you tell me where I am going wrong – Pranay Kumar Jan 31 at 9:15
  • You didn't change your code so it follows the same format as in the answer. It's not going to work until you do that – Clive Jan 31 at 9:46
  • I had made the changes and got the same error thats why I reverted the changes suggested by you – Pranay Kumar Jan 31 at 11:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.