@@ -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
@@ -1326,21 +1338,16 @@ def stop_state_import(self, success: bool, input_file: Path) -> None:
13261338 else :
13271339 self .log_error ("State import failed!" )
13281340
1329- def show_difference_summary (
1341+ def show_environment_difference_summary (
13301342 self ,
13311343 context_diff : ContextDiff ,
1332- environment_naming_info : EnvironmentNamingInfo ,
1333- default_catalog : t .Optional [str ],
13341344 no_diff : bool = True ,
1335- show_environment_statements : bool = True ,
13361345 ) -> None :
1337- """Shows a summary of the differences.
1346+ """Shows a summary of the environment differences.
13381347
13391348 Args:
13401349 context_diff: The context diff to use to print the summary
1341- environment_naming_info: The environment naming info to reference when printing model names
1342- default_catalog: The default catalog to reference when deciding to remove catalog from display names
1343- no_diff: Hide the actual SQL differences.
1350+ no_diff: Hide the actual environment statement differences.
13441351 """
13451352 if context_diff .is_new_environment :
13461353 msg = (
@@ -1375,13 +1382,28 @@ def show_difference_summary(
13751382 if context_diff .has_requirement_changes :
13761383 self ._print (f"[bold]Requirements:\n { context_diff .requirements_diff ()} " )
13771384
1378- if context_diff .has_environment_statements_changes and show_environment_statements :
1385+ if context_diff .has_environment_statements_changes and not no_diff :
13791386 self ._print ("[bold]Environment statements:\n " )
13801387 for type , diff in context_diff .environment_statements_diff (
13811388 include_python_env = not context_diff .is_new_environment
13821389 ):
13831390 self ._print (Syntax (diff , type , line_numbers = False ))
13841391
1392+ def show_model_difference_summary (
1393+ self ,
1394+ context_diff : ContextDiff ,
1395+ environment_naming_info : EnvironmentNamingInfo ,
1396+ default_catalog : t .Optional [str ],
1397+ no_diff : bool = True ,
1398+ ) -> None :
1399+ """Shows a summary of the model differences.
1400+
1401+ Args:
1402+ context_diff: The context diff to use to print the summary
1403+ environment_naming_info: The environment naming info to reference when printing model names
1404+ default_catalog: The default catalog to reference when deciding to remove catalog from display names
1405+ no_diff: Hide the actual SQL differences.
1406+ """
13851407 self ._show_summary_tree_for (
13861408 context_diff ,
13871409 "Models" ,
@@ -1557,13 +1579,18 @@ def _prompt_categorize(
15571579 """Get the user's change category for the directly modified models."""
15581580 plan = plan_builder .build ()
15591581
1560- self .show_difference_summary (
1582+ self .show_environment_difference_summary (
15611583 plan .context_diff ,
1562- plan .environment_naming_info ,
1563- default_catalog = default_catalog ,
1564- show_environment_statements = not no_diff ,
1584+ no_diff = no_diff ,
15651585 )
15661586
1587+ if plan .context_diff .has_changes :
1588+ self .show_model_difference_summary (
1589+ plan .context_diff ,
1590+ plan .environment_naming_info ,
1591+ default_catalog = default_catalog ,
1592+ )
1593+
15671594 if not no_diff :
15681595 self ._show_categorized_snapshots (plan , default_catalog )
15691596
@@ -2503,21 +2530,16 @@ class MarkdownConsole(CaptureTerminalConsole):
25032530 def __init__ (self , ** kwargs : t .Any ) -> None :
25042531 super ().__init__ (** {** kwargs , "console" : RichConsole (no_color = True )})
25052532
2506- def show_difference_summary (
2533+ def show_environment_difference_summary (
25072534 self ,
25082535 context_diff : ContextDiff ,
2509- environment_naming_info : EnvironmentNamingInfo ,
2510- default_catalog : t .Optional [str ],
25112536 no_diff : bool = True ,
2512- show_environment_statements : bool = True ,
25132537 ) -> None :
2514- """Shows a summary of the differences.
2538+ """Shows a summary of the environment differences.
25152539
25162540 Args:
25172541 context_diff: The context diff to use to print the summary.
2518- environment_naming_info: The environment naming info to reference when printing model names
2519- default_catalog: The default catalog to reference when deciding to remove catalog from display names
2520- no_diff: Hide the actual SQL differences.
2542+ no_diff: Hide the actual environment statements differences.
25212543 """
25222544 if context_diff .is_new_environment :
25232545 self ._print (
@@ -2535,13 +2557,28 @@ def show_difference_summary(
25352557 if context_diff .has_requirement_changes :
25362558 self ._print (f"Requirements:\n { context_diff .requirements_diff ()} " )
25372559
2538- if context_diff .has_environment_statements_changes and show_environment_statements :
2560+ if context_diff .has_environment_statements_changes and not no_diff :
25392561 self ._print ("[bold]Environment statements:\n " )
25402562 for _ , diff in context_diff .environment_statements_diff (
25412563 include_python_env = not context_diff .is_new_environment
25422564 ):
25432565 self ._print (diff )
25442566
2567+ def show_model_difference_summary (
2568+ self ,
2569+ context_diff : ContextDiff ,
2570+ environment_naming_info : EnvironmentNamingInfo ,
2571+ default_catalog : t .Optional [str ],
2572+ no_diff : bool = True ,
2573+ ) -> None :
2574+ """Shows a summary of the model differences.
2575+
2576+ Args:
2577+ context_diff: The context diff to use to print the summary.
2578+ environment_naming_info: The environment naming info to reference when printing model names
2579+ default_catalog: The default catalog to reference when deciding to remove catalog from display names
2580+ no_diff: Hide the actual SQL differences.
2581+ """
25452582 added_snapshots = {context_diff .snapshots [s_id ] for s_id in context_diff .added }
25462583 added_snapshot_models = {s for s in added_snapshots if s .is_model }
25472584 if added_snapshot_models :
@@ -3044,26 +3081,32 @@ def update_env_migration_progress(self, num_tasks: int) -> None:
30443081 def stop_env_migration_progress (self , success : bool = True ) -> None :
30453082 self ._write (f"Stopping environment migration with success={ success } " )
30463083
3047- def show_difference_summary (
3084+ def show_environment_difference_summary (
30483085 self ,
30493086 context_diff : ContextDiff ,
3050- environment_naming_info : EnvironmentNamingInfo ,
3051- default_catalog : t .Optional [str ],
30523087 no_diff : bool = True ,
3053- show_environment_statements : bool = True ,
30543088 ) -> None :
3055- self ._write ("Model Difference Summary:" )
3089+ self ._write ("Environment Difference Summary:" )
30563090
30573091 if context_diff .has_requirement_changes :
30583092 self ._write (f"Requirements:\n { context_diff .requirements_diff ()} " )
30593093
3060- if context_diff .has_environment_statements_changes and show_environment_statements :
3094+ if context_diff .has_environment_statements_changes and not no_diff :
30613095 self ._write ("Environment statements:\n " )
30623096 for _ , diff in context_diff .environment_statements_diff (
30633097 include_python_env = not context_diff .is_new_environment
30643098 ):
30653099 self ._write (diff )
30663100
3101+ def show_model_difference_summary (
3102+ self ,
3103+ context_diff : ContextDiff ,
3104+ environment_naming_info : EnvironmentNamingInfo ,
3105+ default_catalog : t .Optional [str ],
3106+ no_diff : bool = True ,
3107+ ) -> None :
3108+ self ._write ("Model Difference Summary:" )
3109+
30673110 for added in context_diff .new_snapshots :
30683111 self ._write (f" Added: { added } " )
30693112 for removed in context_diff .removed_snapshots :
0 commit comments