'How Can I Run FLOAT64 Values In A Query using Python BigQuery?
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
Solution 1:[1]
Posting @MikhailBerlyant's answer in the comment section as a Community wiki answer:
Just remove single quotes. Use salary={float(inf['salary'])}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
