ClickHouse.Client icon indicating copy to clipboard operation
ClickHouse.Client copied to clipboard

How can I use Bulk insertion in a table with nested columns

Open mucahitimre opened this issue 2 years ago • 2 comments
trafficstars

How can send nested columns values?

It gives this error when I send the list as an object array below:

ClickHouse.Client.Copy.ClickHouseBulkCopySerializationException: Error when serializing data ---> System.InvalidCastException: Unable to cast object of type 'System.Collections.Generic.List1[System.Object[]]' to type 'System.Runtime.CompilerServices.ITuple'. at ClickHouse.Client.Types.TupleType.Write(ExtendedBinaryWriter writer, Object value) at ClickHouse.Client.Copy.ClickHouseBulkCopy.<PushBatch>d__28.MoveNext() --- End of inner exception stack trace --- at ClickHouse.Client.Copy.ClickHouseBulkCopy.<PushBatch>d__28.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at ClickHouse.Client.Copy.ClickHouseBulkCopy.<WriteToServerAsync>d__25.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.ConfiguredTaskAwaitable.ConfiguredTaskAwaiter.GetResult()`

mucahitimre avatar Nov 30 '22 12:11 mucahitimre

Hi,

Could you please provide an example table structure and data you expect to insert?

DarkWanderer avatar Dec 05 '22 17:12 DarkWanderer

@mucahitimre This may sound silly, but double check the table (and the schema of the table) you're attempting to insert into. I was getting a similar error because I forgot to ALTER my table.

wub avatar Feb 05 '23 11:02 wub