appService = new AppService; parent::__construct(); } protected function configure() { $this->setDescription('Select 1.'); } /** * @param InputInterface $input * @param OutputInterface $output * @return int * @throws \YandexCloud\Ydb\Exception */ protected function execute(InputInterface $input, OutputInterface $output) { $ydb = $this->appService->initYdb(); $result = $ydb->table()->retrySession(function (Session $session) use ($output) { return $session->query('select 1;'); }, true); $output->writeln('Column count: ' . $result->columnCount()); $output->writeln('Row count: ' . $result->rowCount()); $t = new Table($output); $t ->setHeaders(array_map(function($column) { return $column['name']; }, $result->columns())) ->setRows($result->rows()) ; $t->render(); return Command::SUCCESS; } }