class MockTable(Model): """test model""" TABLENAME = "tester" the_key = Field(Integer, is_primary=True) name = Field() yeah = Field(is_nullable=True)
class FieldTest(Model): """helper class for verify tests""" a = Field(is_primary=True) b = Field() c = Field(expression='foo') d = Field(is_database=False)
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)
class Test(Model): """model with nullable and not-nullable fields""" test = Field() nullable = Field(is_nullable=True)
class Test(Model): """model with default field""" test = Field(default=default)
class Test(Model): """model with one required field""" test = Field()
class Test(Model): """model with a field using column""" yeah = Field(column='select', is_nullable=True)
class Test(Model): # pylint: disable=unused-variable """model with a field name violating reserved words""" save = Field()
class Test(Model): """simple model with a primary key""" id = Field(is_primary=True)
class A(Model): # pylint: disable=invalid-name """test model""" TABLENAME = "yikes" id = Field(is_primary=True)
class D(Model): # pylint: disable=invalid-name """test model""" TABLENAME = "d" a = Field() b = Field(expression='NOW()') c = Field(expression='FN({Q}z{Q})')
class C(Model): # pylint: disable=invalid-name """test model""" id = Field(is_primary=True) a_id = Field(foreign='tests.test_query.A')
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')
class MyTable(Model): """test model""" id = Field(is_primary=True) name = Field() email = Field()