0
내가 테이블의 스키마를 얻을 수있는 방법 파이썬의 BigQuery API - 테이블 스키마/헤더
import uuid
from google.cloud import bigquery
def query_shakespeare():
client = bigquery.Client()
query_job = client.run_async_query(str(uuid.uuid4()), """
#standardSQL
SELECT corpus AS title, COUNT(*) AS unique_words
FROM `publicdata.samples.shakespeare`
GROUP BY title
ORDER BY unique_words DESC
LIMIT 10""")
query_job.begin()
query_job.result() # Wait for job to complete.
destination_table = query_job.destination
destination_table.reload()
for row in destination_table.fetch_data():
print(row)
if __name__ == '__main__':
query_shakespeare()
같은 쿼리의 예를 감안할 때 얻을? 행은 앞의 예에서 형태
Row(('august', -1, 'aaa', 333), {'col1': 0, 'col2': 1, 'col3': 2})
을 가지고 있지만 패키지 구글 - 클라우드의 BigQuery == 0.28.0 헤더 JSON을 추출 할 수있는 방법을 찾을 수 없습니다. 물론 테이블 스키마의 추출도 나에게 도움이 될 것이지만 현재 Google 문서는 마지막 버전에서 작동하지 않습니다 ...