Against a BigQuery table, I'm trying to run a SQL statement calling a UDF. This statement is executed within a Python script and the call is made via the BigQuery API.
When I execute a simple SQL statement without a UDF, it works fine. However, I keep getting the same error when I try to use a UDF script (stored either locally or in a GCS bucket). This what I get on my local Terminal (I run the script via Python Launcher):
Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/googleapiclient/http.py", line 840, in execute raise HttpError(resp, content, uri=self.uri) googleapiclient.errors.HttpError: https://www.googleapis.com/bigquery/v2/projects/[projectId]/queries?alt=json returned "Required parameter is missing">
And this is my Python script:
credentials = SignedJwtAssertionCredentials(
SERVICE_ACCOUNT_EMAIL,
key,
scope='https://www.googleapis.com/auth/bigquery')
aservice = build('bigquery','v2',credentials=credentials)
query_requestb = aservice.jobs()
query_data = {
'configuration': {
'query': {
'userDefinedFunctionResources': [
{
'resourceUri': 'gs://[bucketName]/[fileName].js'
}
],
'query': sql
}
},
'timeoutMs': 100000
}
query_response = query_requestb.query(projectId=PROJECT_NUMBER,body=query_data).execute(num_retries=0)
Any idea what 'parameter is missing' or how I can get this to run?