Iceberg 테이블 만들기

이 항목에서는 다양한 Iceberg 카탈로그 옵션 에 대해 Snowflake에서 Iceberg 테이블 을 만드는 방법을 다룹니다. CREATE ICEBERG TABLE 명령을 사용하여 Iceberg 테이블을 생성할 수 있습니다.

참고

Iceberg 테이블을 생성하려면 세션의 현재 웨어하우스로 지정된 실행 중인 웨어하우스가 있어야 합니다. Iceberg 테이블을 생성할 때 실행 중인 웨어하우스를 지정하지 않으면 오류가 발생할 수 있습니다. 자세한 내용은 웨어하우스 관련 작업하기 를 참조하십시오.

Snowflake를 카탈로그로 사용하여 Iceberg 테이블 만들기

To create an Iceberg table with Snowflake as the catalog, you must specify an external volume and a base location (directory on the external volume) where Snowflake can write table data and metadata. For instructions on creating an external volume, see Configure an external volume for Iceberg tables.

테이블 열을 정의하려면 Iceberg 데이터 타입을 사용할 수 있습니다. 자세한 내용은 Iceberg 테이블 데이터 타입 섹션을 참조하십시오.

다음 예제에서는 Snowflake를 Iceberg 카탈로그로 사용하여 Iceberg 테이블을 생성합니다.

CREATE OR REPLACE ICEBERG TABLE my_iceberg_table (
    boolean_col boolean,
    int_col int,
    long_col long,
    float_col float,
    double_col double,
    decimal_col decimal(10,5),
    string_col string,
    fixed_col fixed(10),
    binary_col binary,
    date_col date,
    time_col time,
    timestamp_ntz_col timestamp_ntz(6),
    timestamp_ltz_col timestamp_ltz(6)
  )
  CATALOG = 'SNOWFLAKE'
  EXTERNAL_VOLUME = 'my_ext_vol'
  BASE_LOCATION = 'my/relative/path/from/extvol';
Copy

참고

또는 베리언트 구문을 사용하십시오. 자세한 내용은 CREATE TABLE … AS SELECTCREATE ICEBERG TABLE … LIKE 를 참조하십시오.

Snowflake를 카탈로그로 사용하는 테이블을 만들면 다음과 같은 작업을 수행할 수 있습니다.

자세한 내용은 Iceberg 테이블 관리하기 섹션을 참조하십시오.

Create an Iceberg table with a catalog integration

외부 카탈로그를 사용하거나 카탈로그를 전혀 사용하지 않는 Iceberg 테이블을 생성하려면 외부 볼륨카탈로그 통합 을 지정해야 합니다. 외부 Iceberg 카탈로그를 사용하는 경우 추가 매개 변수를 지정해야 할 수도 있습니다. 예를 들어 AWS Glue를 카탈로그로 사용할 때 카탈로그 테이블 이름을 지정해야 합니다.

When you create an Iceberg table with a catalog integration, Snowflake performs an initial metadata refresh. You can also manually refresh the table metadata using the ALTER ICEBERG TABLE command to synchronize the metadata with the most recent table changes. For more information, see Manually refresh the table metadata.

AWS Glue를 카탈로그로 사용하여 Iceberg 테이블 만들기

중요

You must configure a catalog integration for AWS Glue to establish a trust relationship between Snowflake and the Glue Data Catalog. For instructions, see Iceberg 테이블의 카탈로그 통합 구성하기.

다음 예제에서는 AWS Glue(glueCatalogInt)에 대해 구성된 카탈로그 통합의 이름과 CATALOG_TABLE_NAME 속성의 값을 지정하여 AWS Glue Data Catalog를 사용하는 Iceberg 테이블을 생성합니다.

CREATE ICEBERG TABLE myGlueTable
  EXTERNAL_VOLUME='glueCatalogVolume'
  CATALOG='glueCatalogInt'
  CATALOG_TABLE_NAME='myGlueTable';
Copy

AWS Glue를 카탈로그로 사용하는 테이블을 만들면 다음과 같은 작업을 수행할 수 있습니다.

오브젝트 저장소의 Iceberg 파일에서 Iceberg 테이블 만들기

다음 예제에서는 외부 볼륨(METADATA_FILE_PATH)의 테이블 메타데이터에 대한 상대 경로를 지정하여 외부 클라우드 저장소의 Iceberg 메타데이터에서 Iceberg 테이블을 생성합니다.

CREATE ICEBERG TABLE myIcebergTable
  EXTERNAL_VOLUME='icebergMetadataVolume'
  CATALOG='icebergCatalogInt'
  METADATA_FILE_PATH='path/to/metadata/v1.metadata.json';
Copy

오브젝트 저장소의 파일에서 테이블을 만들면 다음과 같은 작업을 수행할 수 있습니다.