Skip to content

Show the deprecated Neo4jOperator sql query in Rendered Templates#70373

Merged
eladkal merged 1 commit into
apache:mainfrom
shahar1:fix-neo4j-sql-rendered-templates
Jul 24, 2026
Merged

Show the deprecated Neo4jOperator sql query in Rendered Templates#70373
eladkal merged 1 commit into
apache:mainfrom
shahar1:fix-neo4j-sql-rendered-templates

Conversation

@shahar1

@shahar1 shahar1 commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

AI Summary

Follow-up to #70348.

sql is a deprecated alias for cypher. It used to be folded into cypher in the constructor, so it went through the normal template-field machinery: the resolved query appeared in the Rendered Templates view (with the sql renderer) and op.cypher held it.

It is now kept as a separate attribute that is not declared a template field, and is rendered by an ad-hoc self.render_template(self.sql, context) inside execute(). So for anyone still on sql=:

  • Rendered Templates shows cypher: None while a different query actually runs — the executed query is no longer visible anywhere but the task log.
  • The query is rendered outside the standard pipeline (no RTIF, no template_fields_renderers).

Declaring sql a template field lets the framework render it like every other field and drops the manual call.

The deprecation warning moves to execute() as a consequence: reading a template field in __init__ is exactly what validate_operators_init now forbids, and the constructor would only see the un-rendered expression anyway. The warning still fires once per task run, and both ValueErrors are unchanged.

related: #70296


Was generative AI tooling used to co-author this PR?
  • Yes — Claude Code (Opus 4.8)

Generated-by: Claude Code (Opus 4.8) following the guidelines

The sql parameter is a deprecated alias for cypher. It used to be folded into
cypher in the constructor, so it was rendered by the normal template-field
machinery and the resolved query appeared in the Rendered Templates view. It is
now kept as a separate attribute that is not a template field and is rendered by
an ad-hoc render_template() call inside execute(), so the view shows an empty
cypher while a different query runs, and the rendering bypasses the standard
pipeline.

Declaring sql as a template field lets the framework render it as it does every
other field. The deprecation warning moves to execute() because a constructor
only ever sees the un-rendered Jinja expression of a template field.
@shahar1
shahar1 force-pushed the fix-neo4j-sql-rendered-templates branch from 916cca5 to b29fa87 Compare July 24, 2026 09:26
@shahar1
shahar1 requested a review from vincbeck July 24, 2026 09:29
@eladkal
eladkal merged commit 086361b into apache:main Jul 24, 2026
79 checks passed
@shahar1
shahar1 deleted the fix-neo4j-sql-rendered-templates branch July 24, 2026 10:53
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