@@ -282,13 +282,20 @@ def stop_env_migration_progress(self, success: bool = True) -> None:
282282 """Stop the environment migration progress."""
283283
284284 @abc .abstractmethod
285- def show_difference_summary (
285+ def show_environment_difference_summary (
286+ self ,
287+ context_diff : ContextDiff ,
288+ no_diff : bool = True ,
289+ ) -> None :
290+ """Displays a summary of differences for the environment."""
291+
292+ @abc .abstractmethod
293+ def show_model_difference_summary (
286294 self ,
287295 context_diff : ContextDiff ,
288296 environment_naming_info : EnvironmentNamingInfo ,
289297 default_catalog : t .Optional [str ],
290298 no_diff : bool = True ,
291- show_environment_statements : bool = True ,
292299 ) -> None :
293300 """Displays a summary of differences for the given models."""
294301
@@ -552,14 +559,19 @@ def update_state_import_progress(
552559 def stop_state_import (self , success : bool , input_file : Path ) -> None :
553560 pass
554561
555- def show_difference_summary (
562+ def show_environment_difference_summary (
563+ self ,
564+ context_diff : ContextDiff ,
565+ no_diff : bool = True ,
566+ ) -> None :
567+ pass
568+
569+ def show_model_difference_summary (
556570 self ,
557571 context_diff : ContextDiff ,
558572 environment_naming_info : EnvironmentNamingInfo ,
559573 default_catalog : t .Optional [str ],
560574 no_diff : bool = True ,
561- show_environment_statements : bool = True ,
562- ignored_snapshot_ids : t .Optional [t .Set [SnapshotId ]] = None ,
563575 ) -> None :
564576 pass
565577
@@ -1312,21 +1324,16 @@ def stop_state_import(self, success: bool, input_file: Path) -> None:
13121324 else :
13131325 self .log_error ("State import failed!" )
13141326
1315- def show_difference_summary (
1327+ def show_environment_difference_summary (
13161328 self ,
13171329 context_diff : ContextDiff ,
1318- environment_naming_info : EnvironmentNamingInfo ,
1319- default_catalog : t .Optional [str ],
13201330 no_diff : bool = True ,
1321- show_environment_statements : bool = True ,
13221331 ) -> None :
1323- """Shows a summary of the differences.
1332+ """Shows a summary of the environment differences.
13241333
13251334 Args:
13261335 context_diff: The context diff to use to print the summary
1327- environment_naming_info: The environment naming info to reference when printing model names
1328- default_catalog: The default catalog to reference when deciding to remove catalog from display names
1329- no_diff: Hide the actual SQL differences.
1336+ no_diff: Hide the actual environment statement differences.
13301337 """
13311338 if context_diff .is_new_environment :
13321339 msg = (
@@ -1361,13 +1368,28 @@ def show_difference_summary(
13611368 if context_diff .has_requirement_changes :
13621369 self ._print (f"[bold]Requirements:\n { context_diff .requirements_diff ()} " )
13631370
1364- if context_diff .has_environment_statements_changes and show_environment_statements :
1371+ if context_diff .has_environment_statements_changes and not no_diff :
13651372 self ._print ("[bold]Environment statements:\n " )
13661373 for type , diff in context_diff .environment_statements_diff (
13671374 include_python_env = not context_diff .is_new_environment
13681375 ):
13691376 self ._print (Syntax (diff , type , line_numbers = False ))
13701377
1378+ def show_model_difference_summary (
1379+ self ,
1380+ context_diff : ContextDiff ,
1381+ environment_naming_info : EnvironmentNamingInfo ,
1382+ default_catalog : t .Optional [str ],
1383+ no_diff : bool = True ,
1384+ ) -> None :
1385+ """Shows a summary of the model differences.
1386+
1387+ Args:
1388+ context_diff: The context diff to use to print the summary
1389+ environment_naming_info: The environment naming info to reference when printing model names
1390+ default_catalog: The default catalog to reference when deciding to remove catalog from display names
1391+ no_diff: Hide the actual SQL differences.
1392+ """
13711393 self ._show_summary_tree_for (
13721394 context_diff ,
13731395 "Models" ,
@@ -1543,13 +1565,18 @@ def _prompt_categorize(
15431565 """Get the user's change category for the directly modified models."""
15441566 plan = plan_builder .build ()
15451567
1546- self .show_difference_summary (
1568+ self .show_environment_difference_summary (
15471569 plan .context_diff ,
1548- plan .environment_naming_info ,
1549- default_catalog = default_catalog ,
1550- show_environment_statements = not no_diff ,
1570+ no_diff = no_diff ,
15511571 )
15521572
1573+ if plan .context_diff .has_changes :
1574+ self .show_model_difference_summary (
1575+ plan .context_diff ,
1576+ plan .environment_naming_info ,
1577+ default_catalog = default_catalog ,
1578+ )
1579+
15531580 if not no_diff :
15541581 self ._show_categorized_snapshots (plan , default_catalog )
15551582
@@ -2489,21 +2516,16 @@ class MarkdownConsole(CaptureTerminalConsole):
24892516 def __init__ (self , ** kwargs : t .Any ) -> None :
24902517 super ().__init__ (** {** kwargs , "console" : RichConsole (no_color = True )})
24912518
2492- def show_difference_summary (
2519+ def show_environment_difference_summary (
24932520 self ,
24942521 context_diff : ContextDiff ,
2495- environment_naming_info : EnvironmentNamingInfo ,
2496- default_catalog : t .Optional [str ],
24972522 no_diff : bool = True ,
2498- show_environment_statements : bool = True ,
24992523 ) -> None :
2500- """Shows a summary of the differences.
2524+ """Shows a summary of the environment differences.
25012525
25022526 Args:
25032527 context_diff: The context diff to use to print the summary.
2504- environment_naming_info: The environment naming info to reference when printing model names
2505- default_catalog: The default catalog to reference when deciding to remove catalog from display names
2506- no_diff: Hide the actual SQL differences.
2528+ no_diff: Hide the actual environment statements differences.
25072529 """
25082530 if context_diff .is_new_environment :
25092531 self ._print (
@@ -2521,13 +2543,28 @@ def show_difference_summary(
25212543 if context_diff .has_requirement_changes :
25222544 self ._print (f"Requirements:\n { context_diff .requirements_diff ()} " )
25232545
2524- if context_diff .has_environment_statements_changes and show_environment_statements :
2546+ if context_diff .has_environment_statements_changes and not no_diff :
25252547 self ._print ("[bold]Environment statements:\n " )
25262548 for _ , diff in context_diff .environment_statements_diff (
25272549 include_python_env = not context_diff .is_new_environment
25282550 ):
25292551 self ._print (diff )
25302552
2553+ def show_model_difference_summary (
2554+ self ,
2555+ context_diff : ContextDiff ,
2556+ environment_naming_info : EnvironmentNamingInfo ,
2557+ default_catalog : t .Optional [str ],
2558+ no_diff : bool = True ,
2559+ ) -> None :
2560+ """Shows a summary of the model differences.
2561+
2562+ Args:
2563+ context_diff: The context diff to use to print the summary.
2564+ environment_naming_info: The environment naming info to reference when printing model names
2565+ default_catalog: The default catalog to reference when deciding to remove catalog from display names
2566+ no_diff: Hide the actual SQL differences.
2567+ """
25312568 added_snapshots = {context_diff .snapshots [s_id ] for s_id in context_diff .added }
25322569 added_snapshot_models = {s for s in added_snapshots if s .is_model }
25332570 if added_snapshot_models :
@@ -3030,26 +3067,32 @@ def update_env_migration_progress(self, num_tasks: int) -> None:
30303067 def stop_env_migration_progress (self , success : bool = True ) -> None :
30313068 self ._write (f"Stopping environment migration with success={ success } " )
30323069
3033- def show_difference_summary (
3070+ def show_environment_difference_summary (
30343071 self ,
30353072 context_diff : ContextDiff ,
3036- environment_naming_info : EnvironmentNamingInfo ,
3037- default_catalog : t .Optional [str ],
30383073 no_diff : bool = True ,
3039- show_environment_statements : bool = True ,
30403074 ) -> None :
3041- self ._write ("Model Difference Summary:" )
3075+ self ._write ("Environment Difference Summary:" )
30423076
30433077 if context_diff .has_requirement_changes :
30443078 self ._write (f"Requirements:\n { context_diff .requirements_diff ()} " )
30453079
3046- if context_diff .has_environment_statements_changes and show_environment_statements :
3080+ if context_diff .has_environment_statements_changes and not no_diff :
30473081 self ._write ("Environment statements:\n " )
30483082 for _ , diff in context_diff .environment_statements_diff (
30493083 include_python_env = not context_diff .is_new_environment
30503084 ):
30513085 self ._write (diff )
30523086
3087+ def show_model_difference_summary (
3088+ self ,
3089+ context_diff : ContextDiff ,
3090+ environment_naming_info : EnvironmentNamingInfo ,
3091+ default_catalog : t .Optional [str ],
3092+ no_diff : bool = True ,
3093+ ) -> None :
3094+ self ._write ("Model Difference Summary:" )
3095+
30533096 for added in context_diff .new_snapshots :
30543097 self ._write (f" Added: { added } " )
30553098 for removed in context_diff .removed_snapshots :
0 commit comments