Skip to content

Bug / ThresholdCheckOperator Does Not Work #9309

@DanilBaibak

Description

@DanilBaibak

Apache Airflow version: 1.10.10

Environment:

What happened:
I tried to use ThresholdCheckOperator:

check_amount_value = ThresholdCheckOperator(
    task_id='check_amount_value',
    sql='SELECT MAX(amount) FROM interaction WHERE interaction_date=CURRENT_DATE',
    max_threshold=1500,
    min_threshold=1100,
    conn_id=CONN_ID
)

I caught such error:

[2020-06-15 13:49:25,639] {taskinstance.py:1145} ERROR - 'int' object is not subscriptable
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/airflow/models/taskinstance.py", line 983, in _run_raw_task
    result = task_copy.execute(context=context)
  File "/usr/local/lib/python3.7/site-packages/airflow/operators/check_operator.py", line 375, in execute
    result = hook.get_first(self.sql)[0][0]
TypeError: 'int' object is not subscriptable

What you expected to happen:
I expected that the check will be passed without any error.

How to reproduce it:
Here is the dockerized application, where I played around with all available checks. All check operators work correctly except ThresholdCheckOperator.

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind:bugThis is a clearly a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions