Source code for simpleml.utils.binary_blob

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

import logging
import uuid

from sqlalchemy import Column, LargeBinary, String

from simpleml.persistables.base_sqlalchemy import BinaryStorageSqlalchemy
from simpleml.persistables.sqlalchemy_types import GUID

[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)