SHARE
TWEET

Untitled

a guest Jun 25th, 2019 71 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Base = declarative_base()
  2.  
  3.  
  4. class ormOwner(Base):
  5.     __tablename__ = 'orm_owner'
  6.  
  7.     owner_phone = Column(String(11), primary_key=True)
  8.     owner_birthday = Column(Date, nullable=False)
  9.  
  10.     orm_cars = relationship('ormCar', secondary='orm_owner_car')
  11.  
  12.  
  13. class ormCar(Base):
  14.     __tablename__ = 'orm_car'
  15.     car_number = Column(String(10), primary_key=True)
  16.     car_model = Column(Number, primary_key=True)
  17.  
  18.     orm_owners = relationship('ormOwner', secondary='orm_owner_car')
  19.  
  20.  
  21. class ormOwnerCar(Base):
  22.     __tablename__ = 'orm_owner_car'
  23.    
  24.     car_number = Column(String(10), ForeignKey('orm_car.car_number'),primary_key = True)
  25.     car_model = Column(Number, ForeignKey('orm_car.car_model'),primary_key = True)
  26.     owner_phone = Column(String(11), ForeignKey('orm_owner.owner_phone'),primary_key = True)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top