struct_pack
Create a struct from named arguments. Each field takes its name from its argument, as in struct_pack(a := 1).
Try an expression
In Formula, enter the expression and set Output type to VARCHAR.
Expression
struct_pack(i := 4, s := 'string')Result
'{'i': 4, 's': string}'The expression returns STRUCT(i INTEGER, s VARCHAR). Formula stores it as VARCHAR in this example. To use your own data, replace the example values with column names. Keep format strings and other options as written.
Arguments and types
struct_pack(...)Supported signatures (1)
struct_pack(...: ANY) → STRUCTThe result type can depend on the input types. See DuckDB for the full argument rules.
Things to know
A missing field stays missing
struct_pack(name := NULL::VARCHAR)'{'name': NULL}'
Function metadata from DuckDB, used under the MIT license.