$query = TableModel::find()->where([‘xxx’=>xxx]); var_dump($query->prepare(Yii::$app->db->querybuilder)->createCommand()->rawSql);