Memory Requirements and SQL Results
I'm using Zope to interface with a MySQL back end storing files as BLOBs. For files in the neighborhood of 1MB+, I get MemoryError exceptions when I call my 'insert' SQL method. The file gets uploaded to Zope just fine, but inserting the body throws the exception. What is the best way to stuff potentially large amounts of data into an SQL database via Zope without fear of a MemoryError? -jim Here is my code (this is a python script which is the action of the input form - these are not in a product): (insert is a SQL method which takes mime_type, filename, data, length as parameters) request = container.REQUEST response = request.RESPONSE ... file = request.form['resource_file'] data = file.read() request.set('mime_type', file.headers['Content-type']) request.set('data', data) size = len(data) request.set('length', size) filename = file.filename[file.filename.rindex('\\')+1:] request.set('filename', filename) context.insert()
participants (1)
-
Jim Kutter