title: Store List in SQLAlchemy scheme
body: <p>I am looking for a way to store a list in SQLAlchemy.
  Best described in the following pseudo-code:</p>
  <pre><code>species = Species(name=&quot;N&quot;, indices=[1, 2, 3, 4, 5], mass=[0.1])
  species.name # N
  species.indices # [1, 2, 3, 4, 5]
  species.mass # [0.1]
  </code></pre>
  <p>I am using two tables, one called <code>Species</code> and one called <code>SpeciesAttributes</code></p>
  <pre><code>from sqlalchemy.orm import declarative_base
  from sqlalchemy import Column, Integer, String, Float, ForeignKey, Boolean
  from sqlalchemy.orm import relationship
  
  Base = declarative_base()
  
  class Species(Base):
      __tablename__ = &quot;species&quot;
      id = Column(Integer, primary_key=True)
      name = Column(String)
      
      species_attributes = relationship(&quot;SpeciesAttribute&quot;)
      
      @property
      def indices(self):
          return [x.value for x in self.species_attributes if x.name == &quot;species&quot;]
      
      @property
      def mass(self):
          return [x.value for x in self.species_attributes if x.name == &quot;mass&quot;]
      
  class SpeciesAttribute(Base):
      __tablename__ = &quot;species_attributes&quot;
      id = Column(Integer, primary_key=True)
      value = Column(Float)
      name = Column(String)
      
      species_id = Column(Integer, ForeignKey('species.id'))
      species = relationship(&quot;Species&quot;, back_populates='species_attributes')
  </code></pre>
  <p>This allows me to do</p>
  <pre><code>sp = Species(name=&quot;N&quot;)
  for x in range(5):
      SpeciesAttribute(species=sp, value=x, name=&quot;species&quot;)
  SpeciesAttribute(species=sp, value=0.5, name=&quot;mass&quot;)
  print(species.indices)
  </code></pre>
  <p>but I would like to be able to do</p>
  <pre><code>sp = Species(name=&quot;N&quot;, indices=[0, 1, 2, 3, 4], mass=[0.5])
  ses.add(sp)
  ses.commit()
  </code></pre>
  <p>Can this be done with SQLAlchemy? I have looked into mappings and composites which in some way seem to be close to what I am looking for but I could not translate them to the functionality I am looking for. Could I somehow define a custom Column which functions as the property <code>setter</code> and <code>getter</code> ?</p>