Source code for simpleml.utils.binary_blob

'''
Optional module to persist pickled objects in database instead of filesystem
'''

from simpleml.persistables.sqlalchemy_types import GUID
from simpleml.persistables.base_sqlalchemy import BinaryStorageSqlalchemy
from sqlalchemy import Column, String, LargeBinary
import uuid
import logging

[docs]__author__ = 'Elisha Yadgaran'
[docs]LOGGER = logging.getLogger(__name__)
[docs]class BinaryBlob(BinaryStorageSqlalchemy):
[docs] __tablename__ = 'binary_blobs'
[docs] id = Column(GUID, primary_key=True, default=uuid.uuid4)
[docs] object_type = Column(String, nullable=False)
[docs] object_id = Column(GUID, nullable=False)
# TODO: Figure this out and think it through...
[docs] binary_blob = Column(LargeBinary)