From the continuation of this question I am trying to import paragraphs into my site using migrate from source csv.
I have a single CSV file where there are various fields from those fields I would like to import three fields into paragraph fields, for this process I have created a paragraph type called as fup_balance
and it has three fields called as field_upload
, field_download
and field_total
which are of type textfield . Paragraph has limit of one value.
I have written a custom yml for the paragraph migration and included it as dependency in node migration yml but the data is not being imported and paragraph is empty after import.
Can anyone please point out why it is failing to import paragraphs ?
I have referenced this example for creating yml .
My node and paragraph import ymls as follows :
migration_examples/migrations/article_csv_import.yml
id: article_csv_import
label: Import Articles
migration_group: default
migration_tags:
- Article CSV Migration
source:
plugin: 'csv'
# Full path to the file.
path: public://subscription-list-small-copy.csv
# Column delimiter. Comma (,) by default.
delimiter: ','
enclosure: '"'
header_offset: 0
ids:
- id
fields:
0:
name: id
label: 'Id'
1:
name: title
label: 'Title'
2:
name: body
label: 'Post body'
3:
name: field_activation_date
label: 'Activation Date'
4:
name: field_expiry_date
label: 'Expiry Date'
5:
name: field_upload
label: 'FUP Balance Upload'
6:
name: field_download
label: 'FUP Balance Download'
7:
name: field_total
label: 'FUP Balance Total'
process:
title: title
body: body
#activation date of the account.
field_activation_date:
-
plugin: format_date
from_format: Y-m-d H:i:s
to_format: 'Y-m-d\TH:i:s'
from_timezone: 'America/Managua'
to_timezone: 'UTC'
source: field_activation_date
# expiry date of the account.
field_expiry_date:
-
plugin: format_date
from_format: Y-m-d H:i:s
to_format: 'Y-m-d\TH:i:s'
from_timezone: 'America/Managua'
to_timezone: 'UTC'
source: field_expiry_date
# paragraph field.
field_fup_details:
-
plugin: sub_process
source: field_fup_details
process:
target_id:
-
plugin: migration_lookup
migration: fup_balance_csv_import
source: value
no_stub: TRUE
-
plugin: extract
index:
- 0
target_revision_id: '@target_id'
type:
plugin: default_value
default_value: article
destination:
plugin: entity:node
migration_dependencies:
required:
- fup_balance_csv_import
optional: { }
migration_examples/migrations/fup_balance_csv_import.yml
id: fup_balance_csv_import
label: FUP details from CSV
migration_group: default
migration_tags:
- FUP details CSV Migration
source:
plugin: 'csv'
# Full path to the file.
path: public://subscription-list-small-copy.csv
# Column delimiter. Comma (,) by default.
delimiter: ','
# Field enclosure. Double quotation marks (") by default.
enclosure: '"'
# The row to be used as the CSV header (indexed from 0),
# or null if there is no header row.
header_offset: 0
# The column(s) to use as a key. Each column specified will
# create an index in the migration table and too many columns
# may throw an index size error.
ids:
- id
fields:
0:
name: id
label: 'Id'
1:
name: title
label: 'Title'
2:
name: body
label: 'Post body'
3:
name: field_activation_date
label: 'Activation Date'
4:
name: field_expiry_date
label: 'Expiry Date'
5:
name: field_upload
label: 'FUP Balance Upload'
6:
name: field_download
label: 'FUP Balance Download'
7:
name: field_total
label: 'FUP Balance Total'
process:
field_upload: field_upload
field_download: field_download
field_total: field_total
destination:
plugin: entity_reference_revisions:paragraph
default_bundle: fup_balance
migration_dependencies:
required: {}
optional: {}
Sample CSV Data : subscription-list-small-copy.csv
id,title,body,field_activation_date,field_expiry_date,field_upload,field_download,field_total
1,Title 1,Body 1,2012-12-22 2:36:03,2013-01-03 0:00:00,NA,NA,"DATA: NA, TIME: NA"
2,Title 2,Body 2,2013-08-16 0:00:00,2013-09-15 0:00:00,NA,NA,"DATA: NA, TIME: NA"
3,Title 3,Body 3,2013-09-14 0:00:00,2013-10-14 0:00:00,NA,NA,"DATA: NA, TIME: NA"
4,Title 4,Body 4,2014-04-08 0:00:00,2014-04-07 23:59:59,NA,NA,"DATA: NA, TIME: NA"
5,Title 5,Body 5,2014-09-30 0:00:00,2015-03-29 11:00:00,NA,35840.0 MB,"DATA: 35840.0 MB, TIME: NA"
6,Title 6,Body 6,2014-12-09 12:29:00,2015-01-09 12:29:00,NA,40960.0 MB,"DATA: 40960.0 MB, TIME: NA"
7,Title 7,Body 7,2014-12-31 11:08:00,2015-06-26 23:59:59,NA,61440.0 MB,"DATA: 61440.0 MB, TIME: NA"
8,Title 8,Body 8,2015-02-25 19:12:00,2015-08-10 23:59:59,NA,35840.0 MB,"DATA: 35840.0 MB, TIME: NA"
9,Title 9,Body 9,2015-03-01 11:19:00,2015-02-28 23:59:59,NA,35840.0 MB,"DATA: 35840.0 MB, TIME: NA"
10,Title 10,Body 10,2015-03-02 18:01:00,2015-08-20 23:59:59,NA,30720.0 MB,"DATA: 30720.0 MB, TIME: NA"