

 Amazon Redshift는 패치 198부터 새 Python UDF 생성을 더 이상 지원하지 않습니다. 기존 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/)을 참조하세요.

# Amazon Redshift Python 커넥터용 API 참조
<a name="python-api-reference"></a>

다음에서 Amazon Redshift Python 커넥터 API 작업에 대한 설명을 찾을 수 있습니다.

## redshift\$1connector
<a name="python-api-redshift_connector"></a>

다음에서 `redshift_connector` API 작업에 대한 설명을 찾을 수 있습니다.

`connect(user, database, password[, port, …])`  
Amazon Redshift 클러스터에 대한 연결을 설정합니다. 이 기능은 사용자 입력을 검증하고 선택적으로 자격 증명 공급자 플러그인을 사용하여 인증한 다음 연결 객체를 구성합니다.

`apilevel`  
지원되는 DBAPI 레벨은 현재 "2.0"입니다.

`paramstyle``str(object=’’) -> str str(bytes_or_buffer[, encoding[, errors]]) -> str`  
전역적으로 사용할 데이터베이스 API 파라미터 스타일입니다.

## 연결
<a name="python-api-connection"></a>

다음에서 Amazon Redshift Python 커넥터의 연결 API 작업에 대한 설명을 찾을 수 있습니다.

`__init__(user, password, database[, host, …])`  
원시 연결 객체를 초기화합니다.

`cursor`  
이 연결에 바인딩된 커서 객체를 생성합니다.

`commit`  
현재 데이터베이스 트랜잭션을 커밋합니다.

`rollback`  
현재 데이터베이스 트랜잭션을 롤백합니다.

`close`  
데이터베이스 연결을 닫습니다.

`execute(cursor, operation, vals)`  
지정된 SQL 명령을 실행합니다. `redshift_connector.paramstyle` 값에 따라 파라미터를 시퀀스 또는 매핑으로 제공할 수 있습니다.

`run(sql[, stream])`  
지정된 SQL 명령을 실행합니다. COPY 명령과 함께 사용할 스트림을 제공할 수도 있습니다.

`xid(format_id, global_transaction_id, …)`  
트랜잭션 ID를 생성합니다. postgres에서는 `global_transaction_id` 파라미터만 사용됩니다. format\$1id 및 branch\$1qualifier는 postgres에서 사용되지 않습니다. `global_transaction_id`는 튜플(`format_id`, `global_transaction_id`, `branch_qualifier`)을 반환하는 postgres에서 지원하는 모든 문자열 식별자일 수 있습니다.

`tpc_begin(xid)`  
형식 ID, 글로벌 트랜잭션 ID 및 분기 한정자로 구성된 트랜잭션 ID `xid`로 TPC 트랜잭션을 시작합니다.

`tpc_prepare`  
.tpc\$1begin으로 시작된 트랜잭션의 첫 번째 단계를 수행합니다.

`tpc_commit([xid])`  
인수 없이 호출 시 .tpc\$1commit은 이전에 .tpc\$1prepare()로 준비된 TPC 트랜잭션을 커밋합니다.

`tpc_rollback([xid])`  
인수 없이 호출 시 .tpc\$1rollback은 TPC 트랜잭션을 롤백합니다.

`tpc_recover`  
.tpc\$1commit(xid) 또는 .tpc\$1rollback(xid)과 함께 사용하기에 적합한 보류 중인 트랜잭션 ID 목록을 반환합니다.

## 커서
<a name="python-api-cursor"></a>

다음에서 커서 API 작업에 대한 설명을 찾을 수 있습니다.

`__init__(connection[, paramstyle])`  
원시 커서 객체를 초기화합니다.

`insert_data_bulk(filename, table_name, parameter_indices, column_names, delimiter, batch_size)`  
대량 INSERT 문을 실행합니다.

`execute(operation[, args, stream, …])`  
데이터베이스 작업을 실행합니다.

`executemany(operation, param_sets)`  
데이터베이스 작업을 준비한 다음 제공된 모든 파라미터 시퀀스 또는 매핑에 대해 실행합니다.

`fetchone`  
쿼리 결과 집합의 다음 행을 가져옵니다.

`fetchmany([num])`  
쿼리 결과 집합의 다음 행 집합을 가져옵니다.

`fetchall`  
쿼리 결과의 나머지 행을 모두 가져옵니다.

`close`  
지금 커서를 닫습니다.

`__iter__`  
커서 객체를 반복하여 쿼리에서 행을 검색할 수 있습니다.

`fetch_dataframe([num])`  
마지막 쿼리 결과의 데이터 프레임을 반환합니다.

`write_dataframe(df, table)`  
동일한 구조 데이터 프레임을 Amazon Redshift 데이터베이스에 씁니다.

`fetch_numpy_array([num])`  
마지막 쿼리 결과의 NumPy 배열을 반환합니다.

`get_catalogs`  
Amazon Redshift는 단일 연결에서 여러 카탈로그를 지원하지 않습니다. Amazon Redshift는 현재 카탈로그만 반환합니다.

`get_tables([catalog, schema_pattern, …])`  
시스템 내에서 사용자 정의된 고유한 공용 테이블을 반환합니다.

`get_columns([catalog, schema_pattern, …])`  
Amazon Redshift 데이터베이스의 특정 테이블에 있는 모든 열 목록을 반환합니다.

## AdfsCredentialsProvider 플러그인
<a name="python-adfs-credentials-plugin"></a>

다음은 Amazon Redshift Python 커넥터에 대한 AdfsCredentialsProvider 플러그인 API 작업의 구문입니다.

```
redshift_connector.plugin.AdfsCredentialsProvider()
```

## AzureCredentialsProvider 플러그인
<a name="python-azure-credentials-plugin"></a>

다음은 Amazon Redshift Python 커넥터에 대한 AzureCredentialsProvider 플러그인 API 작업의 구문입니다.

```
redshift_connector.plugin.AzureCredentialsProvider()
```

## BrowserAzureCredentialsProvider 플러그인
<a name="python-browser-azure-credentials-plugin"></a>

다음은 Amazon Redshift Python 커넥터에 대한 BrowserAzureCredentialsProvider 플러그인 API 작업의 구문입니다.

```
redshift_connector.plugin.BrowserAzureCredentialsProvider()
```

## BrowserSamlCredentialsProvider 플러그인
<a name="python-browser-saml-credentials-plugin"></a>

다음은 Amazon Redshift Python 커넥터에 대한 BrowserSamlCredentialsProvider 플러그인 API 작업의 구문입니다.

```
redshift_connector.plugin.BrowserSamlCredentialsProvider()
```

## OktaCredentialsProvider 플러그인
<a name="python-okta-credentials-plugin"></a>

다음은 Amazon Redshift Python 커넥터에 대한 OktaCredentialsProvider 플러그인 API 작업의 구문입니다.

```
redshift_connector.plugin.OktaCredentialsProvider()
```

## PingCredentialsProvider 플러그인
<a name="python-ping-credentials-plugin"></a>

다음은 Amazon Redshift Python 커넥터에 대한 PingCredentialsProvider 플러그인 API 작업의 구문입니다.

```
redshift_connector.plugin.PingCredentialsProvider()
```

## SamlCredentialsProvider 플러그인
<a name="python-saml-credentials-plugin"></a>

다음은 Amazon Redshift Python 커넥터에 대한 SamlCredentialsProvider 플러그인 API 작업의 구문입니다.

```
redshift_connector.plugin.SamlCredentialsProvider()
```