Warn for bad combination of parameters for RedshiftDataOperator - #69524
Conversation
jason810496
left a comment
There was a problem hiding this comment.
LGTM for this one, but wonder how could we address this common regression, thanks.
|
I am not in the details here but the description sounds like a generic problem rather than a single operator? |
|
@eladkal thanks for your comment, i went through a bit and this isn't Redshift specific. I checked the rest of
Given the scope, I suggest keeping this PR focused on |
That is OK |
Same thought for this. |
|
I think I will wait for Vincent / Niko's reply here till I merge this one. |
|
Good topic, this inconsistency across operators has always bothered me. I am on the side of:
So I agree WDYT? |
|
I think at some point the prevailing thought was "if you set deferrable=True then of course that implies you do not want to wait", which is also valid. But I think the main conflict just stems from the fact that deferrable was added after wait and maybe not everything was standardized over when deferrables were implemented. |
|
Good point @vincbeck, and you arre right that its ambiguous as written. I thought about fixing that distinction (e.g. defaulting deferrable to None and only warning when it was explicitly passed), but that pattern So I plan to rather keep this scoped to what it is: a heads up for the common case of someone writing this contradiction directly. If an environment sets |
Looks valid to me |
|
Thanks @vincbeck! Let me see what best I can do of it. |
What
RedshiftDataOperatorhas two independent parameters,deferrableandwait_for_completion. Since #41206,wait_for_completion=Falseintentionally overridesdeferrable=Trueand if a task isnt waiting for the statement to finish at all, there is nothing to defer. That is the correct behavior, but it happens silently: a user who setsdeferrable=Truegets no signal that it was ignored.Current behaviour
Combining
deferrable=Truewithwait_for_completion=Falsesubmits the statement and returns immediately, exactly as ifdeferrable=Falsehad been set but with no warning, log line, or error indicating that thedeferrablesetting had no effect.Proposed change
Added a warning in
RedshiftDataOperatorthat fires when this combination is detected, telling the user both whats set and the resulting behavior:A log.warning rather than a raised exception was a deliberate choice cos this is long standing, already released behavior (not a new feature being gated), so raising would break any existing DAG relying on this combination for zero functional benefit. The goal is discoverability, not enforcement.
Was generative AI tooling used to co-author this PR?
{pr_number}.significant.rst, in airflow-core/newsfragments. You can add this file in a follow-up commit after the PR is created so you know the PR number.