mirror of https://github.com/buster-so/buster.git
ok capture data type from valiation
This commit is contained in:
parent
450bd8fb67
commit
7182222bf0
|
@ -541,27 +541,46 @@ async fn deploy_datasets_handler(
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Create a map of column name to type from ds_columns for easier lookup
|
||||||
|
let ds_column_types: HashMap<String, String> = dataset_columns_map
|
||||||
|
.get(&req.name)
|
||||||
|
.map(|cols| {
|
||||||
|
cols.iter()
|
||||||
|
.map(|col| (col.name.to_lowercase(), col.type_.clone()))
|
||||||
|
.collect()
|
||||||
|
})
|
||||||
|
.unwrap_or_default();
|
||||||
|
|
||||||
let columns: Vec<DatasetColumn> = req
|
let columns: Vec<DatasetColumn> = req
|
||||||
.columns
|
.columns
|
||||||
.iter()
|
.iter()
|
||||||
.map(|col| DatasetColumn {
|
.map(|col| {
|
||||||
id: Uuid::new_v4(),
|
// Look up the type from ds_columns, fallback to request type or "text"
|
||||||
dataset_id,
|
let column_type = ds_column_types
|
||||||
name: col.name.clone(),
|
.get(&col.name.to_lowercase())
|
||||||
type_: col.type_.clone().unwrap_or_else(|| "text".to_string()),
|
.cloned()
|
||||||
description: Some(col.description.clone()),
|
.or_else(|| col.type_.clone())
|
||||||
nullable: true,
|
.unwrap_or_else(|| "text".to_string());
|
||||||
created_at: now,
|
|
||||||
updated_at: now,
|
DatasetColumn {
|
||||||
deleted_at: None,
|
id: Uuid::new_v4(),
|
||||||
stored_values: None,
|
dataset_id,
|
||||||
stored_values_status: None,
|
name: col.name.clone(),
|
||||||
stored_values_error: None,
|
type_: column_type, // Use the type from ds_columns
|
||||||
stored_values_count: None,
|
description: Some(col.description.clone()),
|
||||||
stored_values_last_synced: None,
|
nullable: true,
|
||||||
semantic_type: col.semantic_type.clone(),
|
created_at: now,
|
||||||
dim_type: col.type_.clone(),
|
updated_at: now,
|
||||||
expr: col.expr.clone(),
|
deleted_at: None,
|
||||||
|
stored_values: None,
|
||||||
|
stored_values_status: None,
|
||||||
|
stored_values_error: None,
|
||||||
|
stored_values_count: None,
|
||||||
|
stored_values_last_synced: None,
|
||||||
|
semantic_type: col.semantic_type.clone(),
|
||||||
|
dim_type: col.type_.clone(),
|
||||||
|
expr: col.expr.clone(),
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue