/**
 * Implements hook_taxonomy_vocabulary_load().
 */
function {{ machine_name }}_taxonomy_vocabulary_load($vocabularies) {
  $result = db_select('mytable', 'm')
    ->fields('m', array('vid', 'foo'))
    ->condition('m.vid', array_keys($vocabularies), 'IN')
    ->execute();
  foreach ($result as $record) {
    $vocabularies[$record->vid]->foo = $record->foo;
  }
}
