我想在表(t1)上运行查询以python获取结果,编辑结果(大查询不支持各种逻辑),然后将已编辑的结果存储在大表中的新表(t2)中查询。
我从标准表中得到结果:
import os
os.environ['GOOGLE_APPLICATION_CREDENTIALS'] = 'path_to_json_credentials.json'
from google.cloud import bigquery
client = bigquery.Client()
QUERY = \
(
'SELECT Col1,Col2,Col3, Col4'
'FROM `dataset.table1`'
)
# API request
query_job = client.query(QUERY)
#### # Waits for query to finish
rows = query_job.result()
for row in rows:
if row.col1 = x:
row.col2 = new_val
`dataset.table2` = rows