Skip to content

Instantly share code, notes, and snippets.

@deepanshumehtaa
Created February 22, 2024 14:04
Show Gist options
  • Save deepanshumehtaa/12d3e4c92f15073481e8fbef48cb4fb8 to your computer and use it in GitHub Desktop.
Save deepanshumehtaa/12d3e4c92f15073481e8fbef48cb4fb8 to your computer and use it in GitHub Desktop.
Bulk Insert Update
Bulk Insert:
def bulk_insert(self, sql, sql_parameters, batch_size=1000):
for i in range(0, len(sql_parameters), batch_size):
batch = sql_parameters[i:i+batch_size]
cursor = self.get_connection_cursor()
cursor.executemany(sql,batch)
self.connection.commit()
Bulk Uptdae:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment