3

I need to import a large dataset (over 300,000 records) into a Drupal 8 site. I have figured out how to do this with feeds on a small test dataset.

The dates in the records are in the format June 8, 2018. I do not see a way to use a Drupal 8 Date field to input dates in this format.

I need to be able to create a view that displays records based on a date range.

What is the best way to get the data into Drupal in a format that a view can use? Would it be to maybe use computed field to transform the data while it is being imported? Or would it be better to maybe execute a SQL query after the data is imported?

3

Rather than using Feeds, I suggest using the core Migrate module. There is also a core plugin for converting dates during migration, FormatDate. This will allow you do specific the input format and the output format. I believe, this process configuration would work in your case:

process:
  field_date:
    plugin: format_date
    from_format: 'F j, Y'
    to_format: 'Y-m-d'
    source: event_date

If Feeds is your preferred method, then you can try the Feeds Tamper module. Based on the plugin list for Drupal 8, I think you would need to do a "String to Unix timestamp" tamper on the field, followed by a "Unix timestamp to Date" tamper, using 'Y-m-d' as the format string. However, I haven't used Feeds and Feeds Tamper in a long time, and would typically write custom tampers for something like this.

  • Thanks mpdonadio. I haven't used the Migrate module yet, but now may be the time to try it. – Finn Jul 21 at 18:33

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.