I have been struggling with this for a couple of days now and I felt like I should reach out. This might be very simple but I am not from a programming background and I haven't found any resources to solve this so far.
Basically, I want to parametarize a SQL query that is running for BigQuery within Google APp Script, it takes a variable from a user from a Google From they have submitted and I wanted to ensure that this won't be injectable by parametarizing the query, however, I got the following error that I could not fix:
GoogleJsonResponseException: API call to bigquery.jobs.query failed with error: Query parameter 'account_name' not found at [1:90]
Here is how I run the query::
//Query
const sqlQuery = 'SELECT district FROM `table` WHERE account_name = @account_name AND ent_theatre=("X") LIMIT 1;'
const request = {
query: sqlQuery,
params: {account_name: queryvar},
useLegacySql: false,
};
// Run Query
var queryResult = BigQuery.Jobs.query(request,projectID);