Skip to content

Instantly share code, notes, and snippets.

@deepakaryan1988
Created January 22, 2020 10:40
Show Gist options
  • Save deepakaryan1988/4a81fd5c12d5696e7d99f338ce75a979 to your computer and use it in GitHub Desktop.
Save deepakaryan1988/4a81fd5c12d5696e7d99f338ce75a979 to your computer and use it in GitHub Desktop.
# Migration configuration for imported planets.
id: import_drupal_planets
label: Import planets Data from Nasa
migration_group: Drupal Import
dependencies:
enforced:
module:
- nasa_facts
destination:
plugin: entity:node
source:
plugin: url
# Enable "track changes" feature.
track_changes: true
# We get data from a local file which we have got through cron job.
data_fetcher_plugin: file
data_parser_plugin: json
urls: 'public://migrate/exoplanets.json'
# An xpath-like selector corresponding to the items to be imported.
item_selector:
ids:
pl_name:
type: string
fields:
-
name: pl_name
label: 'pl_name'
selector: pl_name
-
name: pl_hostname
label: 'pl_hostname'
selector: pl_hostname
-
name: pl_letter
label: 'pl_letter'
selector: pl_letter
-
name: pl_discmethod
label: 'pl_discmethod'
selector: pl_discmethod
-
name: pl_controvflag
label: 'pl_controvflag'
selector: pl_controvflag
-
name: pl_pnum
label: 'pl_pnum'
selector: pl_pnum
- name: pl_orbper
label: 'pl_orbper'
selector: pl_orbper
-
name: pl_ttvflag
label: 'pl_ttvflag'
selector: pl_ttvflag
-
name: pl_kepflag
label: 'pl_kepflag'
selector: pl_kepflag
-
name: pl_k2flag
label: 'pl_k2flag'
selector: pl_k2flag
-
name: pl_facility
label: 'pl_facility'
selector: pl_facility
process:
type:
plugin: default_value
default_value: planets
uid:
plugin: default_value
default_value: 1
status:
plugin: default_value
default_value: 1
field_pl_discmethod:
plugin: entity_generate
source: pl_discmethod
value_key: name
bundle_key: vid
bundle: discovery_method
entity_type: taxonomy_term
ignore_case: true
field_pl_controvflag: pl_controvflag
field_pl_pnum : pl_pnum
field_pl_orbper : pl_orbper
field_pl_ttvflag : pl_ttvflag
field_pl_kepflag : pl_kepflag
field_pl_k2flag : pl_k2flag
field_pl_facility:
plugin: entity_generate
source: pl_facility
value_key: name
bundle_key: vid
bundle: discovery_facility
entity_type: taxonomy_term
ignore_case: true
title: pl_name
field_pl_hostname: pl_hostname
field_pl_letter: pl_letter
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment