

 2026 年 6 月 30 日之后，Amazon Redshift 不再支持使用 Python UDF。我们将分阶段开始执行。有关 Python 生命周期终止和迁移选项详情的更多信息，请参阅 2025 年 6 月 30 日发布的[博客文章](https://aws.amazon.com/blogs/big-data/amazon-redshift-python-user-defined-functions-will-reach-end-of-support-after-june-30-2026/)。

# 导入 Python 连接器
<a name="python-start-import"></a>

要导入 Python 连接器，请运行以下命令。

```
>>> import redshift_connector
```

要使用 AWS 凭证连接到 Amazon Redshift 集群，请运行以下命令。

```
conn = redshift_connector.connect(
    host='examplecluster.abc123xyz789.us-west-1.redshift.amazonaws.com',
    port=5439,
    database='dev',
    user='awsuser',
    password='my_password'
 )
```