我正在尝试在google BigQuery
上的数据集中合并两个表使用以下代码:
def mergeTables(workingTable, table, DATASET_ID):
query ="""
SELECT
full_name,
age
FROM {DATASET_ID}.{workingTable}
UNION DISTINCT
SELECT
full_name,
age
FROM {DATASET_ID}.{table}
LIMIT 100;
"""
df = pd.read_gbq(query, "joe-python-analytics", 'standard')
print(df)
工作表和表是我希望与我的union运算符合并的两个表。但是,当我运行该方法时,我得到错误:
googleapiclient.errors.HttpError: <HttpError 400 when requesting https://www.googleapis.com/bigquery/v2/projects/j/queries/job_aalt=json returned "Encountered "" at line 6, column 15.
[Try using standard SQL (https://cloud.google.com/bigquery/docs/reference/standard-sql/enabling-standard-sql)]">
我已经启用了标准的sql,这似乎没什么帮助?
答案 0 :(得分:3)
尝试将输入显式设置为Python,如下所示:
df = pd.read_gbq(query,
project_id="joe-python-analytics",
dialect='standard')
正如您在method contract中所看到的,它期望sereval keyworded参数,所以你使用它的方式没有正确设置标准方言。