@aniya.jaskolski you can cast to string or use toString() method to print raw SQL query in Drupal 8, code:
1 2 3 4 5 6 7 8 9 10 11 |
<?php $connection = \Drupal::service('database'); $query = $connection->select('node', 'node'); $query->fields('node', ['nid']); $query->condition('node.type', 'article'); // Print query print_r($query->__toString()); // Print query params print_r($query->arguments()); |