Skip to content

Strip GlueDataQualityOperator ruleset after rendering - #70331

Merged
shahar1 merged 2 commits into
apache:mainfrom
1fanwang:fix-glue-dq-ruleset-init
Jul 24, 2026
Merged

Strip GlueDataQualityOperator ruleset after rendering#70331
shahar1 merged 2 commits into
apache:mainfrom
1fanwang:fix-glue-dq-ruleset-init

Conversation

@1fanwang

@1fanwang 1fanwang commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

ruleset is a template field, so it is rendered after __init__ runs. The constructor did self.ruleset = ruleset.strip(), which strips the un-rendered value. A templated ruleset that renders with surrounding whitespace is therefore never stripped, and validate_inputs() rejects it because the rendered value no longer ends with ]:

AttributeError: RuleSet must starts with Rules = [ and ends with ]

Store ruleset verbatim in the constructor and strip the rendered value at the start of execute(), before validation.

related: #70296

Testing Done

Operator-level repro (real Dag, real render, real execute with a mocked Glue conn). Before the fix, a templated ruleset rendering to ' Rules = [...] ' reaches validate_inputs() unstripped and raises:

AttributeError: RuleSet must starts with Rules = [ and ends with ]

After the fix, execute() strips first and the API receives the clean 'Rules = [...]'. The new test_execute_strips_rendered_ruleset drives that render→execute path; it fails on the pre-fix source and passes after. TestGlueDataQualityOperator: 11 passed.


Was generative AI tooling used to co-author this PR?
  • Yes (please specify the tool below)

Generated-by: GitHub Copilot CLI following the guidelines

ruleset is a template field, so it is rendered after __init__ runs. The
constructor did self.ruleset = ruleset.strip(), which strips the un-rendered
value. A templated ruleset that renders with surrounding whitespace is therefore
never stripped, and validate_inputs() rejects it because the rendered value no
longer ends with ']':

    AttributeError: RuleSet must starts with Rules = [ and ends with ]

Store ruleset verbatim in the constructor and strip the rendered value at the
start of execute(), before validation.

related: apache#70296
Signed-off-by: 1fanwang <1fannnw@gmail.com>
Signed-off-by: 1fanwang <1fannnw@gmail.com>
@1fanwang
1fanwang marked this pull request as ready for review July 24, 2026 06:23
@shahar1 shahar1 removed the backport-to-v3-3-test Backport to v3-3-test label Jul 24, 2026
Comment thread providers/amazon/src/airflow/providers/amazon/aws/operators/glue.py
@shahar1
shahar1 merged commit 1ced91f into apache:main Jul 24, 2026
135 of 140 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants