

 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/)。

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

# 呼叫資料 API
<a name="data-api-calling"></a>

您可以呼叫資料 API 或 AWS CLI ，在您的叢集或無伺服器工作群組上執行 SQL 陳述式。在《Amazon Redshift 資料 API 參考》**中，用來執行 SQL 陳述式的主要操作是 [https://docs.aws.amazon.com/redshift-data/latest/APIReference/API_ExecuteStatement.html](https://docs.aws.amazon.com/redshift-data/latest/APIReference/API_ExecuteStatement.html) 和 [https://docs.aws.amazon.com/redshift-data/latest/APIReference/API_BatchExecuteStatement.html](https://docs.aws.amazon.com/redshift-data/latest/APIReference/API_BatchExecuteStatement.html)。資料 API 支援 AWS SDK 支援的程式設計語言。如需這些語言的相關資訊，請參閱[用來在 AWS上進行建置的工具](https://aws.amazon.com/tools/)。

若要查看呼叫資料 API 的程式碼範例，請參閱 *GitHub* 中的[開始使用 Redshift 資料 API](https://github.com/aws-samples/getting-started-with-amazon-redshift-data-api#getting-started-with-redshift-data-api)。此儲存庫具有使用 從 Amazon EC2 AWS Glue Data Catalog和 Amazon SageMaker 執行期 AWS Lambda 存取 Amazon Redshift 資料的範例。範例程式設計語言包括 Python、Go、Java 和 Javascript。

您可以使用 AWS CLI呼叫資料 API。

下列範例使用 AWS CLI 呼叫資料 API。若要執行範例，請編輯參數值以符合您的環境。許多範例會提供 `cluster-identifier` 來針對叢集執行。當您針對無伺服器工作群組執行時，請改為提供 `workgroup-name`。這些範例會示範一些資料 API 操作。如需詳細資訊，請參閱 *AWS CLI 命令參考*。

下列範例中的命令已經過分割和格式化，以方便您閱讀。並非所有參數和回應都會在所有範例中顯示。如需完整請求語法、請求參數、回應語法和回應元素的 API 定義，請參閱 [Amazon Redshift 資料 API 參考](https://docs.aws.amazon.com/redshift-data/latest/APIReference/)。