You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@polaris.apache.org by yz...@apache.org on 2026/03/19 00:29:14 UTC

(polaris) branch main updated: CLI: Add summarize subcommand (#4003)

This is an automated email from the ASF dual-hosted git repository.

yzheng pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/polaris.git


The following commit(s) were added to refs/heads/main by this push:
     new f39a9a38c6 CLI: Add summarize subcommand (#4003)
f39a9a38c6 is described below

commit f39a9a38c6b6d08b26f2f90713e54808f4062218
Author: Yong Zheng <yo...@gmail.com>
AuthorDate: Wed Mar 18 19:29:10 2026 -0500

    CLI: Add summarize subcommand (#4003)
---
 CHANGELOG.md                                       |  1 +
 .../apache_polaris/cli/command/catalog_roles.py    | 47 +++++++++++
 .../python/apache_polaris/cli/command/catalogs.py  | 87 ++++++++++++++++++-
 .../apache_polaris/cli/command/namespaces.py       | 47 +++++++++++
 .../python/apache_polaris/cli/command/policies.py  |  1 -
 .../apache_polaris/cli/command/principal_roles.py  | 45 ++++++++++
 .../apache_polaris/cli/command/principals.py       | 35 ++++++++
 client/python/apache_polaris/cli/command/utils.py  | 14 ++++
 client/python/apache_polaris/cli/constants.py      |  1 +
 .../apache_polaris/cli/options/option_tree.py      | 30 +++++++
 .../in-dev/unreleased/command-line-interface.md    | 98 ++++++++++++++++++++++
 11 files changed, 404 insertions(+), 2 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index a4b1b41cc8..ca4b4c325e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -63,6 +63,7 @@ request adding CHANGELOG notes for breaking (!) changes and possibly other secti
 - Added support for persisting Iceberg metrics (ScanReport, CommitReport) to the database. Enable by setting `polaris.iceberg-metrics.reporting.type=persisting` in configuration. Metrics tables are included in the main JDBC schema.
 - Added setup options to Polaris CLI.
 - Added CockroachDB as a supported database for the relational JDBC persistence backend. Set `polaris.persistence.relational.jdbc.database-type` to `cockroachdb` to get started.
+- Added summarize subcommand to Polaris CLI.
 
 ### Changes
 
diff --git a/client/python/apache_polaris/cli/command/catalog_roles.py b/client/python/apache_polaris/cli/command/catalog_roles.py
index 01c99cb6f2..209943325e 100644
--- a/client/python/apache_polaris/cli/command/catalog_roles.py
+++ b/client/python/apache_polaris/cli/command/catalog_roles.py
@@ -31,6 +31,7 @@ from apache_polaris.sdk.management import (
     UpdateCatalogRoleRequest,
     GrantCatalogRoleRequest,
 )
+from apache_polaris.cli.command.utils import format_timestamp
 
 
 @dataclass
@@ -122,7 +123,53 @@ class CatalogRolesCommand(Command):
             api.revoke_catalog_role_from_principal_role(
                 self.principal_role_name, self.catalog_name, self.catalog_role_name
             )
+        elif self.catalog_roles_subcommand == Subcommands.SUMMARIZE:
+            self._generate_summary(api)
         else:
             raise Exception(
                 f"{self.catalog_roles_subcommand} is not supported in the CLI"
             )
+
+    def _generate_summary(self, api: PolarisDefaultApi) -> None:
+        grants = (
+            api.list_grants_for_catalog_role(
+                self.catalog_name, self.catalog_role_name
+            ).grants
+            or []
+        )
+        print(f"Catalog Role: {self.catalog_role_name} [Catalog: {self.catalog_name}]")
+        print("-" * 80)
+        # Metadata
+        role = api.get_catalog_role(self.catalog_name, self.catalog_role_name)
+        print("Metadata")
+        print(f"  {'Created:':<30} {format_timestamp(role.create_timestamp)}")
+        print(f"  {'Modified:':<30} {format_timestamp(role.last_update_timestamp)}")
+        print(f"  {'Version:':<30} {role.entity_version}")
+        # Assignments
+        principal_roles = (
+            api.list_assignee_principal_roles_for_catalog_role(
+                self.catalog_name, self.catalog_role_name
+            ).roles
+            or []
+        )
+        print("Assignments")
+        print(f"  {'Assigned Principal Roles:':<30} {len(principal_roles)}")
+        print(f"  {'Total Grants:':<30} {len(grants)}")
+        # Privileges
+        print("Privileges")
+        if not grants:
+            print("  No grants found.")
+        else:
+            for grant in sorted(
+                grants, key=lambda x: (str(x.privilege), str(x.namespace))
+            ):
+                privilege = grant.privilege.value
+                resource = ""
+                if grant.type == "namespace":
+                    resource = f" on {'.'.join(grant.namespace)}"
+                elif grant.type == "table":
+                    resource = f" on {'.'.join(grant.namespace)}.{grant.table}"
+                elif grant.type == "view":
+                    resource = f" on {'.'.join(grant.namespace)}.{grant.view}"
+                print(f"  - {privilege}{resource}")
+        print("-" * 80)
diff --git a/client/python/apache_polaris/cli/command/catalogs.py b/client/python/apache_polaris/cli/command/catalogs.py
index 4140d83ced..cce4606bbe 100644
--- a/client/python/apache_polaris/cli/command/catalogs.py
+++ b/client/python/apache_polaris/cli/command/catalogs.py
@@ -26,12 +26,13 @@ from apache_polaris.cli.constants import (
     Arguments,
     AuthenticationType,
     ServiceIdentityType,
+    UNIT_SEPARATOR,
 )
 from apache_polaris.cli.options.option_tree import Argument
 
 from dataclasses import dataclass
 from pydantic import StrictStr, SecretStr
-from typing import Dict, List, Optional, Union
+from typing import Dict, List, Optional, Union, Tuple, Callable
 
 from apache_polaris.sdk.management import (
     PolarisDefaultApi,
@@ -53,6 +54,9 @@ from apache_polaris.sdk.management import (
     IcebergRestConnectionConfigInfo,
     AwsIamServiceIdentityInfo,
 )
+from apache_polaris.cli.command.utils import get_catalog_api_client, format_timestamp
+from apache_polaris.sdk.catalog import IcebergCatalogAPI
+from apache_polaris.sdk.catalog.api.policy_api import PolicyAPI
 
 
 @dataclass
@@ -487,5 +491,86 @@ class CatalogsCommand(Command):
                 )
 
             api.update_catalog(self.catalog_name, request)
+        elif self.catalogs_subcommand == Subcommands.SUMMARIZE:
+            self._generate_summary(api)
         else:
             raise Exception(f"{self.catalogs_subcommand} is not supported in the CLI")
+
+    def _generate_summary(self, api: PolarisDefaultApi) -> None:
+        print(f"Catalog: {self.catalog_name}")
+        print("-" * 80)
+        # Metadata
+        catalog = api.get_catalog(self.catalog_name)
+        print("Metadata")
+        print(f"  {'Type:':<30} {catalog.type}")
+        storage_info = catalog.storage_config_info
+        print(f"  {'Storage Type:':<30} {storage_info.storage_type}")
+        print(f"  {'Base Location:':<30} {catalog.properties.default_base_location}")
+        print(
+            f"  {'Allowed Locations:':<30} {','.join(storage_info.allowed_locations or [])}"
+        )
+        print(f"  {'Created:':<30} {format_timestamp(catalog.create_timestamp)}")
+        print(f"  {'Modified:':<30} {format_timestamp(catalog.last_update_timestamp)}")
+        print(f"  {'Version:':<30} {catalog.entity_version}")
+        # Inventory
+        catalog_api = IcebergCatalogAPI(get_catalog_api_client(api))
+        total_ns, total_tables, total_views = self._get_sub_entities_count(catalog_api)
+        print("Inventory")
+        print(f"  {'Namespaces:':<30} {total_ns}")
+        print(f"  {'Tables:':<30} {total_tables}")
+        print(f"  {'Views:':<30} {total_views}")
+        # Access Control
+        catalog_roles = api.list_catalog_roles(self.catalog_name).roles or []
+        principal_roles_names = set()
+        for catalog_role in catalog_roles:
+            pr_resp = api.list_assignee_principal_roles_for_catalog_role(
+                self.catalog_name, catalog_role.name
+            )
+            roles = pr_resp.roles or []
+            for pr in roles:
+                principal_roles_names.add(pr.name)
+        print("Access Control")
+        print(f"  {'Catalog Roles:':<30} {len(catalog_roles)}")
+        print(f"  {'Assigned Principal Roles:':<30} {len(principal_roles_names)}")
+        # Policies
+        policy_api = PolicyAPI(catalog_api.api_client)
+        policies_resp = policy_api.get_applicable_policies(prefix=self.catalog_name)
+        print("Applicable Policies")
+        applicable_policies = policies_resp.applicable_policies or []
+        if applicable_policies:
+            for policy in sorted(applicable_policies, key=lambda x: x.name):
+                print(f"  - {policy.name}")
+        else:
+            print("  No applicable policies")
+        print("-" * 80)
+
+    def _get_sub_entities_count(
+        self, catalog_api: IcebergCatalogAPI
+    ) -> Tuple[int, int, int]:
+        def count_entities(func: Callable, ns_str: str) -> int:
+            try:
+                resp = func(prefix=self.catalog_name, namespace=ns_str)
+                return len(resp.identifiers or [])
+            except Exception as e:
+                print(
+                    f"Warning: Could not list entity for namespace {ns_str}: {e}",
+                )
+                return 0
+
+        def recursive(parent: Optional[str] = None) -> Tuple[int, int, int]:
+            ns_resp = catalog_api.list_namespaces(
+                prefix=self.catalog_name, parent=parent
+            )
+            namespaces = ns_resp.namespaces or []
+            total_ns, total_tables, total_views = len(namespaces), 0, 0
+            for ns in namespaces:
+                ns_str = UNIT_SEPARATOR.join(ns)
+                total_tables += count_entities(catalog_api.list_tables, ns_str)
+                total_views += count_entities(catalog_api.list_views, ns_str)
+                ns_cnt, tables_cnt, views_cnt = recursive(ns_str)
+                total_ns += ns_cnt
+                total_tables += tables_cnt
+                total_views += views_cnt
+            return total_ns, total_tables, total_views
+
+        return recursive()
diff --git a/client/python/apache_polaris/cli/command/namespaces.py b/client/python/apache_polaris/cli/command/namespaces.py
index 4d987e5104..f4f9fa9fd5 100644
--- a/client/python/apache_polaris/cli/command/namespaces.py
+++ b/client/python/apache_polaris/cli/command/namespaces.py
@@ -27,6 +27,7 @@ from apache_polaris.cli.constants import Subcommands, Arguments, UNIT_SEPARATOR
 from apache_polaris.cli.options.option_tree import Argument
 from apache_polaris.sdk.catalog import IcebergCatalogAPI, CreateNamespaceRequest
 from apache_polaris.sdk.management import PolarisDefaultApi
+from apache_polaris.sdk.catalog.api.policy_api import PolicyAPI
 
 
 @dataclass
@@ -86,5 +87,51 @@ class NamespacesCommand(Command):
                     prefix=self.catalog, namespace=UNIT_SEPARATOR.join(self.namespace)
                 ).to_json()
             )
+        elif self.namespaces_subcommand == Subcommands.SUMMARIZE:
+            self._generate_summary(catalog_api)
         else:
             raise Exception(f"{self.namespaces_subcommand} is not supported in the CLI")
+
+    def _generate_summary(self, catalog_api: IcebergCatalogAPI) -> None:
+        ns_str = UNIT_SEPARATOR.join(self.namespace)
+        print(f"Namespace: {'.'.join(self.namespace)}")
+        print("-" * 80)
+        # Metadata
+        print("Metadata")
+        print(f"  {'Level:':<30} {len(self.namespace)}")
+        if len(self.namespace) > 1:
+            print(f"  {'Parent:':<30} {UNIT_SEPARATOR.join(self.namespace[:-1])}")
+        sub_ns = (
+            catalog_api.list_namespaces(prefix=self.catalog, parent=ns_str).namespaces
+            or []
+        )
+        print(f"  {'Sub-namespaces:':<30} {len(sub_ns)}")
+        tables = (
+            catalog_api.list_tables(prefix=self.catalog, namespace=ns_str).identifiers
+            or []
+        )
+        print(f"  {'Tables:':<30} {len(tables)}")
+        views = (
+            catalog_api.list_views(prefix=self.catalog, namespace=ns_str).identifiers
+            or []
+        )
+        print(f"  {'Views:':<30} {len(views)}")
+        # Effective policies
+        policy_api = PolicyAPI(catalog_api.api_client)
+        policies_resp = policy_api.get_applicable_policies(
+            prefix=self.catalog, namespace=ns_str
+        )
+        print("Effective Policies")
+        applicable_policies = policies_resp.applicable_policies or []
+        if applicable_policies:
+            for policy in sorted(applicable_policies, key=lambda x: x.name):
+                source = "Direct"
+                if policy.inherited:
+                    target = (
+                        ".".join(policy.namespace) if policy.namespace else "Catalog"
+                    )
+                    source = f"Inherited from {target}"
+                print(f"  - {policy.name} ({source})")
+        else:
+            print("  No policies apply to this namespace")
+        print("-" * 80)
diff --git a/client/python/apache_polaris/cli/command/policies.py b/client/python/apache_polaris/cli/command/policies.py
index fe2be1b536..7187edb83b 100644
--- a/client/python/apache_polaris/cli/command/policies.py
+++ b/client/python/apache_polaris/cli/command/policies.py
@@ -221,6 +221,5 @@ class PoliciesCommand(Command):
                         else None,
                     ),
                 )
