CREATE CATALOG
적용 대상: Databricks SQL
Databricks Runtime 10.4 LTS 이상
Unity 카탈로그만 해당
지정된 이름을 사용하여 카탈로그를 만듭니다. 같은 이름의 카탈로그가 이미 존재하면 예외가 발생합니다.
FOREIGN
카탈로그를 만들면 인증 사용자에게 표시되는 모든 스키마와 테이블로 채워집니다.
구문
CREATE CATALOG [ IF NOT EXISTS ] catalog_name
[ USING SHARE provider_name . share_name |
MANAGED LOCATION location_path |
COMMENT comment |
OPTIONS ( { option_name = option_value } [ , ... ] ) ] [...]
CREATE FOREIGN CATALOG [ IF NOT EXISTS ] catalog_name
USING CONNECTION connection_name
[ COMMENT comment ]
OPTIONS ( { option_name = option_value } [ , ... ] )
매개 변수
외래의
적용 대상:
Databricks SQL
Databricks Runtime 13.3 LTS 이상
CONNECTION에서 카탈로그가 가져온 것임을 지정합니다.
IF NOT EXISTS
지정된 이름의 카탈로그가 존재하지 않을 경우, 새로 만들어집니다. 이름이 같은 카탈로그가 이미 있는 경우 아무 작업도 수행되지 않습니다.
-
만들 카탈로그의 이름입니다.
USING SHARE provider_name
.
share_name필요에 따라 카탈로그가 Delta Sharing을 기반으로 할 수 있습니다.
-
공유를 제공한 Delta Sharing 공급자의 이름입니다.
-
provider_name에서 제공한 공유의 이름입니다.
-
관리되는 위치 location_path
필요에 따라 메타스토어의 루트 스토리지 위치와 다른, 카탈로그의 관리 스토리지 위치 경로를 지정할 수 있습니다. 이 경로는 외부 위치 구성에서 정의되어야 하며 외부 위치 구성에 대한
CREATE MANAGED STORAGE
권한이 있어야 합니다. 외부 위치 구성에 정의된 경로 또는 하위 경로(즉,'abfss://container@storageaccount.dfs.core.windows.net/finance'
또는'abfss://container@storageaccount.dfs.core.windows.net/finance/product'
)를 사용할 수 있습니다. Databricks SQL 또는 Databricks Runtime 11.3 LTS 이상을 실행하는 클러스터에서 지원됩니다.관리되는 테이블
작업 및 Unity 카탈로그 메타스토어만들기 참조하세요. -
원본 카탈로그가 있는 연결을 지정합니다.
comment
선택적
STRING
리터럴입니다. 카탈로그에 대한 설명입니다.OPTIONS
연결에서 카탈로그를 식별하는 데 필요한 연결 유형별 매개 변수를 설정합니다.
option_name
옵션 키입니다. 키는 점 또는 리터럴로 구분된 하나 이상의
STRING
로 구성될 수 있습니다.옵션 키는 고유해야 하며 대/소문자를 구분해야 합니다.
option_value
옵션의 값입니다. 값은
BOOLEAN
,STRING
,INTEGER
또는DECIMAL
상수 식이어야 합니다. 값은SECRET
SQL 함수에 대한 호출일 수도 있습니다. 예를 들어 forvalue
는password
리터럴 암호를 입력하는 대신 구성할secret('secrets.r.us', 'postgresPassword')
수 있습니다.
예제
-- Create catalog `customer_cat`. This throws exception if catalog with name customer_cat
-- already exists.
> CREATE CATALOG customer_cat;
-- Create catalog `customer_cat` only if catalog with same name doesn't exist.
> CREATE CATALOG IF NOT EXISTS customer_cat;
-- Create catalog `customer_cat` only if catalog with same name doesn't exist, with a comment.
> CREATE CATALOG IF NOT EXISTS customer_cat COMMENT 'This is customer catalog';
-- Create a catalog from a Delta Sharing share.
> CREATE CATALOG customer_cat USING SHARE cdc.vaccinedata;
-- Create a catalog with a different managed storage location than the metastore's.
> CREATE CATALOG customer_cat MANAGED LOCATION 'abfss://container@storageaccount.dfs.core.windows.net/finance';
-- Create a foreign catalog linked to postgresdb at postgresql_connection
> CREATE FOREIGN CATALOG postgresql_catalog
USING CONNECTION postgresql_connection
OPTIONS (database 'postgresdb');