dotnet add package ClickHouse.Client
using System;
using System.Threading.Tasks;
using ClickHouse.Client.ADO;
using ClickHouse.Client.Utility;
namespace Clickhouse.Test;
class Program
{
static async Task Main(string[] args)
{
using var connection = new ClickHouseConnection("Host=<host>;Protocol=https;Port=8443;Username=default;Password=<password>")
var version = await connection.ExecuteScalarAsync("SELECT version()");
Console.WriteLine(version);
}
}
using var connection = new ClickHouseConnection("Host=<host>;Protocol=https;Port=8443;Username=default;Password=<password>");
using var bulkCopyInterface = new ClickHouseBulkCopy(connection)
{
DestinationTableName = "<database>.<table>",
BatchSize = 100000
};
var values = Enumerable.Range(0, 1000000).Select(i => new object[] { (long)i, "value" + i.ToString() });
await bulkCopyInterface.WriteToServerAsync(values);
Console.WriteLine(bulkCopyInterface.RowsWritten);