-
         else:
             raise Exception(f"{self.policies_subcommand} is not supported in the CLI")
diff --git a/client/python/apache_polaris/cli/command/principal_roles.py b/client/python/apache_polaris/cli/command/principal_roles.py
index bfea912dc1..1cc801a4be 100644
--- a/client/python/apache_polaris/cli/command/principal_roles.py
+++ b/client/python/apache_polaris/cli/command/principal_roles.py
@@ -30,6 +30,7 @@ from apache_polaris.sdk.management import (
     UpdatePrincipalRoleRequest,
     GrantPrincipalRoleRequest,
 )
+from apache_polaris.cli.command.utils import format_timestamp
 
 
 @dataclass
@@ -118,7 +119,51 @@ class PrincipalRolesCommand(Command):
             api.assign_principal_role(self.principal_name, request)
         elif self.principal_roles_subcommand == Subcommands.REVOKE:
             api.revoke_principal_role(self.principal_name, self.principal_role_name)
+        elif self.principal_roles_subcommand == Subcommands.SUMMARIZE:
+            self._generate_summary(api)
         else:
             raise Exception(
                 f"{self.principal_roles_subcommand} is not supported in the CLI"
             )
+
+    def _generate_summary(self, api: PolarisDefaultApi) -> None:
+        print(f"Principal Role: {self.principal_role_name}")
+        print("-" * 80)
+        # Metadata
+        role = api.get_principal_role(self.principal_role_name)
+        print("Metadata")
+        print(f"  {'Created:':<30} {format_timestamp(role.create_timestamp)}")
+        print(f"  {'Modified:':<30} {format_timestamp(role.last_update_timestamp)}")
+        print(f"  {'Version:':<30} {role.entity_version}")
+        # Assigned Principals
+        principals = (
+            api.list_assignee_principals_for_principal_role(
+                self.principal_role_name
+            ).principals
+            or []
+        )
+        print("Assigned Principals")
+        if principals:
+            for principal in sorted(principals, key=lambda x: x.name):
+                print(f"  - {principal.name}")
+        else:
+            print("  No principals assigned.")
+        # Assigned Catalog Roles
+        assigned_catalog_roles = []
+        catalogs = api.list_catalogs().catalogs or []
+        for catalog in catalogs:
+            catalog_roles = (
+                api.list_catalog_roles_for_principal_role(
+                    self.principal_role_name, catalog.name
+                ).roles
+                or []
+            )
+            for catalog_role in catalog_roles:
+                assigned_catalog_roles.append((catalog_role.name, catalog.name))
+        print("Assigned Catalog Roles")
+        if assigned_catalog_roles:
+            for catalog_role_name, catalog_name in sorted(assigned_catalog_roles):
+                print(f"  - {catalog_role_name} (Catalog: {catalog_name})")
+        else:
+            print("  No catalog roles assigned.")
+        print("-" * 80)
diff --git a/client/python/apache_polaris/cli/command/principals.py b/client/python/apache_polaris/cli/command/principals.py
index d843510651..c31ddd0407 100644
--- a/client/python/apache_polaris/cli/command/principals.py
+++ b/client/python/apache_polaris/cli/command/principals.py
@@ -32,6 +32,7 @@ from apache_polaris.sdk.management import (
     UpdatePrincipalRequest,
     ResetPrincipalRequest,
 )
