Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default client in KafkaBaseHook #40284

Merged
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions airflow/providers/apache/kafka/hooks/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ def get_ui_field_behaviour(cls) -> dict[str, Any]:
},
}

def _get_client(self, config):
raise NotImplementedError
def _get_client(self, config) -> Any:
return AdminClient(config)

@cached_property
def get_conn(self) -> Any:
Expand Down
5 changes: 1 addition & 4 deletions airflow/providers/apache/kafka/hooks/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from typing import Any, Sequence

from confluent_kafka import KafkaException
from confluent_kafka.admin import AdminClient, NewTopic
from confluent_kafka.admin import NewTopic

from airflow.providers.apache.kafka.hooks.base import KafkaBaseHook

Expand All @@ -34,9 +34,6 @@ class KafkaAdminClientHook(KafkaBaseHook):
def __init__(self, kafka_config_id=KafkaBaseHook.default_conn_name) -> None:
super().__init__(kafka_config_id=kafka_config_id)

def _get_client(self, config) -> AdminClient:
return AdminClient(config)

def create_topic(
self,
topics: Sequence[Sequence[Any]],
Expand Down
Loading