Access BQ via pandas in python

Write data

import pandas as pd

for i in range(1,len(nonstd_q)):
	id += 1
    data2 = pd.DataFrame({"col": dat, "col": dat, "col": dat}, pd.Index(range(1)))
    data = data2.append(data)
    
data.to_gbq(destination_table="*.*", project_id = '*',if_exists="append")

Read data

query = """
  SELECT max(`*`) FROM `*.*.*`
  """
result = pd.read_gbq(query, dialect='standard', project_id='*', use_bqstorage_api=True)

id = int(result["f0_"][0])+1

你可能感兴趣的:(Access BQ via pandas in python)