mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-10-16 11:18:33 +00:00
Fix: Safer default Mark Deleted Tables (#9065)
* Fix: Safer default Mark Deleted Tables * Fix: Change Based On Comments * Fix: Change Based On Comments * Add: Migration Files Co-authored-by: Sachin Chaurasiya <sachinchaurasiyachotey87@gmail.com>
This commit is contained in:
parent
11edcef279
commit
2f9f169de9
@ -0,0 +1,3 @@
|
||||
-- Remove markDeletedTablesFromFilterOnly
|
||||
UPDATE ingestion_pipeline_entity
|
||||
SET json = JSON_REMOVE(json ,'$.sourceConfig.config.markDeletedTablesFromFilterOnly');
|
@ -0,0 +1,3 @@
|
||||
-- Remove markDeletedTablesFromFilterOnly
|
||||
UPDATE ingestion_pipeline_entity
|
||||
SET json = json::jsonb #- '{sourceConfig,config,markDeletedTablesFromFilterOnly}';
|
@ -533,7 +533,12 @@ class DatabaseServiceSource(
|
||||
logger.info(
|
||||
f"Mark Deleted Tables set to True. Processing database [{self.context.database.name.__root__}]"
|
||||
)
|
||||
if self.source_config.markDeletedTablesFromFilterOnly:
|
||||
# If markAllDeletedTables is True, all tables Which are not in FilterPattern will be deleted
|
||||
if self.source_config.markAllDeletedTables:
|
||||
yield from self.fetch_all_schema_and_delete_tables()
|
||||
|
||||
# If markAllDeletedTables is False (Default), Only delete tables which are deleted from the datasource
|
||||
else:
|
||||
schema_names_list = self.get_database_schema_names()
|
||||
for schema_name in schema_names_list:
|
||||
schema_fqn = fqn.build(
|
||||
@ -545,5 +550,3 @@ class DatabaseServiceSource(
|
||||
)
|
||||
|
||||
yield from self.delete_schema_tables(schema_fqn)
|
||||
else:
|
||||
yield from self.fetch_all_schema_and_delete_tables()
|
||||
|
@ -23,8 +23,8 @@
|
||||
"type": "boolean",
|
||||
"default": true
|
||||
},
|
||||
"markDeletedTablesFromFilterOnly": {
|
||||
"description": "Optional configuration to mark deleted tables only to the filtered schema",
|
||||
"markAllDeletedTables": {
|
||||
"description": "Optional configuration to mark all deleted tables to the filtered schema",
|
||||
"type": "boolean",
|
||||
"default": false
|
||||
},
|
||||
|
@ -170,15 +170,14 @@ const AddIngestion = ({
|
||||
)
|
||||
: undefined
|
||||
);
|
||||
const [markDeletedTablesFromFilterOnly, setMarkDeletedTablesFromFilterOnly] =
|
||||
useState(
|
||||
isDatabaseService
|
||||
? Boolean(
|
||||
(data?.sourceConfig.config as ConfigClass)
|
||||
?.markDeletedTablesFromFilterOnly ?? false
|
||||
)
|
||||
: undefined
|
||||
);
|
||||
const [markAllDeletedTables, setMarkAllDeletedTables] = useState(
|
||||
isDatabaseService
|
||||
? Boolean(
|
||||
(data?.sourceConfig.config as ConfigClass)?.markAllDeletedTables ??
|
||||
false
|
||||
)
|
||||
: undefined
|
||||
);
|
||||
const [includeView, setIncludeView] = useState(
|
||||
Boolean((data?.sourceConfig.config as ConfigClass)?.includeViews)
|
||||
);
|
||||
@ -466,7 +465,7 @@ const AddIngestion = ({
|
||||
showTableFilter
|
||||
),
|
||||
markDeletedTables,
|
||||
markDeletedTablesFromFilterOnly,
|
||||
markAllDeletedTables,
|
||||
...DatabaseConfigData,
|
||||
type: ConfigType.DatabaseMetadata,
|
||||
};
|
||||
@ -734,10 +733,10 @@ const AddIngestion = ({
|
||||
handleIncludeView={() => setIncludeView((pre) => !pre)}
|
||||
handleIngestSampleData={() => setIngestSampleData((pre) => !pre)}
|
||||
handleIngestionName={(val) => setIngestionName(val)}
|
||||
handleMarkDeletedTables={() => setMarkDeletedTables((pre) => !pre)}
|
||||
handleMarkDeletedTablesFromFilterOnly={() =>
|
||||
setMarkDeletedTablesFromFilterOnly((pre) => !pre)
|
||||
handleMarkAllDeletedTables={() =>
|
||||
setMarkAllDeletedTables((pre) => !pre)
|
||||
}
|
||||
handleMarkDeletedTables={() => setMarkDeletedTables((pre) => !pre)}
|
||||
handleProfileSample={(val) => setProfileSample(val)}
|
||||
handleQueryLogDuration={(val) => setQueryLogDuration(val)}
|
||||
handleResultLimit={setResultLimit}
|
||||
@ -749,8 +748,8 @@ const AddIngestion = ({
|
||||
includeView={includeView}
|
||||
ingestSampleData={ingestSampleData}
|
||||
ingestionName={ingestionName}
|
||||
markAllDeletedTables={markAllDeletedTables}
|
||||
markDeletedTables={markDeletedTables}
|
||||
markDeletedTablesFromFilterOnly={markDeletedTablesFromFilterOnly}
|
||||
mlModelFilterPattern={mlModelFilterPattern}
|
||||
pipelineFilterPattern={pipelineFilterPattern}
|
||||
pipelineType={pipelineType}
|
||||
|
@ -42,7 +42,7 @@ const ConfigureIngestion = ({
|
||||
includeView,
|
||||
includeTags,
|
||||
markDeletedTables,
|
||||
markDeletedTablesFromFilterOnly,
|
||||
markAllDeletedTables,
|
||||
serviceCategory,
|
||||
pipelineType,
|
||||
showDatabaseFilter,
|
||||
@ -70,7 +70,7 @@ const ConfigureIngestion = ({
|
||||
handleIncludeView,
|
||||
handleIncludeTags,
|
||||
handleMarkDeletedTables,
|
||||
handleMarkDeletedTablesFromFilterOnly,
|
||||
handleMarkAllDeletedTables,
|
||||
handleIngestSampleData,
|
||||
handleDatasetServiceName,
|
||||
handleQueryLogDuration,
|
||||
@ -234,15 +234,15 @@ const ConfigureIngestion = ({
|
||||
{getSeparator('')}
|
||||
</Field>
|
||||
)}
|
||||
{!isNil(markDeletedTablesFromFilterOnly) && (
|
||||
{!isNil(markAllDeletedTables) && (
|
||||
<Field>
|
||||
<div className="tw-flex tw-gap-1">
|
||||
<label>Mark Deleted Tables from Filter Only</label>
|
||||
<label>Mark All Deleted Tables</label>
|
||||
<ToggleSwitchV1
|
||||
checked={markDeletedTablesFromFilterOnly}
|
||||
checked={markAllDeletedTables}
|
||||
handleCheck={() => {
|
||||
if (handleMarkDeletedTablesFromFilterOnly) {
|
||||
handleMarkDeletedTablesFromFilterOnly();
|
||||
if (handleMarkAllDeletedTables) {
|
||||
handleMarkAllDeletedTables();
|
||||
}
|
||||
}}
|
||||
testId="mark-deleted-filter-only"
|
||||
|
@ -72,7 +72,7 @@ export interface ConfigureIngestionProps {
|
||||
includeView: boolean;
|
||||
includeTags: boolean;
|
||||
markDeletedTables?: boolean;
|
||||
markDeletedTablesFromFilterOnly?: boolean;
|
||||
markAllDeletedTables?: boolean;
|
||||
enableDebugLog: boolean;
|
||||
profileSample?: number;
|
||||
ingestSampleData: boolean;
|
||||
@ -98,7 +98,7 @@ export interface ConfigureIngestionProps {
|
||||
handleIncludeView: () => void;
|
||||
handleIncludeTags: () => void;
|
||||
handleMarkDeletedTables?: () => void;
|
||||
handleMarkDeletedTablesFromFilterOnly?: () => void;
|
||||
handleMarkAllDeletedTables?: () => void;
|
||||
handleEnableDebugLog: () => void;
|
||||
handleIngestSampleData: () => void;
|
||||
getIncludeValue: (value: string[], type: FilterPatternEnum) => void;
|
||||
|
@ -23,7 +23,7 @@ export const mockIngestionPipeline = {
|
||||
config: {
|
||||
type: 'DatabaseMetadata',
|
||||
markDeletedTables: true,
|
||||
markDeletedTablesFromFilterOnly: false,
|
||||
markAllDeletedTables: false,
|
||||
includeTables: true,
|
||||
includeViews: true,
|
||||
includeTags: true,
|
||||
|
Loading…
x
Reference in New Issue
Block a user