Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SELECT Post.id, title, SUBSTR(Post.content, 0, 300), Post.created, Post.user_id, User.username
- FROM Post
- JOIN User ON Post.user_id = User.id;
- class User(Base):
- __tablename__ = 'user'
- id = Column(Integer, primary_key=True)
- email = Column(String(250), nullable=False)
- username = Column(String(250), nullable=True)
- firstname = Column(String(250), nullable=True)
- lastname = Column(String(250), nullable=True)
- password = Column(String(250), nullable=False)
- role = Column(String(20), nullable=False)
- class Post(Base):
- __tablename__ = 'post'
- id = Column(Integer, primary_key=True)
- title = Column(String(250), nullable=False)
- content = Column(String(250), nullable=False)
- created = Column(Integer, nullable=False)
- user_id = Column(Integer, ForeignKey('user.id'), nullable=False)
Add Comment
Please, Sign In to add comment