diff --git a/extension/src/controller/dv_builder.rs b/extension/src/controller/dv_builder.rs index bb7672c..0c9c65c 100644 --- a/extension/src/controller/dv_builder.rs +++ b/extension/src/controller/dv_builder.rs @@ -17,7 +17,7 @@ use crate::model::dv_schema::{ use super::dv_loader::*; -pub fn build_dv(build_id: &String, dv_objects_query: &str) { +pub fn build_dv(build_id: &String, dv_objects_query: &str, load_data: bool) { let mut dv_objects_hm: HashMap> = HashMap::new(); @@ -316,7 +316,8 @@ pub fn build_dv(build_id: &String, dv_objects_query: &str) { } }; - dv_data_loader(&dv_schema); + if load_data {dv_data_loader(&dv_schema);} + } diff --git a/extension/src/lib.rs b/extension/src/lib.rs index 75c217f..84a414a 100644 --- a/extension/src/lib.rs +++ b/extension/src/lib.rs @@ -31,11 +31,36 @@ fn go_default() -> String { &build_id, &build_flag, &build_status, &status, &accepted_transformer_confidence_level); _ = Spi::run(query_insert); let query_build_pull = &queries::build_object_pull(&build_id); - controller::dv_builder::build_dv(&build_id, query_build_pull); + let load_data = true; + controller::dv_builder::build_dv(&build_id, query_build_pull, load_data); message } +#[pg_extern(name="build")] +fn build_default() -> String { + let accepted_transformer_confidence_level: String = + utility::guc::get_guc(guc::PgAutoDWGuc::AcceptedTransformerConfidenceLevel) + .unwrap_or_else(|| { + error!("GUC: Unable to obtain parameter \"pg_auto_dw.accepted_transformer_confidence_level.\""); + }); + let build_id = Uuid::new_v4(); + let message = format!("Build ID: {} | Data warehouse tables are currently being built.", build_id); + info!("{}", message); + let build_id = build_id.to_string(); + let build_flag = "Build"; + let build_status = "RTD"; + let status = "Ready to Deploy"; + let query_insert = &queries::insert_into_build_call( + &build_id, &build_flag, &build_status, &status, &accepted_transformer_confidence_level); + _ = Spi::run(query_insert); + let query_build_pull = &queries::build_object_pull(&build_id); + let load_data = false; + controller::dv_builder::build_dv(&build_id, query_build_pull, load_data); + message +} + + #[pg_extern] fn source_include( schema_pattern_include: &str, table_pattern_include: default!(Option<&str>, "NULL"),