Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: clickhouse sink #2353

Merged
merged 4 commits into from
Jan 30, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Use dozer_types::serde
  • Loading branch information
karolisg committed Jan 30, 2024
commit f3cb8525e933fb9ae7992308e94e4f06bcfb729d
1 change: 0 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ members = [
"dozer-recordstore",
"dozer-lambda",
"dozer-sinks",
"dozer-sink-aerospike", "dozer-sink-clickhouse",
"dozer-sink-aerospike",
"dozer-sink-clickhouse",
]
resolver = "2"

Expand Down
2 changes: 1 addition & 1 deletion dozer-cli/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ pub enum OrchestrationError {
CacheFull(String),
#[error("Internal thread panic: {0}")]
JoinError(#[source] tokio::task::JoinError),
#[error("Connector source factory error: {0:?}")]
#[error("Connector source factory error: {0}")]
ConnectorSourceFactory(#[from] ConnectorSourceFactoryError),
#[error(transparent)]
ExecutionError(#[from] ExecutionError),
Expand Down
3 changes: 1 addition & 2 deletions dozer-sink-clickhouse/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,4 @@ dozer-core = { path = "../dozer-core" }
dozer-types = { path = "../dozer-types" }
dozer-log = { path = "../dozer-log" }
dozer-recordstore = { path = "../dozer-recordstore" }
clickhouse = { git = "https://github.com/getdozer/clickhouse.rs.git" }
serde = { version = "1.0.193", features = ["derive"] }
clickhouse = { git = "https://github.com/getdozer/clickhouse.rs.git" }
2 changes: 1 addition & 1 deletion dozer-sink-clickhouse/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ pub struct ClickhouseSinkFactory {
}

#[derive(Debug, Serialize)]
#[serde(untagged)]
#[serde(crate = "dozer_types::serde", untagged)]
pub enum FieldWrapper {
UInt(u64),
U128(u128),
Expand Down
7 changes: 5 additions & 2 deletions dozer-sink-clickhouse/src/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ use crate::{ddl, ClickhouseSinkError};
use clickhouse::{Client, Row};
use dozer_types::errors::internal::BoxedError;
use dozer_types::models::endpoint::ClickhouseSinkConfig;
use dozer_types::serde::{Deserialize, Serialize};
use dozer_types::types::{FieldType, Schema};
use serde::{Deserialize, Serialize};

#[derive(Debug, Row, Deserialize, Serialize)]
#[serde(crate = "dozer_types::serde")]
pub(crate) struct ClickhouseSchemaColumn {
pub(crate) name: String,
pub(crate) r#type: String,
Expand All @@ -18,6 +19,7 @@ pub(crate) struct ClickhouseSchemaColumn {
}

#[derive(Debug, Row, Deserialize, Serialize, Clone)]
#[serde(crate = "dozer_types::serde")]
pub(crate) struct ClickhouseTable {
pub(crate) database: String,
pub(crate) name: String,
Expand All @@ -26,6 +28,7 @@ pub(crate) struct ClickhouseTable {
}

#[derive(Debug, Row, Deserialize, Serialize)]
#[serde(crate = "dozer_types::serde")]
pub(crate) struct ClickhouseKeyColumnDef {
pub(crate) column_name: Option<String>,
pub(crate) constraint_name: Option<String>,
Expand Down Expand Up @@ -132,7 +135,7 @@ impl ClickhouseSchema {
FieldType::String | FieldType::Text => "String",
FieldType::Binary => "UInt8",
FieldType::Decimal => "Decimal64",
FieldType::Timestamp => "Timestamp",
FieldType::Timestamp => "DateTime64(9)",
FieldType::Date => "Date",
FieldType::Json => "Json",
FieldType::Point => "Point",
Expand Down
Loading