Skip to content

Commit

Permalink
Merge pull request #304 from Sanketika-Obsrv/data-schema-fix
Browse files Browse the repository at this point in the history
fix: #OBS-I406 storage type support envs as json
  • Loading branch information
HarishGangula authored Jan 3, 2025
2 parents b1e9744 + 30c0b28 commit b78add1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion api-service/src/configs/Config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,5 +119,5 @@ export const config = {
"enable": process.env.otel_enable || "false",
"collector_endpoint": process.env.otel_collector_endpoint || "http://localhost:4318"
},
"storage_types": process.env.storage_types || 'druid,datalake'
"storage_types": process.env.storage_types || '{"lake_house":true,"realtime_store":true}'
}
11 changes: 6 additions & 5 deletions api-service/src/services/DatasetService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -412,14 +412,15 @@ export const getV1Connectors = async (datasetId: string) => {
return modifiedV1Connectors;
}

const storageTypes = _.split(config.storage_types, ",")
const storageTypes = JSON.parse(config.storage_types)
export const validateStorageSupport = (dataset: Record<string, any>) => {
const { olap_store_enabled, lakehouse_enabled } = _.get(dataset, ["dataset_config", "indexing_config"]) || {}
if (olap_store_enabled && !_.includes(storageTypes, "druid")) {
throw obsrvError("", "DATASET_UNSUPPORTED_STORAGE_TYPE", `The storage type "olap_store" is not available. Please use one of the available storage types: ${storageTypes}`, "BAD_REQUEST", 400)
const validStorageType = _.keys(storageTypes).filter(key => storageTypes[key] === true);
if (olap_store_enabled && !_.get(storageTypes, "realtime_store") === true) {
throw obsrvError("", "DATASET_UNSUPPORTED_STORAGE_TYPE", `The storage type "realtime_store" is not available. Please use one of the available storage types: ${validStorageType}`, "BAD_REQUEST", 400)
}
if (lakehouse_enabled && !_.includes(storageTypes, "datalake")) {
throw obsrvError("", "DATASET_UNSUPPORTED_STORAGE_TYPE", `The storage type "datalake" is not available. Please use one of the available storage types: ${storageTypes}`, "BAD_REQUEST", 400)
if (lakehouse_enabled && !_.get(storageTypes, "lake_house") == true) {
throw obsrvError("", "DATASET_UNSUPPORTED_STORAGE_TYPE", `The storage type "lake_house" is not available. Please use one of the available storage types: ${validStorageType}`, "BAD_REQUEST", 400)
}
}

Expand Down

0 comments on commit b78add1

Please sign in to comment.