Skip to content
Merged
Changes from all 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
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
from confluent_kafka.admin import AdminClient

from airflow.hooks.base import BaseHook
from airflow.providers.google.cloud.hooks.managed_kafka import ManagedKafkaHook


class KafkaBaseHook(BaseHook):
Expand Down Expand Up @@ -70,6 +69,15 @@ def get_conn(self) -> Any:
and bootstrap_servers.find("cloud.goog") != -1
and bootstrap_servers.find("managedkafka") != -1
):
try:
from airflow.providers.google.cloud.hooks.managed_kafka import ManagedKafkaHook
except ImportError:
from airflow.exceptions import AirflowOptionalProviderFeatureException

raise AirflowOptionalProviderFeatureException(
"Failed to import ManagedKafkaHook. For using this functionality google provider version "
">= 14.1.0 should be pre-installed."
)
Comment thread
potiuk marked this conversation as resolved.
self.log.info("Adding token generation for Google Auth to the confluent configuration.")
hook = ManagedKafkaHook()
token = hook.get_confluent_token
Expand Down