ClickHouse / clickhouse-rs

Official pure Rust typed client for ClickHouse DB
https://clickhouse.com
Apache License 2.0
315 stars 87 forks source link

Rename all doesn't work?) #71

Closed Kistor closed 2 months ago

Kistor commented 1 year ago

Hi! I use your lib fo project and use this code:

#[derive(Row, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct RowSpeedLane {
    #[serde(rename = "id")]
    #[serde(with = "clickhouse::serde::uuid")]
    pub uuid: Uuid,
    #[serde(rename = "fixationTime")]
    pub detect_time: i64,
    #[serde(rename = "extComplexId")]
    pub complex_id: String,
    #[serde(rename = "extDetectorId")]
    pub detector_id: String,
    pub ext_lane_number: i8,
    pub ext_vehicle_speed: f64,
}

After Serialize i expext, that field ext_lane_number will be extLaneNumber (worked [serde(rename_all = "camelCase")) , but i get this:

Err(bad response: Code: 16, e.displayText() = DB::Exception: No such column ext_lane_number in table tda_demo.count_by_lane (143a1954-1aed-4b87-943a-19541aed8b87) (version 21.7.4.18 (official build)))

Thank for attantion!

loyd commented 1 year ago

Hi, Row doesn't support rename_all for now, only rename. It's not a big problem to implement it by using the heck crate, but I have no time for it for now.