

 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/)을 참조하세요.

# ALTER EXTERNAL TABLE 예
<a name="r_ALTER_TABLE_external-table"></a>

다음 예시에서는 미국 동부(버지니아 북부) 리전(`us-east-1`) AWS 리전에 있는 Amazon S3 버킷과 [예제](r_CREATE_EXTERNAL_TABLE_examples.md)에서 CREATE TABLE에 대해 생성한 예시 테이블을 사용합니다. 이 외부 테이블 포함 파티션을 사용하는 방법에 대한 자세한 내용은 [Redshift Spectrum 외부 테이블 파티셔닝](c-spectrum-external-tables.md#c-spectrum-external-tables-partitioning) 섹션을 참조하세요.

다음 예에서는 SPECTRUM.SALES 외부 테이블의 numRows 테이블 속성을 170,000개 행으로 설정합니다.

```
alter table spectrum.sales
set table properties ('numRows'='170000');
```

다음 예에서는 SPECTRUM.SALES 외부 테이블의 위치를 변경합니다.

```
alter table spectrum.sales
set location 's3://redshift-downloads/tickit/spectrum/sales/';
```

다음 예에서는 SPECTRUM.SALES 외부 테이블의 형식을 Parquet로 변경합니다.

```
alter table spectrum.sales
set file format parquet;
```

다음 예에서는 테이블 SPECTRUM.SALES\$1PART에 대한 파티션을 한 개 추가합니다.

```
alter table spectrum.sales_part
add if not exists partition(saledate='2008-01-01')
location 's3://redshift-downloads/tickit/spectrum/sales_partition/saledate=2008-01/';
```

다음 예에서는 테이블 SPECTRUM.SALES\$1PART에 대한 파티션을 세 개 추가합니다.

```
alter table spectrum.sales_part add if not exists
partition(saledate='2008-01-01')
location 's3://redshift-downloads/tickit/spectrum/sales_partition/saledate=2008-01/'
partition(saledate='2008-02-01')
location 's3://redshift-downloads/tickit/spectrum/sales_partition/saledate=2008-02/'
partition(saledate='2008-03-01')
location 's3://redshift-downloads/tickit/spectrum/sales_partition/saledate=2008-03/';
```

다음 예에서는 `saledate='2008-01-01''`를 포함한 파티션을 삭제하도록 SPECTRUM.SALES\$1PART를 변경합니다.

```
alter table spectrum.sales_part
drop partition(saledate='2008-01-01');
```

다음 예에서는 `saledate='2008-01-01'`을 포함한 파티션에 대한 Amazon S3 경로를 새로 설정합니다.

```
alter table spectrum.sales_part
partition(saledate='2008-01-01')
set location 's3://redshift-downloads/tickit/spectrum/sales_partition/saledate=2008-01-01/';
```

다음 예에서는 `sales_date`의 이름을 `transaction_date`로 바꿉니다.

```
alter table spectrum.sales rename column sales_date to transaction_date;
```

다음 예에서는 열 매핑을 ORC(Optimized Row Columnar) 형식을 사용하는 외부 테이블의 위치 매핑으로 설정합니다.

```
alter table spectrum.orc_example
set table properties('orc.schema.resolution'='position');
```

다음 예에서는 열 매핑을 ORC 형식을 사용하는 외부 테이블의 이름 매핑으로 설정합니다.

```
alter table spectrum.orc_example
set table properties('orc.schema.resolution'='name');
```