mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-07-31 21:27:58 +00:00
FIX - List ingestion pipeline by multiple query params including provider (#22395)
This commit is contained in:
parent
fb601292ad
commit
bc9075f59d
@ -3203,12 +3203,17 @@ public interface CollectionDAO {
|
||||
}
|
||||
|
||||
if (filter.getQueryParam("provider") != null) {
|
||||
String providerCondition = String.format(" and %s", filter.getProviderCondition());
|
||||
String providerCondition =
|
||||
String.format(" and %s", filter.getProviderCondition(getTableName()));
|
||||
condition += providerCondition;
|
||||
}
|
||||
|
||||
Map<String, Object> bindMap = new HashMap<>();
|
||||
String serviceType = filter.getQueryParam("serviceType");
|
||||
String provider = filter.getQueryParam("provider");
|
||||
if (!nullOrEmpty(provider)) {
|
||||
bindMap.put("provider", provider);
|
||||
}
|
||||
if (!nullOrEmpty(serviceType)) {
|
||||
|
||||
condition =
|
||||
@ -3244,12 +3249,17 @@ public interface CollectionDAO {
|
||||
}
|
||||
|
||||
if (filter.getQueryParam("provider") != null) {
|
||||
String providerCondition = String.format(" and %s", filter.getProviderCondition());
|
||||
String providerCondition =
|
||||
String.format(" and %s", filter.getProviderCondition(getTableName()));
|
||||
condition += providerCondition;
|
||||
}
|
||||
|
||||
Map<String, Object> bindMap = new HashMap<>();
|
||||
String serviceType = filter.getQueryParam("serviceType");
|
||||
String provider = filter.getQueryParam("provider");
|
||||
if (!nullOrEmpty(provider)) {
|
||||
bindMap.put("provider", provider);
|
||||
}
|
||||
if (!nullOrEmpty(serviceType)) {
|
||||
|
||||
condition =
|
||||
@ -3290,12 +3300,17 @@ public interface CollectionDAO {
|
||||
}
|
||||
|
||||
if (filter.getQueryParam("provider") != null) {
|
||||
String providerCondition = String.format(" and %s", filter.getProviderCondition());
|
||||
String providerCondition =
|
||||
String.format(" and %s", filter.getProviderCondition(getTableName()));
|
||||
condition += providerCondition;
|
||||
}
|
||||
|
||||
Map<String, Object> bindMap = new HashMap<>();
|
||||
String serviceType = filter.getQueryParam("serviceType");
|
||||
String provider = filter.getQueryParam("provider");
|
||||
if (!nullOrEmpty(provider)) {
|
||||
bindMap.put("provider", provider);
|
||||
}
|
||||
if (!nullOrEmpty(serviceType)) {
|
||||
condition =
|
||||
String.format(
|
||||
|
@ -55,7 +55,7 @@ public class ListFilter extends Filter<ListFilter> {
|
||||
conditions.add(getWorkflowDefinitionIdCondition());
|
||||
conditions.add(getEntityLinkCondition());
|
||||
conditions.add(getAgentTypeCondition());
|
||||
conditions.add(getProviderCondition());
|
||||
conditions.add(getProviderCondition(tableName));
|
||||
String condition = addCondition(conditions);
|
||||
return condition.isEmpty() ? "WHERE TRUE" : "WHERE " + condition;
|
||||
}
|
||||
@ -119,15 +119,19 @@ public class ListFilter extends Filter<ListFilter> {
|
||||
}
|
||||
}
|
||||
|
||||
public String getProviderCondition() {
|
||||
public String getProviderCondition(String tableName) {
|
||||
String provider = queryParams.get("provider");
|
||||
if (provider == null) {
|
||||
return "";
|
||||
} else {
|
||||
if (Boolean.TRUE.equals(DatasourceConfig.getInstance().isMySQL())) {
|
||||
return String.format("JSON_EXTRACT(json, '$.provider') = '%s'", provider);
|
||||
return tableName == null
|
||||
? "JSON_EXTRACT(json, '$.provider') = :provider"
|
||||
: String.format("JSON_EXTRACT(%s.json, '$.provider') = :provider", tableName);
|
||||
} else {
|
||||
return String.format("json->>'provider' = '%s'", provider);
|
||||
return tableName == null
|
||||
? "json->>'provider' = :provider"
|
||||
: String.format("%s.json->>'provider' = :provider", tableName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -869,6 +869,15 @@ public class IngestionPipelineResourceTest
|
||||
ResultList<IngestionPipeline> resultList = listEntities(queryParams, ADMIN_AUTH_HEADERS);
|
||||
assertEquals(1, resultList.getData().size());
|
||||
assertEquals(ingestionPipeline.getId(), resultList.getData().get(0).getId());
|
||||
|
||||
Map<String, String> multipleQueryParams = new HashMap<>();
|
||||
multipleQueryParams.put("provider", ProviderType.AUTOMATION.value());
|
||||
multipleQueryParams.put("serviceType", "databaseService");
|
||||
multipleQueryParams.put("pipelineType", "metadata");
|
||||
ResultList<IngestionPipeline> multipleParamsResult =
|
||||
listEntities(multipleQueryParams, ADMIN_AUTH_HEADERS);
|
||||
assertEquals(1, multipleParamsResult.getData().size());
|
||||
assertEquals(ingestionPipeline.getId(), multipleParamsResult.getData().get(0).getId());
|
||||
}
|
||||
|
||||
private IngestionPipeline updateIngestionPipeline(
|
||||
|
Loading…
x
Reference in New Issue
Block a user