Comments (5)
This library uses the HTTP interface of the ClickHouse server. According to the official documentation:
For successful requests that do not return a data table, an empty response body is returned.
So, there are no options to retrieve the amount of affected rows, while the ADO.NET contract of DbCommand
requires an int
value to be returned.
In some cases, you can use the ClickHouseCommand.QueryStats
attribute to access written_rows
metrics provided by the X-ClickHouse-Summary
response header. This is particularly useful for INSERT
statements, but note that it is set to 0
for TRUNCATE
statements.
from clickhouse.client.
To be honest, Iām not entirely sure if the ExecuteNonQueryAsync
implementation will ever return a non-zero value:
using var reader = new ExtendedBinaryReader(await response.Content.ReadAsStreamAsync().ConfigureAwait(false));
return reader.PeekChar() != -1 ? reader.Read7BitEncodedInt() : 0;
All the tests still pass (checked for 23.6) if I simplify this to return 0;
(or any other value) =)
from clickhouse.client.
hm ok i misunderstood the client code then. I was looking at this Connection Extensions method and assumed it was using this method as a wrapper over the DbCommand
class. (im a bit new to .NET so trying to get my head around things)
from clickhouse.client.
Correct. The extension method you mentioned calls command.ExecuteNonQueryAsync()
, which is the method I was referring to. To access WrittenRows
, you'll need to create a command manually:
using var command = connection.CreateCommand();
command.CommandText = sql;
await command.ExecuteNonQueryAsync();
var writtenRows = command.QueryStats.WrittenRows;
from clickhouse.client.
AH i see, ok! thank you @MikeAmputer :)
from clickhouse.client.
Related Issues (20)
- Error when executing a bulk insert - Value was either too large or too small for a UInt16. HOT 2
- Understanding connection lifetime & pooling
- Incorrect conversion of ClickHouseDecimal to intger types HOT 2
- NestedType problem. HOT 2
- Add random structure tests
- Insert two fields with the common prefix HOT 1
- BulkCopy not raising exception on big datasets HOT 10
- [bug] BulkInsert intermittently fails HOT 7
- handling of Nullable types. HOT 1
- Bulk Insertion not working with Geo Data Types
- Incorrect conversion to Decimal type HOT 1
- Request hangs until timeout if the previous request has thrown an exception HOT 2
- Aspire component
- Query with id ... is already running. (QUERY_WITH_SAME_ID_IS_ALREADY_RUNNING)
- Please remove dependency on System.Net.Http.Formatting HOT 1
- BulkCopy: Failing to convert DateOnly to DbType Date32 HOT 1
- Apache Arrow format HOT 1
- Ingest performance compression in multiple formats.
- Unable to create ClickHouse.Client.ADO.QueryStats (cannot convert to Int32) HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
š Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ššš
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ā¤ļø Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from clickhouse.client.