From d6eb4fa9e8dd5d841a0ef8b634aa4380b783e33c Mon Sep 17 00:00:00 2001 From: Onkar Ravgan Date: Wed, 28 Aug 2024 14:30:58 +0530 Subject: [PATCH] MINOR: Fixed owner not updating from dbt if owners field has an empty list set in db (#17610) * Fixed owner not updating from dbt for empty list * fix table get --- .../java/org/openmetadata/service/jdbi3/TableRepository.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 3cb25db5c02..5a2a00b1349 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 @@ -598,7 +598,7 @@ public class TableRepository extends EntityRepository { } public Table addDataModel(UUID tableId, DataModel dataModel) { - Table table = find(tableId, NON_DELETED); + Table table = get(null, tableId, getFields(FIELD_OWNERS), NON_DELETED, false); // Update the sql fields only if correct value is present if (dataModel.getRawSql() == null || dataModel.getRawSql().isBlank()) { @@ -618,7 +618,7 @@ public class TableRepository extends EntityRepository
{ table.withDataModel(dataModel); // Carry forward the table owners from the model to table entity, if empty - if (table.getOwners() == null) { + if (nullOrEmpty(table.getOwners())) { storeOwners(table, dataModel.getOwners()); }