Skip to content

Instantly share code, notes, and snippets.

@bosukh
Last active November 26, 2017 07:05
Show Gist options
  • Save bosukh/dec5f94b1fb0d570962df8a219275b31 to your computer and use it in GitHub Desktop.
Save bosukh/dec5f94b1fb0d570962df8a219275b31 to your computer and use it in GitHub Desktop.
import time
def test_sqlalchemy_orm_update(n=100000):
init_sqlalchemy(False)
t0 = time.time()
customer = Customer.__table__
for i in xrange(1, n+1):
stmt = customer.update().where(customer.c.id==i).values(
{'name': 'NEW_NAME ' + str(i)}
)
DBSession.execute(stmt)
DBSession.commit()
print(
"SQLAlchemy ORM: Total time for " + str(n) +
" records " + str(time.time() - t0) + " secs")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment