

 Amazon Redshift 將不再支援從修補程式 198 開始建立新的 Python UDFs。現有 Python UDF 將繼續正常運作至 2026 年 6 月 30 日。如需詳細資訊，請參閱[部落格文章](https://aws.amazon.com/blogs/big-data/amazon-redshift-python-user-defined-functions-will-reach-end-of-support-after-june-30-2026/)。

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# 查詢在 中註冊的目錄 AWS Glue Data Catalog
<a name="iceberg-integration-querying"></a>

將 Amazon Redshift 資料倉儲註冊至 AWS Glue Data Catalog 並設定產生目錄的許可後 AWS Lake Formation，目錄會自動掛載到可存取相同帳戶 和 中來源資料倉儲的所有 Amazon Redshift 執行個體 AWS 區域。然後您可以如同在本機叢集或工作群組上一樣查詢該目錄。您也可以 AWS Glue Data Catalog 使用任何支援 Apache Iceberg REST Open API 的 SQL 引擎來查詢註冊至 的目錄。如需 AWS Glue Data Catalog 使用 Apache Iceberg REST API 在 中查詢目錄的詳細資訊，請參閱《 *AWS Glue 開發人員指南*》中的[存取資料目錄](https://docs.aws.amazon.com/glue/latest/dg/access_catalog.html)。如需 Apache Iceberg REST API 的相關資訊，請參閱 [Apache Iceberg REST Open API 規格](https://github.com/apache/iceberg/blob/main/open-api/rest-catalog-open-api.yaml)。

若要查詢目錄，您必須先使用 AWS Lake Formation設定目錄的許可。如需在 中設定目錄許可的詳細資訊 AWS Lake Formation，請參閱《 *AWS Lake Formation 開發人員指南*》中的[設定 Amazon Redshift 資料共用的許可](https://docs.aws.amazon.com/lake-formation/latest/dg/setup-ds-perms.html)。您也需要已連接 `AmazonRedshiftServiceLinkedRolePolicy` 受管政策的 IAM 角色。如需服務連結角色的相關資訊，請參閱《Amazon Redshift 管理指南》**中的[使用 Amazon Redshift 的服務連結角色](https://docs.aws.amazon.com/redshift/latest/mgmt/using-service-linked-roles.html)。

 請注意，對目錄進行的查詢必須遵循下列三部分語法來存取資料表：

```
database@namespace.schema.table
```

如需查詢 Amazon Redshift 資料倉儲的一般資訊，請參閱《Amazon Redshift 管理指南》**中的[查詢資料庫](https://docs.aws.amazon.com//redshift/latest/mgmt/query-databases.html)。

------
#### [ Querying using the query editor v2 ]

設定讓帳戶存取受管工作群組的許可後，該受管工作群組就會出現在無伺服器資料庫的外部資料庫區段下的樹狀檢視面板中。您可以使用三部分語法格式 `database@namespace/cluster.schema.table` 查詢受管工作群組，就如同查詢內部 Amazon Redshift 佈建叢集或無伺服器工作群組一樣。請參閱以下範例陳述式：

```
SELECT price FROM sales_db@mynamespace.sales_schema.inventory_table
```

------
#### [ Querying using the Data API ]

您可以使用 Amazon Redshift Data API 查詢受管工作群組，方法與查詢內部 Amazon Redshift 佈建叢集或無伺服器工作群組相同，就是將目錄的 Amazon Resource Name (ARN) 傳遞至相關 `database` 屬性。請參考以下在目錄中建立資料表的範例。

```
aws redshift-data execute-statement —sql 'CREATE TABLE IF NOT EXISTS "dev@test-rms-catalog".public.t1 (c1 INT, c2 VARCHAR(10));' —database arn:aws:glue:us-east-1:550022730026:catalog/test-rms-catalog
```

------