Interestingly, for Java this functionality (describeTopics()
) sits within the KafkaAdminCLient.java.
So, I was trying to look for the python equivalent of the same and I discovered the code repository of kafka-python.
The documentation (in-line comments) in admin-client equivalent in kafka-python package says the following:
describe topics functionality is in ClusterMetadata
Note: if implemented here, send the request to the controller
I then switched to cluster.py file in the same repository. This contains the topics()
function that you've used to retrieve the list of topics and the following 2 functions that could help you achieve the describe
functionality:
partitions_for_topic()
- Return set of all partitions for topic (whether available or not)
available_partitions_for_topic()
- Return set of partitions with known leaders
Note: I haven't tried this myself so I'm not entierly sure if the behaviour would be identical to what you would see in the result for kafka-topics --describe ...
command but worth a try.
I hope this helps!