Add a randomint to a kafka load stream

I would like to load with a kafka microbatch (using the KafkaJsonParser ) a table defined as:

create table trans
(
trans_name varchar(20),
trans_seq identity(1,1,1) not null,
trans_part int not null default RANDOMINT(4)
);
The message (in json format) in the kafka topic contains only the trans_name value
ex:
{"trans_name":"TT_000001"}
What I would expect is that trans_seq and trans_part are automatically filled.
This true for trans_seq but not for trans_part, and as trans_part is defined as not null an error is generated (in the case null is allowed no error but value is null)

Is this allowed ? How can I configure load-spec to have this behaviour ?

Comments

  • The solution is to specify --target-columns trans_name in the microbatch

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Emoji
Image
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file