I have a Dataframe that has two columns, one that mentions the product_name and other that has a key related to that product as shown below:
product,key
prod_a, key_1
prod_b, key_2
prod_c, key_3
I am trying to query a table such that I apply both the product and its corresponding key in where clause as shown below:
query:
cursor.execute("""select prod_name, quantity from table where prod_name = {product} and prod_key = {key}""")
product
and key
values are taken from the above Dataframe
I would like to loop through each product and key from the above DataFrame into the SQL query ad get the output