Edit on GitHub

sqlmesh.core.config.gateway

 1from __future__ import annotations
 2
 3import typing as t
 4
 5from sqlmesh.core import constants as c
 6from sqlmesh.core.config.base import BaseConfig
 7from sqlmesh.core.config.model import ModelDefaultsConfig
 8from sqlmesh.core.config.common import variables_validator
 9from sqlmesh.core.config.connection import (
10    SerializableConnectionConfig,
11    connection_config_validator,
12)
13from sqlmesh.core.config.scheduler import SchedulerConfig, scheduler_config_validator
14
15
16class GatewayConfig(BaseConfig):
17    """Gateway configuration defines how SQLMesh should connect to the data warehouse,
18    the state backend and the scheduler.
19
20    Args:
21        connection: Connection configuration for the data warehouse.
22        state_connection: Connection configuration for the state backend. If not provided,
23            the same connection as the data warehouse will be used.
24        test_connection: Connection configuration for running unit tests.
25        scheduler: The scheduler configuration.
26        state_schema: Schema name to use for the state tables. If None or empty string are provided
27            then no schema name is used and therefore the default schema defined for the connection will be used
28        variables: A dictionary of gateway-specific variables that can be used in models / macros. This overrides
29            root-level variables by key.
30    """
31
32    connection: t.Optional[SerializableConnectionConfig] = None
33    state_connection: t.Optional[SerializableConnectionConfig] = None
34    test_connection: t.Optional[SerializableConnectionConfig] = None
35    scheduler: t.Optional[SchedulerConfig] = None
36    state_schema: t.Optional[str] = c.SQLMESH
37    variables: t.Dict[str, t.Any] = {}
38    model_defaults: t.Optional[ModelDefaultsConfig] = None
39
40    _connection_config_validator = connection_config_validator
41    _scheduler_config_validator = scheduler_config_validator
42    _variables_validator = variables_validator
class GatewayConfig(sqlmesh.core.config.base.BaseConfig):
17class GatewayConfig(BaseConfig):
18    """Gateway configuration defines how SQLMesh should connect to the data warehouse,
19    the state backend and the scheduler.
20
21    Args:
22        connection: Connection configuration for the data warehouse.
23        state_connection: Connection configuration for the state backend. If not provided,
24            the same connection as the data warehouse will be used.
25        test_connection: Connection configuration for running unit tests.
26        scheduler: The scheduler configuration.
27        state_schema: Schema name to use for the state tables. If None or empty string are provided
28            then no schema name is used and therefore the default schema defined for the connection will be used
29        variables: A dictionary of gateway-specific variables that can be used in models / macros. This overrides
30            root-level variables by key.
31    """
32
33    connection: t.Optional[SerializableConnectionConfig] = None
34    state_connection: t.Optional[SerializableConnectionConfig] = None
35    test_connection: t.Optional[SerializableConnectionConfig] = None
36    scheduler: t.Optional[SchedulerConfig] = None
37    state_schema: t.Optional[str] = c.SQLMESH
38    variables: t.Dict[str, t.Any] = {}
39    model_defaults: t.Optional[ModelDefaultsConfig] = None
40
41    _connection_config_validator = connection_config_validator
42    _scheduler_config_validator = scheduler_config_validator
43    _variables_validator = variables_validator

Gateway configuration defines how SQLMesh should connect to the data warehouse, the state backend and the scheduler.

Arguments:
  • connection: Connection configuration for the data warehouse.
  • state_connection: Connection configuration for the state backend. If not provided, the same connection as the data warehouse will be used.
  • test_connection: Connection configuration for running unit tests.
  • scheduler: The scheduler configuration.
  • state_schema: Schema name to use for the state tables. If None or empty string are provided then no schema name is used and therefore the default schema defined for the connection will be used
  • variables: A dictionary of gateway-specific variables that can be used in models / macros. This overrides root-level variables by key.
connection: Optional[Annotated[sqlmesh.core.config.connection.ConnectionConfig, SerializeAsAny()]]
state_connection: Optional[Annotated[sqlmesh.core.config.connection.ConnectionConfig, SerializeAsAny()]]
test_connection: Optional[Annotated[sqlmesh.core.config.connection.ConnectionConfig, SerializeAsAny()]]
state_schema: Optional[str]
variables: Dict[str, Any]
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
sqlmesh.core.config.base.BaseConfig
update_with
sqlmesh.utils.pydantic.PydanticModel
dict
json
copy
fields_set
parse_obj
parse_raw
missing_required_fields
extra_fields
all_fields
all_field_infos
required_fields