joining table allocation to actifs

This commit is contained in:
2023-01-29 18:11:40 +01:00
parent 4a55f94551
commit f8023701a4
14 changed files with 111 additions and 272 deletions

View File

@@ -36,25 +36,21 @@ class Actifs(Base):
modif_le = Column(DateTime, default=datetime.datetime.utcnow)
__table_args__ = (Index('symbole_index', 'symbole'),)
class Allocation(Base):
__tablename__ = 'allocation'
no_cat = Column(Integer, primary_key=True)
classe_id = Column(Unicode(45), ForeignKey('classes.classe'))
classe = Column(Unicode(45), ForeignKey('actifs.classe'))
pc_cible = Column(Integer)
pc_atteint = Column(Float)
pc_ecart = Column(Float)
valeur = Column(Float)
# relationship
classe = relationship('Classes', backref="allocation")
class Classes(Base):
__tablename__ = 'classes'
classe = Column(Unicode(45), primary_key=True)
type = Column(Unicode(45), default='ACTION')
ordre = Column(Integer)
bg_color = Column(Unicode(45))
__table_args__ = (Index('ordre_index', 'ordre'),)
__table_args__ = (Index('classe_index', 'classe'), Index('ordre_index', 'ordre'),)
class Histo(Base):
__tablename__ = 'histo'
no_id = Column(Integer, primary_key=True)