16 lines
452 B
Python
16 lines
452 B
Python
from sqlalchemy import Column, Text, LargeBinary, String
|
|
from db.models import Base
|
|
|
|
class Resource(Base):
|
|
__tablename__ = 'resources'
|
|
id = Column(String(255), primary_key=True)
|
|
content = Column(LargeBinary, nullable=False)
|
|
data_type = Column(Text, nullable=False)
|
|
|
|
def to_dict(self):
|
|
return{
|
|
"id": self.id,
|
|
"data_type": self.data_type,
|
|
"content": self.content.decode('utf-8'),
|
|
}
|