Reputation: 8917
I have a SQL query that I want want to execute for a list of input parameters.
SELECT Field1, Field2
FROM Table
WHERE Field3 = ?
AND Field4 = ?
I have ~10,000 pairs of values that I want to run this query for. At the moment I'm iterating over the list, and appending each result to a data frame. I feel like there is probably a more Pythonic way to do this. I just don't know what it is.
Is there a cleaner way to do this?
Upvotes: 3
Views: 912
Reputation: 134
I think you need to create a temp table that stores the 10,000 pairs of values.
Then you can use an Inner Join
on that temp table.
Example:
Select f1,f2
From
table t
Inner Join temptable m
On m.c1 = t.f3 and m.c2(column 2) = t.f4
Upvotes: 1