Mart 테이블 생성
mk_mart_table.Rd이 함수는 제공된 메타데이터 객체를 기반으로 mart 데이터 테이블을 생성합니다.
Usage
mk_mart_table(
obj = NULL,
column_class = NULL,
is_pk = NULL,
is_fk = NULL,
is_null = NULL,
pov_region = NULL,
pov_age = NULL,
subject = NULL,
sub_subject = NULL,
metric_unit = NULL,
table_desc = NULL,
schema = c("data", "ods", "meta"),
cty_smry_type = c("S", "M"),
web_use_yn = c("Y", "N"),
cty_ihrt_yn = c("Y", "N"),
dbms = get_env("ecoDI_DBMS")
)Arguments
- obj
data.frame. DW 스키마에 저장할 테이블 정보를 담고 있는 메타데이터 객체.
- column_class
character vector. 각 컬럼의 데이터 클래스 벡터. 기본값은 NULL이며, 이 경우 함수 내부에서 기본 클래스가 할당됩니다.
- is_pk
logical vector. 각 컬럼이 기본 키인지 여부를 나타내는 벡터. 'Y', 'N'에서의 가값을 가짐. 기본값은 NULL이며, 이 경우 함수 내부에서 산정됨.
- is_fk
logical vector. 각 컬럼이 외래 키인지 여부를 나타 내는 벡터. 'Y', 'N'에서의 가값을 가짐. 기본값은 NULL이며, 이 경우 함수 내부에서 산정됨.
- is_null
characterector. 각 컬럼이 NULL 허용인지 여부를 나타 내는 벡터. 'Y', 'N'에서의 가값을 가짐. 기본값은 NULL이며, 이 경우 함수 내부에서 산정됨.
- pov_region
character. 지역 구분 정보 코드.
- pov_age
character. 연령 구분 정보 코드.
- subject
character. 주제영역 정보 코드.
- sub_subject
character. 서브 주제영역 정보 코드.
- metric_unit
integer. 측정 단위 정보.
- table_desc
character. 테이블 설명.
- schema
character. 테이블이 생성될 스키마 이름. 옵션은 "ods", "meta", "data". 기본값은 "data".
- web_use_yn
character. 웹 사용 여부. 'Y' 또는 'N'. 기본값은 'Y'.
- cty_ihrt_yn
character. 시군구 레벨 구 병합 여부. 'Y' 또는 'N'. 기본값은 'Y'.
- dbms
character. 대상 DBMS 유형. 기본값은 ecoDI_DBMS 환경 변수에서 가져옴.
Examples
# \donttest{
# Example metadata object
data_id <- "DA0002"
region_var <- "c1"
is_mega <- TRUE
tab_info <- ods2data(data_id = data_id, region_var = region_var, is_mega = is_mega)
#> Warning: Closing open result set, cancelling previous query
#> Warning: Closing open result set, cancelling previous query
#> Warning: There is a result object still in use.
#> The connection will be automatically released when it is closed
#> Error: Expected string vector of length 1
# Create mart table
subject <- "107"
sub_subject <- "107001"
mk_mart_table(obj = tab_info, schema = "data", subject = subject,
sub_subject = sub_subject, pov_region = "MEGA")
#> Warning: Closing open result set, cancelling previous query
#> NOTICE: relation "dt_1yl20852_cty" already exists, skipping
#> Warning: There is a result object still in use.
#> The connection will be automatically released when it is closed
#> Warning: There is a result object still in use.
#> The connection will be automatically released when it is closed
#> Error: Failed to fetch row : ERROR: duplicate key value violates unique constraint "mt_table_column_pkey"
#> DETAIL: Key (table_id, column_seq)=(DT_1YL20852_CTY, 1) already exists.
# }