+from apache_polaris.cli.command.utils import format_timestamp
 
 
 @dataclass
@@ -193,5 +194,39 @@ class PrincipalsCommand(Command):
                         api.reset_credentials(self.principal_name, None)
                     )
                 )
+        elif self.principals_subcommand == Subcommands.SUMMARIZE:
+            self._generate_summary(api)
         else:
             raise Exception(f"{self.principals_subcommand} is not supported in the CLI")
+
+    def _generate_summary(self, api: PolarisDefaultApi) -> None:
+        print(f"Principal: {self.principal_name}")
+        print("-" * 80)
+        # Metadata
+        principal = api.get_principal(self.principal_name)
+        print("Metadata")
+        print(f"  {'Client ID:':<30} {principal.client_id}")
+        print(f"  {'Created:':<30} {format_timestamp(principal.create_timestamp)}")
+        print(
+            f"  {'Modified:':<30} {format_timestamp(principal.last_update_timestamp)}"
+        )
+        print(f"  {'Version:':<30} {principal.entity_version}")
+        # Assigned Roles
+        principal_roles = list(self._get_principal_roles(api))
+        print("Assigned Roles")
+        for principal_role in principal_roles:
+            print(f"  - {principal_role}")
+        catalogs = api.list_catalogs().catalogs or []
+        accessible_catalogs = []
+        for catalog in catalogs:
+            if any(
+                api.list_catalog_roles_for_principal_role(role_name, catalog.name).roles
+                for role_name in principal_roles
+            ):
+                accessible_catalogs.append(catalog.name)
+        # Accessible Catalogs
+        print("Accessible Catalogs")
+        if accessible_catalogs:
+            for catalog in sorted(accessible_catalogs):
+                print(f"  - {catalog}")
+        print("-" * 80)
diff --git a/client/python/apache_polaris/cli/command/utils.py b/client/python/apache_polaris/cli/command/utils.py
index fa41aee1fb..3ba0400941 100644
--- a/client/python/apache_polaris/cli/command/utils.py
+++ b/client/python/apache_polaris/cli/command/utils.py
@@ -18,6 +18,8 @@
 #
 import re
 
