<filename>tracardi/process_engine/action/v1/connectors/mysql/query/model/configuration.py
from typing import List, Any
from pydantic import BaseModel, validator
from tracardi.domain.named_entity import NamedEntity


class Configuration(BaseModel):
    source: NamedEntity
    type: str = 'select'
    query: str = "SELECT 1"
    data: List[Any] = []
    timeout: int = None

    @validator("query")
    def must_not_be_empty(cls, value):
        if len(value) < 2:
            raise ValueError("Sql must not be empty.")
        return value

    @validator("type")
    def must_have_certain_value(cls, value):
        allowed_values = ['select', 'insert', 'delete', 'call', 'create']
        if value not in allowed_values:
            raise ValueError(f"Allowed values {allowed_values}")
        return value

<filename>tracardi/process_engine/action/v1/connectors/mysql/query/model/configuration.py
from typing import List, Any
from pydantic import BaseModel, validator
from tracardi.domain.named_entity import NamedEntity


class Configuration(BaseModel):
    source: NamedEntity
    type: str = 'select'
    query: str = "SELECT 1"
    data: List[Any] = []
    timeout: int = None

    @validator("query")
    def must_not_be_empty(cls, value):
        if len(value) < 2:
            raise ValueError("Sql must not be empty.")
        return value

    @validator("type")
    def must_have_certain_value(cls, value):
        allowed_values = ['select', 'insert', 'delete', 'call', 'create']
        if value not in allowed_values:
            raise ValueError(f"Allowed values {allowed_values}")
        return value
