示例#1
0
class MockTable(Model):
    """test model"""
    TABLENAME = "tester"

    the_key = Field(Integer, is_primary=True)
    name = Field()
    yeah = Field(is_nullable=True)
示例#2
0
class FieldTest(Model):
    """helper class for verify tests"""
    a = Field(is_primary=True)
    b = Field()
    c = Field(expression='foo')
    d = Field(is_database=False)
示例#3
0
 class Test(Model):  # pylint: disable=unused-variable
     """bad model with multiple primary keys"""
     id = Field(default=0, is_primary=True)
     idd = Field(default=0, is_primary=True)
示例#4
0
 class Test(Model):
     """model with nullable and not-nullable fields"""
     test = Field()
     nullable = Field(is_nullable=True)
示例#5
0
 class Test(Model):
     """model with default field"""
     test = Field(default=default)
示例#6
0
 class Test(Model):
     """model with one required field"""
     test = Field()
示例#7
0
 class Test(Model):
     """model with a field using column"""
     yeah = Field(column='select', is_nullable=True)
示例#8
0
 class Test(Model):  # pylint: disable=unused-variable
     """model with a field name violating reserved words"""
     save = Field()
示例#9
0
 class Test(Model):
     """simple model with a primary key"""
     id = Field(is_primary=True)
示例#10
0
class A(Model):  # pylint: disable=invalid-name
    """test model"""
    TABLENAME = "yikes"
    id = Field(is_primary=True)
示例#11
0
class D(Model):  # pylint: disable=invalid-name
    """test model"""
    TABLENAME = "d"
    a = Field()
    b = Field(expression='NOW()')
    c = Field(expression='FN({Q}z{Q})')
示例#12
0
class C(Model):  # pylint: disable=invalid-name
    """test model"""
    id = Field(is_primary=True)
    a_id = Field(foreign='tests.test_query.A')
示例#13
0
class B(Model):  # pylint: disable=invalid-name
    """test model"""
    TABLENAME = "yeah"
    id = Field(is_primary=True)
    a_id = Field(foreign='tests.test_query.A')
    c_id = Field(foreign='tests.test_query.C')
示例#14
0
class MyTable(Model):
    """test model"""
    id = Field(is_primary=True)
    name = Field()
    email = Field()