vendredi 22 janvier 2021

how to skip an iteration in python for loop when a particular statement is taking more time to execute?

i have a read_sql call inside for loop, which takes lot of time to return a value sometimes. Is it possible to skip the loop when it is taking more than 5 mins to execute read_sql?

for i in range(columns):
   value=pd.read_sql()   # skip this statement when it takes more than 5 mins to return
   #other operation

Aucun commentaire:

Enregistrer un commentaire