Beispiel #1
0
class User(dbs.Model):
    id = dbs.Column(dbs.Integer, primary_key=True, autoincrement=True)
    username = dbs.Column(dbs.String(16))

    def save(self):
        dbs.session.add(self)
        dbs.session.commit()
Beispiel #2
0
class Cat(Animal):
    c_eat = dbs.Column(dbs.String(16), default='fish')
Beispiel #3
0
class Person(dbs.Model):
    __tablename__ = 'person'
    id = dbs.Column(dbs.Integer, primary_key=True)
    name = dbs.Column(dbs.String(16), unique=True)
Beispiel #4
0
class Animal(dbs.Model):
    __abstract__ = True
    id = dbs.Column(dbs.Integer, primary_key=True, autoincrement=True)
    a_name = dbs.Column(dbs.String(16))
Beispiel #5
0
class Student(dbs.Model):
    id = dbs.Column(dbs.Integer, primary_key=True)
    s_name = dbs.Column(dbs.String(20))
    s_password = dbs.Column(dbs.String(256))