sqlmesh.core.config.janitor
1from __future__ import annotations 2 3import typing as t 4 5from sqlmesh.core.config.base import BaseConfig 6from sqlmesh.utils.pydantic import field_validator 7 8 9class JanitorConfig(BaseConfig): 10 """The configuration for the janitor. 11 12 Args: 13 warn_on_delete_failure: Whether to warn instead of erroring if the janitor fails to delete the expired environment schema / views. 14 expired_snapshots_batch_size: Maximum number of expired snapshots to clean in a single batch. 15 """ 16 17 warn_on_delete_failure: bool = False 18 expired_snapshots_batch_size: t.Optional[int] = None 19 20 @field_validator("expired_snapshots_batch_size", mode="before") 21 @classmethod 22 def _validate_batch_size(cls, value: int) -> int: 23 batch_size = int(value) 24 if batch_size <= 0: 25 raise ValueError("expired_snapshots_batch_size must be greater than 0") 26 return batch_size
10class JanitorConfig(BaseConfig): 11 """The configuration for the janitor. 12 13 Args: 14 warn_on_delete_failure: Whether to warn instead of erroring if the janitor fails to delete the expired environment schema / views. 15 expired_snapshots_batch_size: Maximum number of expired snapshots to clean in a single batch. 16 """ 17 18 warn_on_delete_failure: bool = False 19 expired_snapshots_batch_size: t.Optional[int] = None 20 21 @field_validator("expired_snapshots_batch_size", mode="before") 22 @classmethod 23 def _validate_batch_size(cls, value: int) -> int: 24 batch_size = int(value) 25 if batch_size <= 0: 26 raise ValueError("expired_snapshots_batch_size must be greater than 0") 27 return batch_size
The configuration for the janitor.
Arguments:
- warn_on_delete_failure: Whether to warn instead of erroring if the janitor fails to delete the expired environment schema / views.
- expired_snapshots_batch_size: Maximum number of expired snapshots to clean in a single batch.
model_config =
{'json_encoders': {<class 'sqlglot.expressions.core.Expr'>: <function _expression_encoder>, <class 'sqlglot.expressions.datatypes.DataType'>: <function _expression_encoder>, <class 'sqlglot.expressions.query.Tuple'>: <function _expression_encoder>, typing.Union[sqlglot.expressions.query.Query, sqlmesh.core.dialect.JinjaQuery]: <function _expression_encoder>, typing.Union[sqlglot.expressions.query.Query, sqlmesh.core.dialect.JinjaQuery, sqlmesh.core.dialect.MacroFunc]: <function _expression_encoder>, <class 'datetime.tzinfo'>: <function PydanticModel.<lambda>>}, 'arbitrary_types_allowed': True, 'extra': 'forbid', 'protected_namespaces': ()}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
Inherited Members
- pydantic.main.BaseModel
- BaseModel
- model_fields
- model_computed_fields
- model_extra
- model_fields_set
- model_construct
- model_copy
- model_dump
- model_dump_json
- model_json_schema
- model_parametrized_name
- model_post_init
- model_rebuild
- model_validate
- model_validate_json
- model_validate_strings
- parse_file
- from_orm
- construct
- schema
- schema_json
- validate
- update_forward_refs