+import datetime
+
 from apache_polaris.sdk.catalog.api_client import ApiClient
 from apache_polaris.sdk.catalog.configuration import Configuration
 from apache_polaris.sdk.management import PolarisDefaultApi
@@ -50,3 +52,15 @@ def get_catalog_api_client(api: PolarisDefaultApi) -> ApiClient:
                 catalog_client.set_default_header(header_name, header_value)
 
     return catalog_client
+
+
+def format_timestamp(ms_since_epoch: int) -> str:
+    """
+    Convert a timestamp in milliseconds since epoch to a human-readable string
+    """
+    if ms_since_epoch is None:
+        return "Unknown"
+    dt = datetime.datetime.fromtimestamp(
+        ms_since_epoch / 1000, tz=datetime.timezone.utc
+    )
+    return dt.strftime("%Y-%m-%d %H:%M:%S UTC")
diff --git a/client/python/apache_polaris/cli/constants.py b/client/python/apache_polaris/cli/constants.py
index 60e3378e1b..39aa5243a3 100644
--- a/client/python/apache_polaris/cli/constants.py
+++ b/client/python/apache_polaris/cli/constants.py
@@ -117,6 +117,7 @@ class Subcommands:
     DETACH = "detach"
     APPLY = "apply"
     EXPORT = "export"
