Categories:

System functions (System Information)

SYSTEM$LIST_NAMESPACES_FROM_CATALOG¶

Lists the namespaces in a remote Apache Icebergâ„¢ REST catalog (including Polaris Catalog).

See also:

Syntax¶

SYSTEM$LIST_NAMESPACES_FROM_CATALOG( '<catalog_integration_name>'
  [ , '<parent_namespace>', <levels> ] )
Copy

Arguments¶

Required:

catalog_integration_name

Identifier for the catalog integration for Iceberg REST or Polaris Catalog.

Optional:

parent_namespace

The identifier of the namespace from which to start listing namespaces. To retrieve results for the 0th namespace level in the catalog, specify an empty string ('').

Default: The default namespace for the catalog integration (CATALOG_NAMESPACE).

levels

Specifies the number of levels to traverse in the namespace hierarchy for listing child namespaces.

For example:

  • If set to 0, the function returns all of the namespaces, recursively, relative to the parent_namespace.

  • If set to 1, the function returns all of the namespaces one level under the parent_namespace.

  • If set to n, the function returns namespaces up to n levels deep, relative to the parent_namespace.

Default: 1

Returns¶

Returns a JSON-formatted string which lists namespaces in the Iceberg REST catalog for the specified parent namespace and number of levels.

The JSON-formatted string has the following structure:

[
  "<namespace_identifier>",
  "<namespace_identifier_n>"
]
Copy

Access control requirements¶

A role used to execute this SQL command must have the following privileges at a minimum:

Privilege

Object

Notes

USAGE

Integration (catalog)

For instructions on creating a custom role with a specified set of privileges, see Creating custom roles.

For general information about roles and privilege grants for performing SQL actions on securable objects, see Overview of Access Control.

Examples¶

List only the namespaces directly under the default namespace of the catalog integration:

SELECT SYSTEM$LIST_NAMESPACES_FROM_CATALOG('my_catalog_integration');
Copy

List all namespaces recursively in the catalog:

SELECT SYSTEM$LIST_NAMESPACES_FROM_CATALOG('my_catalog_integration', '', 0);
Copy

List only the namespaces one level under (directly under) the ‘’db1’’ namespace:

SELECT SYSTEM$LIST_NAMESPACES_FROM_CATALOG('my_catalog_integration', 'db1');
Copy

List the namespaces three levels under the ‘’db1’’ namespace:

SELECT SYSTEM$LIST_NAMESPACES_FROM_CATALOG('my_catalog_integration', 'db1', 3);
Copy