duckdb / duckdb-rs

Ergonomic bindings to duckdb for Rust
MIT License
508 stars 113 forks source link

Implementing the list, struct, map types fully #394

Open CGenie opened 2 weeks ago

CGenie commented 2 weeks ago

Hello,

I wanted to use duckdb-rs to insert a list of items. However, it turns out that this isn't implemented in duckdb-rs. See:

CGenie commented 2 weeks ago

BTW, I'm able to hack this with the following:

CREATE TABLE x (model STRUCT(mx DOUBLE, my DOUBLE, mz DOUBLE))

and then calling:

conn.execute("INSERT INTO x (model) values(?)", params![serde_json::json!(model_struct).to_string()])

i.e. I pass a Value::Text as a serialized JSON string, and duckdb is able to reimplement that transparently as a struct/list etc.