Reputation: 83
I am attempting to union two tables within a dataset on google BigQuery
using the following code:
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)
working table and table are the two tables i wish to merge with my union operator. However when i run the method i get the error:
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)]">
I have already enabled standard sql and this doesnt seem to help?
Upvotes: 3
Views: 4671
Reputation: 11797
Try making the input explicit to Python, like so:
df = pd.read_gbq(query,
project_id="joe-python-analytics",
dialect='standard')
As you can see from the method contract, it expects sereval keyworded arguments so the way you used it didn't properly setup the standard dialect.
Upvotes: 5