- 
                Notifications
    You must be signed in to change notification settings 
- Fork 136
          feat!(insert): RowBinaryWithNamesAndTypes
          #244
        
          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
Changes from all commits
cf3b531
              197ce8b
              1b24497
              dcca54a
              e8b9783
              ab6047e
              901659e
              8d76d18
              8ecfbe7
              ae9a4b1
              a0dbeb9
              2284cce
              d9c3125
              36350ac
              59be19f
              ac2ba48
              3be06b0
              b383bee
              c5699bd
              170a545
              300de26
              fc97158
              664b440
              08de9a4
              File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
|  | @@ -137,7 +137,7 @@ struct MyRow { | |
| name: String, | ||
| } | ||
|  | ||
| let mut insert = client.insert("some")?; | ||
| let mut insert = client.insert::<MyRow>("some").await?; | ||
| There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Instead of  I could take that on as a task. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can be done as a part of finalizing #160 | ||
| insert.write(&MyRow { no: 0, name: "foo".into() }).await?; | ||
| insert.write(&MyRow { no: 1, name: "bar".into() }).await?; | ||
| insert.end().await?; | ||
|  | @@ -158,14 +158,14 @@ insert.end().await?; | |
| Requires the `inserter` feature. | ||
|  | ||
| ```rust,ignore | ||
| let mut inserter = client.inserter("some")? | ||
| let mut inserter = client.inserter::<MyRow>("some")? | ||
| .with_timeouts(Some(Duration::from_secs(5)), Some(Duration::from_secs(20))) | ||
| .with_max_bytes(50_000_000) | ||
| .with_max_rows(750_000) | ||
| .with_period(Some(Duration::from_secs(15))); | ||
|  | ||
| inserter.write(&MyRow { no: 0, name: "foo".into() })?; | ||
| inserter.write(&MyRow { no: 1, name: "bar".into() })?; | ||
| inserter.write(&MyRow { no: 0, name: "foo".into() }).await?; | ||
| inserter.write(&MyRow { no: 1, name: "bar".into() }).await?; | ||
| let stats = inserter.commit().await?; | ||
| if stats.rows > 0 { | ||
| println!( | ||
|  | ||
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
|  | @@ -41,21 +41,21 @@ async fn prepare_data() { | |
| client | ||
| .query( | ||
| r#" | ||
| CREATE TABLE IF NOT EXISTS l2_book_log | ||
| ( | ||
| `instrument_id` UInt32 CODEC(T64, Default), | ||
| `received_time` DateTime64(9) CODEC(DoubleDelta, Default), | ||
| `exchange_time` Nullable(DateTime64(9)) CODEC(DoubleDelta, Default), | ||
| `sequence_no` Nullable(UInt64) CODEC(DoubleDelta, Default), | ||
| `trace_id` UInt64 CODEC(DoubleDelta, Default), | ||
| `side` Enum8('Bid' = 0, 'Ask' = 1), | ||
| `price` Float64, | ||
| `amount` Float64, | ||
| `is_eot` Bool | ||
| ) | ||
| ENGINE = MergeTree | ||
| PRIMARY KEY (instrument_id, received_time) | ||
| "#, | ||
| CREATE TABLE IF NOT EXISTS l2_book_log | ||
| ( | ||
| `instrument_id` UInt32 CODEC(T64, Default), | ||
| `received_time` DateTime64(9) CODEC(DoubleDelta, Default), | ||
| `exchange_time` Nullable(DateTime64(9)) CODEC(DoubleDelta, Default), | ||
| `sequence_no` Nullable(UInt64) CODEC(DoubleDelta, Default), | ||
| `trace_id` UInt64 CODEC(DoubleDelta, Default), | ||
| `side` Enum8('Bid' = 0, 'Ask' = 1), | ||
| `price` Float64, | ||
| `amount` Float64, | ||
| `is_eot` Bool | ||
| ) | ||
| ENGINE = MergeTree | ||
| PRIMARY KEY (instrument_id, received_time) | ||
| "#, | ||
| There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Using raw string literals is also something idiomatic to SQLx, though strictly speaking this is only necessary for when you need to quote identifiers as it avoids the need for escapes: https://docs.rs/sqlx/latest/sqlx/macro.query.html#type-overrides-output-columns Since it appears ClickHouse uses backticks instead of double quotes for quoted identifiers, there's not much benefit to using raw string literals here. | ||
| ) | ||
| .execute() | ||
| .await | ||
|  | @@ -71,7 +71,7 @@ async fn prepare_data() { | |
| return; | ||
| } | ||
|  | ||
| let mut insert = client.insert::<L2Update>("l2_book_log").unwrap(); | ||
| let mut insert = client.insert::<L2Update>("l2_book_log").await.unwrap(); | ||
|  | ||
| for i in 0..10_000_000 { | ||
| insert | ||
|  | ||
Uh oh!
There was an error while loading. Please reload this page.