Skip to content

Instantly share code, notes, and snippets.

@bosukh
Created November 26, 2017 07:12
Show Gist options
  • Save bosukh/70f19e966664115e6322fac750d17cf9 to your computer and use it in GitHub Desktop.
Save bosukh/70f19e966664115e6322fac750d17cf9 to your computer and use it in GitHub Desktop.
import time
def test_mysql_update(n=100000):
init_sqlalchemy(False)
t0 = time.time()
for i in xrange(n):
DBSession.execute(
"UPDATE customer SET name = '{0}' WHERE '{1}'".format(
'NEW_NAME ' + str(i), str(i)
)
)
DBSession.commit()
print(
"mysql: Total time for " + str(n) +
" records " + str(time.time() - t0) + " sec")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment