You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Would the DuckDB's underlying C API support sending the entire row's data as a struct or map instead of breaking it down to its individual fields as is currently the case with AppendRow?
I'm dealing with several sources of nested data with a dozen or more columns each and would prefer to just pass one struct. I suppose it would involve somehow 'walking the struct' and make a slice of driver.Value to pass to AppendRow.
The text was updated successfully, but these errors were encountered:
Hi @loicalleyne - I've been working on adding support for this to the C API. Here's a list of related PRs. We can start implementing the Go side once go-duckdb moves to the newest duckdb version. :)
Pass, e.g., a map[string]interface{} to AppendRow. It then matches the map keys to the respective columns and appends the values. It should also be possible to omit specific columns or auto-cast if the value type in the map does not perfectly align with the table's column type.
This should already be possible to implement, as AppendRow calls into appendRowSlice, which we could expose. 🤔
// AppendRow loads a row of values into the appender. The values are provided as separate arguments.func (a*Appender) AppendRow(args...driver.Value) error {
// ...err:=a.appendRowSlice(args)
// ...
}
// ...func (a*Appender) appendRowSlice(args []driver.Value) error {
// ...
Would the DuckDB's underlying C API support sending the entire row's data as a struct or map instead of breaking it down to its individual fields as is currently the case with AppendRow?
I'm dealing with several sources of nested data with a dozen or more columns each and would prefer to just pass one struct. I suppose it would involve somehow 'walking the struct' and make a slice of
driver.Value
to pass to AppendRow.The text was updated successfully, but these errors were encountered: