Skip to content

Instantly share code, notes, and snippets.

@cuongld2
Created March 17, 2020 05:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cuongld2/5939d080ea9b671934b7d03b6e75ec8e to your computer and use it in GitHub Desktop.
Save cuongld2/5939d080ea9b671934b7d03b6e75ec8e to your computer and use it in GitHub Desktop.
sqlalchemy models
from sqlalchemy import Column, Integer, String
from sql_app.database import Base
class UserInfo(Base):
__tablename__ = "user_info"
id = Column(Integer, primary_key=True, index=True)
username = Column(String, unique=True)
password = Column(String)
fullname = Column(String, unique=True)
class Blog(Base):
__tablename__ = "blog"
id = Column(Integer, primary_key=True, index=True)
title = Column(String)
content = Column(String)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment