How to solve Sql Query Error in Airflow with Python

Viewed 22

I user to Airflow GCStoBigqueryOperator N write Query with f-string

Already my Data in GCS N use Query n Select data Driven Bigquery

My Data in GCS enter image description here

My Operator Query

puuid = _puuid()
sql = f'SELECT * FROM game WHERE puuid={puuid};'

Then error occur column

column"ptQZI4tcQ7a9KCL74omce0ctYCf4--6csx6j1CBgFUmuyB0XrGZElURF0K3_0ym9TVbykLVi_mqh9w"does not exists Line 1: SELECT * FROM game where puuid=ptQZI4tcQ7a9KCL74omce0ctYCf4--6csx6j1CBgFUmuyB0XrGZElURF0K3_0ym9TVbykLVi_mqh9w

I think

SELECT * FROM game WHERE puuid='ptQZI4tcQ7a9KCL74omce0ctYCf4--6csx6j1CBgFUmuyB0XrGZElURF0K3_0ym9TVbykLVi_mqh9w' 

is not error

how to change my code??

1 Answers

String values has to be surrounded by qoutes. I guess it should be like this:

puuid = _puuid()
sql = f"SELECT * FROM game WHERE puuid='{puuid}'"
Related