Chirag Madlani c936ac3a41
feat(ui): Data observability and notifications (#14806)
* Centralize EventType

* Format better for readability

* Add Handling for Thread as Change Event

* Centralize logic for Entity Message Creation

* Add Thread Parent Message in Conversation

* Add Task and Announcement

* Support for multiple destinations

* Delete existing alerts for schema changes

* Delete all tables data for event subscription

* Centralize logic for Notifications and Observability

* Change Field Name and Remove redundant code

* Test Fixes

* Add more fields

* Add Optional

* Logical Test Case Addition Chnage Event

* Add Filter By Owner

* Fix Email Entity Url

* added data observability settings page

* localization changes for other languages

* Handler closure and cleanup

* complete create observibility flow

* fix searchIndex method error

* Update Entity Observability Filter

* working observability creation

* complete creation flow

* fix action with arguments

* fix form validations and form data formulation for 'input.actions' field

* localization changes for other languages

* Fixes for Data Observability

* Add mention notification

* Only apply mention to conversation

* fIx test case

* bug fixes for add and edit observability alert form functionality

* fIx test case

* add feature to config internal along with external destinations in alert form

* Fix Formatting

* Fix Url Redirection

* add observability alert details page

* localization changes for other languages

* remove filter and action required rules

* fix styling for observability form and details page

* add delete functionality on observability alert details page

* update view page layout and add a warning in configure destination step

* localization changes for other languages

* feat(ui): support notification with new flow (#14848)

* feat(ui): support notification with new flow

* fix notifications

* add missing filters for notification alert creation flow

* update the filter hiding logic to show at the start always

* add check to show Actions section in observability alert creation form

* code cleanup and improvements

* add breadcrumb to add notification alert page

* Add General Metadata Filters

* remove code smells and code cleanup for add notification page

* add new filter

* show activity feed alert on notifications list page

* add notification alert details page changes

* localization changes for other languages

* show icons for all the entities in the alert trigger dropdown

* redirect to notification alert listing page after deleting the notification alert

* change add alert page title

* add logic to disable all destinations except email for users

* fixed unit tests

* code improvements and cleanups

---------

Co-authored-by: mohitdeuex <mohit.y@deuexsolutions.com>
Co-authored-by: Mohit Yadav <105265192+mohityadav766@users.noreply.github.com>
Co-authored-by: Aniket Katkar <aniketkatkar97@gmail.com>
2024-01-26 13:56:18 +05:30

183 lines
5.9 KiB
SQL

-- Data quality failure status extension time series
CREATE TABLE test_case_resolution_status_time_series (
id varchar(36) GENERATED ALWAYS AS (json ->> 'id') STORED NOT NULL,
stateId varchar(36) GENERATED ALWAYS AS (json ->> 'stateId') STORED NOT NULL,
assignee varchar(256) GENERATED ALWAYS AS (
CASE
WHEN json->'testCaseResolutionStatusDetails' IS NOT NULL AND
json->'testCaseResolutionStatusDetails'->'assignee' IS NOT NULL AND
json->'testCaseResolutionStatusDetails'->'assignee'->>'name' IS NOT NULL
THEN json->'testCaseResolutionStatusDetails'->'assignee'->>'name'
ELSE NULL
END
) STORED NULL,
timestamp bigint GENERATED ALWAYS AS ((json ->> 'timestamp')::bigint) STORED NOT NULL,
testCaseResolutionStatusType varchar(36) GENERATED ALWAYS AS (json ->> 'testCaseResolutionStatusType') STORED NOT NULL,
jsonSchema varchar(256) NOT NULL,
json jsonb NOT NULL,
entityFQNHash varchar(768) COLLATE "C" DEFAULT NULL,
CONSTRAINT test_case_resolution_status_unique_constraint UNIQUE (id, timestamp, entityFQNHash)
);
create index test_case_resolution_status_time_series_id on test_case_resolution_status_time_series (id);
create index test_case_resolution_status_time_series_status_type on test_case_resolution_status_time_series (testCaseResolutionStatusType);
create index test_case_resolution_status_time_series_id_status_type on test_case_resolution_status_time_series (id, testCaseResolutionStatusType);
-- DataInsightsApplication should not allow configuration
UPDATE apps_marketplace
SET json = jsonb_set(
json::jsonb,
'{allowConfiguration}',
to_jsonb(false)
)
where name = 'DataInsightsApplication';
UPDATE installed_apps
SET json = jsonb_set(
json::jsonb,
'{allowConfiguration}',
to_jsonb(false)
)
where name = 'DataInsightsApplication';
-- Remove mssql connection from airflow db
UPDATE pipeline_service_entity pse
SET json = jsonb_set(
json,
'{connection, config}',
json->'connection'->'config' #- '{connection}'
)
WHERE serviceType = 'Airflow'
AND json #>> '{connection,config,connection,type}' = 'Mssql';
-- Rename NOOP Secret Manager to DB
update metadata_service_entity
set json = jsonb_set(
json #- '{connection,config,secretsManagerProvider}',
'{connection,config,secretsManagerProvider}',
'"db"',
true
)
where name = 'OpenMetadata'
and json #>> '{connection,config,secretsManagerProvider}' = 'noop';
-- Clean old test connections
TRUNCATE automations_workflow;
-- update service type to UnityCatalog - update database entity
UPDATE database_entity de
SET json = jsonb_set(
json #- '{serviceType}',
'{serviceType}',
'"UnityCatalog"',
true
)
where id in (
select toId from entity_relationship er
where
fromEntity = 'databaseService'
and toEntity = 'database'
and fromId in (
select id from dbservice_entity dbe
where
serviceType = 'Databricks'
and (dbe.json #>> '{connection,config,useUnityCatalog}')::bool = true
));
-- update service type to UnityCatalog - update database schema entity
UPDATE database_schema_entity dse
SET json = jsonb_set(
json #- '{serviceType}',
'{serviceType}',
'"UnityCatalog"',
true
)
where json #>> '{database,id}' in (
select toId from entity_relationship er
where
fromEntity = 'databaseService'
and toEntity = 'database'
and fromId in (
select id from dbservice_entity dbe
where
serviceType = 'Databricks'
and (dbe.json #>> '{connection,config,useUnityCatalog}')::bool = true
));
-- update service type to UnityCatalog - update table entity
UPDATE table_entity te
SET json = jsonb_set(
json #- '{serviceType}',
'{serviceType}',
'"UnityCatalog"',
true
)
where json #>> '{database,id}' in (
select toId from entity_relationship er
where
fromEntity = 'databaseService'
and toEntity = 'database'
and fromId in (
select id from dbservice_entity dbe
where
serviceType = 'Databricks'
and (dbe.json #>> '{connection,config,useUnityCatalog}')::bool = true
));
-- update service type to UnityCatalog - update db service entity
UPDATE dbservice_entity de
SET json = jsonb_set(
jsonb_set(
de.json #- '{serviceType}',
'{serviceType}',
'"UnityCatalog"'
) #- '{connection,config,type}',
'{connection,config,type}',
'"UnityCatalog"'
)
WHERE de.serviceType = 'Databricks'
AND (de.json #>> '{connection,config,useUnityCatalog}')::bool = True
;
-- remove `useUnityCatalog` flag from service connection details of databricks
UPDATE dbservice_entity de
SET json = json #- '{connection,config,useUnityCatalog}'
WHERE de.serviceType IN ('Databricks','UnityCatalog');
-- Add Incident ID for test case results
ALTER TABLE data_quality_data_time_series ADD COLUMN incidentId varchar(36);
CREATE INDEX IF NOT EXISTS data_quality_data_time_series_incidentId ON data_quality_data_time_series(incidentId);
-- Add new table for event subscription extensions
CREATE TABLE IF NOT EXISTS change_event_consumers (
id VARCHAR(36) NOT NULL,
extension VARCHAR(256) NOT NULL,
jsonSchema VARCHAR(256) NOT NULL,
json jsonb NOT NULL,
timestamp BIGINT GENERATED ALWAYS AS ((json ->> 'timestamp')::bigint) STORED NOT NULL,
UNIQUE(id, extension)
);
DELETE FROM event_subscription_entity ese where name = 'DataInsightReport';
-- Update Change Event Table
ALTER TABLE change_event ADD COLUMN "offset" SERIAL PRIMARY KEY;
CREATE TABLE IF NOT EXISTS consumers_dlq (
id VARCHAR(36) NOT NULL,
extension VARCHAR(256) NOT NULL,
json jsonb NOT NULL,
timestamp BIGINT GENERATED ALWAYS AS ((json ->> 'timestamp')::bigint) STORED NOT NULL,
UNIQUE(id, extension)
);
-- Add supportsQueryComment to MSSQL
update dbservice_entity
set json = jsonb_set(json::jsonb, '{connection,config,supportsQueryComment}', 'true', true)
where serviceType = 'Mssql';
DELETE FROM event_subscription_entity;
DELETE FROM change_event_consumers;
DELETE FROM consumers_dlq;