mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-10-27 08:44:49 +00:00
fix: conditioned call to getColumnTags to columns fields (#13652)
This commit is contained in:
parent
096a08ce57
commit
feb52647d2
@ -367,7 +367,7 @@ class OMetaPatchMixin(OMetaPatchMixinBase):
|
|||||||
Updated Entity
|
Updated Entity
|
||||||
"""
|
"""
|
||||||
instance: Optional[Table] = self._fetch_entity_if_exists(
|
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:
|
if not instance:
|
||||||
|
|||||||
@ -88,9 +88,9 @@ import org.openmetadata.service.util.ResultList;
|
|||||||
public class TableRepository extends EntityRepository<Table> {
|
public class TableRepository extends EntityRepository<Table> {
|
||||||
|
|
||||||
// Table fields that can be patched in a PATCH request
|
// 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
|
// 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_COLUMN_TYPE = "table.columns.column";
|
||||||
public static final String FIELD_RELATION_TABLE_TYPE = "table";
|
public static final String FIELD_RELATION_TABLE_TYPE = "table";
|
||||||
@ -126,7 +126,10 @@ public class TableRepository extends EntityRepository<Table> {
|
|||||||
? EntityUtil.getLatestUsage(daoCollection.usageDAO(), table.getId())
|
? EntityUtil.getLatestUsage(daoCollection.usageDAO(), table.getId())
|
||||||
: table.getUsageSummary());
|
: 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.setJoins(fields.contains("joins") ? getJoins(table) : table.getJoins());
|
||||||
table.setTableProfilerConfig(
|
table.setTableProfilerConfig(
|
||||||
fields.contains(TABLE_PROFILER_CONFIG) ? getTableProfilerConfig(table) : table.getTableProfilerConfig());
|
fields.contains(TABLE_PROFILER_CONFIG) ? getTableProfilerConfig(table) : table.getTableProfilerConfig());
|
||||||
|
|||||||
@ -84,7 +84,7 @@ import org.openmetadata.service.util.ResultList;
|
|||||||
public class TableResource extends EntityResource<Table, TableRepository> {
|
public class TableResource extends EntityResource<Table, TableRepository> {
|
||||||
public static final String COLLECTION_PATH = "v1/tables/";
|
public static final String COLLECTION_PATH = "v1/tables/";
|
||||||
static final String FIELDS =
|
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";
|
+ "tags,followers,joins,viewDefinition,dataModel,extension,testSuite,domain,dataProducts,lifeCycle";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -147,7 +147,7 @@ public class PIIMasker {
|
|||||||
MessageParser.EntityLink testCaseLink = MessageParser.EntityLink.parse(testCase.getEntityLink());
|
MessageParser.EntityLink testCaseLink = MessageParser.EntityLink.parse(testCase.getEntityLink());
|
||||||
Table table =
|
Table table =
|
||||||
Entity.getEntityByName(
|
Entity.getEntityByName(
|
||||||
Entity.TABLE, testCaseLink.getEntityFQN(), "owner,tags", Include.NON_DELETED);
|
Entity.TABLE, testCaseLink.getEntityFQN(), "owner,tags,columns", Include.NON_DELETED);
|
||||||
|
|
||||||
// Ignore table tests
|
// Ignore table tests
|
||||||
if (testCaseLink.getFieldName() == null) return testCase;
|
if (testCaseLink.getFieldName() == null) return testCase;
|
||||||
|
|||||||
@ -595,7 +595,7 @@ public class FeedResourceTest extends OpenMetadataApplicationTest {
|
|||||||
// Task can be resolved by the User2 to whom the task is assigned
|
// Task can be resolved by the User2 to whom the task is assigned
|
||||||
resolveTask(taskId, resolveTask, USER2_AUTH_HEADERS);
|
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<TagLabel> tags = EntityUtil.getColumn(table, C1).getTags();
|
List<TagLabel> tags = EntityUtil.getColumn(table, C1).getTags();
|
||||||
assertEquals(USER_ADDRESS_TAG_LABEL.getTagFQN(), tags.get(0).getTagFQN());
|
assertEquals(USER_ADDRESS_TAG_LABEL.getTagFQN(), tags.get(0).getTagFQN());
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user