11from __future__ import annotations
22
33import abc
4- import logging
54import typing as t
65
76from pydantic import Field
109from sqlglot .helper import subclasses
1110from sqlmesh .core .config .base import BaseConfig
1211from sqlmesh .core .config .common import concurrent_tasks_validator
13- from sqlmesh .core .console import Console
12+ from sqlmesh .core .console import Console , get_console
1413from sqlmesh .core .plan import (
1514 AirflowPlanEvaluator ,
1615 BuiltInPlanEvaluator ,
3231
3332from sqlmesh .utils .config import sensitive_fields , excluded_fields
3433
35- logger = logging .getLogger (__name__ )
36-
3734
3835class SchedulerConfig (abc .ABC ):
3936 """Abstract base class for Scheduler configurations."""
@@ -88,10 +85,10 @@ def create_state_sync(self, context: GenericContext) -> StateSync:
8885 ):
8986 # If we are using DuckDB, ensure that multithreaded mode gets enabled if necessary
9087 if warehouse_connection .concurrent_tasks > 1 :
91- logger . warning (
88+ get_console (). log_warning (
9289 "The duckdb state connection is configured for single threaded mode but the warehouse connection is configured for "
9390 + f"multi threaded mode with { warehouse_connection .concurrent_tasks } concurrent tasks."
94- + " This can cause SQLMesh to hang. Overriding the duckdb state connection config to use multi threaded mode"
91+ + " This can cause SQLMesh to hang. Overriding the duckdb state connection config to use multi threaded mode. "
9592 )
9693 # this triggers multithreaded mode and has to happen before the engine adapter is created below
9794 state_connection .concurrent_tasks = warehouse_connection .concurrent_tasks
@@ -109,7 +106,7 @@ def create_state_sync(self, context: GenericContext) -> StateSync:
109106 warehouse_connection , DuckDBConnectionConfig
110107 ):
111108 if not state_connection .is_recommended_for_state_sync :
112- logger . warning (
109+ get_console (). log_warning (
113110 f"The { state_connection .type_ } engine is not recommended for storing SQLMesh state in production deployments. Please see"
114111 + " https://sqlmesh.readthedocs.io/en/stable/guides/configuration/#state-connection for a list of recommended engines and more information."
115112 )
@@ -205,7 +202,7 @@ def get_default_catalog(self, context: GenericContext) -> t.Optional[str]:
205202
206203
207204def _max_snapshot_ids_per_request_validator (v : t .Any ) -> t .Optional [int ]:
208- logger . warning (
205+ get_console (). log_warning (
209206 "The `max_snapshot_ids_per_request` field is deprecated and will be removed in a future release."
210207 )
211208 return None
0 commit comments