@@ -367,11 +367,7 @@ def __init__(
367367 self ._requirements : t .Dict [str , str ] = {}
368368 self ._environment_statements : t .List [EnvironmentStatements ] = []
369369 self ._excluded_requirements : t .Set [str ] = set ()
370- self ._default_catalog : t .Optional [str ] = None
371- self ._default_catalog_per_gateway : t .Optional [t .Dict [str , str ]] = None
372370 self ._engine_adapter : t .Optional [EngineAdapter ] = None
373- self ._connection_config : t .Optional [ConnectionConfig ] = None
374- self ._test_connection_config : t .Optional [ConnectionConfig ] = None
375371 self ._linters : t .Dict [str , Linter ] = {}
376372 self ._loaded : bool = False
377373
@@ -967,11 +963,9 @@ def requirements(self) -> t.Dict[str, str]:
967963 """Returns the Python dependencies of the project loaded in this context."""
968964 return self ._requirements .copy ()
969965
970- @property
966+ @cached_property
971967 def default_catalog (self ) -> t .Optional [str ]:
972- if self ._default_catalog is None and self .default_catalog_per_gateway :
973- self ._default_catalog = self .default_catalog_per_gateway [self .selected_gateway ]
974- return self ._default_catalog
968+ return self .default_catalog_per_gateway .get (self .selected_gateway )
975969
976970 @python_api_analytics
977971 def render (
@@ -2516,33 +2510,25 @@ def engine_adapters(self) -> t.Dict[str, EngineAdapter]:
25162510 @cached_property
25172511 def default_catalog_per_gateway (self ) -> t .Dict [str , str ]:
25182512 """Returns the default catalogs for each engine adapter."""
2519- if self ._default_catalog_per_gateway is None :
2520- self ._default_catalog_per_gateway = self ._scheduler .get_default_catalog_per_gateway (
2521- self
2522- )
2523- return self ._default_catalog_per_gateway
2513+ return self ._scheduler .get_default_catalog_per_gateway (self )
25242514
2525- @cached_property
2515+ @property
25262516 def concurrent_tasks (self ) -> int :
25272517 if self ._concurrent_tasks is None :
25282518 self ._concurrent_tasks = self .connection_config .concurrent_tasks
25292519 return self ._concurrent_tasks
25302520
25312521 @cached_property
25322522 def connection_config (self ) -> ConnectionConfig :
2533- if self ._connection_config is None :
2534- self ._connection_config = self .config .get_connection (self .selected_gateway )
2535- return self ._connection_config
2523+ return self .config .get_connection (self .selected_gateway )
25362524
25372525 @cached_property
25382526 def test_connection_config (self ) -> ConnectionConfig :
2539- if self ._test_connection_config is None :
2540- self ._test_connection_config = self .config .get_test_connection (
2541- self .gateway ,
2542- self .default_catalog ,
2543- default_catalog_dialect = self .config .dialect ,
2544- )
2545- return self ._test_connection_config
2527+ return self .config .get_test_connection (
2528+ self .gateway ,
2529+ self .default_catalog ,
2530+ default_catalog_dialect = self .config .dialect ,
2531+ )
25462532
25472533 @cached_property
25482534 def environment_catalog_mapping (self ) -> RegexKeyDict :
0 commit comments