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

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