Tuesday, 20 August 2013

SqlAlchemy session.add() can cause Out of Memory?

SqlAlchemy session.add() can cause Out of Memory?

I have an infinite loop in my python script that looks just like this:
while True:
obj = DatabaseObject(
row_name_1 = 'name_1',
row_name_2 = 'name_2'
)
session.add(obj)
try:
session.commit()
except:
session.rollback()
My script needs to constantly insert rows to a database and it all works
fine, the problem I'm having is my script being killed by Linux because
I'm running out of memory, so can this SqlAlchemy approach be the cause of
my script being killed ?

No comments:

Post a Comment