Possible to access source database in prepareRow() in Migrate module?
2 simple approaches:

You call the other DB explicitly like you do any other place to talk to it from drupal.

// Method #1
$query = Database::getConnection('default', 'for_migration')-&gt;select('source_table', 'st');
// $query = ....

// Method #2
db_set_active('my_other_db');
// ... code here ...
db_set_active();  // switch back to normal DB connection in-use. This is important.


Method 1 is outlined here: https://www.drupal.org/node/1014558
Method 2 is outlined here: https://www.drupal.org/node/18429

Your other option is to not do it in every prepareRow() explicitly. Think outside the box :P. Why re-query this information within every prepareRow() -- that just slows down your migration. You can define this custom $tid_map lookup array in your Migration class's constructor as a data member to the migration class itself. You only query it's value a single time (on migration startup). prepareRow then just checks the stored array whenever needed. You may or may not have to use a static variable to assure the value is saved and preserved throughout the Migration lifetime ... I'm not sure.