title: How to store and search list in SQLAlchemy?
body: <p>I need to write two classes like this:</p>
  
  <pre><code>class Item(Base, DBBase):
      __tablename__ = 'items'
  
      id = Column(Integer, primary_key = True)
      name = Column(String)
      description = Column(String)
      price = Column(Float, default = 0)
      on_sell = Column(Boolean, default = False)
  
      img = Column(String)
  
      attributes = relationship('ItemAttribute')
  
      def __init__(self, name, description):
          self.name = name
          self.description = description
  
  class ItemAttribute(Base, DBBase):
      __tablename__ = 'itemattributes'
  
      id = Column(Integer, primary_key = True)
      name = Column(String, nullable = False)
      value = Column(String, nullable = False)
  
      item_id = Column(Integer, ForeignKey('items.id'))
      item = relationship('Item')
  
      def __init__(self, name, value):
          self.name = name
          self.value = value
  </code></pre>
  
  <p>One item can own several attributes, and I need to:
  1. insert some methods on class Item to easily do CURD(insertion, deletion, update and query) attributes for it. I need to search a attribute of a item and return it's corresponding value.
  2. have the ability to search items by attributes. For example, some items have the attributes of 'Feature' = 'True'. I need to get all items which have this attribute.</p>
  
  <p>Thanks for help. :-)</p>