Skip to contents

이 함수는 제공된 데이터 ID를 기반으로 API 데이터를 검색하여 로컬 데이터베이스로 가져옵니다. 또한 가져오기 작업에 대한 로그를 메타데이터 데이터베이스에 기록합니다.

Usage

import_api_data(
  data_id = NULL,
  schema = c("ods", "meta", "data"),
  sleep = 0,
  verbose = TRUE,
  dbms = get_env("ecoDI_DBMS"),
  ...
)

Arguments

data_id

character. API 데이터를 가져올 데이터 ID.

schema

character. 저장 대상 스키마. "ods", "meta" 또는 "data"에서 선택. 기본값은 "ods".

sleep

numeric. API 호출 전 대기할 시간(초). 기본값은 0.

verbose

logical. TRUE로 설정하면 가져오기 과정 중에 자세한 정보가 출력됨. 기본값은 TRUE.

dbms

character. 대상 DBMS 유형. 기본값은 ecoDI_DBMS 환경 변수에서 가져옴.

...

기본 매개변수 값을 재정의하기 위한 추가 매개변수.

Value

logical. 작업이 성공하면 TRUE, 그렇지 않으면 NULL을 반환합니다.

Examples

# \donttest{
# Example usage
imported_data_df <- import_api_data(data_id = "DA0001", vwCd = "MT_ZTITLE", parentListId = "A")
#>  Importing API data for data ID: DA0001 with parameters: vwCd=MT_ZTITLE&parentListId=A
#> Warning: Closing open result set, cancelling previous query
#> Warning: Closing open result set, cancelling previous query
#> Warning: Closing open result set, cancelling previous query
#> Warning: Closing open result set, cancelling previous query
#> Warning: Closing open result set, cancelling previous query
#> Warning: Closing open result set, cancelling previous query
#> Warning: Closing open result set, cancelling previous query
#> Warning: Closing open result set, cancelling previous query
#> NOTICE:  relation "mt_kosis_stat" 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
#> 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
#>  Imported record count: 11, column count: 11, status: 1
# }