Search code examples
pythonsqlpeewee

Peewee MemoryError binary data storage


I'm trying to to store about 350MB of binary data to peewee.BlobField I'm getting a MemoryError. I have no issues with slightly smaller files ~250MB. How can I store 350MB? Memory error is not related to the OS memory. I have few GB of free memory.

This is how I am trying to store data:

Subproducts.create(cfg_id=config_id,
                   c=c,
                   mf=mf_data.getbuffer()

type(mf_data) is <class '_io.BytesIO'>

This is how my model looks like:

class Subproducts(BaseModel):

    cfg = peewee.ForeignKeyField(ConfigModel, related_name='cfg')
    c = peewee.TextField()
    mf = peewee.BlobField()

    class Meta:
        indexes = (
            (('cfg', 'c'), True),
        )

Solution

  • The issue was 32bit Python. There are no issues when using 64bit python