Skip to content

Commit

Permalink
deprecate arbitrary parameter passing to RDS hook (#32352)
Browse files Browse the repository at this point in the history
* deprecate arbitrary parameter passing to RDS hook

* add url to PR
  • Loading branch information
vandonr-amz committed Jul 4, 2023
1 parent c68a319 commit 5623a21
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion airflow/providers/amazon/aws/operators/rds.py
Expand Up @@ -18,12 +18,13 @@
from __future__ import annotations

import json
import warnings
from datetime import timedelta
from typing import TYPE_CHECKING, Sequence

from mypy_boto3_rds.type_defs import TagTypeDef

from airflow.exceptions import AirflowException
from airflow.exceptions import AirflowException, AirflowProviderDeprecationWarning
from airflow.models import BaseOperator
from airflow.providers.amazon.aws.hooks.rds import RdsHook
from airflow.providers.amazon.aws.triggers.rds import RdsDbInstanceTrigger
Expand All @@ -42,6 +43,15 @@ class RdsBaseOperator(BaseOperator):
ui_fgcolor = "#ffffff"

def __init__(self, *args, aws_conn_id: str = "aws_conn_id", hook_params: dict | None = None, **kwargs):
if hook_params is not None:
warnings.warn(
"The parameter hook_params is deprecated and will be removed. "
"If you were using it, please get in touch either on airflow slack, "
"or by opening a github issue on the project. "
"You can mention https://github.com/apache/airflow/pull/32352",
AirflowProviderDeprecationWarning,
stacklevel=3, # 2 is in the operator's init, 3 is in the user code creating the operator
)
self.hook_params = hook_params or {}
self.hook = RdsHook(aws_conn_id=aws_conn_id, **self.hook_params)
super().__init__(*args, **kwargs)
Expand Down

0 comments on commit 5623a21

Please sign in to comment.