# mayim.sql.executor

# Table of Contents

# SQLExecutor

class SQLExecutor(Executor[SQLQuery])

[view_source] (opens new window)

Parents: Executor

# execute

def execute(query: Union[str, Query],
            name: str = "",
            model: Optional[Type[object]] = None,
            as_list: bool = False,
            allow_none: bool = False,
            posargs: Optional[Sequence[Any]] = None,
            params: Optional[Dict[str, Any]] = None)

[view_source] (opens new window)

# generic_prefix: str

Default: "mayim_"

# is_operation

@classmethod
def is_operation(cls, obj)

[view_source] (opens new window)

Check if the object is a method that starts with a query prefix.

# is_query_name

@classmethod
def is_query_name(cls, name: str)

[view_source] (opens new window)

# rollback

async def rollback(*, silent: bool = False) -> None

[view_source] (opens new window)

# run_sql

def run_sql(query: str = "",
            name: str = "",
            as_list: bool = False,
            no_result: bool = False,
            posargs: Optional[Sequence[Any]] = None,
            params: Optional[Dict[str, Any]] = None)

[view_source] (opens new window)

# transaction

@asynccontextmanager
async def transaction()

[view_source] (opens new window)

# verb_prefixes: List[str]

Prefixes used to identify class methods and .sql files to load

Example:

SQLExecutor.verb_prefixes = ["create_","read_","update_","delete_"]

Default: [ "select_", "insert_", "update_", "delete_", ]