{"id":13632606,"url":"https://github.com/suharev7/clickhouse-rs","last_synced_at":"2025-04-18T02:33:48.283Z","repository":{"id":39640993,"uuid":"159049339","full_name":"suharev7/clickhouse-rs","owner":"suharev7","description":"Asynchronous ClickHouse client library for Rust programming language.","archived":false,"fork":false,"pushed_at":"2024-07-16T18:33:44.000Z","size":815,"stargazers_count":324,"open_issues_count":59,"forks_count":121,"subscribers_count":10,"default_branch":"async-await","last_synced_at":"2024-11-06T10:40:53.085Z","etag":null,"topics":["clickhouse","clickhouse-client","rust","tokio"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/suharev7.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-11-25T16:03:52.000Z","updated_at":"2024-10-24T17:07:50.000Z","dependencies_parsed_at":"2024-01-14T07:11:31.351Z","dependency_job_id":"88805709-450b-4546-ac33-d6788fd0c105","html_url":"https://github.com/suharev7/clickhouse-rs","commit_stats":{"total_commits":177,"total_committers":26,"mean_commits":"6.8076923076923075","dds":0.4350282485875706,"last_synced_commit":"ecf28f46774773f39c74ee5213ad1e3ea240739b"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suharev7%2Fclickhouse-rs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suharev7%2Fclickhouse-rs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suharev7%2Fclickhouse-rs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suharev7%2Fclickhouse-rs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/suharev7","download_url":"https://codeload.github.com/suharev7/clickhouse-rs/tar.gz/refs/heads/async-await","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223772291,"owners_count":17199976,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["clickhouse","clickhouse-client","rust","tokio"],"created_at":"2024-08-01T22:03:08.568Z","updated_at":"2024-11-09T00:31:44.700Z","avatar_url":"https://github.com/suharev7.png","language":"Rust","funding_links":[],"categories":["Rust","Language bindings"],"sub_categories":["Rust"],"readme":"# Async ClickHouse Client \n\n[![Build Status](https://travis-ci.com/suharev7/clickhouse-rs.svg?branch=master)](https://travis-ci.com/suharev7/clickhouse-rs)\n[![Crate info](https://img.shields.io/crates/v/clickhouse-rs.svg)](https://crates.io/crates/clickhouse-rs)\n[![Documentation](https://docs.rs/clickhouse-rs/badge.svg)](https://docs.rs/clickhouse-rs)\n[![dependency status](https://deps.rs/repo/github/suharev7/clickhouse-rs/status.svg)](https://deps.rs/repo/github/suharev7/clickhouse-rs)\n[![Coverage Status](https://coveralls.io/repos/github/suharev7/clickhouse-rs/badge.svg)](https://coveralls.io/github/suharev7/clickhouse-rs)\n\nAsynchronous [Yandex ClickHouse](https://clickhouse.yandex/) client library for rust programming language. \n\n## Installation\nLibrary hosted on [crates.io](https://crates.io/crates/clickhouse-rs/).\n```toml\n[dependencies]\nclickhouse-rs = \"*\"\n```\n\n## Supported data types\n\n* Date\n* DateTime\n* Decimal(P, S)\n* Float32, Float64\n* String, FixedString(N)\n* UInt8, UInt16, UInt32, UInt64, UInt128, Int8, Int16, Int32, Int64, Int128\n* Nullable(T)\n* Array(UInt/Int/Float/String/Date/DateTime)\n* SimpleAggregateFunction(F, T)\n* IPv4/IPv6\n* UUID\n* Bool\n\n## DNS\n\n```url\nschema://user:password@host[:port]/database?param1=value1\u0026...\u0026paramN=valueN\n```\n\nparameters:\n\n- `compression` - Whether or not use compression (defaults to `none`). Possible choices:\n    * `none`\n    * `lz4`\n\n- `connection_timeout` - Timeout for connection (defaults to `500 ms`)\n- `query_timeout` - Timeout for queries (defaults to `180 sec`).\n- `insert_timeout` - Timeout for inserts (defaults to `180 sec`).\n- `execute_timeout` - Timeout for execute (defaults to `180 sec`).\n- `keepalive` - TCP keep alive timeout in milliseconds.\n- `nodelay` - Whether to enable `TCP_NODELAY` (defaults to `true`).\n \n- `pool_min` - Lower bound of opened connections for `Pool` (defaults to `10`).\n- `pool_max` - Upper bound of opened connections for `Pool` (defaults to `20`).\n\n- `ping_before_query` - Ping server every time before execute any query. (defaults to `true`).\n- `send_retries` - Count of retry to send request to server. (defaults to `3`).\n- `retry_timeout` - Amount of time to wait before next retry. (defaults to `5 sec`).\n- `ping_timeout` - Timeout for ping (defaults to `500 ms`).\n\n\n- `alt_hosts` - Comma separated list of single address host for load-balancing.\n\nexample:\n```url\ntcp://user:password@host:9000/clicks?compression=lz4\u0026ping_timeout=42ms\n```\n\n## Optional features\n\n`clickhouse-rs` puts some functionality behind optional features to optimize compile time \nfor the most common use cases. The following features are available.\n\n- `tokio_io` *(enabled by default)* — I/O based on [Tokio](https://tokio.rs/).\n- `async_std` — I/O based on [async-std](https://async.rs/) (doesn't work together with `tokio_io`).\n- `tls` — TLS support (allowed only with `tokio_io`).\n\n## Example\n\n```rust\nuse clickhouse_rs::{Block, Pool};\nuse std::error::Error;\n\n#[tokio::main]\nasync fn main() -\u003e Result\u003c(), Box\u003cdyn Error\u003e\u003e {\n    let ddl = r\"\n        CREATE TABLE IF NOT EXISTS payment (\n            customer_id  UInt32,\n            amount       UInt32,\n            account_name Nullable(FixedString(3))\n        ) Engine=Memory\";\n\n    let block = Block::new()\n        .column(\"customer_id\",  vec![1_u32,  3,  5,  7,  9])\n        .column(\"amount\",       vec![2_u32,  4,  6,  8, 10])\n        .column(\"account_name\", vec![Some(\"foo\"), None, None, None, Some(\"bar\")]);\n\n    let pool = Pool::new(database_url);\n\n    let mut client = pool.get_handle().await?;\n    client.execute(ddl).await?;\n    client.insert(\"payment\", block).await?;\n    let block = client.query(\"SELECT * FROM payment\").fetch_all().await?;\n\n    for row in block.rows() {\n        let id: u32             = row.get(\"customer_id\")?;\n        let amount: u32         = row.get(\"amount\")?;\n        let name: Option\u003c\u0026str\u003e  = row.get(\"account_name\")?;\n        println!(\"Found payment {}: {} {:?}\", id, amount, name);\n    }\n\n    Ok(())\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsuharev7%2Fclickhouse-rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsuharev7%2Fclickhouse-rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsuharev7%2Fclickhouse-rs/lists"}