Reputation: 67
I have a Flask server that takes in arguments and then uses those arguments to run this query here:
runQuery = f"UPDATE `mytable` SET start_date='{inf['start_date']}', end_date='{inf['end_date']}', store_ids='{inf['store_ids']}', salary='{float(inf['salary'])}' WHERE row_id = '{row_id}'"
job = client.query(runQuery)
Where SALARY is a float number like "50000.0" (it would be inputted as a string, hence why I tried to convert it to a FLOAT)
The problem is, BigQuery does not like it. I keep getting this error
Value of type STRING cannot be assigned to salary, which has type FLOAT64
Upvotes: 1
Views: 237
Reputation: 1201
Posting @MikhailBerlyant's answer in the comment section as a Community wiki answer:
Just remove single quotes. Use salary={float(inf['salary'])}
Upvotes: 1