add owner_source to primary key in dataset_owner table schema
@@ -22,7 +22,7 @@ CREATE TABLE dataset_owner (
`owner_type` VARCHAR(127) COMMENT 'Producer, Consumer, Stakeholder',
`owner_sub_type` VARCHAR(127) COMMENT 'DWH, UMP, BA, etc',
`owner_id_type` VARCHAR(127) COMMENT 'user, group, service, or urn',
- `owner_source` VARCHAR(127) COMMENT 'where the owner info is extracted: JIRA,RB,DB,FS,AUDIT',
+ `owner_source` VARCHAR(30) NOT NULL COMMENT 'where the owner info is extracted: JIRA,RB,DB,FS,AUDIT',
`db_ids` VARCHAR(127) COMMENT 'comma separated database ids',
`is_group` CHAR(1) COMMENT 'if owner is a group',
`is_active` CHAR(1) COMMENT 'if owner is active',
@@ -34,8 +34,8 @@ CREATE TABLE dataset_owner (
`confirmed_by` VARCHAR(127) NULL,
`confirmed_on` INT UNSIGNED,
wh_etl_exec_id BIGINT COMMENT 'wherehows etl execution id that modified this record',
- PRIMARY KEY (`dataset_id`, `owner_id`, `app_id`),
- UNIQUE KEY (`dataset_urn`, `owner_id`, `app_id`)
+ PRIMARY KEY (`dataset_id`, `owner_id`, `app_id`, `owner_source`),
+ UNIQUE KEY `with_urn` (`dataset_urn`, `owner_id`, `app_id`, `owner_source`)
);
CREATE TABLE stg_dataset_owner (
