Migration query works but migration fails due to sourceid not being found Here is my migration class:

class TaxonomyPrice extends SqlBase {
  /**
   * {@inheritdoc}
   */
  public function query() {
    $table1 = $this-&gt;select('venue', 'v')
      -&gt;isNotNull('price')
      -&gt;condition('price', '', '!=')
      -&gt;groupBy('price')
      -&gt;fields('v', ['price']);

    $table2 = $this-&gt;select('item', 'i')
      -&gt;fields('i', ['price'])
      -&gt;isNotNull('price')
      -&gt;condition('price', '', '!=')
      -&gt;groupBy('price')
      -&gt;union($table1);

    $table3 = $this-&gt;select('nodes_venues', 'nv')
      -&gt;fields('nv', ['price'])
      -&gt;isNotNull('price')
      -&gt;condition('price', '', '!=')
      -&gt;groupBy('price')
      -&gt;union($table2);

    return $this-&gt;select('sc_article', 'sca')
      -&gt;fields('sca', ['price'])
      -&gt;isNotNull('price')
      -&gt;condition('price', '', '!=')
      -&gt;groupBy('price')
      -&gt;union($table3);
  }

  /**
   * {@inheritdoc}
   */
  public function fields() {

    $fields = [
      'price' =&gt; t('Term name'),
    ];

    return $fields;
  }

  /**
   * {@inheritdoc}
   */
  public function getIds() {
    return [
      'price' =&gt; [
        'type' =&gt; 'string',
      ],
    ];
  }
}


When I run drush ms I can see the correct number of items being counted.

$ drush ms taxonomy_price
 Group: Taxonomy Migrations  Status  Total  Imported  Unprocessed  Last imported
 (taxonomy_migration)
 taxonomy_price                Idle    121    0         121


But when I try to run the migration it gives me an error related to the sourceid.

$ drush mi taxonomy_price
Migration failed with source plugin exception: SQLSTATE[42000]: Syntax error or access violation: 1055     [error]
'drupal_8.map.sourceid1' isn't in GROUP BY: SELECT sca.price AS price,
map.sourceid1 AS migrate_map_sourceid1, map.source_row_status AS migrate_map_source_row_status
FROM
{sc_article} sca
LEFT OUTER JOIN drupal_8.migrate_map_taxonomy_price map ON price = map.sourceid1
WHERE  (price IS NOT NULL ) AND (price != :db_condition_placeholder_0) AND( (map.sourceid1 IS NULL ) OR
(map.source_row_status = :db_condition_placeholder_1) )
GROUP BY price UNION SELECT nv.price AS price
FROM
{nodes_venues} nv
WHERE  (price IS NOT NULL ) AND (price != :db_condition_placeholder_2)
GROUP BY price UNION SELECT i.price AS price
FROM
{item} i
WHERE  (price IS NOT NULL ) AND (price != :db_condition_placeholder_3)
GROUP BY price UNION SELECT v.price AS price
FROM
{venue} v
WHERE  (price IS NOT NULL ) AND (price != :db_condition_placeholder_4)
GROUP BY price; Array
(
    [:db_condition_placeholder_0] =&amp;gt;
    [:db_condition_placeholder_1] =&amp;gt; 1
    [:db_condition_placeholder_2] =&amp;gt;
    [:db_condition_placeholder_3] =&amp;gt;
    [:db_condition_placeholder_4] =&amp;gt;
)


I read through the documentation for getIds(), but I didn't see anything there that would help me figure out what's wrong.
The relevent part of the error message is "'drupal_8.map.sourceid1' isn't in GROUP BY". Let's look at the query as executed:

SELECT sca.price AS price,
map.sourceid1 AS migrate_map_sourceid1, map.source_row_status AS migrate_map_source_row_status
...
GROUP BY price


SQL requires that all columns being selected be part of the GROUP BY. The SqlBase class has determined that your source query can be joined directly to the migration's map table, and thus performs the join as an optimization, adding the map table fields to the columns returned. However, it doesn't add them to the GROUP BY. There's an issue for that: https://www.drupal.org/node/2844595. For now, you can set

ignore_map: true


in your source plugin's configuration to prevent the join and it will work.