1
votes

Is there a way to drop the topic from KSQL? According to github it is possible, and I tried

DROP TOPIC my-topic
DROP TOPIC "my-topic"
DROP TOPIC 'my-topic'
DROP TOPIC `my-topic`

But neither of this commands works. I get message

 Message
-------------------------------------------------------------------------------
 io.confluent.ksql.util.KsqlException: No topic with name true was registered.
3
Please file bug repots here: github.com/confluentinc/ksql/issuesMatthias J. Sax
I'm voting to close this question as off-topic because SO is not a bug reporting tool.Matthias J. Sax
@MatthiasJ.Sax, I was unsure if it a bug or not, though asked a question, if you are sure it is a bug, I'll close the questionLanayx
Thx. Let's wait for KSQL folks to reply :)Matthias J. Sax

3 Answers

6
votes

KSQL topic is different concept than Kafka topic. KSQL topic is an internal concept for KSQL that represents a kafka topic along with metadata about that topic including the topic format. Since we do not expose KSQL topic externally you should not use it in KSQL statements. If you wanna delete a kafka topic, you should delete it from kafka. In future we plan to add topic management capability to KSQL.

1
votes

When you create stream or table using a TOPIC then the topic gets registered in KSQL As shown below.

ksql> SHOW TOPICS;

Kafka Topic| Registered| Partitions | Partition Replicas | Consumers | Consumer Groups` 

---------------------------------------------------------------------------------------

 __confluent.support.metric| false      | 1          | 1                  | 0         | 0

_confluent-ksql-default__command_topic | true       | 1          | 1                  | 0         | 0

_schemas                               | false      | 1          | 1                  | 0         | 0

connect-configs                        | false      | 1          | 1                  | 0         | 0

connect-offsets                        | false      | 25         | 1                  | 0         | 0

connect-statuses                       | false      | 5          | 1                  | 0         | 0

email-filters                          | false      | 4          | 1                  | 0         | 0

Please observe the email-filters topics is saying Registered is false because there is no corresponding stream and table.

So when you try to drop it. like this :

ksql> DROP TOPIC "email-filters";

 Message
-----------------------------------------
 No topic with name true was registered.
-----------------------------------------
ksql>

So the answer is correct by @Hojjat is correct.

This is the explanation.

1
votes

You can delete the topic when you delete the stream/table with the command: drop stream my_stream delete topic or drop table my_table delete topic;