sqlmesh.core.config.common API documentation

Edit on GitHub

# sqlmesh.core.config.common

View Source

     1from __future__ import annotations
     2
     3import typing as t
     4
     5from pydantic import validator
     6
     7from sqlmesh.utils.errors import ConfigError
     8
     9
    10def _concurrent_tasks_validator(v: t.Any) -> int:
    11    if isinstance(v, str):
    12        v = int(v)
    13    if not isinstance(v, int) or v <= 0:
    14        raise ConfigError(
    15            f"The number of concurrent tasks must be an integer value greater than 0. '{v}' was provided"
    16        )
    17    return v
    18
    19
    20concurrent_tasks_validator = validator(
    21    "backfill_concurrent_tasks",
    22    "ddl_concurrent_tasks",
    23    "concurrent_tasks",
    24    pre=True,
    25    allow_reuse=True,
    26    check_fields=False,
    27)(_concurrent_tasks_validator)
    28
    29
    30def _http_headers_validator(v: t.Any) -> t.Any:
    31    if isinstance(v, dict):
    32        return [(key, value) for key, value in v.items()]
    33    return v
    34
    35
    36http_headers_validator = validator(
    37    "http_headers",
    38    pre=True,
    39    allow_reuse=True,
    40    check_fields=False,
    41)(_http_headers_validator)

def concurrent_tasks_validator(v: Any) -> int: View Source

    11def _concurrent_tasks_validator(v: t.Any) -> int:
    12    if isinstance(v, str):
    13        v = int(v)
    14    if not isinstance(v, int) or v <= 0:
    15        raise ConfigError(
    16            f"The number of concurrent tasks must be an integer value greater than 0. '{v}' was provided"
    17        )
    18    return v

def http_headers_validator(v: Any) -> Any: View Source

    31def _http_headers_validator(v: t.Any) -> t.Any:
    32    if isinstance(v, dict):
    33        return [(key, value) for key, value in v.items()]
    34    return v