Hello. I made an script to insert rows into my db. All seems to work fine when small amount of rows are inserted. But, when I try to insert lot of them I get a "MemoryError" and all progress is avoided.
I would like to know why this MemoryError happens. I don´t know if its because the db is too big (I doubt, it would be about 700-800Kb), the script is too long (I get the error when I try to insert more than 4.000 lines more or less), or whatever. My code is very simple, something like that.
Any help or suggestion is welcome.
Thanks
PHP Code:import e32db
db_name = u"C:\\Python\\test.db"
try:
db = e32db.Dbms()
db.open(db_name)
db.execute(u"DELETE FROM test")
except:
db.create(db_name)
db.open(db_name)
db.execute(u"CREATE TABLE test (aaa VARCHAR, bbb VARCHAR, ccc INTEGER)")
db.execute("INSERT INTO test (aaa, bbb, ccc) VALUES ('%s','%s', %d)"%(u"ola", u"hola", 1))
##MORE AND MORE INSERTS
db.compact()
db.close()

Reply With Quote


