Exemplo n.º 1
0
class MockTable(Model):
    """test model"""
    TABLENAME = "tester"

    the_key = Field(Integer, is_primary=True)
    name = Field()
    yeah = Field(is_nullable=True)
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 4
0
 class Test(Model):
     """model with nullable and not-nullable fields"""
     test = Field()
     nullable = Field(is_nullable=True)
Exemplo n.º 5
0
 class Test(Model):
     """model with default field"""
     test = Field(default=default)
Exemplo n.º 6
0
 class Test(Model):
     """model with one required field"""
     test = Field()
Exemplo n.º 7
0
 class Test(Model):
     """model with a field using column"""
     yeah = Field(column='select', is_nullable=True)
Exemplo n.º 8
0
 class Test(Model):  # pylint: disable=unused-variable
     """model with a field name violating reserved words"""
     save = Field()
Exemplo n.º 9
0
 class Test(Model):
     """simple model with a primary key"""
     id = Field(is_primary=True)
Exemplo n.º 10
0
class A(Model):  # pylint: disable=invalid-name
    """test model"""
    TABLENAME = "yikes"
    id = Field(is_primary=True)
Exemplo n.º 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})')
Exemplo n.º 12
0
class C(Model):  # pylint: disable=invalid-name
    """test model"""
    id = Field(is_primary=True)
    a_id = Field(foreign='tests.test_query.A')
Exemplo n.º 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')
Exemplo n.º 14
0
class MyTable(Model):
    """test model"""
    id = Field(is_primary=True)
    name = Field()
    email = Field()