Categories:

System functions (System Information)

SYSTEM$VERIFY_CATALOG_INTEGRATION

Verifies the configuration for a specified catalog integration for Apache Iceberg™ REST.

为了检查是否为 Iceberg REST 目录正确配置了授权和访问控制,该函数尝试使用目录集成与目录服务器进行交互。

See also:

CREATE CATALOG INTEGRATION (Apache Iceberg™ REST) , Configure a catalog integration for Apache Iceberg™ REST catalogs

语法

SYSTEM$VERIFY_CATALOG_INTEGRATION( '<rest_catalog_integration_name>' )

实参

rest_catalog_integration_name

Name of the Iceberg REST catalog integration to test.

目录集成名称区分大小写。

返回

该函数返回一个 JSON 对象,其属性如下所述:

PropertyDescription
successSpecifies whether verification was successful; true if successful, otherwise false.
errorCodeError code of the failure (if verification fails).
errorMessageA detailed error message (if verification fails).
{
  "success" : false,
  "errorCode" : "004140",
  "errorMessage" : "SQL Execution Error: Failed to access the REST endpoint of catalog integration CAT_INT_VERIFICATION with error: Unable to process: Unable to find warehouse my_warehouse. Check the accessibility of the REST catalog URI or warehouse."
}

访问控制要求

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

权限对象备注
USAGE目录集成

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.

示例

The following example statement creates a REST catalog integration using an invalid OAuth client secret (this runs without error):

CREATE CATALOG INTEGRATION my_rest_cat_int
  CATALOG_SOURCE = ICEBERG_REST
  TABLE_FORMAT = ICEBERG
  CATALOG_NAMESPACE = 'default'
  REST_CONFIG = (
    CATALOG_URI = 'https://abc123.us-west-2.aws.myapi.com/polaris/api/catalog'
    CATALOG_NAME = 'my_catalog_name'
  )
  REST_AUTHENTICATION = (
    TYPE = OAUTH
    OAUTH_CLIENT_ID = '123AbC ...'
    OAUTH_CLIENT_SECRET = '1365910abIncorrectSecret ...'
    OAUTH_ALLOWED_SCOPES = ('all-apis', 'sql')
  )
  ENABLED = TRUE;

Use the system function to verify the catalog integration, expecting failure:

SELECT SYSTEM$VERIFY_CATALOG_INTEGRATION('my_rest_cat_int');

Output:

+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|                                                                                                              SYSTEM$VERIFY_CATALOG_INTEGRATION('MY_REST_CAT_INT')                                                                                                               |
+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| {                                                                                                                                                                                                                                                                               |
|  "success" : false,                                                                                                                                                                                                                                                             |                                                                                                                                                                                                                                                                    |
|   "errorCode" : "004155",                                                                                                                                                                                                                                                       |
|   "errorMessage" : "SQL Execution Error: Failed to perform OAuth client credential flow for the REST Catalog integration MY_REST_CAT_INT due to error: SQL execution error: OAuth2 Access token request failed with error 'unauthorized_client:The client is not authorized'.." |
| }                                                                                                                                                                                                                                                                               |
+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+