Reputation: 105
I am trying to execute my sql queries available in the below 3 variables. It's working fine when executing individually. For example:
db_connection.execute(sales_updation)
is working.
kp_updates = ['sales_updation','price_updation','reward updation']
[db_connection.execute(i) for i in kp_updates]
Error: Syntax Error near sales_updation
Please suggest a fix.
Upvotes: 0
Views: 32
Reputation: 178
The above code should work in Python3.0+ Although if you have Python 2.7, then try executing in for loop.
kp_updates=['sales_updation','price_updation','reward updation']
for i in kp_updates:
db_connection.execute(i)
Upvotes: 1