Skip to main content

topics

Creates, updates, deletes, gets or lists a topics resource.

Overview

Nametopics
TypeResource
Idconfluent.kafka.topics

Fields

NameDatatypeDescription
authorized_operationsarray
cluster_idstring
configsobject
is_internalboolean
kindstring
metadataobject
partition_reassignmentsobject
partitionsobject
partitions_countinteger
replication_factorinteger
topic_namestring

Methods

NameAccessible byRequired ParamsDescription
get_kafka_topicSELECTcluster_id, topic_nameGenerally Available Return the topic with the given topic_name.
list_kafka_topicsSELECTcluster_idGenerally Available Return the list of topics that belong to the specified Kafka cluster.
create_kafka_topicINSERTcluster_id, data__topic_nameGenerally Available Create a topic. Also supports a dry-run mode that only validates whether the topic creation would succeed if the validate_only request property is explicitly specified and set to true. Note that when dry-run mode is being used the response status would be 200 OK instead of 201 Created.
delete_kafka_topicDELETEcluster_id, topic_nameGenerally Available Delete the topic with the given topic_name.
update_partition_count_kafka_topicUPDATEcluster_id, topic_name, data__partitions_countGenerally Available Increase the number of partitions for a topic.

SELECT examples

Generally Available Return the list of topics that belong to the specified Kafka cluster.

SELECT
authorized_operations,
cluster_id,
configs,
is_internal,
kind,
metadata,
partition_reassignments,
partitions,
partitions_count,
replication_factor,
topic_name
FROM confluent.kafka.topics
WHERE cluster_id = '{{ cluster_id }}';

INSERT example

Use the following StackQL query and manifest file to create a new topics resource.

/*+ create */
INSERT INTO confluent.kafka.topics (
data__topic_name,
data__partitions_count,
data__replication_factor,
data__configs,
data__validate_only,
cluster_id
)
SELECT
'{{ topic_name }}',
'{{ partitions_count }}',
'{{ replication_factor }}',
'{{ configs }}',
'{{ validate_only }}',
'{{ cluster_id }}'
;

UPDATE example

Updates a topics resource.

/*+ update */
UPDATE confluent.kafka.topics
SET
partitions_count = '{{ partitions_count }}'
WHERE
cluster_id = '{{ cluster_id }}'
AND topic_name = '{{ topic_name }}'
AND data__partitions_count = '{{ data__partitions_count }}';

DELETE example

Deletes the specified topics resource.

/*+ delete */
DELETE FROM confluent.kafka.topics
WHERE cluster_id = '{{ cluster_id }}'
AND topic_name = '{{ topic_name }}';