mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-11-02 12:06:56 +08:00
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:
@ -601,22 +601,30 @@ impl AnalyticsProvider {
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn from_conf(config: &AnalyticsConfig, tenant: &str) -> Self {
|
||||
pub async fn from_conf(
|
||||
config: &AnalyticsConfig,
|
||||
tenant: &dyn storage_impl::config::ClickHouseConfig,
|
||||
) -> Self {
|
||||
match config {
|
||||
AnalyticsConfig::Sqlx { sqlx } => Self::Sqlx(SqlxClient::from_conf(sqlx, tenant).await),
|
||||
AnalyticsConfig::Sqlx { sqlx } => {
|
||||
Self::Sqlx(SqlxClient::from_conf(sqlx, tenant.get_schema()).await)
|
||||
}
|
||||
AnalyticsConfig::Clickhouse { clickhouse } => Self::Clickhouse(ClickhouseClient {
|
||||
config: Arc::new(clickhouse.clone()),
|
||||
database: tenant.get_clickhouse_database().to_string(),
|
||||
}),
|
||||
AnalyticsConfig::CombinedCkh { sqlx, clickhouse } => Self::CombinedCkh(
|
||||
SqlxClient::from_conf(sqlx, tenant).await,
|
||||
SqlxClient::from_conf(sqlx, tenant.get_schema()).await,
|
||||
ClickhouseClient {
|
||||
config: Arc::new(clickhouse.clone()),
|
||||
database: tenant.get_clickhouse_database().to_string(),
|
||||
},
|
||||
),
|
||||
AnalyticsConfig::CombinedSqlx { sqlx, clickhouse } => Self::CombinedSqlx(
|
||||
SqlxClient::from_conf(sqlx, tenant).await,
|
||||
SqlxClient::from_conf(sqlx, tenant.get_schema()).await,
|
||||
ClickhouseClient {
|
||||
config: Arc::new(clickhouse.clone()),
|
||||
database: tenant.get_clickhouse_database().to_string(),
|
||||
},
|
||||
),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user