full model for these 3 classes:

# machine
class Machine(Base):
    __tablename__ =  'machine'
    
    machine_ID = Column(Integer, primary_key=True)
    machine_Type = Column(Integer, nullable=False)
    machine_model = Column(String(10), nullable=False)
    machine_Weight = Column(Integer)
    machine_price = Column(Float(), nullable=False)
    saleRel = relationship('Sale', secondary='sale_product')
    children = relationship("Options",
                    secondary='machine_options', 
                    back_populates="parents")


# options
class Options(Base):
    __tablename__ = 'options'

    options_ID = Column(Integer, primary_key=True)
    options_category = Column(String(10), nullable=False)
    options_Price = Column(Float(), nullable=False)
    options_Type_FK = Column(Integer, ForeignKey(
'options_Type.options_Type_ID'))
    parents = relationship("Machine",
        secondary=Machine_Options, back_populates="children")


#machine_options
Machine_Options = Table('machine_options', Base.metadata,
        Column('machine_FK', Integer, ForeignKey('machine.machine_ID'),
                                 primary_key=True),
        Column('options_FK',Integer, ForeignKey('options.options_ID'),
                                 primary_key=True))




-- 
SQLAlchemy - 
The Python SQL Toolkit and Object Relational Mapper

http://www.sqlalchemy.org/

To post example code, please provide an MCVE: Minimal, Complete, and Verifiable 
Example.  See  http://stackoverflow.com/help/mcve for a full description.
--- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sqlalchemy/f0a08fdd-1951-4b33-8ce8-5abbf4f87faeo%40googlegroups.com.

Reply via email to