# fields.model\_fields #### is\_field\_nullable ```python is_field_nullable(nullable: Optional[bool], default: Any, server_default: Any, pydantic_only: Optional[bool]) -> bool ``` Checks if the given field should be nullable/ optional based on parameters given. **Arguments**: - `nullable (Optional[bool])`: flag explicit setting a column as nullable - `default (Any)`: value or function to be called as default in python - `server_default (Any)`: function to be called as default by sql server - `pydantic_only (Optional[bool])`: flag if fields should not be included in the sql table **Returns**: `(bool)`: result of the check #### is\_auto\_primary\_key ```python is_auto_primary_key(primary_key: bool, autoincrement: bool) -> bool ``` Checks if field is an autoincrement pk -> if yes it's optional. **Arguments**: - `primary_key (bool)`: flag if field is a pk field - `autoincrement (bool)`: flag if field should be autoincrement **Returns**: `(bool)`: result of the check ## ModelFieldFactory Objects ```python class ModelFieldFactory() ``` Default field factory that construct Field classes and populated their values. #### \_bases #### \_type #### \_\_new\_\_ ```python | __new__(cls, *args: Any, **kwargs: Any) -> Type[BaseField] ``` #### get\_column\_type ```python | @classmethod | get_column_type(cls, **kwargs: Any) -> Any ``` Return proper type of db column for given field type. Accepts required and optional parameters that each column type accepts. **Arguments**: - `kwargs (Any)`: key, value pairs of sqlalchemy options **Returns**: `(sqlalchemy Column)`: initialized column with proper options #### validate ```python | @classmethod | validate(cls, **kwargs: Any) -> None ``` Used to validate if all required parameters on a given field type are set. **Arguments**: - `kwargs (Any)`: all params passed during construction ## String Objects ```python class String(ModelFieldFactory, str) ``` String field factory that construct Field classes and populated their values. #### \_type #### \_\_new\_\_ ```python | __new__(cls, *, allow_blank: bool = True, strip_whitespace: bool = False, min_length: int = None, max_length: int = None, curtail_length: int = None, regex: str = None, **kwargs: Any) -> Type[BaseField] ``` #### get\_column\_type ```python | @classmethod | get_column_type(cls, **kwargs: Any) -> Any ``` Return proper type of db column for given field type. Accepts required and optional parameters that each column type accepts. **Arguments**: - `kwargs (Any)`: key, value pairs of sqlalchemy options **Returns**: `(sqlalchemy Column)`: initialized column with proper options #### validate ```python | @classmethod | validate(cls, **kwargs: Any) -> None ``` Used to validate if all required parameters on a given field type are set. **Arguments**: - `kwargs (Any)`: all params passed during construction ## Integer Objects ```python class Integer(ModelFieldFactory, int) ``` Integer field factory that construct Field classes and populated their values. #### \_type #### \_\_new\_\_ ```python | __new__(cls, *, minimum: int = None, maximum: int = None, multiple_of: int = None, **kwargs: Any) -> Type[BaseField] ``` #### get\_column\_type ```python | @classmethod | get_column_type(cls, **kwargs: Any) -> Any ``` Return proper type of db column for given field type. Accepts required and optional parameters that each column type accepts. **Arguments**: - `kwargs (Any)`: key, value pairs of sqlalchemy options **Returns**: `(sqlalchemy Column)`: initialized column with proper options ## Text Objects ```python class Text(ModelFieldFactory, str) ``` Text field factory that construct Field classes and populated their values. #### \_type #### \_\_new\_\_ ```python | __new__(cls, *, allow_blank: bool = True, strip_whitespace: bool = False, **kwargs: Any) -> Type[BaseField] ``` #### get\_column\_type ```python | @classmethod | get_column_type(cls, **kwargs: Any) -> Any ``` Return proper type of db column for given field type. Accepts required and optional parameters that each column type accepts. **Arguments**: - `kwargs (Any)`: key, value pairs of sqlalchemy options **Returns**: `(sqlalchemy Column)`: initialized column with proper options ## Float Objects ```python class Float(ModelFieldFactory, float) ``` Float field factory that construct Field classes and populated their values. #### \_type #### \_\_new\_\_ ```python | __new__(cls, *, minimum: float = None, maximum: float = None, multiple_of: int = None, **kwargs: Any) -> Type[BaseField] ``` #### get\_column\_type ```python | @classmethod | get_column_type(cls, **kwargs: Any) -> Any ``` Return proper type of db column for given field type. Accepts required and optional parameters that each column type accepts. **Arguments**: - `kwargs (Any)`: key, value pairs of sqlalchemy options **Returns**: `(sqlalchemy Column)`: initialized column with proper options ## DateTime Objects ```python class DateTime(ModelFieldFactory, datetime.datetime) ``` DateTime field factory that construct Field classes and populated their values. #### \_type #### get\_column\_type ```python | @classmethod | get_column_type(cls, **kwargs: Any) -> Any ``` Return proper type of db column for given field type. Accepts required and optional parameters that each column type accepts. **Arguments**: - `kwargs (Any)`: key, value pairs of sqlalchemy options **Returns**: `(sqlalchemy Column)`: initialized column with proper options ## Date Objects ```python class Date(ModelFieldFactory, datetime.date) ``` Date field factory that construct Field classes and populated their values. #### \_type #### get\_column\_type ```python | @classmethod | get_column_type(cls, **kwargs: Any) -> Any ``` Return proper type of db column for given field type. Accepts required and optional parameters that each column type accepts. **Arguments**: - `kwargs (Any)`: key, value pairs of sqlalchemy options **Returns**: `(sqlalchemy Column)`: initialized column with proper options ## Time Objects ```python class Time(ModelFieldFactory, datetime.time) ``` Time field factory that construct Field classes and populated their values. #### \_type #### get\_column\_type ```python | @classmethod | get_column_type(cls, **kwargs: Any) -> Any ``` Return proper type of db column for given field type. Accepts required and optional parameters that each column type accepts. **Arguments**: - `kwargs (Any)`: key, value pairs of sqlalchemy options **Returns**: `(sqlalchemy Column)`: initialized column with proper options ## JSON Objects ```python class JSON(ModelFieldFactory, pydantic.Json) ``` JSON field factory that construct Field classes and populated their values. #### \_type #### get\_column\_type ```python | @classmethod | get_column_type(cls, **kwargs: Any) -> Any ``` Return proper type of db column for given field type. Accepts required and optional parameters that each column type accepts. **Arguments**: - `kwargs (Any)`: key, value pairs of sqlalchemy options **Returns**: `(sqlalchemy Column)`: initialized column with proper options ## BigInteger Objects ```python class BigInteger(Integer, int) ``` BigInteger field factory that construct Field classes and populated their values. #### \_type #### \_\_new\_\_ ```python | __new__(cls, *, minimum: int = None, maximum: int = None, multiple_of: int = None, **kwargs: Any) -> Type[BaseField] ``` #### get\_column\_type ```python | @classmethod | get_column_type(cls, **kwargs: Any) -> Any ``` Return proper type of db column for given field type. Accepts required and optional parameters that each column type accepts. **Arguments**: - `kwargs (Any)`: key, value pairs of sqlalchemy options **Returns**: `(sqlalchemy Column)`: initialized column with proper options ## Decimal Objects ```python class Decimal(ModelFieldFactory, decimal.Decimal) ``` Decimal field factory that construct Field classes and populated their values. #### \_type #### \_\_new\_\_ ```python | __new__(cls, *, minimum: float = None, maximum: float = None, multiple_of: int = None, precision: int = None, scale: int = None, max_digits: int = None, decimal_places: int = None, **kwargs: Any) -> Type[BaseField] ``` #### get\_column\_type ```python | @classmethod | get_column_type(cls, **kwargs: Any) -> Any ``` Return proper type of db column for given field type. Accepts required and optional parameters that each column type accepts. **Arguments**: - `kwargs (Any)`: key, value pairs of sqlalchemy options **Returns**: `(sqlalchemy Column)`: initialized column with proper options #### validate ```python | @classmethod | validate(cls, **kwargs: Any) -> None ``` Used to validate if all required parameters on a given field type are set. **Arguments**: - `kwargs (Any)`: all params passed during construction ## UUID Objects ```python class UUID(ModelFieldFactory, uuid.UUID) ``` UUID field factory that construct Field classes and populated their values. #### \_type #### \_\_new\_\_ ```python | __new__(cls, *, uuid_format: str = "hex", **kwargs: Any) -> Type[BaseField] ``` #### get\_column\_type ```python | @classmethod | get_column_type(cls, **kwargs: Any) -> Any ``` Return proper type of db column for given field type. Accepts required and optional parameters that each column type accepts. **Arguments**: - `kwargs (Any)`: key, value pairs of sqlalchemy options **Returns**: `(sqlalchemy Column)`: initialized column with proper options