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

Remove duplicated connection-type within the provider #26628

Merged

Conversation

Taragolis
Copy link
Contributor

@Taragolis Taragolis commented Sep 23, 2022

Remove duplicated connection type for amazon and databricks providers.

aws provided by airflow.providers.amazon.aws.hooks.base_aws.AwsGenericHook
databricks provided by airflow.providers.databricks.hooks.databricks.DatabricksHook

Seem like the actual order in connection-types in provider.yaml the only thing that really matter, if provider contains multiple different hook-class-name with the same connection-type:

  • The first hook-class-name with listed would use in the UI/API/CLI for fields names and testing connection
  • All other would be ignored, the warning only shows if same connection-type exists in the different providers

provider_uses_connection_types = False
connection_types = provider.data.get("connection-types")
if connection_types:
for connection_type_dict in connection_types:
connection_type = connection_type_dict['connection-type']
hook_class_name = connection_type_dict['hook-class-name']
hook_class_names_registered.add(hook_class_name)
already_registered = self._hook_provider_dict.get(connection_type)
if already_registered:
if already_registered.package_name != package_name:
already_registered_warning_connection_types.add(connection_type)

Might be also good idea to warn users if already_registered connection-type exists in the same provider.

@Taragolis Taragolis force-pushed the remove-duplicated-conn-type-within-provider branch from 9090e05 to 7fad9f7 Compare September 23, 2022 17:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants