amogh-jahagirdar commented on code in PR #8570:
URL: https://github.com/apache/iceberg/pull/8570#discussion_r1341953280


##########
python/pyiceberg/cli/output.py:
##########
@@ -127,6 +132,18 @@ def describe_table(self, table: Table) -> None:
         output_table.add_row("Properties", table_properties)
         Console().print(output_table)
 
+    def describe_refs(self, ref_details: List[Tuple[str, str, str]]):
+        refs_table = RichTable(title="Snapshot Refs")
+        refs_table.add_column("Ref")
+        refs_table.add_column("Type")
+        refs_table.add_column("Max ref age ms")
+        refs_table.add_column("Min snapshots to keep")
+        refs_table.add_column("Max snapshot age ms")
+        for name, type, ref_detail in ref_details:
+            refs_table.add_row(name, type, ref_detail['max_ref_age_ms'], 
ref_detail['min_snapshots_to_keep'], ref_detail['max_snapshot_age_ms'])

Review Comment:
   I changed it to putting the ref name in the first column, followed by the 
type (previously it was the other way around, but it made more sense to me to 
have the name be first)



##########
python/pyiceberg/cli/console.py:
##########
@@ -242,6 +242,29 @@ def rename(ctx: Context, from_identifier: str, 
to_identifier: str) -> None:
     catalog.rename_table(from_identifier, to_identifier)
     output.text(f"Renamed table from {from_identifier} to {to_identifier}")
 
[email protected]()
[email protected]("identifier")
[email protected]("--type", required=False)
[email protected]("--verbose", type=click.BOOL)
[email protected]_context
+@catch_exception()
+def list_refs(ctx: Context, identifier: str, type: str, verbose: bool) -> None:
+    """List all the refs in the provided table"""
+    catalog, output = _catalog_and_output(ctx)
+    table = catalog.load_table(identifier)
+    refs = table.metadata.refs

Review Comment:
   Sure, I added a new `refs()` API on `Table`, let me know what you think! 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to