Guest User

Untitled

a guest
Jun 15th, 2020
18
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. class Player:
  2. id = db.Column(db.BIGINT, primary_key=True, autoincrement=True)
  3.  
  4. # СВЯЗЬ \/ \/
  5. last_log_id = db.Column(db.BIGINT, db.ForeignKey('PlayerLog.id'), nullable=False)
  6. last_log_action = db.relationship('CameraOnlineHistory',
  7. # primaryjoin="Player.last_log_id == PlayerLog.id",
  8. )
  9. # Связь ^^^
  10.  
  11. logs = db.relationship('PlayerLog', lazy='dynamic', back_populates='player',
  12. # primaryjoin="Player.id == PlayerLog.camera_id"
  13. )
  14. Class PlayerLog()
  15. id = db.Column(db.BIGINT, primary_key=True, autoincrement=True)
  16.  
  17. player_id = db.Column(db.BIGINT, db.ForeignKey('player.id'), index=True, nullable=False)
  18. player = db.relationship("Player",
  19. back_populates='logs',
  20. # foreign_keys='Player.id'
  21. # lazy='dynamic',
  22. )
Advertisement
Add Comment
Please, Sign In to add comment