mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-09-26 17:34:41 +00:00
Minor: Fix migration location for unity catalog (#14339)
This commit is contained in:
parent
5c0c7d3d2b
commit
e67ffd5c04
@ -1,85 +0,0 @@
|
|||||||
-- update service type to UnityCatalog - update database entity
|
|
||||||
UPDATE database_entity de
|
|
||||||
SET de.json = JSON_INSERT(
|
|
||||||
JSON_REMOVE(de.json, '$.serviceType'),
|
|
||||||
'$.serviceType',
|
|
||||||
'UnityCatalog'
|
|
||||||
)
|
|
||||||
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 JSON_EXTRACT(
|
|
||||||
dbe.json, '$.connection.config.useUnityCatalog'
|
|
||||||
) = true
|
|
||||||
));
|
|
||||||
|
|
||||||
|
|
||||||
-- update service type to UnityCatalog - update database schema entity
|
|
||||||
UPDATE database_schema_entity dse
|
|
||||||
SET dse.json = JSON_INSERT(
|
|
||||||
JSON_REMOVE(dse.json, '$.serviceType'),
|
|
||||||
'$.serviceType',
|
|
||||||
'UnityCatalog'
|
|
||||||
)
|
|
||||||
where JSON_EXTRACT(dse.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 JSON_EXTRACT(
|
|
||||||
dbe.json, '$.connection.config.useUnityCatalog'
|
|
||||||
) = true
|
|
||||||
));
|
|
||||||
|
|
||||||
|
|
||||||
-- update service type to UnityCatalog - update table entity
|
|
||||||
UPDATE table_entity te
|
|
||||||
SET te.json = JSON_INSERT(
|
|
||||||
JSON_REMOVE(te.json, '$.serviceType'),
|
|
||||||
'$.serviceType',
|
|
||||||
'UnityCatalog'
|
|
||||||
)
|
|
||||||
where JSON_EXTRACT(te.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 JSON_EXTRACT(
|
|
||||||
dbe.json, '$.connection.config.useUnityCatalog'
|
|
||||||
) = true
|
|
||||||
));
|
|
||||||
|
|
||||||
|
|
||||||
-- update service type to UnityCatalog - update db service entity
|
|
||||||
UPDATE dbservice_entity de
|
|
||||||
SET de.json = JSON_INSERT(
|
|
||||||
JSON_REMOVE(de.json, '$.connection.config.type'),
|
|
||||||
'$.connection.config.type',
|
|
||||||
'UnityCatalog'
|
|
||||||
),de.json = JSON_INSERT(
|
|
||||||
JSON_REMOVE(de.json, '$.serviceType'),
|
|
||||||
'$.serviceType',
|
|
||||||
'UnityCatalog'
|
|
||||||
)
|
|
||||||
WHERE de.serviceType = 'Databricks'
|
|
||||||
AND JSON_EXTRACT(de.json, '$.connection.config.useUnityCatalog') = True
|
|
||||||
;
|
|
||||||
|
|
||||||
-- remove `useUnityCatalog` flag from service connection details of databricks
|
|
||||||
UPDATE dbservice_entity de
|
|
||||||
SET de.json = JSON_REMOVE(de.json, '$.connection.config.useUnityCatalog')
|
|
||||||
WHERE de.serviceType IN ('Databricks','UnityCatalog');
|
|
@ -11,86 +11,3 @@ WHERE json #>> '{pipelineType}' = 'metadata'
|
|||||||
AND json #>> '{sourceConfig,config,type}' = 'DatabaseMetadata'
|
AND json #>> '{sourceConfig,config,type}' = 'DatabaseMetadata'
|
||||||
AND json #>> '{sourceConfig,config,viewParsingTimeoutLimit}' is not null;
|
AND json #>> '{sourceConfig,config,viewParsingTimeoutLimit}' is not null;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-- 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');
|
|
||||||
|
@ -46,3 +46,89 @@ where name = 'OpenMetadata'
|
|||||||
|
|
||||||
-- Clean old test connections
|
-- Clean old test connections
|
||||||
TRUNCATE automations_workflow;
|
TRUNCATE automations_workflow;
|
||||||
|
|
||||||
|
-- update service type to UnityCatalog - update database entity
|
||||||
|
UPDATE database_entity de
|
||||||
|
SET de.json = JSON_INSERT(
|
||||||
|
JSON_REMOVE(de.json, '$.serviceType'),
|
||||||
|
'$.serviceType',
|
||||||
|
'UnityCatalog'
|
||||||
|
)
|
||||||
|
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 JSON_EXTRACT(
|
||||||
|
dbe.json, '$.connection.config.useUnityCatalog'
|
||||||
|
) = true
|
||||||
|
));
|
||||||
|
|
||||||
|
|
||||||
|
-- update service type to UnityCatalog - update database schema entity
|
||||||
|
UPDATE database_schema_entity dse
|
||||||
|
SET dse.json = JSON_INSERT(
|
||||||
|
JSON_REMOVE(dse.json, '$.serviceType'),
|
||||||
|
'$.serviceType',
|
||||||
|
'UnityCatalog'
|
||||||
|
)
|
||||||
|
where JSON_EXTRACT(dse.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 JSON_EXTRACT(
|
||||||
|
dbe.json, '$.connection.config.useUnityCatalog'
|
||||||
|
) = true
|
||||||
|
));
|
||||||
|
|
||||||
|
|
||||||
|
-- update service type to UnityCatalog - update table entity
|
||||||
|
UPDATE table_entity te
|
||||||
|
SET te.json = JSON_INSERT(
|
||||||
|
JSON_REMOVE(te.json, '$.serviceType'),
|
||||||
|
'$.serviceType',
|
||||||
|
'UnityCatalog'
|
||||||
|
)
|
||||||
|
where JSON_EXTRACT(te.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 JSON_EXTRACT(
|
||||||
|
dbe.json, '$.connection.config.useUnityCatalog'
|
||||||
|
) = true
|
||||||
|
));
|
||||||
|
|
||||||
|
|
||||||
|
-- update service type to UnityCatalog - update db service entity
|
||||||
|
UPDATE dbservice_entity de
|
||||||
|
SET de.json = JSON_INSERT(
|
||||||
|
JSON_REMOVE(de.json, '$.connection.config.type'),
|
||||||
|
'$.connection.config.type',
|
||||||
|
'UnityCatalog'
|
||||||
|
),de.json = JSON_INSERT(
|
||||||
|
JSON_REMOVE(de.json, '$.serviceType'),
|
||||||
|
'$.serviceType',
|
||||||
|
'UnityCatalog'
|
||||||
|
)
|
||||||
|
WHERE de.serviceType = 'Databricks'
|
||||||
|
AND JSON_EXTRACT(de.json, '$.connection.config.useUnityCatalog') = True
|
||||||
|
;
|
||||||
|
|
||||||
|
-- remove `useUnityCatalog` flag from service connection details of databricks
|
||||||
|
UPDATE dbservice_entity de
|
||||||
|
SET de.json = JSON_REMOVE(de.json, '$.connection.config.useUnityCatalog')
|
||||||
|
WHERE de.serviceType IN ('Databricks','UnityCatalog');
|
||||||
|
@ -62,3 +62,85 @@ where name = 'OpenMetadata'
|
|||||||
|
|
||||||
-- Clean old test connections
|
-- Clean old test connections
|
||||||
TRUNCATE automations_workflow;
|
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');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user