sqlmesh.core.config.model API documentation

Edit on GitHub

# sqlmesh.core.config.model

View Source

     1from __future__ import annotations
     2
     3import typing as t
     4
     5from sqlmesh.core.config.base import BaseConfig
     6from sqlmesh.core.model.kind import ModelKind, model_kind_validator
     7from sqlmesh.utils.date import TimeLike
     8
     9
    10class ModelDefaultsConfig(BaseConfig):
    11    """A config object for default values applied to model definitions.
    12
    13    Args:
    14        kind: The model kind.
    15        dialect: The SQL dialect that the model's query is written in.
    16        cron: A cron string specifying how often the model should be refreshed, leveraging the
    17            [croniter](https://github.com/kiorky/croniter) library.
    18        owner: The owner of the model.
    19        start: The earliest date that the model will be backfilled for. If this is None,
    20            then the date is inferred by taking the most recent start date of its ancestors.
    21            The start date can be a static datetime or a relative datetime like "1 year ago"
    22        batch_size: The maximum number of intervals that can be run per backfill job. If this is None,
    23            then backfilling this model will do all of history in one job. If this is set, a model's backfill
    24            will be chunked such that each individual job will only contain jobs with max `batch_size` intervals.
    25        storage_format: The storage format used to store the physical table, only applicable in certain engines.
    26            (eg. 'parquet')
    27    """
    28
    29    kind: t.Optional[ModelKind]
    30    dialect: t.Optional[str]
    31    cron: t.Optional[str]
    32    owner: t.Optional[str]
    33    start: t.Optional[TimeLike]
    34    batch_size: t.Optional[int]
    35    storage_format: t.Optional[str]
    36
    37    _model_kind_validator = model_kind_validator

class ModelDefaultsConfig(sqlmesh.core.config.base.BaseConfig): View Source

    11class ModelDefaultsConfig(BaseConfig):
    12    """A config object for default values applied to model definitions.
    13
    14    Args:
    15        kind: The model kind.
    16        dialect: The SQL dialect that the model's query is written in.
    17        cron: A cron string specifying how often the model should be refreshed, leveraging the
    18            [croniter](https://github.com/kiorky/croniter) library.
    19        owner: The owner of the model.
    20        start: The earliest date that the model will be backfilled for. If this is None,
    21            then the date is inferred by taking the most recent start date of its ancestors.
    22            The start date can be a static datetime or a relative datetime like "1 year ago"
    23        batch_size: The maximum number of intervals that can be run per backfill job. If this is None,
    24            then backfilling this model will do all of history in one job. If this is set, a model's backfill
    25            will be chunked such that each individual job will only contain jobs with max `batch_size` intervals.
    26        storage_format: The storage format used to store the physical table, only applicable in certain engines.
    27            (eg. 'parquet')
    28    """
    29
    30    kind: t.Optional[ModelKind]
    31    dialect: t.Optional[str]
    32    cron: t.Optional[str]
    33    owner: t.Optional[str]
    34    start: t.Optional[TimeLike]
    35    batch_size: t.Optional[int]
    36    storage_format: t.Optional[str]
    37
    38    _model_kind_validator = model_kind_validator

A config object for default values applied to model definitions.

###### Arguments:

- kind: The model kind.
- dialect: The SQL dialect that the model's query is written in.
- cron: A cron string specifying how often the model should be refreshed, leveraging the croniter library.
- owner: The owner of the model.
- start: The earliest date that the model will be backfilled for. If this is None, then the date is inferred by taking the most recent start date of its ancestors. The start date can be a static datetime or a relative datetime like "1 year ago"
- batch_size: The maximum number of intervals that can be run per backfill job. If this is None, then backfilling this model will do all of history in one job. If this is set, a model's backfill will be chunked such that each individual job will only contain jobs with max `batch_size` intervals.
- storage_format: The storage format used to store the physical table, only applicable in certain engines. (eg. 'parquet')

##### Inherited Members

pydantic.main.BaseModel
  BaseModel
  parse_obj
  parse_raw
  parse_file
  from_orm
  construct
  copy
  schema
  schema_json
  validate
  update_forward_refs
sqlmesh.core.config.base.BaseConfig
  update_with
sqlmesh.utils.pydantic.PydanticModel
  Config
  dict
  json
  missing_required_fields
  extra_fields
  all_fields
  required_fields