Relative Content

Tag Archive for pythonpython-3.xpandaspyodbc

Python code for deleting multiple SQL records taking too long: how to optimize?

My delete_ids variable contains 8,000 unique conversation IDs. I am trying to delete these 8,000 conversation IDs from my SQL table one at a time in a loop. I cannot delete all 8,000 IDs at once because some of them may not be valid conversation IDs; they might be something else. Therefore, I have written a try-except block to skip IDs that cannot be deleted or cause errors. However, this process is taking almost 40 minutes. The count in my delete_ids list can vary, going up or down. Is there a more efficient way to improve the performance of my code?

Python code for deleting multiple SQL records taking too long: how to optimize?

My delete_ids variable contains 8,000 unique conversation IDs. I am trying to delete these 8,000 conversation IDs from my SQL table one at a time in a loop. I cannot delete all 8,000 IDs at once because some of them may not be valid conversation IDs; they might be something else. Therefore, I have written a try-except block to skip IDs that cannot be deleted or cause errors. However, this process is taking almost 40 minutes. The count in my delete_ids list can vary, going up or down. Is there a more efficient way to improve the performance of my code?

Python code for deleting multiple SQL records taking too long: how to optimize?

My delete_ids variable contains 8,000 unique conversation IDs. I am trying to delete these 8,000 conversation IDs from my SQL table one at a time in a loop. I cannot delete all 8,000 IDs at once because some of them may not be valid conversation IDs; they might be something else. Therefore, I have written a try-except block to skip IDs that cannot be deleted or cause errors. However, this process is taking almost 40 minutes. The count in my delete_ids list can vary, going up or down. Is there a more efficient way to improve the performance of my code?