Community Documentation

Adjust query

Last updated March 1, 2013. Created by peteruithoven on October 23, 2012.
Edited by jrbeeman. Log in to edit this page.

You can adjust the query for migrations by overriding the query function.
Below are some examples to limit the amount of nodes you migrate.

<?php
protected function query() {
   
$query = parent::query();
   
//$query->condition('n.nid',2161); // only migrate the node with nid 2161
    //$query->condition('n.nid',array(1849,2161)); // only migrate the nodes with nid 1849 or 2161
   
$query->range(0, 50); // only migrate the first 50 results
   
return $query;
}
?>

For more information about the syntax check the database api documentation.
http://drupal.org/developing/api/database

Administration & Security Guide

Drupal’s online documentation is © 2000-2013 by the individual contributors and can be used in accordance with the Creative Commons License, Attribution-ShareAlike 2.0. PHP code is distributed under the GNU General Public License. Comments on documentation pages are used to improve content and then deleted.