I have a query which on realtime will give 4million + record, i want to pass the query output one by one in to the for loop and want to do the function inside the for loop. The out put of the query will be like
[(167806,), (167806,), (50791734,), (7615365,), (641219,), (6990522,), (641219,), (641219,), (4943654,), (4943654,)]
i want to pass it one by one in the inside the for loop .
What I have tried:
query = "select id from contacts limit 10"
print (query)
cursor.execute(query)
contact = cursor.fetchall()
print(contact)
id = contact[0][0]
print(id)
for row in contact:
print (id)
ivurl = f'{api}/company/{id}/contacts?'
payload: Dict[str, Union[bool, int]] = {'isEmailRequired': True}
response = get_iv_response(url=ivurl, payload=payload)
email_contact_totalresult: int = response.get('totalResults')
email = int(email_contact_totalresult)
if email > 0:
print("true")
else :
print ("false")