diff --git a/catalog-rest-service/src/main/java/org/openmetadata/catalog/jdbi3/IngestionRepository.java b/catalog-rest-service/src/main/java/org/openmetadata/catalog/jdbi3/IngestionRepository.java index 94282bd4328..f9cfc5c7274 100644 --- a/catalog-rest-service/src/main/java/org/openmetadata/catalog/jdbi3/IngestionRepository.java +++ b/catalog-rest-service/src/main/java/org/openmetadata/catalog/jdbi3/IngestionRepository.java @@ -41,9 +41,9 @@ import static org.openmetadata.catalog.exception.CatalogExceptionMessage.entityN public class IngestionRepository extends EntityRepository { private static final Fields INGESTION_UPDATE_FIELDS = new Fields(IngestionResource.FIELD_LIST, - "owner,tags"); + "scheduleInterval,owner,tags"); private static final Fields INGESTION_PATCH_FIELDS = new Fields(IngestionResource.FIELD_LIST, - "owner,tags"); + "scheduleInterval,owner,tags"); private final CollectionDAO dao; public IngestionRepository(CollectionDAO dao) { @@ -76,6 +76,8 @@ public class IngestionRepository extends EntityRepository { public Ingestion setFields(Ingestion ingestion, Fields fields) throws IOException { ingestion.setDisplayName(ingestion.getDisplayName()); ingestion.setService(getService(ingestion)); + ingestion.setConnectorConfig(ingestion.getConnectorConfig()); + ingestion.setScheduleInterval(ingestion.getScheduleInterval()); ingestion.setOwner(fields.contains("owner") ? getOwner(ingestion) : null); ingestion.setTags(fields.contains("tags") ? getTags(ingestion.getFullyQualifiedName()) : null); return ingestion; @@ -285,7 +287,12 @@ public class IngestionRepository extends EntityRepository { @Override public void entitySpecificUpdate() throws IOException { - + Ingestion origIngestion = original.getEntity(); + Ingestion updatedIngestion = updated.getEntity(); + recordChange("scheduleInterval", origIngestion.getScheduleInterval(), updatedIngestion.getScheduleInterval()); + recordChange("connectorConfig", origIngestion.getConnectorConfig(), updatedIngestion.getConnectorConfig()); + recordChange("startDate", origIngestion.getStartDate(), updatedIngestion.getStartDate()); + recordChange("endDate", origIngestion.getEndDate(), updatedIngestion.getEndDate()); } } diff --git a/catalog-rest-service/src/main/java/org/openmetadata/catalog/resources/operations/IngestionResource.java b/catalog-rest-service/src/main/java/org/openmetadata/catalog/resources/operations/IngestionResource.java index 9a92a1d8045..1e2f5f478d5 100644 --- a/catalog-rest-service/src/main/java/org/openmetadata/catalog/resources/operations/IngestionResource.java +++ b/catalog-rest-service/src/main/java/org/openmetadata/catalog/resources/operations/IngestionResource.java @@ -131,7 +131,7 @@ public class IngestionResource { } } - static final String FIELDS = "owner,service,tags,status"; + static final String FIELDS = "owner,service,tags,status,scheduleInterval"; public static final List FIELD_LIST = Arrays.asList(FIELDS.replaceAll(" ", "") .split(",")); diff --git a/catalog-rest-service/src/test/java/org/openmetadata/catalog/resources/operations/IngestionResourceTest.java b/catalog-rest-service/src/test/java/org/openmetadata/catalog/resources/operations/IngestionResourceTest.java index 4cf6f0c079a..7fdeead1911 100644 --- a/catalog-rest-service/src/test/java/org/openmetadata/catalog/resources/operations/IngestionResourceTest.java +++ b/catalog-rest-service/src/test/java/org/openmetadata/catalog/resources/operations/IngestionResourceTest.java @@ -221,19 +221,23 @@ public class IngestionResourceTest extends EntityResourceTest { @Test public void put_IngestionUrlUpdate_200(TestInfo test) throws IOException { CreateIngestion request = create(test).withService(new EntityReference().withId(BIGQUERY_REFERENCE.getId()) - .withType("databaseService")).withDescription("description"); + .withType("databaseService")).withDescription("description").withScheduleInterval("5 * * * *"); createAndCheckEntity(request, adminAuthHeaders()); Integer pipelineConcurrency = 110; Date startDate = new DateTime("2021-11-13T20:20:39+00:00").toDate(); - + String expectedScheduleInterval = "7 * * * *"; // Updating description is ignored when backend already has description Ingestion ingestion = updateIngestion(request.withConnectorConfig(INGESTION_CONFIG) - .withConcurrency(pipelineConcurrency) - .withStartDate(startDate.toString()), OK, adminAuthHeaders()); + .withConcurrency(pipelineConcurrency) + .withScheduleInterval(expectedScheduleInterval) + .withStartDate(startDate.toString()), OK, adminAuthHeaders()); String expectedFQN = BIGQUERY_REFERENCE.getName() + "." + ingestion.getName(); assertEquals(startDate.toString(), ingestion.getStartDate()); assertEquals(pipelineConcurrency, ingestion.getConcurrency()); assertEquals(expectedFQN, ingestion.getFullyQualifiedName()); + assertEquals(expectedScheduleInterval, ingestion.getScheduleInterval()); + ingestion = getIngestion(ingestion.getId(), "owner,service", adminAuthHeaders()); + assertEquals(expectedScheduleInterval, ingestion.getScheduleInterval()); } @Test