Closed (fixed)
Project:
Migrate
Version:
7.x-2.4
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
12 Oct 2012 at 18:55 UTC
Updated:
19 Dec 2013 at 09:40 UTC
Jump to comment: Most recent
When I try migrating my content from one MySQL into my Drupal site using drush, I'm getting the following error:
Migration failed with source plugin exception: SQLSTATE[42000]: Syntax error or access violation: 1142 SELECT command denied to user 'isps_wp'@'localhost' for table 'migrate_map_isps' [error]
When I give the source database's user all permissions to my Drupal database, the migration works fine. But it seems wrong to me that I would have to give my source database's user permissions to my Drupal db to make this work.
I'm pasting my migrate class below. Are there some obvious things wrong here?
// Migration class.
class IspsMigration extends Migration {
public function __construct() {
parent::__construct(MigrateGroup::getInstance('ISPS'));
$this->description = 'ISPS migration';
// Use a SQL database as source.
$query = Database::getConnection('default', 'for_migration')
->select('wp_posts', 'wp')
->fields('wp', array('id', 'post_title', 'post_content', 'post_type'))
->condition('post_type', 'page', '=');
$this->source = new MigrateSourceSQL($query);
// We migrate into "article" nodes.
$this->destination = new MigrateDestinationNode('article');
// We instantiate the MigrateMap
$this->map = new MigrateSQLMap($this->machineName,
array(
'id' => array('type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
)
),
MigrateDestinationNode::getKeySchema()
);
// Finally we add simple field mappings
$this->addFieldMapping('title', 'post_title');
$this->addFieldMapping('body', 'post_content');
}
}
Comments
Comment #1
brunodboI'm assuming this has to do with the creation of the migration map table, as mentioned on http://drupal.org/node/1014558 ('Map tables').
Marking as fixed.
Comment #2
mikeryanBy default, Migrate will try to directly join the source query to the map table, which is (by default) in the Drupal database, as a performance optimization. To disable this behavior:
In hindsight, I wish I'd made FALSE the default, but changing the default would affect those depending on getting the join automatically...
Comment #3
mikeryanYep, you found it!
Comment #4.0
(not verified) commentedUpdating description.
Comment #5
kenorb commentedComment #6
kenorb commentedSee: Cross-database migrations