+    SUMMARIZE = "summarize"
 
 
 class Actions:
diff --git a/client/python/apache_polaris/cli/options/option_tree.py b/client/python/apache_polaris/cli/options/option_tree.py
index 6d8c42f044..71dc531112 100644
--- a/client/python/apache_polaris/cli/options/option_tree.py
+++ b/client/python/apache_polaris/cli/options/option_tree.py
@@ -337,6 +337,10 @@ class OptionTree:
                         ],
                         input_name=Arguments.CATALOG,
                     ),
+                    Option(
+                        Subcommands.SUMMARIZE,
+                        input_name=Arguments.CATALOG,
+                    ),
                 ],
             ),
             Option(
@@ -404,6 +408,10 @@ class OptionTree:
                         ],
                         input_name=Arguments.PRINCIPAL,
                     ),
+                    Option(
+                        Subcommands.SUMMARIZE,
+                        input_name=Arguments.PRINCIPAL,
+                    ),
                 ],
             ),
             Option(
@@ -482,6 +490,10 @@ class OptionTree:
                         ],
                         input_name=Arguments.PRINCIPAL_ROLE,
                     ),
+                    Option(
+                        Subcommands.SUMMARIZE,
+                        input_name=Arguments.PRINCIPAL_ROLE,
+                    ),
                 ],
             ),
             Option(
@@ -584,6 +596,15 @@ class OptionTree:
                         ],
                         input_name=Arguments.CATALOG_ROLE,
                     ),
