GithubHelp home page GithubHelp logo

gorkdesign / migration_batch Goto Github PK

View Code? Open in Web Editor NEW

This project forked from patrickfweston/migration_batch

0.0 1.0 0.0 23 KB

A Drupal 8 module that allows for CSV migrations to be performed in batches.

License: GNU General Public License v3.0

PHP 100.00%

migration_batch's Introduction

Migration Batch

A Drupal 8 module to perform CSV migrations in batches.

Overview

When migrating large CSV files into Drupal, the migration process can occasionally run out of memory. This module temporarily divides the source CSV file into smaller files to perform the migration.

Usage

This module simply extends the default drush migrate:import command with two additional options:

Batch Size

--batch-size controls how many lines the temporary CSV batch files have

Example

drush migrate:import:batch sample_migration --batch-size=100

When run, the source CSV file for the sample_migration migration will be divided into smaller files with 100 lines each. These files are stored in the private files directory at the URI of private://migration_batch/batched_migrations and are cleaned up after completion.

Source File

--source-file allows for a different file than is defined in the migration to be used

Note: Rolling back may be affected if various source files are used with a single migration.

Example

drush migrate:import:batch sample_migration --source-file=private://migrations/test.csv

Runs the sample_migration migration with the source file in the migration's configuration replaced with the file at private://migrations/test.csv

Common questions

  1. How does rolling back work?

Rolling back should complete correctly. The smaller batched files add to the migration map database table just like one, larger migration file. Memory is not as scarce when rolling back.

See also

  1. Writing a script to automate rerunning migrations when out of memory: https://www.mediacurrent.com/blog/memory-management-migrations-drupal-8
  2. Another post on writing a script to automate migrations, but using an approach utilizing the limit flag: https://chromatichq.com/blog/migration-memory-management-batching-and-limits
  3. Drupal.org issue about memory reclamation: https://www.drupal.org/node/2701335
  4. Drupal.org issue about batches not being restarted completely: https://www.drupal.org/node/2701121

migration_batch's People

Contributors

patrickfweston avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.