Closed Looskie closed 10 months ago
There are several ways to bind an enum.
Either send a string representation of your enum (A
/B
/C
) and bind as a String
, index (0/1/2) and bind as a UInt8
, or provide an entire type Enum8('A' = 0, 'B' = 1, 'C' = 2)
(it complaints about precisely that, Enum8
!= Enum8('A' = 0, 'B' = 1, 'C' = 2)
).
EDIT: this works.
await client.command({
query: `INSERT INTO default.customers (id, customer_name, is_admin, created_at, random_enum, pi, card_number, uuid)
VALUES ({v0: String}, {v1: String}, {v2: Boolean}, {v3: DateTime64}, {v4: String}, {v5: Float32},
{v6: Int32}, {v7: UUID})`,
query_params: {
v0: 'd65d104b-8398-419a-9b7f-87d13872d5f7',
v1: 'John Doe',
v2: false,
v3: new Date(),
v4: 'A',
v5: 3.14,
v6: 123456789,
v7: crypto.randomUUID(),
},
})
sweet, thank you so much for the quick answer ❤️
When I use
query_params
with an enum, it does not work.Steps to reproduce
Expected behaviour
to work :D
Code example
Error log
Enum data type cannot be empty: While executing ValuesBlockInputFormat.
Configuration
Environment
ClickHouse server
CREATE TABLE
statements for tables involved:I feel like I'm missing something so obvious