+                    Option(
+                        Subcommands.SUMMARIZE,
+                        args=[
+                            Argument(
+                                Arguments.CATALOG, str, Hints.CatalogRoles.CATALOG_NAME
+                            )
+                        ],
+                        input_name=Arguments.CATALOG_ROLE,
+                    ),
                 ],
             ),
             Option(
@@ -750,6 +771,15 @@ class OptionTree:
                         ],
                         input_name=Arguments.NAMESPACE,
                     ),
+                    Option(
+                        Subcommands.SUMMARIZE,
+                        args=[
+                            Argument(
+                                Arguments.CATALOG, str, Hints.CatalogRoles.CATALOG_NAME
+                            )
+                        ],
+                        input_name=Arguments.NAMESPACE,
+                    ),
                 ],
             ),
             Option(
diff --git a/site/content/in-dev/unreleased/command-line-interface.md b/site/content/in-dev/unreleased/command-line-interface.md
index 6f4b25e2f7..8f42acac2e 100644
--- a/site/content/in-dev/unreleased/command-line-interface.md
+++ b/site/content/in-dev/unreleased/command-line-interface.md
@@ -134,6 +134,7 @@ The `catalogs` command is used to create, discover, and otherwise manage catalog
 3. get
 4. list
 5. update
+6. summarize
 
 #### create
 
@@ -268,6 +269,24 @@ polaris catalogs list
 polaris catalogs list --principal-role some_user
 ```
 
+#### summarize
+
+The `summarize` subcommand is used to display summary for a catalog.
+
+```
+input: polaris catalogs summarize --help
+options:
+  summarize
+    Positional arguments:
+      catalog
+```
+
+##### Examples
+
+```
+polaris catalogs summarize some_catalog
+```
+
 #### update
 
 The `update` subcommand is used to update a catalog. Currently, this command supports changing the properties of a catalog or updating its storage configuration.
@@ -469,6 +488,24 @@ polaris principals reset --new-client-secret ${NEW_CLIENT_SECRET} some_user
 polaris principals reset --new-client-id ${NEW_CLIENT_ID} --new-client-secret ${NEW_CLIENT_SECRET} some_user
 ```
 
+#### summarize
+
+The `summarize` subcommand is used to display summary for a principal.
+
+```
+input: polaris principals summarize --help
+options:
+  summarize
+    Positional arguments:
+      principal
+```
+
+##### Examples
+
+```
+polaris principals summarize some_user
+```
+
 ### Principal Roles
 
 The `principal-roles` command is used to create, discover, and manage principal roles within Polaris. Additionally, this command can identify principals or catalog roles associated with a principal role, and can be used to grant a principal role to a principal.
@@ -482,6 +519,7 @@ The `principal-roles` command is used to create, discover, and manage principal
 5. update
 6. grant
 7. revoke
+8. summarize
 
 #### create
 
@@ -635,6 +673,24 @@ polaris principal-roles revoke --principal former.employee data_engineer
 polaris principal-roles revoke data_scientist --principal changed.role
 ```
 
+#### summarize
+
+The `summarize` subcommand is used to display summary for a principal role.
+
+```
+input: polaris principal-roles summarize --help
+options:
+  summarize
+    Positional arguments:
+      principal_role
+```
+
+##### Examples
+
+```
+polaris principal-roles summarize data_engineer
+```
+
 ### Catalog Roles
 
 The catalog-roles command is used to create, discover, and manage catalog roles within Polaris. Additionally, this command can be used to grant a catalog role to a principal role.
@@ -648,6 +704,7 @@ The catalog-roles command is used to create, discover, and manage catalog roles
 5. update
 6. grant
 7. revoke
+8. summarize
 
 #### create
 
@@ -808,6 +865,26 @@ polaris catalog-roles revoke sensitive_data --catalog some_catalog --principal-r
 polaris catalog-roles revoke --catalog sales_data contains_cc_info_catalog_role --principal-role financial_analyst_role
 ```
 
+#### summarize
+
+The `summarize` subcommand is used to display summary for a catalog role.
+
+```
+input: polaris catalog-roles summarize --help
+options:
+  summarize
+    Named arguments:
+      --catalog  The name of an existing catalog
+    Positional arguments:
+      catalog_role
+```
+
+##### Examples
+
+```
+polaris catalog-roles summarize --catalog some_catalog some_catalog_role
+```
+
 ### Namespaces
 
 The `namespaces` command is used to manage namespaces within Polaris.
@@ -818,6 +895,7 @@ The `namespaces` command is used to manage namespaces within Polaris.
 2. delete
 3. get
 4. list
+5. summarize
 
 #### create
 
@@ -912,6 +990,26 @@ polaris namespaces list --catalog my_catalog --parent a
 polaris namespaces list --catalog my_catalog --parent a.b
 ```
 
+#### summarize
+
+The `summarize` subcommand is used to display summary for a namespace.
+
+```
+input: polaris namespaces summarize --help
+options:
+  summarize
+    Named arguments:
+      --catalog  The name of an existing catalog
+    Positional arguments:
+      namespace
+```
+
+##### Examples
+
+```
+polaris namespaces summarize --catalog my_catalog a.b
+```
+
 ### Privileges
 
 The `privileges` command is used to grant various privileges to a catalog role, or to revoke those privileges. Privileges can be on the level of a catalog, a namespace, a table, or a view. For more information on privileges, please refer to the [docs]({{% ref "entities#privilege" %}}).