# How to delete row from table using a producer?

**URL:** <https://forum.confluent.io/t/how-to-delete-row-from-table-using-a-producer/10848>\
**Category:** ksqlDB\
**Created:** [11 June 2024 10:25 UTC](https://forum.confluent.io/t/how-to-delete-row-from-table-using-a-producer/10848 "2024-06-11T10:25:31Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mrt181](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.confluent.io/mrt181/32/3823_2.png) [@mrt181](https://forum.confluent.io/u/mrt181)\
**Post date:** [11 June 2024 10:25 UTC](https://forum.confluent.io/t/how-to-delete-row-from-table-using-a-producer/10848/1 "2024-06-11T10:25:31Z")

</div>

I have posted the question also on Stackoverflow:

> <https://stackoverflow.com/questions/78606150/how-to-delete-a-value-from-ksqldb-table-using-a-tombstone-value>

I am trying to delete a row from a ksql db source table that contains json values.

In my case I did it like this.

```shell
ksql> CREATE STREAM to_delete (id VARCHAR KEY, DUMMY VARCHAR)
> WITH (KAFKA_TOPIC='mytopic', VALUE_FORMAT='KAFKA');

ksql> INSERT INTO to_delete (id, DUMMY) VALUES ('"some_id"', CAST(NULL as VARCHAR));

```

But producing a message with a null value does not work. The row is not deleted.

```shell
confluent kafka topic produce mytopic --parse-key
Starting Kafka Producer. Use Ctrl-C to exit.
'"some_id"':null
'some_id':null

```

In the processing log of the table I can see this message

```json
{
  "MESSAGE": "null",
  "DESERIALIZATIONERRORCAUSE": [],
  "DESERIALIZATIONERRORMESSAGE": "Cannot invoke \"org.apache.kafka.connect.data.Struct.schema()\" because \"struct\" is null",
  "RECORDPROCESSINGERRORCAUSE": null,
  "RECORDPROCESSINGERRORRECORD": null,
  "RECORDPROCESSINGERRORERRORMESSAGE": null,
  "SERIALIZATIONERRORCAUSE": null,
  "SERIALIZATIONERRORRECORD": null,
  "SERIALIZATIONERRORERRORMESSAGE": null,
  "PRODUCTIONERRORERRORMESSAGE": null,
  "KAFKASTREAMSTHREADERRORCAUSE": null,
  "KAFKASTREAMSTHREADERRORTHREADNAME": null,
  "KAFKASTREAMSTHREADERRORERRORMESSAGE": null
}

```

How can I produce a message to delete the row in ksqldb?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex019/uploads/confluentcommunity/original/1X/c49438c90c9df282e9996fdf6971be890c71b65a.svg) [@system](https://forum.confluent.io/u/system)\
**Post date:** [11 July 2024 10:26 UTC](https://forum.confluent.io/t/how-to-delete-row-from-table-using-a-producer/10848/2 "2024-07-11T10:26:03Z")

</div>

This topic was automatically closed after 30 days. New replies are no longer allowed.
