@@ -217,6 +217,26 @@ def show_model_difference_summary(
217217 ) -> None :
218218 """Displays a summary of differences for the given models."""
219219
220+ @abc .abstractmethod
221+ def show_impacted_tables_diff (
222+ self ,
223+ table_diffs : t .List [TableDiff ],
224+ show_sample : bool = True ,
225+ skip_grain_check : bool = False ,
226+ temp_schema : t .Optional [str ] = None ,
227+ ) -> None :
228+ """Display the table diff between all mismatched tables."""
229+
230+ @abc .abstractmethod
231+ def show_table_diff (
232+ self ,
233+ table_diff : TableDiff ,
234+ show_sample : bool = True ,
235+ skip_grain_check : bool = False ,
236+ temp_schema : t .Optional [str ] = None ,
237+ ) -> None :
238+ """Display the table diff between two tables."""
239+
220240 @abc .abstractmethod
221241 def show_table_diff_summary (self , table_diff : TableDiff ) -> None :
222242 """Display information about the tables being diffed and how they are being joined"""
@@ -648,6 +668,24 @@ def loading_start(self, message: t.Optional[str] = None) -> uuid.UUID:
648668 def loading_stop (self , id : uuid .UUID ) -> None :
649669 pass
650670
671+ def show_impacted_tables_diff (
672+ self ,
673+ table_diffs : t .List [TableDiff ],
674+ show_sample : bool = True ,
675+ skip_grain_check : bool = False ,
676+ temp_schema : t .Optional [str ] = None ,
677+ ) -> None :
678+ pass
679+
680+ def show_table_diff (
681+ self ,
682+ table_diff : TableDiff ,
683+ show_sample : bool = True ,
684+ skip_grain_check : bool = False ,
685+ temp_schema : t .Optional [str ] = None ,
686+ ) -> None :
687+ pass
688+
651689 def show_table_diff_summary (self , table_diff : TableDiff ) -> None :
652690 pass
653691
@@ -2113,6 +2151,77 @@ def show_row_diff(
21132151 self .console .print (f"\n [b][green]{ target_name } ONLY[/green] sample rows:[/b]" )
21142152 self .console .print (row_diff .t_sample .to_string (index = False ), end = "\n \n " )
21152153
2154+
2155+ def show_table_diff (
2156+ self ,
2157+ table_diff : TableDiff ,
2158+ show_sample : bool = True ,
2159+ skip_grain_check : bool = False ,
2160+ temp_schema : t .Optional [str ] = None ,
2161+ ) -> None :
2162+ """Display the table diff between two tables.
2163+
2164+ Args:
2165+ table_diff: The TableDiff object containing schema and summary differences
2166+ show_sample: Show the sample dataframe in the console. Requires show=True.
2167+ skip_grain_check: Skip check for rows that contain null or duplicate grains.
2168+ temp_schema: The schema to use for temporary tables.
2169+ """
2170+
2171+ self .show_table_diff_summary (table_diff )
2172+ self .show_schema_diff (table_diff .schema_diff ())
2173+ self .show_row_diff (
2174+ table_diff .row_diff (temp_schema = temp_schema , skip_grain_check = skip_grain_check ),
2175+ show_sample = show_sample ,
2176+ skip_grain_check = skip_grain_check ,
2177+ )
2178+
2179+ def show_impacted_tables_diff (
2180+ self ,
2181+ table_diffs : t .List [TableDiff ],
2182+ show_sample : bool = True ,
2183+ skip_grain_check : bool = False ,
2184+ temp_schema : t .Optional [str ] = None ,
2185+ ) -> None :
2186+ """
2187+ Display the table diff between all mismatched tables.
2188+ """
2189+ mismatched_tables = []
2190+ fully_matched = []
2191+ for table_diff in table_diffs :
2192+ if (
2193+ table_diff .row_diff (
2194+ temp_schema = temp_schema , skip_grain_check = skip_grain_check
2195+ ).full_match_pct
2196+ == 100
2197+ ):
2198+ fully_matched .append (table_diff )
2199+ else :
2200+ mismatched_tables .append (table_diff )
2201+
2202+ if fully_matched :
2203+ m_tree = Tree ("\n [b]Identical Tables" )
2204+ for m in fully_matched :
2205+ m_tree .add (
2206+ f"[{ self .TABLE_DIFF_SOURCE_BLUE } ]{ m .source } [/{ self .TABLE_DIFF_SOURCE_BLUE } ] - [{ self .TABLE_DIFF_TARGET_GREEN } ]{ m .target } [/{ self .TABLE_DIFF_TARGET_GREEN } ]"
2207+ )
2208+ self ._print (m_tree )
2209+
2210+ if mismatched_tables :
2211+ m_tree = Tree ("\n [b]Mismatched Tables" )
2212+ for m in mismatched_tables :
2213+ m_tree .add (
2214+ f"[{ self .TABLE_DIFF_SOURCE_BLUE } ]{ m .source } [/{ self .TABLE_DIFF_SOURCE_BLUE } ] - [{ self .TABLE_DIFF_TARGET_GREEN } ]{ m .target } [/{ self .TABLE_DIFF_TARGET_GREEN } ]"
2215+ )
2216+ self ._print (m_tree )
2217+ for diff in mismatched_tables :
2218+ self .show_table_diff (
2219+ table_diff = diff ,
2220+ show_sample = show_sample ,
2221+ skip_grain_check = skip_grain_check ,
2222+ temp_schema = temp_schema ,
2223+ )
2224+
21162225 def print_environments (self , environments_summary : t .List [EnvironmentSummary ]) -> None :
21172226 """Prints all environment names along with expiry datetime."""
21182227 output = [
0 commit comments