@@ -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,76 @@ 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+ def show_table_diff (
2155+ self ,
2156+ table_diff : TableDiff ,
2157+ show_sample : bool = True ,
2158+ skip_grain_check : bool = False ,
2159+ temp_schema : t .Optional [str ] = None ,
2160+ ) -> None :
2161+ """Display the table diff between two tables.
2162+
2163+ Args:
2164+ table_diff: The TableDiff object containing schema and summary differences
2165+ show_sample: Show the sample dataframe in the console. Requires show=True.
2166+ skip_grain_check: Skip check for rows that contain null or duplicate grains.
2167+ temp_schema: The schema to use for temporary tables.
2168+ """
2169+
2170+ self .show_table_diff_summary (table_diff )
2171+ self .show_schema_diff (table_diff .schema_diff ())
2172+ self .show_row_diff (
2173+ table_diff .row_diff (temp_schema = temp_schema , skip_grain_check = skip_grain_check ),
2174+ show_sample = show_sample ,
2175+ skip_grain_check = skip_grain_check ,
2176+ )
2177+
2178+ def show_impacted_tables_diff (
2179+ self ,
2180+ table_diffs : t .List [TableDiff ],
2181+ show_sample : bool = True ,
2182+ skip_grain_check : bool = False ,
2183+ temp_schema : t .Optional [str ] = None ,
2184+ ) -> None :
2185+ """
2186+ Display the table diff between all mismatched tables.
2187+ """
2188+ mismatched_tables = []
2189+ fully_matched = []
2190+ for table_diff in table_diffs :
2191+ if (
2192+ table_diff .row_diff (
2193+ temp_schema = temp_schema , skip_grain_check = skip_grain_check
2194+ ).full_match_pct
2195+ == 100
2196+ ):
2197+ fully_matched .append (table_diff )
2198+ else :
2199+ mismatched_tables .append (table_diff )
2200+
2201+ if fully_matched :
2202+ m_tree = Tree ("\n [b]Identical Tables" )
2203+ for m in fully_matched :
2204+ m_tree .add (
2205+ 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 } ]"
2206+ )
2207+ self ._print (m_tree )
2208+
2209+ if mismatched_tables :
2210+ m_tree = Tree ("\n [b]Mismatched Tables" )
2211+ for m in mismatched_tables :
2212+ m_tree .add (
2213+ 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 } ]"
2214+ )
2215+ self ._print (m_tree )
2216+ for diff in mismatched_tables :
2217+ self .show_table_diff (
2218+ table_diff = diff ,
2219+ show_sample = show_sample ,
2220+ skip_grain_check = skip_grain_check ,
2221+ temp_schema = temp_schema ,
2222+ )
2223+
21162224 def print_environments (self , environments_summary : t .Dict [str , int ]) -> None :
21172225 """Prints all environment names along with expiry datetime."""
21182226 output = [
0 commit comments