@@ -622,6 +622,40 @@ def global_ctx(cls) -> SessionContext:
622622 wrapper .ctx = internal_ctx
623623 return wrapper
624624
625+ def with_display_config (
626+ self ,
627+ max_table_bytes : Optional [int ] = None ,
628+ min_table_rows : Optional [int ] = None ,
629+ max_cell_length : Optional [int ] = None ,
630+ max_table_rows_in_repr : Optional [int ] = None ,
631+ ) -> SessionContext :
632+ """Configure the display options for DataFrames.
633+
634+ Args:
635+ max_table_bytes: Maximum bytes to display for table presentation
636+ (default: 2MB)
637+ min_table_rows: Minimum number of table rows to display
638+ (default: 20)
639+ max_cell_length: Maximum length of a cell before it gets minimized
640+ (default: 25)
641+ max_table_rows_in_repr: Maximum number of rows to display in repr
642+ string output (default: 10)
643+
644+ Returns:
645+ A new :py:class:`SessionContext` object with the updated display settings.
646+ """
647+ display_config = DataframeDisplayConfig (
648+ max_table_bytes = max_table_bytes ,
649+ min_table_rows = min_table_rows ,
650+ max_cell_length = max_cell_length ,
651+ max_table_rows_in_repr = max_table_rows_in_repr ,
652+ )
653+
654+ klass = self .__class__
655+ obj = klass .__new__ (klass )
656+ obj .ctx = self .ctx .with_display_config (display_config .config_internal )
657+ return obj
658+
625659 def enable_url_table (self ) -> SessionContext :
626660 """Control if local files can be queried as tables.
627661
0 commit comments