Example #1
0
class User(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    username = db.Column(db.String(80), unique=True)
    rmial = db.Column(db.String(120), unique=True)

    def __repr__(self):
        return "<user %r>" % self.username
Example #2
0
class Bookmark(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    url = db.Column(db.Text, nullable=False)
    date = db.Column(db.DateTime, default=datetime.utcnow)
    description = db.Column(db.String(300))

    def __repr__(self):
        return "<BookMark '{}' : '{}'>".format(self.description, self.url)
Example #3
0
class Base(db.Model):
    __abstract__ = True

    id = db.Column(db.Integer, primary_key=True)
    created = db.Column(db.DateTime, default=db.func.current_timestamp())
    last_modified = db.Column(db.DateTime,
                              default=db.func.current_timestamp(),
                              onupdate=db.func.current_timestamp())
Example #4
0
class User(Base):
    __tablename__ = 'user'
    name = db.Column(db.String)
    score = db.Column(db.Integer)

    def __init__(self, x, y):
        self.name = x
        self.score = y