SHARE
TWEET

Untitled

a guest Jun 19th, 2017 51 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class Association(Base):
  2.     __tablename__ = 'association'
  3.     left_id = Column(String, ForeignKey('users.username'), primary_key=True)
  4.     right_id = Column(String, ForeignKey('clients.client_id'), primary_key=True)
  5.     access_token = Column(String)
  6.     user_token = Column(String)
  7.     scope = Column(String)
  8.     user = relationship("User", back_populates="clients_store")
  9.     Client = relationship("Client", back_populates="users_store")
  10.  
  11.  
  12. class User(Base):
  13.  
  14.     __tablename__ = "users"
  15.  
  16.     username = Column(String, primary_key=True)
  17.  
  18.     first_name = Column(String)
  19.     last_name = Column(String)
  20.     password = Column(String)
  21.     created = Column(DateTime)
  22.     admin = Column(Boolean, default=False)
  23.     settings = Column(PickleType)
  24.     clients = relationship("Association", back_populates="users_store")
  25.     notifications = relationship("Notification")
  26.  
  27.  
  28. class Client(Base):
  29.     __tablename__ = "clients"
  30.  
  31.     client_id = Column(String, primary_key=True)
  32.     official = Column(Boolean, default=False)
  33.     secret_key = Column(String)
  34.     scope = Column(String)
  35.     users = relationship("Association", back_populates="clients_store")
RAW Paste Data
Want to get better at Python?
Learn to code Python in 2017
Pastebin PRO Summer Special!
Get 40% OFF on Pastebin PRO accounts!
Top