Guest User

Untitled

a guest
May 25th, 2018
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. SELECT Post.id, title, SUBSTR(Post.content, 0, 300), Post.created, Post.user_id, User.username
  2. FROM Post
  3. JOIN User ON Post.user_id = User.id;
  4.  
  5. class User(Base):
  6. __tablename__ = 'user'
  7. id = Column(Integer, primary_key=True)
  8. email = Column(String(250), nullable=False)
  9. username = Column(String(250), nullable=True)
  10. firstname = Column(String(250), nullable=True)
  11. lastname = Column(String(250), nullable=True)
  12. password = Column(String(250), nullable=False)
  13. role = Column(String(20), nullable=False)
  14.  
  15. class Post(Base):
  16. __tablename__ = 'post'
  17. id = Column(Integer, primary_key=True)
  18. title = Column(String(250), nullable=False)
  19. content = Column(String(250), nullable=False)
  20. created = Column(Integer, nullable=False)
  21. user_id = Column(Integer, ForeignKey('user.id'), nullable=False)
Add Comment
Please, Sign In to add comment