기존 객체의 복사본을 생성하는 작업. 핵심은 metadata-only operation.
💡 포인트: "Cloning은 즉시 storage cost가 드는가?" → No. 변경 시점부터.
| # | 규칙 |
|---|---|
| 1 | Cloned 객체는 source의 권한(privileges)을 상속 안 함. 단, 테이블은 예외 (COPY GRANTS) |
| 2 | Cloning은 database·schema에 대해 재귀적(recursive) |
| 3 | External tables와 internal named stages는 clone 안 됨 |
| 4 | Cloned table은 source의 load history를 포함 안 함 |
| 5 | Temporary·Transient table → Permanent로 clone 불가 (temp/transient로만 가능) |
🔴 이 5개가 Cloning 파트 중요 각 규칙은 아래에서 상세 정리.
목록 암기보다 예외가 시험에 나온다.
| 객체 | 조건 |
|---|---|
| PIPES | external stage(S3·GCS·Azure) 참조 pipe만 clone / internal stage 참조 pipe는 ❌ |
| Hybrid tables | database clone 시 가능, schema clone 시 불가 |
| Iceberg tables | Snowflake-managed 테이블만 가능 |
💡 포인트: "internal stage를 참조하는 pipe는 clone되는가?" → No
AUTO_INGEST = FALSE → pausedAUTO_INGEST = TRUE → STOPPED_CLONED| 대상 | 권한 상속 |
|---|---|
| 일반 객체 | ❌ (상속 안 함) |
| Table (COPY GRANTS 사용 시) | ✅ OWNERSHIP 제외하고 상속 |
| DB/Schema clone 시 자식 객체 | ✅ 자식의 grant는 유지 |
| DB/Schema 컨테이너 자체 | ❌ 컨테이너에 걸린 grant는 상속 안 함 |
💡 포인트: 권한 상속의 예외는 테이블(COPY GRANTS). 그 외엔 새로 GRANT 필요.
retention period 내 특정 시점의 객체를 clone (DB·Schema·non-temporary table·stream 등).
CREATE TABLE MY_TABLE_CLONE CLONE MY_TABLE
AT (TIMESTAMP => TO_TIMESTAMP('2022-01-01'));
CREATE TABLE MY_TABLE_CLONE CLONE MY_TABLE
AT (OFFSET => -60*30); -- 1800초 = 30분 전
IGNORE TABLES WITH INSUFFICIENT DATA RETENTION 파라미터로 skip💡 포인트:
OFFSET => -60*30해석 = 30분 전. 음수가 과거 방향.
-- 공통 패턴: CREATE <object> <new> CLONE <source>;
CREATE TABLE MY_TABLE_CLONE CLONE MY_TABLE;
CREATE DATABASE MY_DB_CLONE CLONE MY_DB; -- 재귀적
CREATE SCHEMA MY_SC_CLONE CLONE MY_SCHEMA; -- 재귀적
기존 CREATE 문에 CLONE 키워드만 추가한 변형.
"Cloning = 메타데이터만 복사(빠름·공짜), 변경분만 새 micro-partition.
권한은 테이블만 상속(COPY GRANTS), DB/Schema는 재귀,
External table·Internal named stage는 clone ❌,
Temp/Transient는 Permanent로 ❌, load history 안 따라옴."