diff --git a/snuba/datasets/table_storage.py b/snuba/datasets/table_storage.py index 68d04e7521..edf00c572b 100644 --- a/snuba/datasets/table_storage.py +++ b/snuba/datasets/table_storage.py @@ -39,7 +39,23 @@ def topic(self) -> Topic: @property def topic_name(self) -> str: - return get_topic_name(self.__topic) + """ + Returns the physical topic name for the dataset. Ignores slicing. + Use ```get_physical_topic_name``` instead as it is slice aware. + """ + topic = self.__topic.value + return settings.KAFKA_TOPIC_MAP.get(topic, topic) + + def get_physical_topic_name(self, slice_id: Optional[int] = None) -> str: + """ + Slice aware version of``topic_name``. + """ + if slice_id is not None: + physical_topic = SLICED_KAFKA_TOPIC_MAP[(self.topic_name, slice_id)] + else: + physical_topic = self.topic_name + + return physical_topic @property def partitions_number(self) -> int: @@ -59,18 +75,6 @@ def topic_creation_config(self) -> Mapping[str, str]: def __eq__(self, other: object) -> bool: return isinstance(other, KafkaTopicSpec) and self.topic == other.topic - def get_physical_topic_name(self, slice_id: Optional[int] = None) -> str: - if slice_id is not None: - physical_topic = SLICED_KAFKA_TOPIC_MAP[(self.topic_name, slice_id)] - else: - physical_topic = self.topic_name - - return physical_topic - - -def get_topic_name(topic: Topic) -> str: - return settings.KAFKA_TOPIC_MAP.get(topic.value, topic.value) - class KafkaStreamLoader: """