diff --git a/ingestion/src/metadata/ingestion/ometa/mixins/patch_mixin.py b/ingestion/src/metadata/ingestion/ometa/mixins/patch_mixin.py index 38f35f954352..a7f5a62517b2 100644 --- a/ingestion/src/metadata/ingestion/ometa/mixins/patch_mixin.py +++ b/ingestion/src/metadata/ingestion/ometa/mixins/patch_mixin.py @@ -367,7 +367,7 @@ def patch_column_tags( Updated Entity """ instance: Optional[Table] = self._fetch_entity_if_exists( - entity=Table, entity_id=table.id, fields=["tags"] + entity=Table, entity_id=table.id, fields=["tags", "columns"] ) if not instance: diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/TableRepository.java b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/TableRepository.java index 239ed09b8071..da5b4c11faae 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/TableRepository.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/TableRepository.java @@ -88,9 +88,9 @@ public class TableRepository extends EntityRepository { // Table fields that can be patched in a PATCH request - static final String PATCH_FIELDS = "tableConstraints,tablePartition"; + static final String PATCH_FIELDS = "tableConstraints,tablePartition,columns"; // Table fields that can be updated in a PUT request - static final String UPDATE_FIELDS = "tableConstraints,tablePartition,dataModel,sourceUrl"; + static final String UPDATE_FIELDS = "tableConstraints,tablePartition,dataModel,sourceUrl,columns"; public static final String FIELD_RELATION_COLUMN_TYPE = "table.columns.column"; public static final String FIELD_RELATION_TABLE_TYPE = "table"; @@ -126,7 +126,10 @@ public Table setFields(Table table, Fields fields) { ? EntityUtil.getLatestUsage(daoCollection.usageDAO(), table.getId()) : table.getUsageSummary()); } - getColumnTags(fields.contains(FIELD_TAGS), table.getColumns()); + if (fields.contains(COLUMN_FIELD)) { + // We'll get column tags only if we are getting the column fields + getColumnTags(fields.contains(FIELD_TAGS), table.getColumns()); + } table.setJoins(fields.contains("joins") ? getJoins(table) : table.getJoins()); table.setTableProfilerConfig( fields.contains(TABLE_PROFILER_CONFIG) ? getTableProfilerConfig(table) : table.getTableProfilerConfig()); diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/resources/databases/TableResource.java b/openmetadata-service/src/main/java/org/openmetadata/service/resources/databases/TableResource.java index 244a4bf43698..fc15edb0f402 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/resources/databases/TableResource.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/resources/databases/TableResource.java @@ -84,7 +84,7 @@ public class TableResource extends EntityResource { public static final String COLLECTION_PATH = "v1/tables/"; static final String FIELDS = - "tableConstraints,tablePartition,usageSummary,owner,customMetrics," + "tableConstraints,tablePartition,usageSummary,owner,customMetrics,columns," + "tags,followers,joins,viewDefinition,dataModel,extension,testSuite,domain,dataProducts,lifeCycle"; @Override diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/security/mask/PIIMasker.java b/openmetadata-service/src/main/java/org/openmetadata/service/security/mask/PIIMasker.java index b2a9c9a70049..1ba90ee34cd3 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/security/mask/PIIMasker.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/security/mask/PIIMasker.java @@ -147,7 +147,7 @@ public static ResultList getTestCases( MessageParser.EntityLink testCaseLink = MessageParser.EntityLink.parse(testCase.getEntityLink()); Table table = Entity.getEntityByName( - Entity.TABLE, testCaseLink.getEntityFQN(), "owner,tags", Include.NON_DELETED); + Entity.TABLE, testCaseLink.getEntityFQN(), "owner,tags,columns", Include.NON_DELETED); // Ignore table tests if (testCaseLink.getFieldName() == null) return testCase; diff --git a/openmetadata-service/src/test/java/org/openmetadata/service/resources/feeds/FeedResourceTest.java b/openmetadata-service/src/test/java/org/openmetadata/service/resources/feeds/FeedResourceTest.java index 1f4cb645c915..a7bc3f857884 100644 --- a/openmetadata-service/src/test/java/org/openmetadata/service/resources/feeds/FeedResourceTest.java +++ b/openmetadata-service/src/test/java/org/openmetadata/service/resources/feeds/FeedResourceTest.java @@ -595,7 +595,7 @@ void put_resolveTask_tags_200() throws IOException { // Task can be resolved by the User2 to whom the task is assigned resolveTask(taskId, resolveTask, USER2_AUTH_HEADERS); - Table table = TABLE_RESOURCE_TEST.getEntity(TABLE.getId(), "tags", USER_AUTH_HEADERS); + Table table = TABLE_RESOURCE_TEST.getEntity(TABLE.getId(), "tags,columns", USER_AUTH_HEADERS); List tags = EntityUtil.getColumn(table, C1).getTags(); assertEquals(USER_ADDRESS_TAG_LABEL.getTagFQN(), tags.get(0).getTagFQN());