@@ -214,13 +214,47 @@ def show_model_difference_summary(
214214 """Displays a summary of differences for the given models."""
215215
216216
217+ class BaseConsole (abc .ABC ):
218+ @abc .abstractmethod
219+ def log_error (self , message : str ) -> None :
220+ """Display error info to the user."""
221+
222+ @abc .abstractmethod
223+ def log_warning (self , short_message : str , long_message : t .Optional [str ] = None ) -> None :
224+ """Display warning info to the user.
225+
226+ Args:
227+ short_message: The warning message to print to console.
228+ long_message: The warning message to log to file. If not provided, `short_message` is used.
229+ """
230+
231+ @abc .abstractmethod
232+ def log_success (self , message : str ) -> None :
233+ """Display a general successful message to the user."""
234+
235+
236+ class PlanBuilderConsole (BaseConsole , abc .ABC ):
237+ @abc .abstractmethod
238+ def log_destructive_change (
239+ self ,
240+ snapshot_name : str ,
241+ dropped_column_names : t .List [str ],
242+ alter_expressions : t .List [exp .Alter ],
243+ dialect : str ,
244+ error : bool = True ,
245+ ) -> None :
246+ """Display a destructive change error or warning to the user."""
247+
248+
217249class Console (
250+ PlanBuilderConsole ,
218251 LinterConsole ,
219252 StateExporterConsole ,
220253 StateImporterConsole ,
221254 JanitorConsole ,
222255 EnvironmentsConsole ,
223256 DifferenceConsole ,
257+ BaseConsole ,
224258 abc .ABC ,
225259):
226260 """Abstract base class for defining classes used for displaying information to the user and also interact
@@ -378,34 +412,6 @@ def log_skipped_models(self, snapshot_names: t.Set[str]) -> None:
378412 def log_failed_models (self , errors : t .List [NodeExecutionFailedError ]) -> None :
379413 """Display list of models that failed during evaluation to the user."""
380414
381- @abc .abstractmethod
382- def log_destructive_change (
383- self ,
384- snapshot_name : str ,
385- dropped_column_names : t .List [str ],
386- alter_expressions : t .List [exp .Alter ],
387- dialect : str ,
388- error : bool = True ,
389- ) -> None :
390- """Display a destructive change error or warning to the user."""
391-
392- @abc .abstractmethod
393- def log_error (self , message : str ) -> None :
394- """Display error info to the user."""
395-
396- @abc .abstractmethod
397- def log_warning (self , short_message : str , long_message : t .Optional [str ] = None ) -> None :
398- """Display warning info to the user.
399-
400- Args:
401- short_message: The warning message to print to console.
402- long_message: The warning message to log to file. If not provided, `short_message` is used.
403- """
404-
405- @abc .abstractmethod
406- def log_success (self , message : str ) -> None :
407- """Display a general successful message to the user."""
408-
409415 @abc .abstractmethod
410416 def loading_start (self , message : t .Optional [str ] = None ) -> uuid .UUID :
411417 """Starts loading and returns a unique ID that can be used to stop the loading. Optionally can display a message."""
0 commit comments