Get pure SQL from Drupal::entityQuery Given the following code, how can I print the SQL that is generated?

$bundle='my_bundle_type';
$query = \Drupal::entityQuery('node');
$query-&gt;condition('status', 1);
$query-&gt;condition('type', $bundle);
$entity_ids = $query-&gt;execute();


What I have tried:


__toString() doesn't work
dpq($query) throws an error
With debug tag (devel module is mandatory) we can print the raw sql. 

$query = \Drupal::entityQuery('foo')-&gt;condition('bar', 'xyz')-&gt;addTag('debug');
$ids = $query-&gt;execute();