from database import Base
from sqlalchemy import Column, Integer, String, inspect
from sqlalchemy.types import DateTime

class Items(Base):
    """
    Items table
    """
    __tablename__ = 'items'
    id = Column(Integer, primary_key=True)
    name = Column(String(256))
    quantity = Column(Integer)
    description = Column(String(256))
    date_added = Column(DateTime())

def object_as_dict(obj):
    return {c.key : getattr(obj, c.key) for c in inspect(obj).mapper.column_attrs}
