홈으로 돌아가기

asapBI IDE에서의 Data Vault 모델링

asapBI IDE는 Greenplum에서 Data Vault의 허브, 링크, 새텔라이트 생성을 간소화합니다. FK, UNIQUE, 메타데이터가 포함된 자동 DDL 생성. 효율적인 DWH 모델링을 위한 VSCode/Theia 시각적 인터페이스.

asapBI: IDE에서 Data Vault의 허브와 링크 생성
Advertisement 728x90

asapBI IDE에서 Data Vault 모델링: Hub, Link, Satellite

asapBI IDE는 VSCode 또는 Theia 플러그인으로 Data Vault 구조 생성을 간소화합니다. 왼쪽 트리에는 데이터베이스(NORD, ASGARD), 스키마(repo_md, repo_fi), 폴더(ODS, DDS), 그리고 sales_hub 같은 객체가 표시됩니다. Greenplum은 SQL 생성 모듈을 통해 지원됩니다. 과제: FI 스키마에 DEMO 폴더를 만들고, 두 개의 Hub, Satellite, 그리고 이들 사이의 Link를 생성하세요.

폴더 구조 생성

스키마나 폴더 위에 마우스를 올리면 새 폴더 옵션이 나타납니다. 이름과 배포 패키지(test, prod)를 지정하세요. 임시 객체의 경우 기본값으로 두세요.

완성된 폴더는 트리에 통합됩니다. 이 과정은 수동 SQL 작업을 최소화합니다.

Google AdInline article slot

Hub 만들기

Hub(Hub 유형) 생성. 시스템이 DDL을 자동 생성합니다:

CREATE TABLE repo_fi.product_demo_hub (
	date_load date DEFAULT now() NOT NULL,
	src_sys text DEFAULT ''::character varying NOT NULL,
	hkey int8 GENERATED BY DEFAULT AS IDENTITY
		( INCREMENT BY 1 MINVALUE 1 MAXVALUE 9223372036854775807 
		START 1 CACHE 20 NO CYCLE) NOT NULL,
	CONSTRAINT product_demo_hub_pkey PRIMARY KEY (hkey)
)
USING heap
DISTRIBUTED REPLICATED;
COMMENT ON TABLE repo_fi.product_demo_hub IS '{ "app": "asapBI",
"descr": "Product Demo hub",
"type": "HUB",
"folder": "161"
}';

에디터에서 서비스 필드 활성화(체크박스). 버튼: 비즈니스 키 추가, Satellite 추가, Link 추가.

product text 필드를 UNIQUE 제약 조건과 함께 추가하고 Satellite 생성:

Google AdInline article slot
ALTER TABLE repo_fi.product_demo_hub DROP CONSTRAINT product_demo_hub_unique; 
ALTER TABLE repo_fi.product_demo_hub ADD product text; 
COMMENT ON COLUMN repo_fi.product_demo_hub.product IS 'Produkt';
ALTER TABLE repo_fi.product_demo_hub ADD CONSTRAINT 
   product_demo_hub_unique UNIQUE ( product );

CREATE TABLE repo_fi.product_demo_hub_sat1 (
   id bigint GENERATED BY DEFAULT AS IDENTITY primary key,
   hkey bigint NOT NULL,
   valid_from date DEFAULT now() NOT NULL,
   date_load date DEFAULT now() NOT NULL,
   src_sys text DEFAULT ''::character varying NOT NULL,
   brand text,
   categ text,
   FOREIGN KEY (hkey) REFERENCES repo_fi.product_demo_hub (hkey)
)
USING heap
DISTRIBUTED REPLICATED;
COMMENT ON TABLE repo_fi.product_demo_hub_sat1 IS '{ "app": "asapBI",
"descr": "New sat",
"type": "SAT",
"owner": "repo_fi.product_demo_hub"
}';

ALTER TABLE repo_fi.product_demo_hub_sat1 ADD CONSTRAINT 
    product_demo_hub_sat1_unique UNIQUE (hkey, valid_from);

고객 Hub와 Link

마찬가지로 customer_demo_hub Hub를 만들고 customer text 필드 추가:

CREATE TABLE repo_fi.customer_demo_hub (
	date_load date DEFAULT now() NOT NULL,
	src_sys text DEFAULT ''::character varying NOT NULL,
	hkey int8 GENERATED BY DEFAULT AS IDENTITY
		( INCREMENT BY 1 MINVALUE 1 MAXVALUE 9223372036854775807 
		START 1 CACHE 20 NO CYCLE) NOT NULL,
	customer text NULL,
	CONSTRAINT customer_demo_hub_pkey PRIMARY KEY (hkey),
	CONSTRAINT customer_demo_hub_unique UNIQUE (customer)
)
USING heap
DISTRIBUTED REPLICATED;
COMMENT ON TABLE repo_fi.customer_demo_hub IS '{ "app": "asapBI",
"descr": "Customer Demo hub",
"type": "HUB",
"folder": "161"
}';

Hub들 사이에 Link 추가:

CREATE TABLE repo_fi.customer_demo_hub_link1 (
   id bigint GENERATED BY DEFAULT AS IDENTITY primary key,
   customer_demo_hub bigint,
   date_load date DEFAULT now() NOT NULL,
   src_sys text DEFAULT ''::character varying NOT NULL,
   product_demo_hub bigint ,
   FOREIGN KEY (customer_demo_hub) REFERENCES repo_fi.customer_demo_hub (hkey),
   FOREIGN KEY (product_demo_hub) REFERENCES repo_fi.product_demo_hub (hkey)
)
USING heap
DISTRIBUTED REPLICATED;
COMMENT ON TABLE repo_fi.customer_demo_hub_link1 IS '{ "app": "asapBI",
"descr": "New link",
"type": "LINK"
}';

ALTER TABLE repo_fi.customer_demo_hub_link1
    ADD CONSTRAINT customer_demo_hub_link1_unique 
    UNIQUE (customer_demo_hub, product_demo_hub);

Link는 두 Hub 아래에 나타납니다. Link에 Satellite 추가 가능(+Sat).

Google AdInline article slot

DEMO 구조:

  • Product Hub + Satellite (brand, categ)
  • Customer Hub
  • Hub 간 Link

이 접근 방식의 장점

  • DDL 자동 생성: Hub, Link, Satellite에 대한 완전한 SQL(FK, UNIQUE, JSON COMMENT 포함).
  • 시각화: 객체 트리, 관계 다이어그램.
  • 호환성: SQL을 수동 실행 가능(DBeaver), 객체 동기화.
  • 유연성: 임시/영구 객체, CI/CD용 패키지.
  • 집중: 서비스 필드(hkey, date_load, src_sys) 숨김.

Greenplum 지원; 다른 DBMS로 확장 가능.

핵심 사항

  • Data Vault에서 일상적인 JOIN과 DDL 자동화.
  • 중간/시니어 개발자를 위한 VSCode/Theia 통합.
  • COMMENT에 메타데이터 포함한 프로덕션 준비 SQL 생성.
  • Hub hkey에 대한 FK를 사용한 Link 지원.
  • 코드 제어 손실 없이 시각적 편집.

— Editorial Team

Advertisement 728x90

다음 읽기