Skip to content

Conversation

@MathewBravo
Copy link

This PR addresses the need for a more ergonomic way to pass heterogeneous sets of parameters (different data types) to the Appender::append_rows method, as detailed in issue #449.

By implementing AppenderParams for tuples, it resolves common lifetime issues when passing data from iterators.

let data = vec![(1, "alice", 30), (2, "bob", 25)];
// The AppenderParams implementation for the tuple handles the required binding.
appender.append_rows(data.iter().map(|(id, name, age)| (*id, *name, *age)))?;

Implements AppenderParams for tuples up to arity 12, allowing ergonomic
heterogeneous row insertion without lifetime issues.

Users can now write:
  appender.append_rows(data.iter().map(|(id, name)| (id, name)))

Previously, using params with owned values in closures caused lifetime
errors because the macro created references that outlived the closure scope.

Fixes duckdb#449
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant