def create_connection_model(service): """ Create an SQL Alchemy table that connects the provides services """ # the services connected services = service._services # the mixins / base for the model bases = (BaseModel,) # the fields of the derived attributes = {model_service_name(service): fields.CharField() for service in services} # create an instance of base model with the right attributes return type(BaseModel)(connection_service_name(service), bases, attributes)
class User(BaseModel): email = fields.CharField()
def test_serialize_native_type(self): # make sure it converts a native string to 'String' import nautilus.models.fields as fields assert serialize_native_type(fields.CharField()) == 'String', ( "Could not serialize native type.")
def test_can_convert_CharField(self): self.assert_field_converted(nautilus.CharField(), graphene.String)
class UserPassword(HasPassword, BaseModel): user = fields.CharField(unique=True) # points to a remote user entry
class Ingredient(BaseModel): name = fields.CharField()
class Recipe(BaseModel): name = fields.CharField() category = fields.CharField() cook_time = fields.IntegerField()