feat(multitenancy): add tenant_id as a field for data pipeline and support individual database for clickhouse (#4867)

Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
Co-authored-by: Arun Raj M <jarnura47@gmail.com>
Co-authored-by: Sampras Lopes <sampras.lopes@juspay.in>
This commit is contained in:
Jagan
2024-06-18 18:58:46 +05:30
committed by GitHub
parent d2092dcb0a
commit 776ddb8c1a
15 changed files with 55 additions and 68 deletions

View File

@ -35,6 +35,7 @@ pub type ClickhouseResult<T> = error_stack::Result<T, ClickhouseError>;
#[derive(Clone, Debug)]
pub struct ClickhouseClient {
pub config: Arc<ClickhouseConfig>,
pub database: String,
}
#[derive(Clone, Debug, serde::Deserialize)]
@ -42,7 +43,6 @@ pub struct ClickhouseConfig {
username: String,
password: Option<String>,
host: String,
database_name: String,
}
impl Default for ClickhouseConfig {
@ -51,7 +51,6 @@ impl Default for ClickhouseConfig {
username: "default".to_string(),
password: None,
host: "http://localhost:8123".to_string(),
database_name: "default".to_string(),
}
}
}
@ -63,7 +62,7 @@ impl ClickhouseClient {
let params = CkhQuery {
date_time_output_format: String::from("iso"),
output_format_json_quote_64bit_integers: 0,
database: self.config.database_name.clone(),
database: self.database.clone(),
};
let response = client
.post(&self.config.host)