取得列名是否有可能從查詢得到的列名,例如:從查詢結果
SELECT name AS EmployeeName FROM wh.employee
是否有可能在返回結果得到EmployeeName。我目前的PHP代碼:
$result = $this->bigQueryService->jobs->getQueryResults($this->projectId, $jobId)
$rows = $result->getRows();
if ($rows) {
foreach ($rows as $row) {
/** @var \Google_Service_Bigquery_TableCell $cell */
foreach ($row["f"] as $cell) {
print $cell->getV();
}
}
}
基本上,我想從查詢結果中獲得EmployeeName,這可能嗎?
在泛型BigQuery API中,它位於queryResult.schema.fields中。不過,我不確定PHP庫是否有這個方法。我在github中找不到任何提到架構對象的東西。 – Barmar