0

If I wanted to initialize a string and include it into query, how would I do that?

tom = "Tom"
q = pd.read_sql_query('select Names from table_name2 where Names = ' + tom, connection)
print(q)

This gives error: Incorrect syntax near '='.

I tried using pd.read_sql_query and sql alchemy

buckets09
  • 3
  • 2

0 Answers0